@proconnect-gouv/proconnect.core 1.0.1 → 1.1.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/CHANGELOG.md +12 -0
- package/dist/data/index.cjs +61 -9
- package/dist/data/index.js +61 -9
- package/dist/services/email/index.cjs +5 -1
- package/dist/services/email/index.d.ts +1 -1
- package/dist/services/email/index.d.ts.map +1 -1
- package/dist/services/email/index.js +5 -1
- package/package.json +1 -1
- package/src/data/most-used-free-email-domains.ts +61 -9
- package/src/services/email/get-email-domain.test.ts +22 -0
- package/src/services/email/get-email-domain.ts +4 -0
- package/src/services/email/is-a-free-domain.test.ts +3 -1
- package/src/services/email/is-a-free-domain.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @proconnect-gouv/proconnect.core
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#2246](https://github.com/proconnect-gouv/proconnect-identite/pull/2246) [`d7a9f69`](https://github.com/proconnect-gouv/proconnect-identite/commit/d7a9f69111ae9fe6b9c99a38e64258acc0663686) Thanks [@douglasduteil](https://github.com/douglasduteil)! - 🔒 les fonctions isAFreeDomain et getEmailDomain sont plus robustes et acceptent une plus grande variété de paramètres
|
|
8
|
+
|
|
9
|
+
## 1.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#2186](https://github.com/proconnect-gouv/proconnect-identite/pull/2186) [`f0764ad`](https://github.com/proconnect-gouv/proconnect-identite/commit/f0764ad3f9f91f3cdf51289a182ea0362b3c295f) Thanks [@douglasduteil](https://github.com/douglasduteil)! - la liste des fournisseurs de messagerie grand public couverts par isAFreeDomain passe de 15 à 67 domaines
|
|
14
|
+
|
|
3
15
|
## 1.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/data/index.cjs
CHANGED
|
@@ -240,21 +240,73 @@ var gouvfrDomains = [
|
|
|
240
240
|
];
|
|
241
241
|
|
|
242
242
|
var mostUsedFreeEmailDomains = [
|
|
243
|
+
"9business.fr",
|
|
244
|
+
"9online.fr",
|
|
245
|
+
"adeli.biz",
|
|
246
|
+
"akeonet.com",
|
|
247
|
+
"aliceadsl.fr",
|
|
248
|
+
"alsatis.net",
|
|
249
|
+
"aol.com",
|
|
250
|
+
"aricia.fr",
|
|
251
|
+
"bbox.fr",
|
|
252
|
+
"bouyguestelecom.fr",
|
|
253
|
+
"cegetel.net",
|
|
254
|
+
"club-internet.fr",
|
|
255
|
+
"club.fr",
|
|
256
|
+
"evc.net",
|
|
257
|
+
"free.fr",
|
|
243
258
|
"gmail.com",
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
247
|
-
"
|
|
259
|
+
"gmail.fr",
|
|
260
|
+
"gmx.com",
|
|
261
|
+
"gmx.fr",
|
|
262
|
+
"gmx.net",
|
|
263
|
+
"googlemail.com",
|
|
248
264
|
"hotmail.com",
|
|
249
|
-
"
|
|
265
|
+
"hotmail.fr",
|
|
266
|
+
"icloud.com",
|
|
267
|
+
"idyle-telecom.com",
|
|
250
268
|
"laposte.net",
|
|
251
|
-
"
|
|
252
|
-
"
|
|
269
|
+
"lgtel.fr",
|
|
270
|
+
"live.com",
|
|
253
271
|
"live.fr",
|
|
272
|
+
"mail.com",
|
|
273
|
+
"mailo.com",
|
|
274
|
+
"mailoo.org",
|
|
275
|
+
"mcom.fr",
|
|
276
|
+
"me.com",
|
|
277
|
+
"msn.com",
|
|
278
|
+
"netcourrier.com",
|
|
279
|
+
"neuf.fr",
|
|
280
|
+
"nordnet.fr",
|
|
281
|
+
"numericable.com",
|
|
254
282
|
"numericable.fr",
|
|
283
|
+
"online.fr",
|
|
284
|
+
"orange-business.fr",
|
|
285
|
+
"orange.fr",
|
|
286
|
+
"outlook.com",
|
|
287
|
+
"outlook.fr",
|
|
288
|
+
"ovh.fr",
|
|
289
|
+
"ovh.net",
|
|
290
|
+
"ozone.net",
|
|
291
|
+
"pagesperso-orange.fr",
|
|
292
|
+
"proton.me",
|
|
293
|
+
"protonmail.com",
|
|
294
|
+
"rtvc.fr",
|
|
255
295
|
"sfr.fr",
|
|
256
|
-
"
|
|
257
|
-
"
|
|
296
|
+
"telwan.fr",
|
|
297
|
+
"tubeo.eu",
|
|
298
|
+
"tutanota.com",
|
|
299
|
+
"tv-com.net",
|
|
300
|
+
"vialis.net",
|
|
301
|
+
"voila.fr",
|
|
302
|
+
"wanadoo.fr",
|
|
303
|
+
"west-telecom.com",
|
|
304
|
+
"wibox.fr",
|
|
305
|
+
"yahoo.com",
|
|
306
|
+
"yahoo.fr",
|
|
307
|
+
"yandex.com",
|
|
308
|
+
"ymail.com",
|
|
309
|
+
"zoho.com"
|
|
258
310
|
];
|
|
259
311
|
|
|
260
312
|
var otherGouvDomains = [
|
package/dist/data/index.js
CHANGED
|
@@ -238,21 +238,73 @@ var gouvfrDomains = [
|
|
|
238
238
|
];
|
|
239
239
|
|
|
240
240
|
var mostUsedFreeEmailDomains = [
|
|
241
|
+
"9business.fr",
|
|
242
|
+
"9online.fr",
|
|
243
|
+
"adeli.biz",
|
|
244
|
+
"akeonet.com",
|
|
245
|
+
"aliceadsl.fr",
|
|
246
|
+
"alsatis.net",
|
|
247
|
+
"aol.com",
|
|
248
|
+
"aricia.fr",
|
|
249
|
+
"bbox.fr",
|
|
250
|
+
"bouyguestelecom.fr",
|
|
251
|
+
"cegetel.net",
|
|
252
|
+
"club-internet.fr",
|
|
253
|
+
"club.fr",
|
|
254
|
+
"evc.net",
|
|
255
|
+
"free.fr",
|
|
241
256
|
"gmail.com",
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"
|
|
257
|
+
"gmail.fr",
|
|
258
|
+
"gmx.com",
|
|
259
|
+
"gmx.fr",
|
|
260
|
+
"gmx.net",
|
|
261
|
+
"googlemail.com",
|
|
246
262
|
"hotmail.com",
|
|
247
|
-
"
|
|
263
|
+
"hotmail.fr",
|
|
264
|
+
"icloud.com",
|
|
265
|
+
"idyle-telecom.com",
|
|
248
266
|
"laposte.net",
|
|
249
|
-
"
|
|
250
|
-
"
|
|
267
|
+
"lgtel.fr",
|
|
268
|
+
"live.com",
|
|
251
269
|
"live.fr",
|
|
270
|
+
"mail.com",
|
|
271
|
+
"mailo.com",
|
|
272
|
+
"mailoo.org",
|
|
273
|
+
"mcom.fr",
|
|
274
|
+
"me.com",
|
|
275
|
+
"msn.com",
|
|
276
|
+
"netcourrier.com",
|
|
277
|
+
"neuf.fr",
|
|
278
|
+
"nordnet.fr",
|
|
279
|
+
"numericable.com",
|
|
252
280
|
"numericable.fr",
|
|
281
|
+
"online.fr",
|
|
282
|
+
"orange-business.fr",
|
|
283
|
+
"orange.fr",
|
|
284
|
+
"outlook.com",
|
|
285
|
+
"outlook.fr",
|
|
286
|
+
"ovh.fr",
|
|
287
|
+
"ovh.net",
|
|
288
|
+
"ozone.net",
|
|
289
|
+
"pagesperso-orange.fr",
|
|
290
|
+
"proton.me",
|
|
291
|
+
"protonmail.com",
|
|
292
|
+
"rtvc.fr",
|
|
253
293
|
"sfr.fr",
|
|
254
|
-
"
|
|
255
|
-
"
|
|
294
|
+
"telwan.fr",
|
|
295
|
+
"tubeo.eu",
|
|
296
|
+
"tutanota.com",
|
|
297
|
+
"tv-com.net",
|
|
298
|
+
"vialis.net",
|
|
299
|
+
"voila.fr",
|
|
300
|
+
"wanadoo.fr",
|
|
301
|
+
"west-telecom.com",
|
|
302
|
+
"wibox.fr",
|
|
303
|
+
"yahoo.com",
|
|
304
|
+
"yahoo.fr",
|
|
305
|
+
"yandex.com",
|
|
306
|
+
"ymail.com",
|
|
307
|
+
"zoho.com"
|
|
256
308
|
];
|
|
257
309
|
|
|
258
310
|
var otherGouvDomains = [
|
|
@@ -5,13 +5,17 @@ var mostUsedFreeEmailDomains = require('#src/data/most-used-free-email-domains')
|
|
|
5
5
|
var isDisposableEmailDomain = require('is-disposable-email-domain');
|
|
6
6
|
|
|
7
7
|
function getEmailDomain(email) {
|
|
8
|
+
if (!email) {
|
|
9
|
+
throw new Error("Empty string");
|
|
10
|
+
}
|
|
8
11
|
const parts = email.split("@");
|
|
9
12
|
const host = parts[parts.length - 1];
|
|
10
13
|
const { sub, domain } = tldExtract.parse_host(host, { allowDotlessTLD: true });
|
|
11
14
|
return [sub, domain].filter(Boolean).join(".");
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
function isAFreeDomain(
|
|
17
|
+
function isAFreeDomain(string) {
|
|
18
|
+
const domain = getEmailDomain(string);
|
|
15
19
|
return isDisposableEmailDomain.isFree(domain) || mostUsedFreeEmailDomains.includes(domain);
|
|
16
20
|
}
|
|
17
21
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
declare function getEmailDomain(email: string): string;
|
|
9
9
|
|
|
10
|
-
declare function isAFreeDomain(
|
|
10
|
+
declare function isAFreeDomain(string: string): boolean;
|
|
11
11
|
|
|
12
12
|
export { getEmailDomain, isAFreeDomain };
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sources":["../../../src/services/email/get-email-domain.ts","../../../src/services/email/is-a-free-domain.ts"],"mappings":"AAMA;;;;;;;AAOA,iBAAgB,cAAc;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../../src/services/email/get-email-domain.ts","../../../src/services/email/is-a-free-domain.ts"],"mappings":"AAMA;;;;;;;AAOA,iBAAgB,cAAc;;ACJ9B,iBAAgB,aAAa","names":[]}
|
|
@@ -3,13 +3,17 @@ import mostUsedFreeEmailDomains from '#src/data/most-used-free-email-domains';
|
|
|
3
3
|
import { isFree } from 'is-disposable-email-domain';
|
|
4
4
|
|
|
5
5
|
function getEmailDomain(email) {
|
|
6
|
+
if (!email) {
|
|
7
|
+
throw new Error("Empty string");
|
|
8
|
+
}
|
|
6
9
|
const parts = email.split("@");
|
|
7
10
|
const host = parts[parts.length - 1];
|
|
8
11
|
const { sub, domain } = parse_host(host, { allowDotlessTLD: true });
|
|
9
12
|
return [sub, domain].filter(Boolean).join(".");
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
function isAFreeDomain(
|
|
15
|
+
function isAFreeDomain(string) {
|
|
16
|
+
const domain = getEmailDomain(string);
|
|
13
17
|
return isFree(domain) || mostUsedFreeEmailDomains.includes(domain);
|
|
14
18
|
}
|
|
15
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proconnect-gouv/proconnect.core",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"homepage": "https://github.com/proconnect-gouv/proconnect-identite/tree/main/packages/core#readme",
|
|
5
5
|
"bugs": "https://github.com/proconnect-gouv/proconnect-identite/issues",
|
|
6
6
|
"repository": {
|
|
@@ -1,18 +1,70 @@
|
|
|
1
1
|
// arbitrary selection of free email provider domains used by our users
|
|
2
2
|
export default [
|
|
3
|
+
"9business.fr",
|
|
4
|
+
"9online.fr",
|
|
5
|
+
"adeli.biz",
|
|
6
|
+
"akeonet.com",
|
|
7
|
+
"aliceadsl.fr",
|
|
8
|
+
"alsatis.net",
|
|
9
|
+
"aol.com",
|
|
10
|
+
"aricia.fr",
|
|
11
|
+
"bbox.fr",
|
|
12
|
+
"bouyguestelecom.fr",
|
|
13
|
+
"cegetel.net",
|
|
14
|
+
"club-internet.fr",
|
|
15
|
+
"club.fr",
|
|
16
|
+
"evc.net",
|
|
17
|
+
"free.fr",
|
|
3
18
|
"gmail.com",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
19
|
+
"gmail.fr",
|
|
20
|
+
"gmx.com",
|
|
21
|
+
"gmx.fr",
|
|
22
|
+
"gmx.net",
|
|
23
|
+
"googlemail.com",
|
|
8
24
|
"hotmail.com",
|
|
9
|
-
"
|
|
25
|
+
"hotmail.fr",
|
|
26
|
+
"icloud.com",
|
|
27
|
+
"idyle-telecom.com",
|
|
10
28
|
"laposte.net",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
29
|
+
"lgtel.fr",
|
|
30
|
+
"live.com",
|
|
13
31
|
"live.fr",
|
|
32
|
+
"mail.com",
|
|
33
|
+
"mailo.com",
|
|
34
|
+
"mailoo.org",
|
|
35
|
+
"mcom.fr",
|
|
36
|
+
"me.com",
|
|
37
|
+
"msn.com",
|
|
38
|
+
"netcourrier.com",
|
|
39
|
+
"neuf.fr",
|
|
40
|
+
"nordnet.fr",
|
|
41
|
+
"numericable.com",
|
|
14
42
|
"numericable.fr",
|
|
43
|
+
"online.fr",
|
|
44
|
+
"orange-business.fr",
|
|
45
|
+
"orange.fr",
|
|
46
|
+
"outlook.com",
|
|
47
|
+
"outlook.fr",
|
|
48
|
+
"ovh.fr",
|
|
49
|
+
"ovh.net",
|
|
50
|
+
"ozone.net",
|
|
51
|
+
"pagesperso-orange.fr",
|
|
52
|
+
"proton.me",
|
|
53
|
+
"protonmail.com",
|
|
54
|
+
"rtvc.fr",
|
|
15
55
|
"sfr.fr",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
56
|
+
"telwan.fr",
|
|
57
|
+
"tubeo.eu",
|
|
58
|
+
"tutanota.com",
|
|
59
|
+
"tv-com.net",
|
|
60
|
+
"vialis.net",
|
|
61
|
+
"voila.fr",
|
|
62
|
+
"wanadoo.fr",
|
|
63
|
+
"west-telecom.com",
|
|
64
|
+
"wibox.fr",
|
|
65
|
+
"yahoo.com",
|
|
66
|
+
"yahoo.fr",
|
|
67
|
+
"yandex.com",
|
|
68
|
+
"ymail.com",
|
|
69
|
+
"zoho.com",
|
|
18
70
|
];
|
|
@@ -20,6 +20,10 @@ describe("getEmailDomain", () => {
|
|
|
20
20
|
email: "user@subdomain.domain.org",
|
|
21
21
|
domain: "subdomain.domain.org",
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
email: "domain.org",
|
|
25
|
+
domain: "domain.org",
|
|
26
|
+
},
|
|
23
27
|
];
|
|
24
28
|
|
|
25
29
|
data.forEach(({ email, domain }) => {
|
|
@@ -27,4 +31,22 @@ describe("getEmailDomain", () => {
|
|
|
27
31
|
assert.equal(getEmailDomain(email), domain);
|
|
28
32
|
});
|
|
29
33
|
});
|
|
34
|
+
|
|
35
|
+
const errors: { email: string; error: { name: string; message: RegExp } }[] =
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
email: "",
|
|
39
|
+
error: { name: "Error", message: /Empty string/ },
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
email: "jean",
|
|
43
|
+
error: { name: "Error", message: /Invalid TLD/ },
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
errors.forEach(({ email, error }) => {
|
|
48
|
+
it(`should throw on ${JSON.stringify(email)}`, () => {
|
|
49
|
+
assert.throws(() => getEmailDomain(email), error);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
30
52
|
});
|
|
@@ -12,6 +12,10 @@ import { parse_host } from "tld-extract";
|
|
|
12
12
|
* @returns the domain of the email address
|
|
13
13
|
*/
|
|
14
14
|
export function getEmailDomain(email: string) {
|
|
15
|
+
if (!email) {
|
|
16
|
+
throw new Error("Empty string");
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
const parts = email.split("@");
|
|
16
20
|
const host = parts[parts.length - 1];
|
|
17
21
|
const { sub, domain } = parse_host(host, { allowDotlessTLD: true });
|
|
@@ -14,9 +14,11 @@ describe("isAFreeDomain", () => {
|
|
|
14
14
|
"outlook.com",
|
|
15
15
|
"aol.com",
|
|
16
16
|
"yopmail.com",
|
|
17
|
+
"9business.fr",
|
|
17
18
|
].forEach((domain) => {
|
|
18
|
-
it(`should return true for free domains "${domain}"`, () => {
|
|
19
|
+
it(`should return true for free domains and emails using "${domain}"`, () => {
|
|
19
20
|
assert.equal(isAFreeDomain(domain), true);
|
|
21
|
+
assert.equal(isAFreeDomain(`user@${domain}`), true);
|
|
20
22
|
});
|
|
21
23
|
});
|
|
22
24
|
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import mostUsedFreeEmailDomains from "#src/data/most-used-free-email-domains";
|
|
4
4
|
import { isFree } from "is-disposable-email-domain";
|
|
5
|
+
import { getEmailDomain } from "./get-email-domain.js";
|
|
5
6
|
|
|
6
7
|
//
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
// heavily inspired from https://stackoverflow.com/questions/71232973/check-email-domain-type-personal-email-or-company-email#answer-72640757
|
|
10
|
+
export function isAFreeDomain(string: string) {
|
|
11
|
+
const domain = getEmailDomain(string);
|
|
12
|
+
|
|
10
13
|
return isFree(domain) || mostUsedFreeEmailDomains.includes(domain);
|
|
11
14
|
}
|