@bitclaw/disposable-email 1.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { DISPOSABLE_DOMAINS } from './domains';
2
+ export { DISPOSABLE_MX_HOSTS } from './mx-hosts';
2
3
  export { validateEmailDomain } from './mx-validator';
3
4
  export type { EmailValidationResult, MxValidationOptions } from './types';
4
5
  export { isDisposableEmail } from './validator';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { DISPOSABLE_DOMAINS } from './domains';
2
+ export { DISPOSABLE_MX_HOSTS } from './mx-hosts';
2
3
  export { validateEmailDomain } from './mx-validator';
3
4
  export { isDisposableEmail } from './validator';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Backend mail servers for services that assign rotating/random alias domains
3
+ * (e.g. 10minutemail.com hands out `vtmpj.net`, `xyzab.net`, etc., all routed
4
+ * through the same MX host). A domain-name blocklist can never enumerate every
5
+ * rotating alias; the MX host is the stable ground truth for these services.
6
+ *
7
+ * Every entry here was confirmed via a live `dig MX` lookup to be dedicated
8
+ * infrastructure for the disposable-mail service itself. Do NOT add a host
9
+ * shared with a real mail provider (e.g. a service that routes through
10
+ * mx.yandex.net or protonmail.ch's MX), that blocks legitimate users of the
11
+ * underlying provider, not just the disposable service.
12
+ */
13
+ export declare const DISPOSABLE_MX_HOSTS: ReadonlySet<string>;
14
+ //# sourceMappingURL=mx-hosts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mx-hosts.d.ts","sourceRoot":"","sources":["../src/mx-hosts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAalD,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Backend mail servers for services that assign rotating/random alias domains
3
+ * (e.g. 10minutemail.com hands out `vtmpj.net`, `xyzab.net`, etc., all routed
4
+ * through the same MX host). A domain-name blocklist can never enumerate every
5
+ * rotating alias; the MX host is the stable ground truth for these services.
6
+ *
7
+ * Every entry here was confirmed via a live `dig MX` lookup to be dedicated
8
+ * infrastructure for the disposable-mail service itself. Do NOT add a host
9
+ * shared with a real mail provider (e.g. a service that routes through
10
+ * mx.yandex.net or protonmail.ch's MX), that blocks legitimate users of the
11
+ * underlying provider, not just the disposable service.
12
+ */
13
+ export const DISPOSABLE_MX_HOSTS = new Set([
14
+ 'prd-smtp.10minutemail.com',
15
+ 'mail.guerrillamail.com',
16
+ 'mail.mailinator.com',
17
+ 'mail2.mailinator.com',
18
+ 'smtp.yopmail.com',
19
+ 'mx.discard.email',
20
+ 'mail1.trashymail.com',
21
+ 'mail2.trashymail.com',
22
+ 'mx.dropmail.me',
23
+ 'mintserver.mintemail.com',
24
+ 'mail.getnada.com',
25
+ 'mail.burnermail.io'
26
+ ]);
@@ -1 +1 @@
1
- {"version":3,"file":"mx-validator.d.ts","sourceRoot":"","sources":["../src/mx-validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,CAuEhC"}
1
+ {"version":3,"file":"mx-validator.d.ts","sourceRoot":"","sources":["../src/mx-validator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,CAsFhC"}
@@ -1,5 +1,6 @@
1
1
  import { resolve } from 'node:dns/promises';
2
2
  import { DISPOSABLE_DOMAINS } from './domains';
3
+ import { DISPOSABLE_MX_HOSTS } from './mx-hosts';
3
4
  /**
4
5
  * Validate an email domain against the disposable blocklist and optionally
5
6
  * check DNS MX records to verify the domain can receive mail.
@@ -40,6 +41,17 @@ export async function validateEmailDomain(email, opts = {}) {
40
41
  message: 'This email domain does not appear to accept mail. Please use a different email.'
41
42
  };
42
43
  }
44
+ // Rotating-alias services (10minutemail, etc.) hand out a fresh domain per
45
+ // inbox, so no domain blocklist can enumerate them all, but they all route
46
+ // through the same handful of backend mail servers.
47
+ const exchangeHost = records.find(r => DISPOSABLE_MX_HOSTS.has(r.exchange.toLowerCase()));
48
+ if (exchangeHost) {
49
+ return {
50
+ valid: false,
51
+ reason: 'disposable',
52
+ message: 'Disposable email addresses are not allowed. Please use a permanent email.'
53
+ };
54
+ }
43
55
  }
44
56
  catch (error) {
45
57
  // Check for DNS error codes (ENOTFOUND / ENODATA = domain doesn't exist)
@@ -53,7 +65,7 @@ export async function validateEmailDomain(email, opts = {}) {
53
65
  message: 'This email domain does not exist. Please check your email address.'
54
66
  };
55
67
  }
56
- // DNS timeout or other transient error — don't block the user
68
+ // DNS timeout or other transient error - don't block the user
57
69
  const message = error instanceof Error ? error.message : String(error);
58
70
  if (message === 'DNS timeout') {
59
71
  return {
@@ -62,7 +74,7 @@ export async function validateEmailDomain(email, opts = {}) {
62
74
  message: 'Unable to verify email domain. Please try again in a moment.'
63
75
  };
64
76
  }
65
- // Other DNS errors — allow through (fail open)
77
+ // Other DNS errors - allow through (fail open)
66
78
  return { valid: true };
67
79
  }
68
80
  }
package/package.json CHANGED
@@ -1,13 +1,20 @@
1
1
  {
2
2
  "name": "@bitclaw/disposable-email",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Fast disposable and free email provider detection with optional MX record validation",
5
- "files": ["dist", "LICENSE", "README.md"],
5
+ "files": [
6
+ "dist",
7
+ "LICENSE",
8
+ "README.md"
9
+ ],
6
10
  "type": "module",
7
11
  "main": "./dist/index.js",
8
12
  "types": "./dist/index.d.ts",
9
13
  "exports": {
10
- ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
11
18
  },
12
19
  "scripts": {
13
20
  "build": "tsc -p tsconfig.build.json",
@@ -18,20 +25,27 @@
18
25
  "lint:fix": "biome check --write",
19
26
  "format": "biome format --write",
20
27
  "knip": "knip",
28
+ "sync-domains": "bun scripts/sync-domains.ts",
21
29
  "prepublishOnly": "npm run build && npm run test",
22
30
  "publish:dev": "npm run build && npm publish --tag dev --access public",
23
31
  "publish:patch": "npm whoami && npm version patch && git push --follow-tags && npm publish --access public",
24
32
  "publish:minor": "npm whoami && npm version minor && git push --follow-tags && npm publish --access public",
25
33
  "publish:major": "npm whoami && npm version major && git push --follow-tags && npm publish --access public"
26
34
  },
27
- "keywords": ["disposable-email", "email-validation", "spam-prevention", "mx-validation", "bun"],
35
+ "keywords": [
36
+ "disposable-email",
37
+ "email-validation",
38
+ "spam-prevention",
39
+ "mx-validation",
40
+ "bun"
41
+ ],
28
42
  "author": "bitclaw",
29
43
  "license": "MIT",
30
44
  "devDependencies": {
31
- "@biomejs/biome": "^2.4.15",
32
- "knip": "^6.12.1",
33
- "@types/bun": "^1.3.9",
34
- "@types/node": "^22.0.0",
35
- "typescript": "^5.8.3"
45
+ "@biomejs/biome": "2.4.15",
46
+ "knip": "6.14.1",
47
+ "@types/bun": "1.3.14",
48
+ "@types/node": "22.19.19",
49
+ "typescript": "5.9.3"
36
50
  }
37
51
  }