@triangular/password-checker 9.0.0 → 11.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 +16 -24
- package/{esm2020 → esm2022}/lib/password-checker-lib.directive.mjs +12 -11
- package/{esm2020 → esm2022}/lib/password-checker-lib.module.mjs +7 -7
- package/{fesm2020 → fesm2022}/triangular-password-checker.mjs +17 -16
- package/fesm2022/triangular-password-checker.mjs.map +1 -0
- package/lib/password-checker-lib.directive.d.ts +1 -2
- package/lib/password-checker-lib.module.d.ts +3 -3
- package/lib/password-checker.config.d.ts +1 -1
- package/package.json +7 -13
- package/fesm2015/triangular-password-checker.mjs +0 -119
- package/fesm2015/triangular-password-checker.mjs.map +0 -1
- package/fesm2020/triangular-password-checker.mjs.map +0 -1
- /package/{esm2020 → esm2022}/lib/password-checker.config.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/triangular-password-checker.mjs +0 -0
package/README.md
CHANGED
|
@@ -7,17 +7,19 @@ Protect your users from re-using a password known to be hacked with this simple
|
|
|
7
7
|
If you just want to use the library to verify the passwords given by your users, follow the following 4 simple steps. For contributing, or building the library locally, see the section on [building](#building) the library.
|
|
8
8
|
|
|
9
9
|
Supported Angular Versions
|
|
10
|
-
| Angular Version | Password Checker Version
|
|
11
|
-
| ---------------- |
|
|
12
|
-
| 6.x |
|
|
13
|
-
| 7.x |
|
|
14
|
-
| 8.x |
|
|
15
|
-
| 9.x |
|
|
16
|
-
| 10.x |
|
|
17
|
-
| 11.x |
|
|
18
|
-
| 12.x |
|
|
19
|
-
| 13.x |
|
|
20
|
-
| 14.x |
|
|
10
|
+
| Angular Version | Password Checker Version |
|
|
11
|
+
| ---------------- | ------------------------- |
|
|
12
|
+
| 6.x | 1.0.0 |
|
|
13
|
+
| 7.x | 2.2.0 |
|
|
14
|
+
| 8.x | 3.0.0 |
|
|
15
|
+
| 9.x | 4.0.0 |
|
|
16
|
+
| 10.x | 5.0.0 |
|
|
17
|
+
| 11.x | 6.0.0 |
|
|
18
|
+
| 12.x | 7.0.0 |
|
|
19
|
+
| 13.x | 8.0.1 |
|
|
20
|
+
| 14.x | 9.0.0 |
|
|
21
|
+
| 15.x | 10.0.0 |
|
|
22
|
+
| 16.x | 11.0.0 |
|
|
21
23
|
|
|
22
24
|
### Step 1: Install
|
|
23
25
|
|
|
@@ -31,6 +33,8 @@ npm i @triangular/password-checker crypto-js
|
|
|
31
33
|
|
|
32
34
|
Then, add the __PasswordCheckerModule__ to the imports of your app.
|
|
33
35
|
|
|
36
|
+
_If you're using standalone components, you can skip this step._
|
|
37
|
+
|
|
34
38
|
```typescript
|
|
35
39
|
import { NgModule } from '@angular/core';
|
|
36
40
|
import { PasswordCheckerModule } from '@triangular/password-checker';
|
|
@@ -165,19 +169,7 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc
|
|
|
165
169
|
|
|
166
170
|
## Versioning
|
|
167
171
|
|
|
168
|
-
We use [SemVer](http://semver.org/) for versioning.
|
|
169
|
-
|
|
170
|
-
### Version History
|
|
171
|
-
|
|
172
|
-
- 1.0.0: Initial Release
|
|
173
|
-
- 2.2.0: Code Improvements and Angular 7.x
|
|
174
|
-
- 3.0.0: Angular 8.x
|
|
175
|
-
- 4.0.0: Angular 9.x
|
|
176
|
-
- 5.0.0: Angular 10.x
|
|
177
|
-
- 6.0.0: Angular 11.x
|
|
178
|
-
- 7.0.0: Angular 12.x
|
|
179
|
-
- 8.0.0: Angular 13.x
|
|
180
|
-
- 8.0.1: Upgrade rxjs to 7.4
|
|
172
|
+
We use [SemVer](http://semver.org/) for versioning.
|
|
181
173
|
|
|
182
174
|
## Authors
|
|
183
175
|
|
|
@@ -42,16 +42,16 @@ export class PasswordCheckerLibDirective {
|
|
|
42
42
|
? { pwnedPasswordOccurrence: password.count }
|
|
43
43
|
: null));
|
|
44
44
|
}
|
|
45
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerLibDirective, deps: [{ token: i1.HttpClient }, { token: PasswordCheckerConfigValue, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
46
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.6", type: PasswordCheckerLibDirective, isStandalone: true, selector: "[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]", inputs: { pwnedPasswordApi: "pwnedPasswordApi", pwnedPasswordMinimumOccurrenceForError: "pwnedPasswordMinimumOccurrenceForError", pwnedPasswordApiCallDebounceTime: "pwnedPasswordApiCallDebounceTime" }, providers: [
|
|
47
|
+
{
|
|
48
|
+
provide: NG_ASYNC_VALIDATORS,
|
|
49
|
+
useExisting: PasswordCheckerLibDirective,
|
|
50
|
+
multi: true,
|
|
51
|
+
},
|
|
52
|
+
], ngImport: i0 }); }
|
|
45
53
|
}
|
|
46
|
-
|
|
47
|
-
PasswordCheckerLibDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: PasswordCheckerLibDirective, selector: "[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]", inputs: { pwnedPasswordApi: "pwnedPasswordApi", pwnedPasswordMinimumOccurrenceForError: "pwnedPasswordMinimumOccurrenceForError", pwnedPasswordApiCallDebounceTime: "pwnedPasswordApiCallDebounceTime" }, providers: [
|
|
48
|
-
{
|
|
49
|
-
provide: NG_ASYNC_VALIDATORS,
|
|
50
|
-
useExisting: PasswordCheckerLibDirective,
|
|
51
|
-
multi: true,
|
|
52
|
-
},
|
|
53
|
-
], ngImport: i0 });
|
|
54
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerLibDirective, decorators: [{
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerLibDirective, decorators: [{
|
|
55
55
|
type: Directive,
|
|
56
56
|
args: [{
|
|
57
57
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
@@ -62,7 +62,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImpor
|
|
|
62
62
|
useExisting: PasswordCheckerLibDirective,
|
|
63
63
|
multi: true,
|
|
64
64
|
},
|
|
65
|
-
]
|
|
65
|
+
],
|
|
66
|
+
standalone: true
|
|
66
67
|
}]
|
|
67
68
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
68
69
|
type: Optional
|
|
@@ -76,4 +77,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImpor
|
|
|
76
77
|
}], pwnedPasswordApiCallDebounceTime: [{
|
|
77
78
|
type: Input
|
|
78
79
|
}] } });
|
|
79
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
80
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFzc3dvcmQtY2hlY2tlci1saWIuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvcGFzc3dvcmQtY2hlY2tlci1saWIvc3JjL2xpYi9wYXNzd29yZC1jaGVja2VyLWxpYi5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFjLEtBQUssRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUN6QyxPQUFPLEVBQUUsR0FBRyxFQUFFLFNBQVMsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ2hELE9BQU8sRUFBbUMsbUJBQW1CLEVBQW9CLE1BQU0sZ0JBQWdCLENBQUM7QUFDeEcsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQU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c3xudWxsPiB7XG4gICAgY29uc3QgcHcgPSAnJy5jb25jYXQoY29udHJvbC52YWx1ZSk7XG5cbiAgICByZXR1cm4gdGltZXIodGhpcy5wd25lZFBhc3N3b3JkQXBpQ2FsbERlYm91bmNlVGltZSkucGlwZShcbiAgICAgIG1hcCgoKSA9PiB7XG4gICAgICAgIGNvbnN0IHB3U2hhMSA9IHNoYTEocHcpLnRvU3RyaW5nKCkudG9VcHBlckNhc2UoKTtcblxuICAgICAgICByZXR1cm4ge1xuICAgICAgICAgIGZpcnN0UGFydDogcHdTaGExLnN1YnN0cmluZygwLCA1KSxcbiAgICAgICAgICBsYXN0UGFydDogcHdTaGExLnN1YnN0cmluZyg1KSxcbiAgICAgICAgfTtcbiAgICAgIH0pLFxuICAgICAgc3dpdGNoTWFwKFxuICAgICAgICAoaGFzaCkgPT4gdGhpcy5odHRwLmdldChcbiAgICAgICAgICBgJHt0aGlzLnB3bmVkUGFzc3dvcmRBcGl9JHtoYXNoLmZpcnN0UGFydH1gLCAgeyByZXNwb25zZVR5cGU6ICd0ZXh0JyB9XG4gICAgICAgICAgKS5waXBlKFxuICAgICAgICAgIG1hcChwYXNzd29yZHMgPT4gcGFzc3dvcmRzLnNwbGl0KC9bXFxyXFxuXSsvKSksXG4gICAgICAgICAgbWFwKHBhc3N3b3JkcyA9PiBwYXNzd29yZHMubWFwKChwYXNzd29yZCkgPT4ge1xuICAgICAgICAgICAgICBjb25zdCBzcGxpdCA9ICBwYXNzd29yZC5zcGxpdCgnOicpO1xuXG4gICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgaGFzaDogc3BsaXRbMF0sXG4gICAgICAgICAgICAgICAgY291bnQ6IHBhcnNlSW50KHNwbGl0WzFdLCAxMCksXG4gICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgKSksXG4gICAgICAgICAgbWFwKHBhc3N3b3JkcyA9PiBwYXNzd29yZHMuZmluZChwYXNzd29yZCA9PiBwYXNzd29yZC5oYXNoID09PSBoYXNoLmxhc3RQYXJ0KSksXG4gICAgICAgICksXG4gICAgICApLFxuICAgICAgbWFwKHBhc3N3b3JkID0+IHBhc3N3b3JkICYmIHBhc3N3b3JkLmNvdW50ID49IHRoaXMucHduZWRQYXNzd29yZE1pbmltdW1PY2N1cnJlbmNlRm9yRXJyb3JcbiAgICAgICAgPyB7IHB3bmVkUGFzc3dvcmRPY2N1cnJlbmNlOiBwYXNzd29yZC5jb3VudCB9XG4gICAgICAgIDogbnVsbCksXG4gICAgKTtcbiAgfVxufVxuIl19
|
|
@@ -15,16 +15,16 @@ export class PasswordCheckerModule {
|
|
|
15
15
|
]
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
19
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerModule, imports: [HttpClientModule, PasswordCheckerLibDirective], exports: [PasswordCheckerLibDirective] }); }
|
|
20
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerModule, imports: [HttpClientModule] }); }
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
PasswordCheckerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, declarations: [PasswordCheckerLibDirective], imports: [HttpClientModule], exports: [PasswordCheckerLibDirective] });
|
|
21
|
-
PasswordCheckerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, imports: [HttpClientModule] });
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, decorators: [{
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerModule, decorators: [{
|
|
23
23
|
type: NgModule,
|
|
24
24
|
args: [{
|
|
25
|
-
declarations: [
|
|
26
|
-
imports: [HttpClientModule],
|
|
25
|
+
declarations: [],
|
|
26
|
+
imports: [HttpClientModule, PasswordCheckerLibDirective],
|
|
27
27
|
exports: [PasswordCheckerLibDirective]
|
|
28
28
|
}]
|
|
29
29
|
}] });
|
|
30
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFzc3dvcmQtY2hlY2tlci1saWIubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvcGFzc3dvcmQtY2hlY2tlci1saWIvc3JjL2xpYi9wYXNzd29yZC1jaGVja2VyLWxpYi5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUF1QixRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDOUQsT0FBTyxFQUFFLDJCQUEyQixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDL0UsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDeEQsT0FBTyxFQUFrQywwQkFBMEIsRUFBRSxNQUFNLDJCQUEyQixDQUFDOztBQU92RyxNQUFNLE9BQU8scUJBQXFCO0lBQ2hDLE1BQU0sQ0FBQyxPQUFPLENBQUMsU0FBeUMsRUFBRTtRQUN4RCxPQUFPO1lBQ0wsUUFBUSxFQUFFLHFCQUFxQjtZQUMvQixTQUFTLEVBQUU7Z0JBQ1Q7b0JBQ0UsT0FBTyxFQUFFLDBCQUEwQjtvQkFDbkMsUUFBUSxFQUFFLE1BQU07a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JSb290KGNvbmZpZzogUGFydGlhbDxQYXNzd29yZENoZWNrZXJDb25maWc+ID0ge30pOiBNb2R1bGVXaXRoUHJvdmlkZXJzPFBhc3N3b3JkQ2hlY2tlck1vZHVsZT4ge1xuICAgIHJldHVybiB7XG4gICAgICBuZ01vZHVsZTogUGFzc3dvcmRDaGVja2VyTW9kdWxlLFxuICAgICAgcHJvdmlkZXJzOiBbXG4gICAgICAgIHtcbiAgICAgICAgICBwcm92aWRlOiBQYXNzd29yZENoZWNrZXJDb25maWdWYWx1ZSxcbiAgICAgICAgICB1c2VWYWx1ZTogY29uZmlnLFxuICAgICAgICB9XG4gICAgICBdXG4gICAgfTtcbiAgfVxufVxuIl19
|
|
@@ -45,16 +45,16 @@ class PasswordCheckerLibDirective {
|
|
|
45
45
|
? { pwnedPasswordOccurrence: password.count }
|
|
46
46
|
: null));
|
|
47
47
|
}
|
|
48
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerLibDirective, deps: [{ token: i1.HttpClient }, { token: PasswordCheckerConfigValue, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
49
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.6", type: PasswordCheckerLibDirective, isStandalone: true, selector: "[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]", inputs: { pwnedPasswordApi: "pwnedPasswordApi", pwnedPasswordMinimumOccurrenceForError: "pwnedPasswordMinimumOccurrenceForError", pwnedPasswordApiCallDebounceTime: "pwnedPasswordApiCallDebounceTime" }, providers: [
|
|
50
|
+
{
|
|
51
|
+
provide: NG_ASYNC_VALIDATORS,
|
|
52
|
+
useExisting: PasswordCheckerLibDirective,
|
|
53
|
+
multi: true,
|
|
54
|
+
},
|
|
55
|
+
], ngImport: i0 }); }
|
|
48
56
|
}
|
|
49
|
-
|
|
50
|
-
PasswordCheckerLibDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: PasswordCheckerLibDirective, selector: "[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]", inputs: { pwnedPasswordApi: "pwnedPasswordApi", pwnedPasswordMinimumOccurrenceForError: "pwnedPasswordMinimumOccurrenceForError", pwnedPasswordApiCallDebounceTime: "pwnedPasswordApiCallDebounceTime" }, providers: [
|
|
51
|
-
{
|
|
52
|
-
provide: NG_ASYNC_VALIDATORS,
|
|
53
|
-
useExisting: PasswordCheckerLibDirective,
|
|
54
|
-
multi: true,
|
|
55
|
-
},
|
|
56
|
-
], ngImport: i0 });
|
|
57
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerLibDirective, decorators: [{
|
|
57
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerLibDirective, decorators: [{
|
|
58
58
|
type: Directive,
|
|
59
59
|
args: [{
|
|
60
60
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
@@ -65,7 +65,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImpor
|
|
|
65
65
|
useExisting: PasswordCheckerLibDirective,
|
|
66
66
|
multi: true,
|
|
67
67
|
},
|
|
68
|
-
]
|
|
68
|
+
],
|
|
69
|
+
standalone: true
|
|
69
70
|
}]
|
|
70
71
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
71
72
|
type: Optional
|
|
@@ -92,15 +93,15 @@ class PasswordCheckerModule {
|
|
|
92
93
|
]
|
|
93
94
|
};
|
|
94
95
|
}
|
|
96
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
97
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerModule, imports: [HttpClientModule, PasswordCheckerLibDirective], exports: [PasswordCheckerLibDirective] }); }
|
|
98
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerModule, imports: [HttpClientModule] }); }
|
|
95
99
|
}
|
|
96
|
-
|
|
97
|
-
PasswordCheckerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, declarations: [PasswordCheckerLibDirective], imports: [HttpClientModule], exports: [PasswordCheckerLibDirective] });
|
|
98
|
-
PasswordCheckerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, imports: [HttpClientModule] });
|
|
99
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, decorators: [{
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PasswordCheckerModule, decorators: [{
|
|
100
101
|
type: NgModule,
|
|
101
102
|
args: [{
|
|
102
|
-
declarations: [
|
|
103
|
-
imports: [HttpClientModule],
|
|
103
|
+
declarations: [],
|
|
104
|
+
imports: [HttpClientModule, PasswordCheckerLibDirective],
|
|
104
105
|
exports: [PasswordCheckerLibDirective]
|
|
105
106
|
}]
|
|
106
107
|
}] });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triangular-password-checker.mjs","sources":["../../../projects/password-checker-lib/src/lib/password-checker.config.ts","../../../projects/password-checker-lib/src/lib/password-checker-lib.directive.ts","../../../projects/password-checker-lib/src/lib/password-checker-lib.module.ts","../../../projects/password-checker-lib/src/public_api.ts","../../../projects/password-checker-lib/src/triangular-password-checker.ts"],"sourcesContent":["import {InjectionToken} from '@angular/core';\n\nexport type Partial<T> = {\n [P in keyof T]?: T[P];\n};\n\nexport interface PasswordCheckerConfig {\n pwnedPasswordApi: string;\n pwnedPasswordMinimumOccurrenceForError: number;\n pwnedPasswordApiCallDebounceTime: number;\n}\n\nexport const PasswordCheckerConfigValue = new InjectionToken<Partial<PasswordCheckerConfig>>('PASSWORD_CHECKER_CONFIG');\n","import { Observable, timer } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\nimport { AbstractControl, AsyncValidator, NG_ASYNC_VALIDATORS, ValidationErrors } from '@angular/forms';\nimport { Directive, Inject, Input, Optional } from '@angular/core';\nimport {HttpClient, HttpClientModule} from '@angular/common/http';\nimport sha1 from 'crypto-js/sha1';\nimport { Partial, PasswordCheckerConfig, PasswordCheckerConfigValue } from './password-checker.config';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]',\n providers: [\n {\n provide: NG_ASYNC_VALIDATORS,\n useExisting: PasswordCheckerLibDirective,\n multi: true,\n },\n ],\n standalone: true\n})\nexport class PasswordCheckerLibDirective implements AsyncValidator {\n @Input() pwnedPasswordApi: string;\n @Input() pwnedPasswordMinimumOccurrenceForError: number;\n @Input() pwnedPasswordApiCallDebounceTime: number;\n\n constructor(\n private http: HttpClient,\n @Optional() @Inject(PasswordCheckerConfigValue) config: Partial<PasswordCheckerConfig>,\n ) {\n\n if (!config) {\n // default initialization in constructor didn't work.\n // conflict with @Optional()?\n config = {};\n }\n\n this.pwnedPasswordApi =\n config.pwnedPasswordApi\n || 'https://api.pwnedpasswords.com/range/';\n this.pwnedPasswordMinimumOccurrenceForError =\n config.pwnedPasswordMinimumOccurrenceForError\n || 1;\n this.pwnedPasswordApiCallDebounceTime =\n config.pwnedPasswordApiCallDebounceTime\n || 400;\n }\n\n validate(control: AbstractControl): Observable<ValidationErrors|null> {\n const pw = ''.concat(control.value);\n\n return timer(this.pwnedPasswordApiCallDebounceTime).pipe(\n map(() => {\n const pwSha1 = sha1(pw).toString().toUpperCase();\n\n return {\n firstPart: pwSha1.substring(0, 5),\n lastPart: pwSha1.substring(5),\n };\n }),\n switchMap(\n (hash) => this.http.get(\n `${this.pwnedPasswordApi}${hash.firstPart}`, { responseType: 'text' }\n ).pipe(\n map(passwords => passwords.split(/[\\r\\n]+/)),\n map(passwords => passwords.map((password) => {\n const split = password.split(':');\n\n return {\n hash: split[0],\n count: parseInt(split[1], 10),\n };\n }\n )),\n map(passwords => passwords.find(password => password.hash === hash.lastPart)),\n ),\n ),\n map(password => password && password.count >= this.pwnedPasswordMinimumOccurrenceForError\n ? { pwnedPasswordOccurrence: password.count }\n : null),\n );\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { PasswordCheckerLibDirective } from './password-checker-lib.directive';\nimport { HttpClientModule } from '@angular/common/http';\nimport { Partial, PasswordCheckerConfig, PasswordCheckerConfigValue } from './password-checker.config';\n\n@NgModule({\n declarations: [],\n imports: [HttpClientModule, PasswordCheckerLibDirective],\n exports: [PasswordCheckerLibDirective]\n})\nexport class PasswordCheckerModule {\n static forRoot(config: Partial<PasswordCheckerConfig> = {}): ModuleWithProviders<PasswordCheckerModule> {\n return {\n ngModule: PasswordCheckerModule,\n providers: [\n {\n provide: PasswordCheckerConfigValue,\n useValue: config,\n }\n ]\n };\n }\n}\n","/*\n * Public API Surface of password-checker-lib\n */\n\nexport * from './lib/password-checker-lib.directive';\nexport * from './lib/password-checker-lib.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;AAYO,MAAM,0BAA0B,GAAG,IAAI,cAAc,CAAiC,yBAAyB,CAAC;;MCQ1G,2BAA2B,CAAA;IAKtC,WACU,CAAA,IAAgB,EACwB,MAAsC,EAAA;QAD9E,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY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CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAHtB,gBAAgB,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAGf,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBALjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,2BAA2B,CAAC;oBACxD,OAAO,EAAE,CAAC,2BAA2B,CAAC;AACvC,iBAAA,CAAA;;;ACTD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -5,12 +5,11 @@ import { Partial, PasswordCheckerConfig } from './password-checker.config';
|
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class PasswordCheckerLibDirective implements AsyncValidator {
|
|
7
7
|
private http;
|
|
8
|
-
private pwnedPasswordMinimumOccurrenceForErrorValue;
|
|
9
8
|
pwnedPasswordApi: string;
|
|
10
9
|
pwnedPasswordMinimumOccurrenceForError: number;
|
|
11
10
|
pwnedPasswordApiCallDebounceTime: number;
|
|
12
11
|
constructor(http: HttpClient, config: Partial<PasswordCheckerConfig>);
|
|
13
12
|
validate(control: AbstractControl): Observable<ValidationErrors | null>;
|
|
14
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<PasswordCheckerLibDirective, [null, { optional: true; }]>;
|
|
15
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<PasswordCheckerLibDirective, "[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]", never, { "pwnedPasswordApi": "pwnedPasswordApi"; "pwnedPasswordMinimumOccurrenceForError": "pwnedPasswordMinimumOccurrenceForError"; "pwnedPasswordApiCallDebounceTime": "pwnedPasswordApiCallDebounceTime"; }, {}, never, never,
|
|
14
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PasswordCheckerLibDirective, "[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]", never, { "pwnedPasswordApi": { "alias": "pwnedPasswordApi"; "required": false; }; "pwnedPasswordMinimumOccurrenceForError": { "alias": "pwnedPasswordMinimumOccurrenceForError"; "required": false; }; "pwnedPasswordApiCallDebounceTime": { "alias": "pwnedPasswordApiCallDebounceTime"; "required": false; }; }, {}, never, never, true, never>;
|
|
16
15
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ModuleWithProviders } from '@angular/core';
|
|
2
2
|
import { Partial, PasswordCheckerConfig } from './password-checker.config';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "
|
|
5
|
-
import * as i2 from "
|
|
4
|
+
import * as i1 from "@angular/common/http";
|
|
5
|
+
import * as i2 from "./password-checker-lib.directive";
|
|
6
6
|
export declare class PasswordCheckerModule {
|
|
7
7
|
static forRoot(config?: Partial<PasswordCheckerConfig>): ModuleWithProviders<PasswordCheckerModule>;
|
|
8
8
|
static ɵfac: i0.ɵɵFactoryDeclaration<PasswordCheckerModule, never>;
|
|
9
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<PasswordCheckerModule, [typeof i1.
|
|
9
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<PasswordCheckerModule, never, [typeof i1.HttpClientModule, typeof i2.PasswordCheckerLibDirective], [typeof i2.PasswordCheckerLibDirective]>;
|
|
10
10
|
static ɵinj: i0.ɵɵInjectorDeclaration<PasswordCheckerModule>;
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@triangular/password-checker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^
|
|
6
|
-
"@angular/core": "^
|
|
5
|
+
"@angular/common": "^16.0.0",
|
|
6
|
+
"@angular/core": "^16.0.0",
|
|
7
7
|
"crypto-js": "^4.1.1"
|
|
8
8
|
},
|
|
9
9
|
"homepage": "https://password.akehir.com",
|
|
@@ -24,11 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"tslib": "^2.0.0"
|
|
26
26
|
},
|
|
27
|
-
"module": "
|
|
28
|
-
"es2020": "fesm2020/triangular-password-checker.mjs",
|
|
29
|
-
"esm2020": "esm2020/triangular-password-checker.mjs",
|
|
30
|
-
"fesm2020": "fesm2020/triangular-password-checker.mjs",
|
|
31
|
-
"fesm2015": "fesm2015/triangular-password-checker.mjs",
|
|
27
|
+
"module": "fesm2022/triangular-password-checker.mjs",
|
|
32
28
|
"typings": "index.d.ts",
|
|
33
29
|
"exports": {
|
|
34
30
|
"./package.json": {
|
|
@@ -36,11 +32,9 @@
|
|
|
36
32
|
},
|
|
37
33
|
".": {
|
|
38
34
|
"types": "./index.d.ts",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"node": "./fesm2015/triangular-password-checker.mjs",
|
|
43
|
-
"default": "./fesm2020/triangular-password-checker.mjs"
|
|
35
|
+
"esm2022": "./esm2022/triangular-password-checker.mjs",
|
|
36
|
+
"esm": "./esm2022/triangular-password-checker.mjs",
|
|
37
|
+
"default": "./fesm2022/triangular-password-checker.mjs"
|
|
44
38
|
}
|
|
45
39
|
},
|
|
46
40
|
"sideEffects": false
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { timer } from 'rxjs';
|
|
2
|
-
import { map, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { NG_ASYNC_VALIDATORS } from '@angular/forms';
|
|
4
|
-
import * as i0 from '@angular/core';
|
|
5
|
-
import { InjectionToken, Directive, Optional, Inject, Input, NgModule } from '@angular/core';
|
|
6
|
-
import sha1 from 'crypto-js/sha1';
|
|
7
|
-
import * as i1 from '@angular/common/http';
|
|
8
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
9
|
-
|
|
10
|
-
const PasswordCheckerConfigValue = new InjectionToken('PASSWORD_CHECKER_CONFIG');
|
|
11
|
-
|
|
12
|
-
class PasswordCheckerLibDirective {
|
|
13
|
-
constructor(http, config) {
|
|
14
|
-
this.http = http;
|
|
15
|
-
if (!config) {
|
|
16
|
-
// default initialization in constructor didn't work.
|
|
17
|
-
// conflict with @Optional()?
|
|
18
|
-
config = {};
|
|
19
|
-
}
|
|
20
|
-
this.pwnedPasswordApi =
|
|
21
|
-
config.pwnedPasswordApi
|
|
22
|
-
|| 'https://api.pwnedpasswords.com/range/';
|
|
23
|
-
this.pwnedPasswordMinimumOccurrenceForError =
|
|
24
|
-
config.pwnedPasswordMinimumOccurrenceForError
|
|
25
|
-
|| 1;
|
|
26
|
-
this.pwnedPasswordApiCallDebounceTime =
|
|
27
|
-
config.pwnedPasswordApiCallDebounceTime
|
|
28
|
-
|| 400;
|
|
29
|
-
}
|
|
30
|
-
validate(control) {
|
|
31
|
-
const pw = ''.concat(control.value);
|
|
32
|
-
return timer(this.pwnedPasswordApiCallDebounceTime).pipe(map(() => {
|
|
33
|
-
const pwSha1 = sha1(pw).toString().toUpperCase();
|
|
34
|
-
return {
|
|
35
|
-
firstPart: pwSha1.substring(0, 5),
|
|
36
|
-
lastPart: pwSha1.substring(5),
|
|
37
|
-
};
|
|
38
|
-
}), switchMap((hash) => this.http.get(`${this.pwnedPasswordApi}${hash.firstPart}`, { responseType: 'text' }).pipe(map(passwords => passwords.split(/[\r\n]+/)), map(passwords => passwords.map((password) => {
|
|
39
|
-
const split = password.split(':');
|
|
40
|
-
return {
|
|
41
|
-
hash: split[0],
|
|
42
|
-
count: parseInt(split[1], 10),
|
|
43
|
-
};
|
|
44
|
-
})), map(passwords => passwords.find(password => password.hash === hash.lastPart)))), map(password => password && password.count >= this.pwnedPasswordMinimumOccurrenceForError
|
|
45
|
-
? { pwnedPasswordOccurrence: password.count }
|
|
46
|
-
: null));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
PasswordCheckerLibDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerLibDirective, deps: [{ token: i1.HttpClient }, { token: PasswordCheckerConfigValue, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
50
|
-
PasswordCheckerLibDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.3", type: PasswordCheckerLibDirective, selector: "[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]", inputs: { pwnedPasswordApi: "pwnedPasswordApi", pwnedPasswordMinimumOccurrenceForError: "pwnedPasswordMinimumOccurrenceForError", pwnedPasswordApiCallDebounceTime: "pwnedPasswordApiCallDebounceTime" }, providers: [
|
|
51
|
-
{
|
|
52
|
-
provide: NG_ASYNC_VALIDATORS,
|
|
53
|
-
useExisting: PasswordCheckerLibDirective,
|
|
54
|
-
multi: true,
|
|
55
|
-
},
|
|
56
|
-
], ngImport: i0 });
|
|
57
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerLibDirective, decorators: [{
|
|
58
|
-
type: Directive,
|
|
59
|
-
args: [{
|
|
60
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
61
|
-
selector: '[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]',
|
|
62
|
-
providers: [
|
|
63
|
-
{
|
|
64
|
-
provide: NG_ASYNC_VALIDATORS,
|
|
65
|
-
useExisting: PasswordCheckerLibDirective,
|
|
66
|
-
multi: true,
|
|
67
|
-
},
|
|
68
|
-
]
|
|
69
|
-
}]
|
|
70
|
-
}], ctorParameters: function () {
|
|
71
|
-
return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
|
72
|
-
type: Optional
|
|
73
|
-
}, {
|
|
74
|
-
type: Inject,
|
|
75
|
-
args: [PasswordCheckerConfigValue]
|
|
76
|
-
}] }];
|
|
77
|
-
}, propDecorators: { pwnedPasswordApi: [{
|
|
78
|
-
type: Input
|
|
79
|
-
}], pwnedPasswordMinimumOccurrenceForError: [{
|
|
80
|
-
type: Input
|
|
81
|
-
}], pwnedPasswordApiCallDebounceTime: [{
|
|
82
|
-
type: Input
|
|
83
|
-
}] } });
|
|
84
|
-
|
|
85
|
-
class PasswordCheckerModule {
|
|
86
|
-
static forRoot(config = {}) {
|
|
87
|
-
return {
|
|
88
|
-
ngModule: PasswordCheckerModule,
|
|
89
|
-
providers: [
|
|
90
|
-
{
|
|
91
|
-
provide: PasswordCheckerConfigValue,
|
|
92
|
-
useValue: config,
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
PasswordCheckerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
99
|
-
PasswordCheckerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, declarations: [PasswordCheckerLibDirective], imports: [HttpClientModule], exports: [PasswordCheckerLibDirective] });
|
|
100
|
-
PasswordCheckerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, imports: [HttpClientModule] });
|
|
101
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.3", ngImport: i0, type: PasswordCheckerModule, decorators: [{
|
|
102
|
-
type: NgModule,
|
|
103
|
-
args: [{
|
|
104
|
-
declarations: [PasswordCheckerLibDirective],
|
|
105
|
-
imports: [HttpClientModule],
|
|
106
|
-
exports: [PasswordCheckerLibDirective]
|
|
107
|
-
}]
|
|
108
|
-
}] });
|
|
109
|
-
|
|
110
|
-
/*
|
|
111
|
-
* Public API Surface of password-checker-lib
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Generated bundle index. Do not edit.
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
export { PasswordCheckerLibDirective, PasswordCheckerModule };
|
|
119
|
-
//# sourceMappingURL=triangular-password-checker.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triangular-password-checker.mjs","sources":["../../../projects/password-checker-lib/src/lib/password-checker.config.ts","../../../projects/password-checker-lib/src/lib/password-checker-lib.directive.ts","../../../projects/password-checker-lib/src/lib/password-checker-lib.module.ts","../../../projects/password-checker-lib/src/public_api.ts","../../../projects/password-checker-lib/src/triangular-password-checker.ts"],"sourcesContent":["import {InjectionToken} from '@angular/core';\n\nexport type Partial<T> = {\n [P in keyof T]?: T[P];\n};\n\nexport interface PasswordCheckerConfig {\n pwnedPasswordApi: string;\n pwnedPasswordMinimumOccurrenceForError: number;\n pwnedPasswordApiCallDebounceTime: number;\n}\n\nexport const PasswordCheckerConfigValue = new InjectionToken<Partial<PasswordCheckerConfig>>('PASSWORD_CHECKER_CONFIG');\n","import { Observable, timer } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\nimport { AbstractControl, AsyncValidator, NG_ASYNC_VALIDATORS, ValidationErrors } from '@angular/forms';\nimport { Directive, Inject, Input, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport sha1 from 'crypto-js/sha1';\nimport { Partial, PasswordCheckerConfig, PasswordCheckerConfigValue } from './password-checker.config';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]',\n providers: [\n {\n provide: NG_ASYNC_VALIDATORS,\n useExisting: PasswordCheckerLibDirective,\n multi: true,\n },\n ]\n})\nexport class PasswordCheckerLibDirective implements AsyncValidator {\n private pwnedPasswordMinimumOccurrenceForErrorValue: number;\n\n @Input() pwnedPasswordApi: string;\n @Input() pwnedPasswordMinimumOccurrenceForError: number;\n @Input() pwnedPasswordApiCallDebounceTime: number;\n\n constructor(\n private http: HttpClient,\n @Optional() @Inject(PasswordCheckerConfigValue) config: Partial<PasswordCheckerConfig>,\n ) {\n\n if (!config) {\n // default initialization in constructor didn't work.\n // conflict with @Optional()?\n config = {};\n }\n\n this.pwnedPasswordApi =\n config.pwnedPasswordApi\n || 'https://api.pwnedpasswords.com/range/';\n this.pwnedPasswordMinimumOccurrenceForError =\n config.pwnedPasswordMinimumOccurrenceForError\n || 1;\n this.pwnedPasswordApiCallDebounceTime =\n config.pwnedPasswordApiCallDebounceTime\n || 400;\n }\n\n validate(control: AbstractControl): Observable<ValidationErrors|null> {\n const pw = ''.concat(control.value);\n\n return timer(this.pwnedPasswordApiCallDebounceTime).pipe(\n map(() => {\n const pwSha1 = sha1(pw).toString().toUpperCase();\n\n return {\n firstPart: pwSha1.substring(0, 5),\n lastPart: pwSha1.substring(5),\n };\n }),\n switchMap(\n (hash) => this.http.get(\n `${this.pwnedPasswordApi}${hash.firstPart}`, { responseType: 'text' }\n ).pipe(\n map(passwords => passwords.split(/[\\r\\n]+/)),\n map(passwords => passwords.map((password) => {\n const split = password.split(':');\n\n return {\n hash: split[0],\n count: parseInt(split[1], 10),\n };\n }\n )),\n map(passwords => passwords.find(password => password.hash === hash.lastPart)),\n ),\n ),\n map(password => password && password.count >= this.pwnedPasswordMinimumOccurrenceForError\n ? { pwnedPasswordOccurrence: password.count }\n : null),\n );\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { PasswordCheckerLibDirective } from './password-checker-lib.directive';\nimport { HttpClientModule } from '@angular/common/http';\nimport { Partial, PasswordCheckerConfig, PasswordCheckerConfigValue } from './password-checker.config';\n\n@NgModule({\n declarations: [PasswordCheckerLibDirective],\n imports: [HttpClientModule],\n exports: [PasswordCheckerLibDirective]\n})\nexport class PasswordCheckerModule {\n static forRoot(config: Partial<PasswordCheckerConfig> = {}): ModuleWithProviders<PasswordCheckerModule> {\n return {\n ngModule: PasswordCheckerModule,\n providers: [\n {\n provide: PasswordCheckerConfigValue,\n useValue: config,\n }\n ]\n };\n }\n}\n","/*\n * Public API Surface of password-checker-lib\n */\n\nexport * from './lib/password-checker-lib.directive';\nexport * from './lib/password-checker-lib.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;AAYO,MAAM,0BAA0B,GAAG,IAAI,cAAc,CAAiC,yBAAyB,CAAC;;MCO1G,2BAA2B,CAAA;IAOtC,WACU,CAAA,IAAgB,EACwB,MAAsC,EAAA;AAD9E,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;QAIxB,IAAI,CAAC,MAAM,EAAE;;;YAGX,MAAM,GAAG,EAAE,CAAC;AACb,SAAA;AAED,QAAA,IAAI,CAAC,gBAAgB;AACnB,YAAA,MAAM,CAAC,gBAAgB;AACpB,mBAAA,uCAAuC,CAAC;AAC7C,QAAA,IAAI,CAAC,sCAAsC;AACzC,YAAA,MAAM,CAAC,sCAAsC;AAC1C,mBAAA,CAAC,CAAC;AACP,QAAA,IAAI,CAAC,gCAAgC;AACnC,YAAA,MAAM,CAAC,gCAAgC;AACpC,mBAAA,GAAG,CAAC;KACV;AAED,IAAA,QAAQ,CAAC,OAAwB,EAAA;QAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAEpC,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC,IAAI,CACtD,GAAG,CAAC,MAAK;AACP,YAAA,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;YAEjD,OAAO;gBACL,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;AACjC,gBAAA,Q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AAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAArB,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,EAJjB,YAAA,EAAA,CAAA,2BAA2B,CAChC,EAAA,OAAA,EAAA,CAAA,gBAAgB,aAChB,2BAA2B,CAAA,EAAA,CAAA,CAAA;AAE1B,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,YAHtB,gBAAgB,CAAA,EAAA,CAAA,CAAA;2FAGf,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBALjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,2BAA2B,CAAC;oBAC3C,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,OAAO,EAAE,CAAC,2BAA2B,CAAC;iBACvC,CAAA;;;ACTD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triangular-password-checker.mjs","sources":["../../../projects/password-checker-lib/src/lib/password-checker.config.ts","../../../projects/password-checker-lib/src/lib/password-checker-lib.directive.ts","../../../projects/password-checker-lib/src/lib/password-checker-lib.module.ts","../../../projects/password-checker-lib/src/public_api.ts","../../../projects/password-checker-lib/src/triangular-password-checker.ts"],"sourcesContent":["import {InjectionToken} from '@angular/core';\n\nexport type Partial<T> = {\n [P in keyof T]?: T[P];\n};\n\nexport interface PasswordCheckerConfig {\n pwnedPasswordApi: string;\n pwnedPasswordMinimumOccurrenceForError: number;\n pwnedPasswordApiCallDebounceTime: number;\n}\n\nexport const PasswordCheckerConfigValue = new InjectionToken<Partial<PasswordCheckerConfig>>('PASSWORD_CHECKER_CONFIG');\n","import { Observable, timer } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\nimport { AbstractControl, AsyncValidator, NG_ASYNC_VALIDATORS, ValidationErrors } from '@angular/forms';\nimport { Directive, Inject, Input, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport sha1 from 'crypto-js/sha1';\nimport { Partial, PasswordCheckerConfig, PasswordCheckerConfigValue } from './password-checker.config';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[pwnedPasswordValidator][formControlName], [pwnedPasswordValidator][ngModel],[pwnedPasswordValidator][formControl]',\n providers: [\n {\n provide: NG_ASYNC_VALIDATORS,\n useExisting: PasswordCheckerLibDirective,\n multi: true,\n },\n ]\n})\nexport class PasswordCheckerLibDirective implements AsyncValidator {\n private pwnedPasswordMinimumOccurrenceForErrorValue: number;\n\n @Input() pwnedPasswordApi: string;\n @Input() pwnedPasswordMinimumOccurrenceForError: number;\n @Input() pwnedPasswordApiCallDebounceTime: number;\n\n constructor(\n private http: HttpClient,\n @Optional() @Inject(PasswordCheckerConfigValue) config: Partial<PasswordCheckerConfig>,\n ) {\n\n if (!config) {\n // default initialization in constructor didn't work.\n // conflict with @Optional()?\n config = {};\n }\n\n this.pwnedPasswordApi =\n config.pwnedPasswordApi\n || 'https://api.pwnedpasswords.com/range/';\n this.pwnedPasswordMinimumOccurrenceForError =\n config.pwnedPasswordMinimumOccurrenceForError\n || 1;\n this.pwnedPasswordApiCallDebounceTime =\n config.pwnedPasswordApiCallDebounceTime\n || 400;\n }\n\n validate(control: AbstractControl): Observable<ValidationErrors|null> {\n const pw = ''.concat(control.value);\n\n return timer(this.pwnedPasswordApiCallDebounceTime).pipe(\n map(() => {\n const pwSha1 = sha1(pw).toString().toUpperCase();\n\n return {\n firstPart: pwSha1.substring(0, 5),\n lastPart: pwSha1.substring(5),\n };\n }),\n switchMap(\n (hash) => this.http.get(\n `${this.pwnedPasswordApi}${hash.firstPart}`, { responseType: 'text' }\n ).pipe(\n map(passwords => passwords.split(/[\\r\\n]+/)),\n map(passwords => passwords.map((password) => {\n const split = password.split(':');\n\n return {\n hash: split[0],\n count: parseInt(split[1], 10),\n };\n }\n )),\n map(passwords => passwords.find(password => password.hash === hash.lastPart)),\n ),\n ),\n map(password => password && password.count >= this.pwnedPasswordMinimumOccurrenceForError\n ? { pwnedPasswordOccurrence: password.count }\n : null),\n );\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { PasswordCheckerLibDirective } from './password-checker-lib.directive';\nimport { HttpClientModule } from '@angular/common/http';\nimport { Partial, PasswordCheckerConfig, PasswordCheckerConfigValue } from './password-checker.config';\n\n@NgModule({\n declarations: [PasswordCheckerLibDirective],\n imports: [HttpClientModule],\n exports: [PasswordCheckerLibDirective]\n})\nexport class PasswordCheckerModule {\n static forRoot(config: Partial<PasswordCheckerConfig> = {}): ModuleWithProviders<PasswordCheckerModule> {\n return {\n ngModule: PasswordCheckerModule,\n providers: [\n {\n provide: PasswordCheckerConfigValue,\n useValue: config,\n }\n ]\n };\n }\n}\n","/*\n * Public API Surface of password-checker-lib\n */\n\nexport * from './lib/password-checker-lib.directive';\nexport * from './lib/password-checker-lib.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;AAYO,MAAM,0BAA0B,GAAG,IAAI,cAAc,CAAiC,yBAAyB,CAAC;;MCO1G,2BAA2B,CAAA;IAOtC,WACU,CAAA,IAAgB,EACwB,MAAsC,EAAA;QAD9E,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;QAIxB,IAAI,CAAC,MAAM,EAAE;;;YAGX,MAAM,GAAG,EAAE,CAAC;AACb,SAAA;AAED,QAAA,IAAI,CAAC,gBAAgB;AACnB,YAAA,MAAM,CAAC,gBAAgB;AACpB,mBAAA,uCAAuC,CAAC;AAC7C,QAAA,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