Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

otm-detector

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

otm-detector - npm Package Compare versions

Comparing version 1.0.1 to 1.0.3

11

index.js

@@ -8,4 +8,11 @@ import dns from "node:dns/promises";

const otmDns = options.dns || dns;
const records = await otmDns.resolveMx(domain)
return records.some((record) => OTM_HOSTS.has(record.exchange))
try {
const records = await otmDns.resolveMx(domain)
return records.some((record) => OTM_HOSTS.has(record.exchange))
} catch (e) {
if (e.code === "ENOTFOUND") {
return false
}
throw e
}
};

@@ -5,2 +5,5 @@ import test from "node:test";

const ENOTFOUND = new Error("ENOTFOUND");
ENOTFOUND.code = "ENOTFOUND";
const domains = [

@@ -17,10 +20,22 @@ {

},
{
domain: "uentiheunsthieunst.com",
mx: ENOTFOUND,
result: false,
},
];
for (const domain of domains) {
test(`Check if ${domain.domain} has ${domain.mx.join(", ")} as MX`, async (t) => {
test(`Check if ${domain.domain} has ${domain.mx} as MX`, async (t) => {
assert.equal(
await isOneTimeMail(domain.domain, { dns: {
resolveMx: async () => domain.mx.map((exchange) => ({ exchange })),
}}),
await isOneTimeMail(domain.domain, {
dns: {
resolveMx: async () => {
if (domain.mx instanceof Error) {
throw domain.mx;
}
return domain.mx.map((exchange) => ({ exchange }));
},
},
}),
domain.result

@@ -27,0 +42,0 @@ );

2

package.json
{
"name": "otm-detector",
"version": "1.0.1",
"version": "1.0.3",
"description": "Detect one-time mail services, the new way",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc