fakeout 1.0.1 → 1.0.3
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/README.md +161 -15
- package/dist/domains.d.ts.map +1 -1
- package/dist/domains.js +145 -1
- package/dist/domains.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,51 +1,197 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
1
3
|
# fakeout
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
**Catch disposable emails before they catch you.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/fakeout)
|
|
8
|
+
[](https://bundlephobia.com/package/fakeout)
|
|
9
|
+
[](./LICENSE)
|
|
10
|
+
[](https://github.com/Manas1820/fakeout/actions)
|
|
11
|
+
|
|
12
|
+
A tiny, zero-dependency library that detects disposable (burner) email domains.
|
|
13
|
+
The blocklist auto-updates daily — no manual maintenance required.
|
|
14
|
+
|
|
15
|
+
[Install](#install) · [Usage](#usage) · [API](#api) · [Staying up to date](#staying-up-to-date) · [How it works](#how-it-works)
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
5
20
|
|
|
6
|
-
|
|
21
|
+
## Why?
|
|
22
|
+
|
|
23
|
+
Disposable email services like Mailinator, Guerrilla Mail, and thousands of others let users sign up with throwaway addresses. This means fake accounts, abused trials, and wasted resources. **fakeout** lets you detect them with a single function call.
|
|
24
|
+
|
|
25
|
+
- **5,000+ domains** tracked and growing
|
|
26
|
+
- **Zero dependencies** — just a `Set` lookup
|
|
27
|
+
- **Auto-updated** — new domains added daily via CI
|
|
28
|
+
- **TypeScript-first** — full type safety and JSDoc
|
|
7
29
|
|
|
8
30
|
## Install
|
|
9
31
|
|
|
10
32
|
```bash
|
|
33
|
+
# npm
|
|
11
34
|
npm install fakeout
|
|
35
|
+
|
|
36
|
+
# pnpm
|
|
37
|
+
pnpm add fakeout
|
|
38
|
+
|
|
39
|
+
# yarn
|
|
40
|
+
yarn add fakeout
|
|
12
41
|
```
|
|
13
42
|
|
|
43
|
+
> Requires Node.js 18+
|
|
44
|
+
|
|
14
45
|
## Usage
|
|
15
46
|
|
|
16
47
|
```ts
|
|
17
48
|
import { isDisposableEmail, isDisposableDomain, getDisposableDomains } from "fakeout";
|
|
18
49
|
|
|
19
|
-
|
|
20
|
-
isDisposableEmail("user@
|
|
21
|
-
isDisposableEmail("
|
|
50
|
+
// Check a full email address
|
|
51
|
+
isDisposableEmail("user@mailinator.com"); // true
|
|
52
|
+
isDisposableEmail("user@gmail.com"); // false
|
|
53
|
+
isDisposableEmail("not-an-email"); // false (invalid → false)
|
|
22
54
|
|
|
23
|
-
|
|
24
|
-
isDisposableDomain("
|
|
55
|
+
// Check a bare domain
|
|
56
|
+
isDisposableDomain("guerrillamail.com"); // true
|
|
57
|
+
isDisposableDomain("outlook.com"); // false
|
|
25
58
|
|
|
26
|
-
|
|
59
|
+
// Get the full list
|
|
60
|
+
const domains = getDisposableDomains(); // string[] — sorted, ~5000+ entries
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Common patterns
|
|
64
|
+
|
|
65
|
+
**Express middleware:**
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { isDisposableEmail } from "fakeout";
|
|
69
|
+
|
|
70
|
+
app.post("/signup", (req, res) => {
|
|
71
|
+
if (isDisposableEmail(req.body.email)) {
|
|
72
|
+
return res.status(422).json({ error: "Disposable emails are not allowed" });
|
|
73
|
+
}
|
|
74
|
+
// proceed with signup...
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Form validation:**
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { isDisposableEmail } from "fakeout";
|
|
82
|
+
|
|
83
|
+
function validateEmail(email: string): string | null {
|
|
84
|
+
if (isDisposableEmail(email)) {
|
|
85
|
+
return "Please use a permanent email address";
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
27
89
|
```
|
|
28
90
|
|
|
29
91
|
## API
|
|
30
92
|
|
|
31
93
|
### `isDisposableEmail(email: string): boolean`
|
|
32
94
|
|
|
33
|
-
|
|
95
|
+
Checks if an email address belongs to a known disposable provider.
|
|
96
|
+
|
|
97
|
+
| Input | Output |
|
|
98
|
+
|-------|--------|
|
|
99
|
+
| `"user@mailinator.com"` | `true` |
|
|
100
|
+
| `"user@gmail.com"` | `false` |
|
|
101
|
+
| `"bad-input"` | `false` |
|
|
102
|
+
|
|
103
|
+
Returns `false` for invalid emails rather than throwing.
|
|
34
104
|
|
|
35
105
|
### `isDisposableDomain(domain: string): boolean`
|
|
36
106
|
|
|
37
|
-
|
|
107
|
+
Checks if a bare domain is in the blocklist. Handles uppercase and extra whitespace.
|
|
108
|
+
|
|
109
|
+
| Input | Output |
|
|
110
|
+
|-------|--------|
|
|
111
|
+
| `"guerrillamail.com"` | `true` |
|
|
112
|
+
| `" YOPMAIL.COM "` | `true` |
|
|
113
|
+
| `"gmail.com"` | `false` |
|
|
38
114
|
|
|
39
115
|
### `getDisposableDomains(): string[]`
|
|
40
116
|
|
|
41
|
-
Returns a sorted array of all known disposable domains. Each call returns a
|
|
117
|
+
Returns a sorted array of all known disposable domains. Each call returns a fresh copy, so mutations won't affect the internal dataset.
|
|
118
|
+
|
|
119
|
+
## Staying up to date
|
|
120
|
+
|
|
121
|
+
Domain updates are published as **patch** releases (e.g. `1.0.1` → `1.0.2`), so the default npm semver range already keeps you current:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npm install fakeout # saves "^1.x.x" — automatically resolves to the latest patch
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Every `npm install` (or `pnpm install` / `yarn install`) in a fresh CI environment or after deleting your lockfile will pull the newest patch. To update an existing lockfile:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm update fakeout
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Automated dependency updates
|
|
134
|
+
|
|
135
|
+
For hands-free updates, add [Renovate](https://github.com/renovatebot/renovate) or [Dependabot](https://docs.github.com/en/code-security/dependabot) to your repo. They'll open PRs whenever a new fakeout version is published.
|
|
136
|
+
|
|
137
|
+
<details>
|
|
138
|
+
<summary>Example Dependabot config</summary>
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
# .github/dependabot.yml
|
|
142
|
+
version: 2
|
|
143
|
+
updates:
|
|
144
|
+
- package-ecosystem: npm
|
|
145
|
+
directory: "/"
|
|
146
|
+
schedule:
|
|
147
|
+
interval: daily
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
</details>
|
|
42
151
|
|
|
43
152
|
## How it works
|
|
44
153
|
|
|
45
|
-
|
|
154
|
+
```
|
|
155
|
+
┌─────────────────────────┐
|
|
156
|
+
│ Upstream blocklist │
|
|
157
|
+
│ (disposable-email- │
|
|
158
|
+
│ domains/disposable- │
|
|
159
|
+
│ email-domains) │
|
|
160
|
+
└────────────┬────────────┘
|
|
161
|
+
│ daily cron
|
|
162
|
+
▼
|
|
163
|
+
┌─────────────────────────┐
|
|
164
|
+
│ sync-domains script │
|
|
165
|
+
│ fetch → clean → hash │
|
|
166
|
+
│ → compare → generate │
|
|
167
|
+
└────────────┬────────────┘
|
|
168
|
+
│ if changed
|
|
169
|
+
▼
|
|
170
|
+
┌─────────────────────────┐
|
|
171
|
+
│ semantic-release │
|
|
172
|
+
│ patch bump → publish │
|
|
173
|
+
│ to npm │
|
|
174
|
+
└─────────────────────────┘
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
1. A GitHub Actions cron job runs daily
|
|
178
|
+
2. It fetches the latest domain list from upstream
|
|
179
|
+
3. If the list changed (SHA-256 comparison), tests run and a new **patch version** is auto-published to npm
|
|
180
|
+
4. If nothing changed, the job exits silently
|
|
181
|
+
|
|
182
|
+
The domain list is compiled into a `ReadonlySet<string>` at build time — **zero file I/O at runtime**, just a fast hash lookup.
|
|
183
|
+
|
|
184
|
+
## Credits
|
|
185
|
+
|
|
186
|
+
The disposable domain dataset is sourced from the community-maintained [disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains) project. Huge thanks to all its contributors for keeping the list comprehensive and up to date.
|
|
187
|
+
|
|
188
|
+
## Contributing
|
|
189
|
+
|
|
190
|
+
Contributions are welcome! If you find a domain that should be blocked:
|
|
46
191
|
|
|
47
|
-
|
|
192
|
+
- For **new disposable domains**, please submit them upstream to [disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains/issues) — they'll be picked up automatically on the next sync
|
|
193
|
+
- For **bugs or feature requests** in fakeout itself, [open an issue](https://github.com/Manas1820/fakeout/issues)
|
|
48
194
|
|
|
49
195
|
## License
|
|
50
196
|
|
|
51
|
-
MIT
|
|
197
|
+
[MIT](./LICENSE) — use it however you like.
|
package/dist/domains.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAmuKjD,CAAC"}
|