disposable-domains 1.0.0
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 +53 -0
- package/domain-manager.js +432 -0
- package/flattened_codebase.txt +335 -0
- package/index.js +6 -0
- package/index.json +121599 -0
- package/llm.json +9 -0
- package/package.json +27 -0
- package/test/helpers/isFQDN.js +17 -0
- package/test/helpers/lowercase.js +15 -0
- package/test/helpers/notInWildcard.js +20 -0
- package/test/index.js +33 -0
- package/test/wildcard.js +29 -0
- package/wildcard.js +6 -0
- package/wildcard.json +407 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
## Codebase
|
|
2
|
+
<.gitignore>
|
|
3
|
+
.DS_Store
|
|
4
|
+
npm-debug.log
|
|
5
|
+
node_modules/
|
|
6
|
+
tmp.*
|
|
7
|
+
*.sh
|
|
8
|
+
</.gitignore>
|
|
9
|
+
|
|
10
|
+
<.npmignore>
|
|
11
|
+
tmp.*
|
|
12
|
+
*.sh
|
|
13
|
+
contributions/*
|
|
14
|
+
</.npmignore>
|
|
15
|
+
|
|
16
|
+
<Readme.md>
|
|
17
|
+
# disposable-email-domains
|
|
18
|
+
|
|
19
|
+
A list of [disposable email domains](http://en.wikipedia.org/wiki/Disposable_email_address) like `mailinator.com`. You can use it to detect or block disposable accounts in your signup process. Exact domain matches are found in [index.json](https://github.com/ivolo/disposable-email-domains/blob/master/index.json) and wildcard domains (ex: `*.33mail.com`) are in [wildcard.json](https://github.com/ivolo/disposable-email-domains/blob/master/wildcard.json).
|
|
20
|
+
|
|
21
|
+
# Examples
|
|
22
|
+
|
|
23
|
+
## Node.JS
|
|
24
|
+
```js
|
|
25
|
+
var domains = require('disposable-email-domains');
|
|
26
|
+
var wildcards = require('disposable-email-domains/wildcard.json');
|
|
27
|
+
|
|
28
|
+
// ... your code here
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
An always-up-to-date version of this repo is provided as an API by [Kickbox](https://kickbox.com/). Issuing a `GET` request to https://open.kickbox.com/v1/disposable/{DomainOrEmailAddress} will return `{"disposable":true}` or `{"disposable":false}` as a JSON response.
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
https://open.kickbox.com/v1/disposable/mailinator.com
|
|
37
|
+
|
|
38
|
+
{"disposable":true}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
# Installation
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
$ npm install disposable-email-domains
|
|
45
|
+
```
|
|
46
|
+
```
|
|
47
|
+
$ component install ivolo/disposable-email-domains
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
# Contributing
|
|
51
|
+
|
|
52
|
+
Add new disposable domains to [index.json](https://github.com/ivolo/disposable-email-domains/blob/master/index.json) and wildcard disposable domains to [wildcard.json](https://github.com/ivolo/disposable-email-domains/blob/master/wildcard.json).
|
|
53
|
+
|
|
54
|
+
To easily add new domains, insert them into [index.txt](https://github.com/ivolo/disposable-email-domains/blob/master/contributions/index.txt) and/or [wildcard.txt](https://github.com/ivolo/disposable-email-domains/blob/master/contributions/wildcard.txt) and run `npm run add`.
|
|
55
|
+
The domains will be added to the respective files and some validation will be made to ensure they pass the tests.
|
|
56
|
+
|
|
57
|
+
Please run `npm run test` before creating a Pull Request to ensure all tests are passing.
|
|
58
|
+
|
|
59
|
+
You can also run `npm run prod` to add new domains and run the tests at the same time.
|
|
60
|
+
|
|
61
|
+
# License
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
WWWWWW||WWWWWW
|
|
65
|
+
W W W||W W W
|
|
66
|
+
||
|
|
67
|
+
( OO )__________
|
|
68
|
+
/ | \
|
|
69
|
+
/o o| MIT \
|
|
70
|
+
\___/||_||__||_|| *
|
|
71
|
+
|| || || ||
|
|
72
|
+
_||_|| _||_||
|
|
73
|
+
(__|__|(__|__|
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND "AS AND WHEN AVAILABLE", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
77
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
78
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
79
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
80
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
81
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
82
|
+
THE SOFTWARE.
|
|
83
|
+
</Readme.md>
|
|
84
|
+
|
|
85
|
+
<add.js>
|
|
86
|
+
const { writeFileSync, readFileSync } = require('fs')
|
|
87
|
+
const _ = require('lodash')
|
|
88
|
+
|
|
89
|
+
var index = require('./index')
|
|
90
|
+
var wildcard = require('./wildcard')
|
|
91
|
+
|
|
92
|
+
// Add new domains
|
|
93
|
+
const newDomains = readFileSync('./contributions/index.txt').toString().split("\n").filter(d => d)
|
|
94
|
+
index = _.concat(index, newDomains)
|
|
95
|
+
|
|
96
|
+
const newWildcardDomains = readFileSync('./contributions/wildcard.txt').toString().split("\n").filter(d => d)
|
|
97
|
+
wildcard = _.concat(wildcard, newWildcardDomains)
|
|
98
|
+
|
|
99
|
+
// Remove empty strings
|
|
100
|
+
index = index.filter(d => d)
|
|
101
|
+
wildcard = wildcard.filter(d => d)
|
|
102
|
+
|
|
103
|
+
// Lowercase
|
|
104
|
+
index = index.map(domain => { return _.toLower(domain) })
|
|
105
|
+
wildcard = wildcard.map(domain => { return _.toLower(domain) })
|
|
106
|
+
|
|
107
|
+
// Sort
|
|
108
|
+
index.sort()
|
|
109
|
+
wildcard.sort()
|
|
110
|
+
|
|
111
|
+
// Dedupe
|
|
112
|
+
index = _.uniq(index)
|
|
113
|
+
wildcard = _.uniq(wildcard)
|
|
114
|
+
|
|
115
|
+
// Remove wildcards
|
|
116
|
+
var regexp = new RegExp(/(.+(?:\.[\w-]+\.[\w-]+)+)$/)
|
|
117
|
+
|
|
118
|
+
index = index
|
|
119
|
+
.filter(domain => {
|
|
120
|
+
if (regexp.test(domain)) {
|
|
121
|
+
return ! wildcard.filter(wildcard => {
|
|
122
|
+
return _.endsWith(domain, wildcard)
|
|
123
|
+
}).length
|
|
124
|
+
}
|
|
125
|
+
return true
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
writeFileSync('index.json', JSON.stringify(index, null, 2))
|
|
129
|
+
writeFileSync('wildcard.json', JSON.stringify(wildcard, null, 2))
|
|
130
|
+
</add.js>
|
|
131
|
+
|
|
132
|
+
<component.json>
|
|
133
|
+
{
|
|
134
|
+
"name": "disposable-email-domains",
|
|
135
|
+
"repo": "ivolo/disposable-email-domains",
|
|
136
|
+
"description": "Get a list of disposable email domains.",
|
|
137
|
+
"version": "1.0.62",
|
|
138
|
+
"keywords": ["validate", "email", "disposable", "domains"],
|
|
139
|
+
"license": "MIT",
|
|
140
|
+
"files": ["index.json"],
|
|
141
|
+
"scripts": ["index.js"]
|
|
142
|
+
}
|
|
143
|
+
</component.json>
|
|
144
|
+
|
|
145
|
+
<composer.json>
|
|
146
|
+
{
|
|
147
|
+
"name": "ivolo/disposable-email-domains",
|
|
148
|
+
"description": "disposable domains list",
|
|
149
|
+
"keywords": ["disposable", "domains"],
|
|
150
|
+
"license": "MIT",
|
|
151
|
+
"authors": [
|
|
152
|
+
{
|
|
153
|
+
"name": "Ilya Volodarsky",
|
|
154
|
+
"email": "ivolodarsky@gmail.com",
|
|
155
|
+
"role": "Maintainer"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
</composer.json>
|
|
160
|
+
|
|
161
|
+
<contributions/index.txt>
|
|
162
|
+
|
|
163
|
+
</contributions/index.txt>
|
|
164
|
+
|
|
165
|
+
<contributions/wildcard.txt>
|
|
166
|
+
|
|
167
|
+
</contributions/wildcard.txt>
|
|
168
|
+
|
|
169
|
+
<index.js>
|
|
170
|
+
/**
|
|
171
|
+
* Expose the disposable domains.
|
|
172
|
+
*/
|
|
173
|
+
|
|
174
|
+
module.exports = require('./index.json');
|
|
175
|
+
</index.js>
|
|
176
|
+
|
|
177
|
+
<package.json>
|
|
178
|
+
{
|
|
179
|
+
"name": "disposable-domains",
|
|
180
|
+
"version": "0.0.1",
|
|
181
|
+
"repository": "https://github.com/tompec/disposable-email-domains.git",
|
|
182
|
+
"license": "MIT",
|
|
183
|
+
"main": "./index.json",
|
|
184
|
+
"scripts": {
|
|
185
|
+
"test": "mocha || true",
|
|
186
|
+
"add": "node add.js",
|
|
187
|
+
"prod": "node add.js && mocha || true"
|
|
188
|
+
},
|
|
189
|
+
"devDependencies": {
|
|
190
|
+
"chai": "^3.5.0",
|
|
191
|
+
"chai-sorted": "^0.1.0",
|
|
192
|
+
"lodash": "^4.17.21",
|
|
193
|
+
"mocha": "^6.2.1",
|
|
194
|
+
"validator": "^13.7.0"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
</package.json>
|
|
198
|
+
|
|
199
|
+
<test/helpers/isFQDN.js>
|
|
200
|
+
const isFQDN = require('validator').isFQDN;
|
|
201
|
+
|
|
202
|
+
/*
|
|
203
|
+
Check if all the elements are valid domains
|
|
204
|
+
*/
|
|
205
|
+
module.exports = function (chai) {
|
|
206
|
+
chai.Assertion.addProperty('isFQDN', function () {
|
|
207
|
+
var obj = this._obj, _this = this;
|
|
208
|
+
obj.forEach(function(o){
|
|
209
|
+
_this.assert(
|
|
210
|
+
isFQDN(o)
|
|
211
|
+
, 'expected "' + o + '" to be a valid domain'
|
|
212
|
+
, 'expected "' + o + '" to not be all lowecase'
|
|
213
|
+
);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
</test/helpers/isFQDN.js>
|
|
218
|
+
|
|
219
|
+
<test/helpers/lowercase.js>
|
|
220
|
+
/*
|
|
221
|
+
Check if all the elements are in lowercase
|
|
222
|
+
*/
|
|
223
|
+
module.exports = function (chai) {
|
|
224
|
+
chai.Assertion.addProperty('lowercase', function () {
|
|
225
|
+
var obj = this._obj, _this = this;
|
|
226
|
+
obj.forEach(function(o){
|
|
227
|
+
_this.assert(
|
|
228
|
+
o === o.toLowerCase()
|
|
229
|
+
, 'expected "' + o + '" to be all lowercase'
|
|
230
|
+
, 'expected "' + o + '" to not be all lowercase'
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
</test/helpers/lowercase.js>
|
|
236
|
+
|
|
237
|
+
<test/helpers/notInWildcard.js>
|
|
238
|
+
var wildcard = require('../../wildcard');
|
|
239
|
+
const _ = require('lodash');
|
|
240
|
+
|
|
241
|
+
/*
|
|
242
|
+
Check if all the elements are in lowercase
|
|
243
|
+
*/
|
|
244
|
+
module.exports = function (chai) {
|
|
245
|
+
chai.Assertion.addProperty('notInWildcard', function () {
|
|
246
|
+
this._obj.forEach(domain => {
|
|
247
|
+
if (new RegExp(/(.+(?:\.[\w-]+\.[\w-]+)+)$/).test(domain)) {
|
|
248
|
+
wildcard.forEach(wildcard => {
|
|
249
|
+
this.assert(
|
|
250
|
+
! _.endsWith(domain, wildcard)
|
|
251
|
+
, '"' + domain + '" is already in the wildcard list'
|
|
252
|
+
);
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
</test/helpers/notInWildcard.js>
|
|
259
|
+
|
|
260
|
+
<test/index.js>
|
|
261
|
+
const _ = require('lodash');
|
|
262
|
+
const domains = require('../index');
|
|
263
|
+
const chai = require('chai');
|
|
264
|
+
const expect = chai.expect;
|
|
265
|
+
|
|
266
|
+
chai.use(require("chai-sorted"));
|
|
267
|
+
chai.use(require('./helpers/lowercase'));
|
|
268
|
+
chai.use(require('./helpers/isFQDN'));
|
|
269
|
+
chai.use(require('./helpers/notInWildcard'));
|
|
270
|
+
|
|
271
|
+
describe('Domains', function(){
|
|
272
|
+
it('should be an array', function(){
|
|
273
|
+
expect(domains).to.be.a('array');
|
|
274
|
+
});
|
|
275
|
+
it('should have at least one domain', function(){
|
|
276
|
+
expect(domains).to.have.length.above(0);
|
|
277
|
+
});
|
|
278
|
+
it('should be in alphabetical order', function(){
|
|
279
|
+
expect(domains).to.be.sorted();
|
|
280
|
+
});
|
|
281
|
+
it('should not have duplicates', function(){
|
|
282
|
+
expect(domains).to.deep.equal(_.uniq(domains));
|
|
283
|
+
});
|
|
284
|
+
it('should be lowercase', function(){
|
|
285
|
+
expect(domains).to.be.all.lowercase;
|
|
286
|
+
});
|
|
287
|
+
it('should be a valid domain', function(){
|
|
288
|
+
expect(domains).to.be.all.isFQDN;
|
|
289
|
+
});
|
|
290
|
+
it('should not be a wildcard domain', function(){
|
|
291
|
+
expect(domains).to.be.all.notInWildcard;
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
</test/index.js>
|
|
295
|
+
|
|
296
|
+
<test/wildcard.js>
|
|
297
|
+
const _ = require('lodash');
|
|
298
|
+
const domains = require('../wildcard');
|
|
299
|
+
const chai = require('chai');
|
|
300
|
+
const expect = chai.expect;
|
|
301
|
+
|
|
302
|
+
chai.use(require("chai-sorted"));
|
|
303
|
+
chai.use(require('./helpers/lowercase'));
|
|
304
|
+
chai.use(require('./helpers/isFQDN'));
|
|
305
|
+
|
|
306
|
+
describe('Wildcard domains', function(){
|
|
307
|
+
it('should be an array', function(){
|
|
308
|
+
expect(domains).to.be.a('array');
|
|
309
|
+
});
|
|
310
|
+
it('should have at least one domain', function(){
|
|
311
|
+
expect(domains).to.have.length.above(0);
|
|
312
|
+
});
|
|
313
|
+
it('should be in alphabetical order', function(){
|
|
314
|
+
expect(domains).to.be.sorted();
|
|
315
|
+
});
|
|
316
|
+
it('should not have duplicates', function(){
|
|
317
|
+
expect(domains).to.deep.equal(_.uniq(domains));
|
|
318
|
+
});
|
|
319
|
+
it('should be lowercase', function(){
|
|
320
|
+
expect(domains).to.be.all.lowercase;
|
|
321
|
+
});
|
|
322
|
+
it('should be a valid domain', function(){
|
|
323
|
+
expect(domains).to.be.all.isFQDN;
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
</test/wildcard.js>
|
|
327
|
+
|
|
328
|
+
<wildcard.js>
|
|
329
|
+
/**
|
|
330
|
+
* Expose the wildcard disposable domains.
|
|
331
|
+
*/
|
|
332
|
+
|
|
333
|
+
module.exports = require('./wildcard.json');
|
|
334
|
+
</wildcard.js>
|
|
335
|
+
|