@tstdl/base 0.93.178 → 0.93.180
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/api/response.js +4 -3
- package/api/server/gateway.js +9 -3
- package/audit/auditor.d.ts +1 -2
- package/audit/drizzle/{0000_lumpy_thunderball.sql → 0000_shallow_elektra.sql} +1 -1
- package/audit/drizzle/meta/0000_snapshot.json +2 -2
- package/audit/drizzle/meta/_journal.json +2 -2
- package/authentication/README.md +87 -42
- package/authentication/authentication.api.d.ts +392 -53
- package/authentication/authentication.api.js +133 -28
- package/authentication/client/api.client.d.ts +3 -3
- package/authentication/client/api.client.js +4 -4
- package/authentication/client/authentication.service.d.ts +93 -23
- package/authentication/client/authentication.service.js +113 -28
- package/authentication/client/http-client.middleware.d.ts +1 -1
- package/authentication/client/http-client.middleware.js +5 -4
- package/authentication/client/module.d.ts +1 -1
- package/authentication/client/module.js +2 -2
- package/authentication/errors/index.d.ts +1 -1
- package/authentication/errors/index.js +1 -1
- package/authentication/errors/password-requirements.error.d.ts +5 -0
- package/authentication/errors/{secret-requirements.error.js → password-requirements.error.js} +2 -2
- package/authentication/models/authentication-password.model.d.ts +8 -0
- package/authentication/models/{authentication-credentials.model.js → authentication-password.model.js} +11 -17
- package/authentication/models/authentication-session.model.d.ts +0 -2
- package/authentication/models/authentication-session.model.js +1 -7
- package/authentication/models/authentication-totp-recovery-code.model.d.ts +6 -0
- package/authentication/models/authentication-totp-recovery-code.model.js +34 -0
- package/authentication/models/authentication-totp.model.d.ts +19 -0
- package/authentication/models/authentication-totp.model.js +51 -0
- package/authentication/models/authentication-used-totp-token.model.d.ts +5 -0
- package/authentication/models/authentication-used-totp-token.model.js +32 -0
- package/authentication/models/index.d.ts +6 -3
- package/authentication/models/index.js +6 -3
- package/authentication/models/{init-secret-reset-data.model.d.ts → init-password-reset-data.model.d.ts} +3 -3
- package/authentication/models/{init-secret-reset-data.model.js → init-password-reset-data.model.js} +5 -5
- package/authentication/models/password-check-result.model.d.ts +3 -0
- package/authentication/models/{secret-check-result.model.js → password-check-result.model.js} +6 -6
- package/authentication/models/subject.model.d.ts +0 -6
- package/authentication/models/subject.model.js +0 -6
- package/authentication/models/token.model.d.ts +16 -2
- package/authentication/server/authentication-ancillary.service.d.ts +6 -6
- package/authentication/server/authentication-ancillary.service.js +1 -1
- package/authentication/server/authentication-password-requirements.validator.d.ts +55 -0
- package/authentication/server/{authentication-secret-requirements.validator.js → authentication-password-requirements.validator.js} +22 -22
- package/authentication/server/authentication.api-controller.d.ts +55 -27
- package/authentication/server/authentication.api-controller.js +214 -39
- package/authentication/server/authentication.audit.d.ts +42 -5
- package/authentication/server/authentication.service.d.ts +182 -93
- package/authentication/server/authentication.service.js +628 -206
- package/authentication/server/drizzle/{0000_soft_tag.sql → 0000_odd_echo.sql} +59 -13
- package/authentication/server/drizzle/meta/0000_snapshot.json +345 -32
- package/authentication/server/drizzle/meta/_journal.json +2 -2
- package/authentication/server/helper.d.ts +16 -16
- package/authentication/server/helper.js +33 -34
- package/authentication/server/index.d.ts +1 -1
- package/authentication/server/index.js +1 -1
- package/authentication/server/module.d.ts +2 -2
- package/authentication/server/module.js +4 -2
- package/authentication/server/schemas.d.ts +11 -7
- package/authentication/server/schemas.js +7 -3
- package/authentication/tests/authentication-password-requirements.validator.test.js +29 -0
- package/authentication/tests/authentication.api-controller.test.js +49 -15
- package/authentication/tests/authentication.client-error-handling.test.js +3 -2
- package/authentication/tests/authentication.client-middleware.test.js +5 -5
- package/authentication/tests/authentication.client-service-methods.test.js +28 -14
- package/authentication/tests/authentication.client-service-refresh.test.js +7 -6
- package/authentication/tests/authentication.client-service.test.js +10 -8
- package/authentication/tests/authentication.service.test.js +37 -29
- package/authentication/tests/authentication.test-ancillary-service.d.ts +1 -1
- package/authentication/tests/authentication.test-ancillary-service.js +1 -1
- package/authentication/tests/brute-force-protection.test.js +211 -0
- package/authentication/tests/helper.test.js +25 -21
- package/authentication/tests/password-requirements.error.test.js +14 -0
- package/authentication/tests/remember.api.test.js +22 -14
- package/authentication/tests/remember.service.test.js +23 -16
- package/authentication/tests/subject.service.test.js +2 -2
- package/authentication/tests/suspended-subject.test.d.ts +1 -0
- package/authentication/tests/suspended-subject.test.js +120 -0
- package/authentication/tests/totp.enrollment.test.d.ts +1 -0
- package/authentication/tests/totp.enrollment.test.js +123 -0
- package/authentication/tests/totp.login.test.d.ts +1 -0
- package/authentication/tests/totp.login.test.js +213 -0
- package/authentication/tests/totp.recovery-codes.test.d.ts +1 -0
- package/authentication/tests/totp.recovery-codes.test.js +97 -0
- package/authentication/tests/totp.status.test.d.ts +1 -0
- package/authentication/tests/totp.status.test.js +72 -0
- package/circuit-breaker/postgres/drizzle/{0000_cooing_korath.sql → 0000_same_captain_cross.sql} +1 -1
- package/circuit-breaker/postgres/drizzle/meta/0000_snapshot.json +2 -2
- package/circuit-breaker/postgres/drizzle/meta/_journal.json +2 -2
- package/cryptography/cryptography.d.ts +336 -0
- package/cryptography/cryptography.js +328 -0
- package/cryptography/index.d.ts +4 -0
- package/cryptography/index.js +4 -0
- package/{utils → cryptography}/jwt.d.ts +22 -4
- package/{utils → cryptography}/jwt.js +36 -18
- package/cryptography/module.d.ts +35 -0
- package/cryptography/module.js +148 -0
- package/cryptography/tests/cryptography.test.d.ts +1 -0
- package/cryptography/tests/cryptography.test.js +175 -0
- package/cryptography/tests/jwt.test.d.ts +1 -0
- package/cryptography/tests/jwt.test.js +54 -0
- package/cryptography/tests/modern.test.d.ts +1 -0
- package/cryptography/tests/modern.test.js +105 -0
- package/cryptography/tests/module.test.d.ts +1 -0
- package/cryptography/tests/module.test.js +100 -0
- package/cryptography/tests/totp.test.d.ts +1 -0
- package/cryptography/tests/totp.test.js +108 -0
- package/cryptography/totp.d.ts +96 -0
- package/cryptography/totp.js +123 -0
- package/document-management/server/drizzle/{0000_curious_nighthawk.sql → 0000_sharp_scream.sql} +21 -21
- package/document-management/server/drizzle/meta/0000_snapshot.json +22 -22
- package/document-management/server/drizzle/meta/_journal.json +2 -2
- package/document-management/server/services/document-file.service.js +1 -1
- package/errors/errors.localization.d.ts +2 -2
- package/errors/errors.localization.js +2 -2
- package/errors/index.d.ts +1 -0
- package/errors/index.js +1 -0
- package/errors/too-many-requests.error.d.ts +5 -0
- package/errors/too-many-requests.error.js +7 -0
- package/examples/api/authentication.js +5 -5
- package/examples/api/custom-authentication.js +4 -3
- package/file/server/mime-type.js +1 -1
- package/http/http-body.d.ts +1 -0
- package/http/http-body.js +3 -0
- package/image-service/imgproxy/imgproxy-image-service.d.ts +0 -1
- package/image-service/imgproxy/imgproxy-image-service.js +9 -27
- package/key-value-store/postgres/drizzle/{0000_shocking_slipstream.sql → 0000_moaning_calypso.sql} +1 -1
- package/key-value-store/postgres/drizzle/meta/0000_snapshot.json +2 -2
- package/key-value-store/postgres/drizzle/meta/_journal.json +2 -2
- package/lock/postgres/drizzle/{0000_busy_tattoo.sql → 0000_nappy_wraith.sql} +1 -1
- package/lock/postgres/drizzle/meta/0000_snapshot.json +2 -2
- package/lock/postgres/drizzle/meta/_journal.json +2 -2
- package/logger/formatters/json.js +1 -1
- package/logger/formatters/pretty-print.js +1 -1
- package/mail/drizzle/{0000_numerous_the_watchers.sql → 0000_cultured_quicksilver.sql} +2 -2
- package/mail/drizzle/meta/0000_snapshot.json +4 -4
- package/mail/drizzle/meta/_journal.json +2 -9
- package/notification/server/drizzle/{0000_wise_pyro.sql → 0000_new_tenebrous.sql} +6 -6
- package/notification/server/drizzle/meta/0000_snapshot.json +7 -7
- package/notification/server/drizzle/meta/_journal.json +2 -2
- package/notification/tests/notification-flow.test.js +1 -8
- package/notification/tests/notification-type.service.test.js +3 -3
- package/openid-connect/oidc.service.js +2 -3
- package/orm/data-types/common.js +1 -1
- package/orm/server/drizzle/schema-converter.js +9 -4
- package/orm/server/encryption.js +1 -1
- package/orm/server/module.d.ts +0 -1
- package/orm/server/module.js +0 -4
- package/orm/server/repository.d.ts +2 -1
- package/orm/server/repository.js +7 -10
- package/orm/tests/encryption.test.js +4 -6
- package/orm/tests/repository-extra-coverage.test.js +0 -2
- package/orm/tests/repository-regression.test.js +0 -3
- package/package.json +9 -8
- package/password/README.md +1 -1
- package/password/have-i-been-pwned.js +1 -1
- package/rate-limit/postgres/drizzle/{0000_watery_rage.sql → 0000_serious_sauron.sql} +1 -1
- package/rate-limit/postgres/drizzle/meta/0000_snapshot.json +2 -2
- package/rate-limit/postgres/drizzle/meta/_journal.json +2 -2
- package/rate-limit/postgres/postgres-rate-limiter.d.ts +1 -1
- package/rate-limit/postgres/postgres-rate-limiter.js +1 -1
- package/rate-limit/rate-limiter.d.ts +1 -1
- package/rpc/tests/rpc.integration.test.js +25 -31
- package/supports.d.ts +1 -0
- package/supports.js +1 -0
- package/task-queue/postgres/drizzle/{0000_faithful_daimon_hellstrom.sql → 0000_dark_ronan.sql} +5 -5
- package/task-queue/postgres/drizzle/meta/0000_snapshot.json +10 -10
- package/task-queue/postgres/drizzle/meta/_journal.json +2 -9
- package/task-queue/postgres/task-queue.js +2 -2
- package/task-queue/tests/coverage-enhancement.test.js +2 -2
- package/test/drizzle/{0000_natural_cannonball.sql → 0000_organic_gamora.sql} +2 -2
- package/test/drizzle/meta/0000_snapshot.json +3 -4
- package/test/drizzle/meta/_journal.json +2 -9
- package/testing/integration-setup.d.ts +7 -3
- package/testing/integration-setup.js +119 -96
- package/utils/alphabet.d.ts +1 -0
- package/utils/alphabet.js +1 -0
- package/utils/base32.d.ts +4 -0
- package/utils/base32.js +49 -0
- package/utils/base64.d.ts +0 -2
- package/utils/base64.js +6 -70
- package/utils/equals.d.ts +13 -3
- package/utils/equals.js +29 -9
- package/utils/index.d.ts +1 -2
- package/utils/index.js +1 -2
- package/utils/random.d.ts +1 -0
- package/utils/random.js +14 -8
- package/authentication/errors/secret-requirements.error.d.ts +0 -5
- package/authentication/models/authentication-credentials.model.d.ts +0 -10
- package/authentication/models/secret-check-result.model.d.ts +0 -3
- package/authentication/server/authentication-secret-requirements.validator.d.ts +0 -55
- package/authentication/tests/authentication-ancillary.service.test.js +0 -13
- package/authentication/tests/authentication-secret-requirements.validator.test.js +0 -29
- package/authentication/tests/secret-requirements.error.test.js +0 -14
- package/mail/drizzle/0001_married_tarantula.sql +0 -12
- package/mail/drizzle/meta/0001_snapshot.json +0 -69
- package/orm/server/tokens.d.ts +0 -1
- package/orm/server/tokens.js +0 -2
- package/task-queue/postgres/drizzle/0001_rapid_infant_terrible.sql +0 -16
- package/task-queue/postgres/drizzle/meta/0001_snapshot.json +0 -753
- package/test/drizzle/0001_closed_the_captain.sql +0 -2
- package/test/drizzle/meta/0001_snapshot.json +0 -117
- package/utils/cryptography.d.ts +0 -137
- package/utils/cryptography.js +0 -201
- /package/authentication/tests/{authentication-ancillary.service.test.d.ts → authentication-password-requirements.validator.test.d.ts} +0 -0
- /package/authentication/tests/{authentication-secret-requirements.validator.test.d.ts → brute-force-protection.test.d.ts} +0 -0
- /package/authentication/tests/{secret-requirements.error.test.d.ts → password-requirements.error.test.d.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { firstValueFrom, race, timeout as rxjsTimeout } from 'rxjs';
|
|
2
2
|
import { HttpError } from '../../http/index.js';
|
|
3
|
+
import { supportsCookies } from '../../supports.js';
|
|
3
4
|
import { timeout } from '../../utils/timing.js';
|
|
4
5
|
import { isDefined } from '../../utils/type-guards.js';
|
|
5
6
|
import { cacheValueOrAsyncProvider } from '../../utils/value-or-provider.js';
|
|
@@ -9,9 +10,9 @@ import { dontWaitForValidToken } from '../authentication.api.js';
|
|
|
9
10
|
* @param authenticationServiceOrProvider The authentication service or a provider for it.
|
|
10
11
|
* @returns A http client middleware.
|
|
11
12
|
*/
|
|
12
|
-
export function
|
|
13
|
+
export function waitForAuthenticationMiddleware(authenticationServiceOrProvider) {
|
|
13
14
|
const getAuthenticationService = cacheValueOrAsyncProvider(authenticationServiceOrProvider);
|
|
14
|
-
async function
|
|
15
|
+
async function waitForAuthenticationMiddleware({ request }, next) {
|
|
15
16
|
const endpoint = request.context?.endpoint;
|
|
16
17
|
if ((endpoint?.credentials == true) && (endpoint.data?.[dontWaitForValidToken] != true)) {
|
|
17
18
|
const authenticationService = await getAuthenticationService();
|
|
@@ -31,7 +32,7 @@ export function waitForAuthenticationCredentialsMiddleware(authenticationService
|
|
|
31
32
|
}
|
|
32
33
|
await next();
|
|
33
34
|
}
|
|
34
|
-
return
|
|
35
|
+
return waitForAuthenticationMiddleware;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* A http client middleware that logs out the user if a request fails with a 401 Unauthorized error.
|
|
@@ -80,7 +81,7 @@ export function authenticationMiddleware(authenticationServiceOrProvider) {
|
|
|
80
81
|
request.headers.setIfMissing('X-Impersonator-Refresh-Token', rawImpersonatorRefreshToken);
|
|
81
82
|
}
|
|
82
83
|
await next();
|
|
83
|
-
if (isDefined(context.response)) {
|
|
84
|
+
if (!supportsCookies && isDefined(context.response)) {
|
|
84
85
|
const { response } = context;
|
|
85
86
|
const responseToken = response.headers.tryGetSingle('X-Authorization');
|
|
86
87
|
const responseRefreshToken = response.headers.tryGetSingle('X-Refresh-Token');
|
|
@@ -15,7 +15,7 @@ export type AuthenticationClientModuleConfig = {
|
|
|
15
15
|
*/
|
|
16
16
|
initialAuthenticationData?: unknown;
|
|
17
17
|
/**
|
|
18
|
-
* Whether to register the {@link
|
|
18
|
+
* Whether to register the {@link waitForAuthenticationMiddleware} for all http clients.
|
|
19
19
|
*
|
|
20
20
|
* @default false
|
|
21
21
|
*/
|
|
@@ -2,7 +2,7 @@ import { HTTP_CLIENT_MIDDLEWARE } from '../../http/client/tokens.js';
|
|
|
2
2
|
import { forwardRef, getCurrentInjector, Injector } from '../../injector/index.js';
|
|
3
3
|
import { isDefined } from '../../utils/type-guards.js';
|
|
4
4
|
import { AuthenticationClientService } from './authentication.service.js';
|
|
5
|
-
import { authenticationMiddleware, logoutOnUnauthorizedMiddleware,
|
|
5
|
+
import { authenticationMiddleware, logoutOnUnauthorizedMiddleware, waitForAuthenticationMiddleware } from './http-client.middleware.js';
|
|
6
6
|
import { AUTHENTICATION_API_CLIENT, INITIAL_AUTHENTICATION_DATA } from './tokens.js';
|
|
7
7
|
/**
|
|
8
8
|
* Configures authentication client services.
|
|
@@ -20,7 +20,7 @@ export function configureAuthenticationClient(config, injector = getCurrentInjec
|
|
|
20
20
|
(injector ?? Injector).register(HTTP_CLIENT_MIDDLEWARE, {
|
|
21
21
|
useFactory(_, context) {
|
|
22
22
|
const authenticationService = context.resolve(forwardRef(() => AuthenticationClientService, 'object'));
|
|
23
|
-
return
|
|
23
|
+
return waitForAuthenticationMiddleware(authenticationService);
|
|
24
24
|
},
|
|
25
25
|
}, { multi: true });
|
|
26
26
|
(injector ?? Injector).register(HTTP_CLIENT_MIDDLEWARE, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './password-requirements.error.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './password-requirements.error.js';
|
package/authentication/errors/{secret-requirements.error.js → password-requirements.error.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomError } from '../../errors/custom.error.js';
|
|
2
|
-
export class
|
|
3
|
-
static errorName = '
|
|
2
|
+
export class PasswordRequirementsError extends CustomError {
|
|
3
|
+
static errorName = 'PasswordRequirementsError';
|
|
4
4
|
constructor(message = 'Secret requirements not met.') {
|
|
5
5
|
super({ message });
|
|
6
6
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TenantEntity, type Uuid } from '../../orm/index.js';
|
|
2
|
+
export declare class AuthenticationPassword extends TenantEntity {
|
|
3
|
+
subjectId: Uuid;
|
|
4
|
+
/** The salt used to hash the password. */
|
|
5
|
+
salt: Uint8Array<ArrayBuffer>;
|
|
6
|
+
/** The hashed password. */
|
|
7
|
+
hash: Uint8Array<ArrayBuffer>;
|
|
8
|
+
}
|
|
@@ -8,36 +8,30 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { Table, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { Uint8ArrayProperty } from '../../schema/index.js';
|
|
12
12
|
import { Subject } from './subject.model.js';
|
|
13
|
-
let
|
|
13
|
+
let AuthenticationPassword = class AuthenticationPassword extends TenantEntity {
|
|
14
14
|
subjectId;
|
|
15
|
-
/** The
|
|
16
|
-
hashVersion;
|
|
17
|
-
/** The salt used to hash the secret. */
|
|
15
|
+
/** The salt used to hash the password. */
|
|
18
16
|
salt;
|
|
19
|
-
/** The hashed
|
|
17
|
+
/** The hashed password. */
|
|
20
18
|
hash;
|
|
21
19
|
};
|
|
22
20
|
__decorate([
|
|
23
21
|
TenantReference(() => Subject),
|
|
24
22
|
UuidProperty(),
|
|
25
23
|
__metadata("design:type", String)
|
|
26
|
-
],
|
|
27
|
-
__decorate([
|
|
28
|
-
Integer(),
|
|
29
|
-
__metadata("design:type", Number)
|
|
30
|
-
], AuthenticationCredentials.prototype, "hashVersion", void 0);
|
|
24
|
+
], AuthenticationPassword.prototype, "subjectId", void 0);
|
|
31
25
|
__decorate([
|
|
32
26
|
Uint8ArrayProperty(),
|
|
33
27
|
__metadata("design:type", Uint8Array)
|
|
34
|
-
],
|
|
28
|
+
], AuthenticationPassword.prototype, "salt", void 0);
|
|
35
29
|
__decorate([
|
|
36
30
|
Uint8ArrayProperty(),
|
|
37
31
|
__metadata("design:type", Uint8Array)
|
|
38
|
-
],
|
|
39
|
-
|
|
40
|
-
Table('
|
|
32
|
+
], AuthenticationPassword.prototype, "hash", void 0);
|
|
33
|
+
AuthenticationPassword = __decorate([
|
|
34
|
+
Table('password', { schema: 'authentication' }),
|
|
41
35
|
Unique(['tenantId', 'subjectId'])
|
|
42
|
-
],
|
|
43
|
-
export {
|
|
36
|
+
], AuthenticationPassword);
|
|
37
|
+
export { AuthenticationPassword };
|
|
@@ -4,8 +4,6 @@ export declare class AuthenticationSession extends TenantEntity {
|
|
|
4
4
|
subjectId: Uuid;
|
|
5
5
|
begin: Timestamp;
|
|
6
6
|
end: Timestamp;
|
|
7
|
-
/** The version of the hash algorithm used. */
|
|
8
|
-
refreshTokenHashVersion: number;
|
|
9
7
|
/** The salt used to hash the refresh token. */
|
|
10
8
|
refreshTokenSalt: Uint8Array<ArrayBuffer>;
|
|
11
9
|
/** The hashed refresh token. */
|
|
@@ -8,14 +8,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { Table, TenantEntity, TenantReference, TimestampProperty, UuidProperty } from '../../orm/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { Uint8ArrayProperty } from '../../schema/index.js';
|
|
12
12
|
import { Subject } from './subject.model.js';
|
|
13
13
|
let AuthenticationSession = class AuthenticationSession extends TenantEntity {
|
|
14
14
|
subjectId;
|
|
15
15
|
begin;
|
|
16
16
|
end;
|
|
17
|
-
/** The version of the hash algorithm used. */
|
|
18
|
-
refreshTokenHashVersion;
|
|
19
17
|
/** The salt used to hash the refresh token. */
|
|
20
18
|
refreshTokenSalt;
|
|
21
19
|
/** The hashed refresh token. */
|
|
@@ -34,10 +32,6 @@ __decorate([
|
|
|
34
32
|
TimestampProperty(),
|
|
35
33
|
__metadata("design:type", Number)
|
|
36
34
|
], AuthenticationSession.prototype, "end", void 0);
|
|
37
|
-
__decorate([
|
|
38
|
-
Integer(),
|
|
39
|
-
__metadata("design:type", Number)
|
|
40
|
-
], AuthenticationSession.prototype, "refreshTokenHashVersion", void 0);
|
|
41
35
|
__decorate([
|
|
42
36
|
Uint8ArrayProperty(),
|
|
43
37
|
__metadata("design:type", Uint8Array)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Table, TenantEntity, TenantReference, TimestampProperty, UuidProperty } from '../../orm/index.js';
|
|
11
|
+
import { Uint8ArrayProperty } from '../../schema/index.js';
|
|
12
|
+
import { AuthenticationTotp } from './authentication-totp.model.js';
|
|
13
|
+
let AuthenticationTotpRecoveryCode = class AuthenticationTotpRecoveryCode extends TenantEntity {
|
|
14
|
+
totpId;
|
|
15
|
+
code;
|
|
16
|
+
usedTimestamp;
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
TenantReference(() => AuthenticationTotp),
|
|
20
|
+
UuidProperty(),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], AuthenticationTotpRecoveryCode.prototype, "totpId", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
Uint8ArrayProperty(),
|
|
25
|
+
__metadata("design:type", Uint8Array)
|
|
26
|
+
], AuthenticationTotpRecoveryCode.prototype, "code", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
TimestampProperty({ nullable: true }),
|
|
29
|
+
__metadata("design:type", Object)
|
|
30
|
+
], AuthenticationTotpRecoveryCode.prototype, "usedTimestamp", void 0);
|
|
31
|
+
AuthenticationTotpRecoveryCode = __decorate([
|
|
32
|
+
Table('totp_recovery_code', { schema: 'authentication' })
|
|
33
|
+
], AuthenticationTotpRecoveryCode);
|
|
34
|
+
export { AuthenticationTotpRecoveryCode };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type EnumType } from '../../enumeration/enumeration.js';
|
|
2
|
+
import { TenantEntity, type Uuid } from '../../orm/index.js';
|
|
3
|
+
import type { Encrypted } from '../../orm/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Status of a TOTP enrollment.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TotpStatus: {
|
|
8
|
+
/** Enrollment initiated, awaiting verification. */
|
|
9
|
+
readonly Pending: "pending";
|
|
10
|
+
/** Enrollment complete and TOTP active. */
|
|
11
|
+
readonly Active: "active";
|
|
12
|
+
};
|
|
13
|
+
export type TotpStatus = EnumType<typeof TotpStatus>;
|
|
14
|
+
export declare class AuthenticationTotp extends TenantEntity {
|
|
15
|
+
subjectId: Uuid;
|
|
16
|
+
secret: Encrypted<Uint8Array<ArrayBuffer>>;
|
|
17
|
+
recoveryCodeSalt: Uint8Array<ArrayBuffer>;
|
|
18
|
+
status: TotpStatus;
|
|
19
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { defineEnum } from '../../enumeration/enumeration.js';
|
|
11
|
+
import { EncryptedProperty, Table, TenantEntity, TenantReference, Unique, UuidProperty } from '../../orm/index.js';
|
|
12
|
+
import { Enumeration, Uint8ArrayProperty } from '../../schema/index.js';
|
|
13
|
+
import { Subject } from './subject.model.js';
|
|
14
|
+
/**
|
|
15
|
+
* Status of a TOTP enrollment.
|
|
16
|
+
*/
|
|
17
|
+
export const TotpStatus = defineEnum('TotpStatus', {
|
|
18
|
+
/** Enrollment initiated, awaiting verification. */
|
|
19
|
+
Pending: 'pending',
|
|
20
|
+
/** Enrollment complete and TOTP active. */
|
|
21
|
+
Active: 'active',
|
|
22
|
+
});
|
|
23
|
+
let AuthenticationTotp = class AuthenticationTotp extends TenantEntity {
|
|
24
|
+
subjectId;
|
|
25
|
+
secret;
|
|
26
|
+
recoveryCodeSalt;
|
|
27
|
+
status;
|
|
28
|
+
};
|
|
29
|
+
__decorate([
|
|
30
|
+
TenantReference(() => Subject),
|
|
31
|
+
UuidProperty(),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], AuthenticationTotp.prototype, "subjectId", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
EncryptedProperty(),
|
|
36
|
+
Uint8ArrayProperty(),
|
|
37
|
+
__metadata("design:type", Object)
|
|
38
|
+
], AuthenticationTotp.prototype, "secret", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
Uint8ArrayProperty(),
|
|
41
|
+
__metadata("design:type", Uint8Array)
|
|
42
|
+
], AuthenticationTotp.prototype, "recoveryCodeSalt", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
Enumeration(TotpStatus),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], AuthenticationTotp.prototype, "status", void 0);
|
|
47
|
+
AuthenticationTotp = __decorate([
|
|
48
|
+
Table('totp', { schema: 'authentication' }),
|
|
49
|
+
Unique(['tenantId', 'subjectId'])
|
|
50
|
+
], AuthenticationTotp);
|
|
51
|
+
export { AuthenticationTotp };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Table, TenantEntity, TenantReference, TimeToLive, Unique, UuidProperty } from '../../orm/index.js';
|
|
11
|
+
import { StringProperty } from '../../schema/index.js';
|
|
12
|
+
import { millisecondsPerMinute } from '../../utils/units.js';
|
|
13
|
+
import { Subject } from './subject.model.js';
|
|
14
|
+
let AuthenticationUsedTotpToken = class AuthenticationUsedTotpToken extends TenantEntity {
|
|
15
|
+
subjectId;
|
|
16
|
+
token;
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
TenantReference(() => Subject),
|
|
20
|
+
UuidProperty(),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], AuthenticationUsedTotpToken.prototype, "subjectId", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
StringProperty(),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], AuthenticationUsedTotpToken.prototype, "token", void 0);
|
|
27
|
+
AuthenticationUsedTotpToken = __decorate([
|
|
28
|
+
Table('used_totp_tokens', { schema: 'authentication' }),
|
|
29
|
+
Unique(['tenantId', 'subjectId', 'token']),
|
|
30
|
+
TimeToLive(5 * millisecondsPerMinute, 'hard') // 5 minutes
|
|
31
|
+
], AuthenticationUsedTotpToken);
|
|
32
|
+
export { AuthenticationUsedTotpToken };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export * from './authentication-
|
|
1
|
+
export * from './authentication-password.model.js';
|
|
2
2
|
export * from './authentication-session.model.js';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './authentication-totp-recovery-code.model.js';
|
|
4
|
+
export * from './authentication-totp.model.js';
|
|
5
|
+
export * from './authentication-used-totp-token.model.js';
|
|
6
|
+
export * from './init-password-reset-data.model.js';
|
|
7
|
+
export * from './password-check-result.model.js';
|
|
5
8
|
export * from './service-account.model.js';
|
|
6
9
|
export * from './subject.model.js';
|
|
7
10
|
export * from './system-account.model.js';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export * from './authentication-
|
|
1
|
+
export * from './authentication-password.model.js';
|
|
2
2
|
export * from './authentication-session.model.js';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './authentication-totp-recovery-code.model.js';
|
|
4
|
+
export * from './authentication-totp.model.js';
|
|
5
|
+
export * from './authentication-used-totp-token.model.js';
|
|
6
|
+
export * from './init-password-reset-data.model.js';
|
|
7
|
+
export * from './password-check-result.model.js';
|
|
5
8
|
export * from './service-account.model.js';
|
|
6
9
|
export * from './subject.model.js';
|
|
7
10
|
export * from './system-account.model.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Data for initializing a
|
|
2
|
+
* Data for initializing a password reset.
|
|
3
3
|
*/
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class InitPasswordResetData {
|
|
5
5
|
/**
|
|
6
6
|
* The subject for which to reset the secret.
|
|
7
7
|
* Note: The existence of the subject is not checked to avoid data leaks.
|
|
8
8
|
*/
|
|
9
9
|
subject: string;
|
|
10
10
|
/**
|
|
11
|
-
* The
|
|
11
|
+
* The password reset token.
|
|
12
12
|
*/
|
|
13
13
|
token: string;
|
|
14
14
|
}
|
package/authentication/models/{init-secret-reset-data.model.js → init-password-reset-data.model.js}
RENAMED
|
@@ -9,24 +9,24 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { StringProperty } from '../../schema/index.js';
|
|
11
11
|
/**
|
|
12
|
-
* Data for initializing a
|
|
12
|
+
* Data for initializing a password reset.
|
|
13
13
|
*/
|
|
14
|
-
export class
|
|
14
|
+
export class InitPasswordResetData {
|
|
15
15
|
/**
|
|
16
16
|
* The subject for which to reset the secret.
|
|
17
17
|
* Note: The existence of the subject is not checked to avoid data leaks.
|
|
18
18
|
*/
|
|
19
19
|
subject;
|
|
20
20
|
/**
|
|
21
|
-
* The
|
|
21
|
+
* The password reset token.
|
|
22
22
|
*/
|
|
23
23
|
token;
|
|
24
24
|
}
|
|
25
25
|
__decorate([
|
|
26
26
|
StringProperty(),
|
|
27
27
|
__metadata("design:type", String)
|
|
28
|
-
],
|
|
28
|
+
], InitPasswordResetData.prototype, "subject", void 0);
|
|
29
29
|
__decorate([
|
|
30
30
|
StringProperty(),
|
|
31
31
|
__metadata("design:type", String)
|
|
32
|
-
],
|
|
32
|
+
], InitPasswordResetData.prototype, "token", void 0);
|
package/authentication/models/{secret-check-result.model.js → password-check-result.model.js}
RENAMED
|
@@ -4,11 +4,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { PasswordCheckResult } from '../../password/password-check-result.model.js';
|
|
8
|
-
import { Class } from '../../schema/
|
|
9
|
-
let
|
|
7
|
+
import { PasswordCheckResult as BasePasswordCheckResult } from '../../password/password-check-result.model.js';
|
|
8
|
+
import { Class } from '../../schema/index.js';
|
|
9
|
+
let PasswordCheckResult = class PasswordCheckResult extends BasePasswordCheckResult {
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
PasswordCheckResult = __decorate([
|
|
12
12
|
Class()
|
|
13
|
-
],
|
|
14
|
-
export {
|
|
13
|
+
], PasswordCheckResult);
|
|
14
|
+
export { PasswordCheckResult };
|
|
@@ -13,14 +13,8 @@ export type SubjectType = EnumType<typeof SubjectType>;
|
|
|
13
13
|
export declare const SubjectStatus: {
|
|
14
14
|
/** Subject is active and can perform actions. */
|
|
15
15
|
readonly Active: "active";
|
|
16
|
-
/** Subject is inactive and cannot perform actions. Usually set by the user or a default state. */
|
|
17
|
-
readonly Inactive: "inactive";
|
|
18
16
|
/** Subject is suspended and cannot perform actions. Usually set by an administrator for security or policy reasons. */
|
|
19
17
|
readonly Suspended: "suspended";
|
|
20
|
-
/** Subject is pending approval from an administrator. */
|
|
21
|
-
readonly PendingApproval: "pending-approval";
|
|
22
|
-
/** Subject has been invited but has not yet accepted or completed setup. */
|
|
23
|
-
readonly Invited: "invited";
|
|
24
18
|
};
|
|
25
19
|
export type SubjectStatus = EnumType<typeof SubjectStatus>;
|
|
26
20
|
export declare class Subject extends TenantEntity {
|
|
@@ -25,14 +25,8 @@ export const SubjectType = defineEnum('SubjectType', {
|
|
|
25
25
|
export const SubjectStatus = defineEnum('SubjectStatus', {
|
|
26
26
|
/** Subject is active and can perform actions. */
|
|
27
27
|
Active: 'active',
|
|
28
|
-
/** Subject is inactive and cannot perform actions. Usually set by the user or a default state. */
|
|
29
|
-
Inactive: 'inactive',
|
|
30
28
|
/** Subject is suspended and cannot perform actions. Usually set by an administrator for security or policy reasons. */
|
|
31
29
|
Suspended: 'suspended',
|
|
32
|
-
/** Subject is pending approval from an administrator. */
|
|
33
|
-
PendingApproval: 'pending-approval',
|
|
34
|
-
/** Subject has been invited but has not yet accepted or completed setup. */
|
|
35
|
-
Invited: 'invited',
|
|
36
30
|
});
|
|
37
31
|
let Subject = class Subject extends TenantEntity {
|
|
38
32
|
type;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { JwtToken, JwtTokenHeader } from '../../cryptography/index.js';
|
|
1
2
|
import type { Record } from '../../types/index.js';
|
|
2
|
-
import type { JwtToken, JwtTokenHeader } from '../../utils/jwt.js';
|
|
3
3
|
import type { TokenPayloadBase } from './token-payload-base.model.js';
|
|
4
4
|
export type TokenHeader = {
|
|
5
5
|
/** Token version. */
|
|
@@ -31,7 +31,7 @@ export type RefreshToken = JwtToken<{
|
|
|
31
31
|
/** The secret to use for refreshing the token. */
|
|
32
32
|
secret: string;
|
|
33
33
|
}>;
|
|
34
|
-
export type
|
|
34
|
+
export type PasswordResetToken = JwtToken<{
|
|
35
35
|
/** Issued at timestamp in seconds. */
|
|
36
36
|
iat: number;
|
|
37
37
|
/** Expiration timestamp in seconds. */
|
|
@@ -41,3 +41,17 @@ export type SecretResetToken = JwtToken<{
|
|
|
41
41
|
/** The subject for which to reset the secret. */
|
|
42
42
|
subject: string;
|
|
43
43
|
}>;
|
|
44
|
+
export type TotpChallengeToken<AuthenticationData = unknown> = JwtToken<{
|
|
45
|
+
/** Issued at timestamp in seconds. */
|
|
46
|
+
iat: number;
|
|
47
|
+
/** Expiration timestamp in seconds. */
|
|
48
|
+
exp: number;
|
|
49
|
+
/** The tenant id. */
|
|
50
|
+
tenant: string;
|
|
51
|
+
/** The subject. */
|
|
52
|
+
subject: string;
|
|
53
|
+
/** Whether to remember the session. */
|
|
54
|
+
remember: boolean;
|
|
55
|
+
/** Additional authentication data. */
|
|
56
|
+
data: AuthenticationData;
|
|
57
|
+
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type EnumType } from '../../enumeration/enumeration.js';
|
|
2
2
|
import type { Record } from '../../types/index.js';
|
|
3
3
|
import { Subject, type TokenPayload } from '../models/index.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { InitPasswordResetData } from '../models/init-password-reset-data.model.js';
|
|
5
5
|
import type { SubjectInput } from '../types.js';
|
|
6
6
|
export declare const GetTokenPayloadContextAction: {
|
|
7
7
|
readonly GetToken: "get-token";
|
|
@@ -19,9 +19,9 @@ export type GetTokenPayloadContext = {
|
|
|
19
19
|
*
|
|
20
20
|
* @param AdditionalTokenPayload Type of additional token payload
|
|
21
21
|
* @param AuthenticationData Type of additional authentication data
|
|
22
|
-
* @param
|
|
22
|
+
* @param AdditionalInitPasswordResetData Type of additional password reset data
|
|
23
23
|
*/
|
|
24
|
-
export declare abstract class AuthenticationAncillaryService<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void,
|
|
24
|
+
export declare abstract class AuthenticationAncillaryService<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void, AdditionalInitPasswordResetData = void> {
|
|
25
25
|
readonly subjectRepository: import("../../orm/server/repository.js").EntityRepository<Subject>;
|
|
26
26
|
/**
|
|
27
27
|
* Resolve a provided subject (like what was entered into login form) to all matching actual subjects.
|
|
@@ -42,10 +42,10 @@ export declare abstract class AuthenticationAncillaryService<AdditionalTokenPayl
|
|
|
42
42
|
*/
|
|
43
43
|
abstract getTokenPayload(subject: Subject, authenticationData: AuthenticationData, context: GetTokenPayloadContext): AdditionalTokenPayload | Promise<AdditionalTokenPayload>;
|
|
44
44
|
/**
|
|
45
|
-
* Handle the initialization of a
|
|
46
|
-
* @param data Data for initializing the
|
|
45
|
+
* Handle the initialization of a password reset.
|
|
46
|
+
* @param data Data for initializing the password reset.
|
|
47
47
|
*/
|
|
48
|
-
abstract
|
|
48
|
+
abstract handleInitPasswordReset(data: InitPasswordResetData & AdditionalInitPasswordResetData): void | Promise<void>;
|
|
49
49
|
/**
|
|
50
50
|
* Check if token is allowed to impersonate subject.
|
|
51
51
|
* @param token Token which tries to impersonate.
|
|
@@ -10,7 +10,7 @@ export const GetTokenPayloadContextAction = defineEnum('GetTokenPayloadContextAc
|
|
|
10
10
|
*
|
|
11
11
|
* @param AdditionalTokenPayload Type of additional token payload
|
|
12
12
|
* @param AuthenticationData Type of additional authentication data
|
|
13
|
-
* @param
|
|
13
|
+
* @param AdditionalInitPasswordResetData Type of additional password reset data
|
|
14
14
|
*/
|
|
15
15
|
export class AuthenticationAncillaryService {
|
|
16
16
|
subjectRepository = injectRepository(Subject);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { PasswordCheckResult } from '../models/password-check-result.model.js';
|
|
2
|
+
export type PasswordTestResult = {
|
|
3
|
+
success: true;
|
|
4
|
+
reason?: undefined;
|
|
5
|
+
} | {
|
|
6
|
+
success: false;
|
|
7
|
+
reason: string;
|
|
8
|
+
};
|
|
9
|
+
export declare abstract class AuthenticationPasswordRequirementsValidator {
|
|
10
|
+
/**
|
|
11
|
+
* Checks the password against the requirements.
|
|
12
|
+
* @param password The password to check.
|
|
13
|
+
* @returns The result of the check.
|
|
14
|
+
*/
|
|
15
|
+
abstract checkPasswordRequirements(password: string): Promise<PasswordCheckResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Tests the password against the requirements.
|
|
18
|
+
* @param password The password to test.
|
|
19
|
+
* @returns The result of the test.
|
|
20
|
+
*/
|
|
21
|
+
abstract testPasswordRequirements(password: string): Promise<PasswordTestResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Validates the password against the requirements. Throws an error if the requirements are not met.
|
|
24
|
+
* @param password The password to validate.
|
|
25
|
+
* @throws {PasswordRequirementsError} If the password does not meet the requirements.
|
|
26
|
+
*/
|
|
27
|
+
abstract validatePasswordRequirements(password: string): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Default validator for password requirements.
|
|
31
|
+
*
|
|
32
|
+
* Checks for pwned passwords and password strength.
|
|
33
|
+
* - Pwned passwords are not allowed.
|
|
34
|
+
* - Password strength must be at least 'medium'.
|
|
35
|
+
*/
|
|
36
|
+
export declare class DefaultAuthenticationPasswordRequirementsValidator extends AuthenticationPasswordRequirementsValidator {
|
|
37
|
+
/**
|
|
38
|
+
* Checks the password against the requirements.
|
|
39
|
+
* @param password The password to check.
|
|
40
|
+
* @returns The result of the check.
|
|
41
|
+
*/
|
|
42
|
+
checkPasswordRequirements(password: string): Promise<PasswordCheckResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Tests the password against the requirements.
|
|
45
|
+
* @param password The password to test.
|
|
46
|
+
* @returns The result of the test.
|
|
47
|
+
*/
|
|
48
|
+
testPasswordRequirements(password: string): Promise<PasswordTestResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Validates the password against the requirements. Throws an error if the requirements are not met.
|
|
51
|
+
* @param password The password to validate.
|
|
52
|
+
* @throws {PasswordRequirementsError} If the password does not meet the requirements.
|
|
53
|
+
*/
|
|
54
|
+
validatePasswordRequirements(password: string): Promise<void>;
|
|
55
|
+
}
|