@bymax-one/nest-auth 1.5.14 → 1.5.16
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 +51 -1
- package/README.md +14 -0
- package/dist/client/index.cjs +3 -5
- package/dist/client/index.mjs +3 -5
- package/dist/nextjs/index.cjs +5 -1
- package/dist/nextjs/index.mjs +5 -1
- package/dist/server/index.cjs +5504 -4155
- package/dist/server/index.d.cts +59 -35
- package/dist/server/index.d.ts +59 -35
- package/dist/server/index.mjs +4002 -2658
- package/package.json +3 -3
package/dist/server/index.d.cts
CHANGED
|
@@ -7398,11 +7398,13 @@ declare class WorkspaceAccessService {
|
|
|
7398
7398
|
/**
|
|
7399
7399
|
* Reads the workspace and the membership together, whatever the first one says.
|
|
7400
7400
|
*
|
|
7401
|
-
* A missing workspace, an inactive one and a non-member then cost the same repository
|
|
7402
|
-
*
|
|
7403
|
-
*
|
|
7401
|
+
* A missing workspace, an inactive one and a non-member then cost the same repository reads, and
|
|
7402
|
+
* a repository that finds nothing is copied for the same work per field as one that finds a row.
|
|
7403
|
+
* That is the same work, not the same time: how long a host's database takes for each row is
|
|
7404
|
+
* outside this library. The pending-deletion answer for an owner is decided from these same two rows.
|
|
7404
7405
|
*/
|
|
7405
7406
|
private readRepositories;
|
|
7407
|
+
private accessFrom;
|
|
7406
7408
|
}
|
|
7407
7409
|
|
|
7408
7410
|
/**
|
|
@@ -9696,6 +9698,11 @@ declare class SessionService {
|
|
|
9696
9698
|
* caller told only that "a hash" was malformed cannot act on it.
|
|
9697
9699
|
*/
|
|
9698
9700
|
rotateSession(oldHash: string, newHash: string, ip: string, userAgent: string): Promise<void>;
|
|
9701
|
+
/**
|
|
9702
|
+
* Reads the creation time of the session being rotated, so that its age is stable across token
|
|
9703
|
+
* rotations; the current time when its detail is missing or unparseable.
|
|
9704
|
+
*/
|
|
9705
|
+
private readRotatedCreatedAt;
|
|
9699
9706
|
/**
|
|
9700
9707
|
* Asserts that a session hash string is a valid 64-character lowercase hex string.
|
|
9701
9708
|
*
|
|
@@ -9736,6 +9743,10 @@ declare class SessionService {
|
|
|
9736
9743
|
* rotation script writes it.
|
|
9737
9744
|
*/
|
|
9738
9745
|
private graceSuccessor;
|
|
9746
|
+
/** Drops the grace pointers that have expired from the index, without making the listing wait for it. */
|
|
9747
|
+
private pruneGracePointers;
|
|
9748
|
+
/** Drops the members of the index that name nothing, without making the listing wait for it. */
|
|
9749
|
+
private pruneDeadPointers;
|
|
9739
9750
|
/**
|
|
9740
9751
|
* The Redis key of this user's session index.
|
|
9741
9752
|
*
|
|
@@ -9801,6 +9812,8 @@ declare class SessionService {
|
|
|
9801
9812
|
* @returns Maximum allowed concurrent sessions for the given user.
|
|
9802
9813
|
*/
|
|
9803
9814
|
private resolveSessionLimit;
|
|
9815
|
+
/** Reads the creation time of every member together; a failed read throws, after the reads before it settled. */
|
|
9816
|
+
private readAges;
|
|
9804
9817
|
}
|
|
9805
9818
|
|
|
9806
9819
|
/**
|
|
@@ -9839,16 +9852,7 @@ declare class TokenManagerService {
|
|
|
9839
9852
|
* @returns Signed JWT string.
|
|
9840
9853
|
*/
|
|
9841
9854
|
private issuePlatformAccess;
|
|
9842
|
-
/**
|
|
9843
|
-
* Builds JwtSignOptions from resolved configuration.
|
|
9844
|
-
*
|
|
9845
|
-
* The double-cast through `unknown` is required because:
|
|
9846
|
-
* 1. `@nestjs/jwt` types `expiresIn` as the branded `StringValue` from `ms`
|
|
9847
|
-
* (not a plain `string`), and
|
|
9848
|
-
* 2. `exactOptionalPropertyTypes` rejects `string | undefined` as the value
|
|
9849
|
-
* type of an optional property typed as `StringValue`.
|
|
9850
|
-
* At runtime the value is always a valid `ms` string — the cast is safe.
|
|
9851
|
-
*/
|
|
9855
|
+
/** The options of an access-token `sign` call: the resolved configuration, over a neutral value for every option the library does not choose. */
|
|
9852
9856
|
private accessSignOptions;
|
|
9853
9857
|
/**
|
|
9854
9858
|
* The `iss`/`aud` pair to stamp and to require, or nothing when the deployment configured
|
|
@@ -10424,6 +10428,8 @@ declare class AuthService {
|
|
|
10424
10428
|
password: string;
|
|
10425
10429
|
tenantId?: string;
|
|
10426
10430
|
}, req: Request): Promise<AuthResult | MfaChallengeResult>;
|
|
10431
|
+
/** Issues the tokens of a signed-in user and, when sessions are enabled, records the session that holds them. */
|
|
10432
|
+
private openSession;
|
|
10427
10433
|
/**
|
|
10428
10434
|
* Logs out a dashboard user by revoking the access token and deleting the refresh session.
|
|
10429
10435
|
*
|
|
@@ -10769,6 +10775,10 @@ declare class AuthService {
|
|
|
10769
10775
|
* refused login into a different refusal, nor a successful one into a failure.
|
|
10770
10776
|
*/
|
|
10771
10777
|
private fireAndForget;
|
|
10778
|
+
/** Records the time of a login without making the login wait for it; a failure is logged, never raised. */
|
|
10779
|
+
private touchLastLogin;
|
|
10780
|
+
/** Moves the detail of a session to its rotated token without making the refresh wait for it. */
|
|
10781
|
+
private rotateSessionDetail;
|
|
10772
10782
|
/** Writes the event of a password login that reached its end: tokens issued, or an MFA challenge. */
|
|
10773
10783
|
private logLogin;
|
|
10774
10784
|
private assertUserNotBlocked;
|
|
@@ -11083,6 +11093,15 @@ declare class MfaRecordService {
|
|
|
11083
11093
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
11084
11094
|
*/
|
|
11085
11095
|
transition(context: 'dashboard' | 'platform', userId: string, tenantId: string | undefined, mutate: (current: AuthUser | AuthPlatformUser) => MfaRecordUpdate | null): Promise<boolean>;
|
|
11096
|
+
/**
|
|
11097
|
+
* Writes an update inside the lock, to the repository of the plane the account belongs to.
|
|
11098
|
+
*
|
|
11099
|
+
* @param context - Which identity plane the account belongs to.
|
|
11100
|
+
* @param userId - The account being written.
|
|
11101
|
+
* @param tenantId - The account's tenant, required on the dashboard plane.
|
|
11102
|
+
* @param update - What `mutate` asked to be stored.
|
|
11103
|
+
*/
|
|
11104
|
+
private persist;
|
|
11086
11105
|
/**
|
|
11087
11106
|
* Releases the transition lock this call took, whatever the store answers.
|
|
11088
11107
|
*
|
|
@@ -11209,6 +11228,13 @@ declare class MfaChallengeService {
|
|
|
11209
11228
|
* @throws `MFA_INVALID_CODE` if the submitted code is incorrect.
|
|
11210
11229
|
*/
|
|
11211
11230
|
challenge(mfaTempToken: string, code: string, ip: string, userAgent: string, mfa: MfaConfig): Promise<AuthResult | PlatformAuthResult>;
|
|
11231
|
+
/** The checks and the session of one challenge, run on the plane the temp token names. */
|
|
11232
|
+
private admitChallenge;
|
|
11233
|
+
/**
|
|
11234
|
+
* Consumes the temp token, and the consume must WIN: two concurrent submissions both see the marker, and on the recovery-code
|
|
11235
|
+
* path one code and one token would mint two sessions. The loser is reported as an invalid temp token.
|
|
11236
|
+
*/
|
|
11237
|
+
private consumeOrRefuse;
|
|
11212
11238
|
/**
|
|
11213
11239
|
* Refuses a challenge for an account at its failure ceiling.
|
|
11214
11240
|
*
|
|
@@ -11566,21 +11592,6 @@ interface MfaSetupResult {
|
|
|
11566
11592
|
/** Plain-text recovery codes. Display once and never persist in this form. */
|
|
11567
11593
|
recoveryCodes: string[];
|
|
11568
11594
|
}
|
|
11569
|
-
/**
|
|
11570
|
-
* Manages TOTP-based multi-factor authentication lifecycle.
|
|
11571
|
-
*
|
|
11572
|
-
* Handles the complete MFA flow for both dashboard users and platform admins:
|
|
11573
|
-
* - **Setup**: generate TOTP secret + recovery codes, store temporarily in Redis
|
|
11574
|
-
* - **Verify & Enable**: confirm first TOTP code, persist encrypted secret to DB
|
|
11575
|
-
* - **Challenge**: exchange a valid MFA temp token + code for full access tokens
|
|
11576
|
-
* - **Disable**: require a current TOTP code to disable MFA
|
|
11577
|
-
*
|
|
11578
|
-
* @remarks
|
|
11579
|
-
* This service is only registered when `options.mfa` is configured in
|
|
11580
|
-
* `BymaxAuthModule.registerAsync()`. All crypto operations use `node:crypto` only.
|
|
11581
|
-
*
|
|
11582
|
-
* @layer Service
|
|
11583
|
-
*/
|
|
11584
11595
|
declare class MfaService {
|
|
11585
11596
|
private readonly options;
|
|
11586
11597
|
private readonly userRepo;
|
|
@@ -11605,6 +11616,8 @@ declare class MfaService {
|
|
|
11605
11616
|
* here eliminates repetitive `!` assertions throughout the class.
|
|
11606
11617
|
*/
|
|
11607
11618
|
private get mfaOptions();
|
|
11619
|
+
/** The setup a first request stored, read back for the account's address. */
|
|
11620
|
+
private storedSetup;
|
|
11608
11621
|
/**
|
|
11609
11622
|
* Initiates the MFA setup flow for a dashboard user or platform administrator.
|
|
11610
11623
|
*
|
|
@@ -12213,6 +12226,10 @@ declare class PasswordResetService {
|
|
|
12213
12226
|
* the configured breach checker.
|
|
12214
12227
|
*/
|
|
12215
12228
|
changePassword(userId: string, tenantId: string, dto: ChangePasswordDto, currentRefreshToken?: string): Promise<void>;
|
|
12229
|
+
/**
|
|
12230
|
+
* Counts a failed proof of the current password and refuses a locked account, a wrong password included.
|
|
12231
|
+
*/
|
|
12232
|
+
private assertCurrentPassword;
|
|
12216
12233
|
/**
|
|
12217
12234
|
* The hash of the live session a presented refresh token stands for, or `undefined` when the
|
|
12218
12235
|
* request carried none. Refuses a token that names no live session of the account; a token that
|
|
@@ -12272,6 +12289,8 @@ declare class PasswordResetService {
|
|
|
12272
12289
|
* Errors are caught and logged — they must not propagate to `initiateReset`.
|
|
12273
12290
|
*/
|
|
12274
12291
|
private sendToken;
|
|
12292
|
+
/** Deletes the token of a reset whose delivery failed, so nothing keeps a working reset nobody was sent. */
|
|
12293
|
+
private dropUnsentToken;
|
|
12275
12294
|
/**
|
|
12276
12295
|
* Generates and stores a password-reset OTP, then sends it to the user's email.
|
|
12277
12296
|
* Errors are caught and logged — they must not propagate to `initiateReset`.
|
|
@@ -12347,6 +12366,8 @@ declare class PlatformAuthService {
|
|
|
12347
12366
|
* account status is configured as blocked.
|
|
12348
12367
|
*/
|
|
12349
12368
|
login(dto: PlatformLoginDto, ip: string, userAgent: string): Promise<PlatformAuthResult | MfaChallengeResult>;
|
|
12369
|
+
/** Records the time of a login without making the login wait for it; a failure is logged, never raised. */
|
|
12370
|
+
private touchLastLogin;
|
|
12350
12371
|
/**
|
|
12351
12372
|
* Logs out a platform administrator by revoking the access token JTI and
|
|
12352
12373
|
* deleting the associated platform refresh session from Redis.
|
|
@@ -13213,6 +13234,8 @@ declare class OAuthService {
|
|
|
13213
13234
|
* @returns The auth result.
|
|
13214
13235
|
*/
|
|
13215
13236
|
private openSession;
|
|
13237
|
+
/** Starts the non-blocking side effects of a login; nothing waits for them. */
|
|
13238
|
+
private runLoginSideEffects;
|
|
13216
13239
|
/**
|
|
13217
13240
|
* Validates and spends the `state` of a callback.
|
|
13218
13241
|
*
|
|
@@ -13473,7 +13496,12 @@ declare function sanitizeHeaders(headers: Record<string, string | string[] | und
|
|
|
13473
13496
|
* ```typescript
|
|
13474
13497
|
* const MIN_RESPONSE_MS = 300
|
|
13475
13498
|
* const start = Date.now()
|
|
13476
|
-
*
|
|
13499
|
+
* let user = null
|
|
13500
|
+
* try {
|
|
13501
|
+
* user = await userRepo.findByEmail(dto.email)
|
|
13502
|
+
* } catch {
|
|
13503
|
+
* // an unknown account and a failed lookup take the same time
|
|
13504
|
+
* }
|
|
13477
13505
|
* const elapsed = Date.now() - start
|
|
13478
13506
|
* await sleep(Math.max(0, MIN_RESPONSE_MS - elapsed)) // always >= 300 ms total
|
|
13479
13507
|
* ```
|
|
@@ -13826,6 +13854,8 @@ declare class ApiKeyGuard implements CanActivate {
|
|
|
13826
13854
|
* @returns The scopes, or `null` when the route declares none.
|
|
13827
13855
|
*/
|
|
13828
13856
|
private declaredScopes;
|
|
13857
|
+
/** Audits a denial and refuses with the code of its reason; never returns. */
|
|
13858
|
+
private refuse;
|
|
13829
13859
|
/**
|
|
13830
13860
|
* Emits the audit event.
|
|
13831
13861
|
*
|
|
@@ -14078,12 +14108,6 @@ declare const AllowPendingWorkspace: () => MethodDecorator & ClassDecorator;
|
|
|
14078
14108
|
*/
|
|
14079
14109
|
declare const CurrentWsWorkspace: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
14080
14110
|
|
|
14081
|
-
/**
|
|
14082
|
-
* @fileoverview Names scoped to a workspace: the keys, rooms and prefixes a host builds for
|
|
14083
|
-
* storage, cache, sockets and queues, encoded so two workspaces can never share one.
|
|
14084
|
-
*
|
|
14085
|
-
* @layer Utility
|
|
14086
|
-
*/
|
|
14087
14111
|
/**
|
|
14088
14112
|
* Builds the name of something that belongs to one workspace.
|
|
14089
14113
|
*
|
package/dist/server/index.d.ts
CHANGED
|
@@ -7398,11 +7398,13 @@ declare class WorkspaceAccessService {
|
|
|
7398
7398
|
/**
|
|
7399
7399
|
* Reads the workspace and the membership together, whatever the first one says.
|
|
7400
7400
|
*
|
|
7401
|
-
* A missing workspace, an inactive one and a non-member then cost the same repository
|
|
7402
|
-
*
|
|
7403
|
-
*
|
|
7401
|
+
* A missing workspace, an inactive one and a non-member then cost the same repository reads, and
|
|
7402
|
+
* a repository that finds nothing is copied for the same work per field as one that finds a row.
|
|
7403
|
+
* That is the same work, not the same time: how long a host's database takes for each row is
|
|
7404
|
+
* outside this library. The pending-deletion answer for an owner is decided from these same two rows.
|
|
7404
7405
|
*/
|
|
7405
7406
|
private readRepositories;
|
|
7407
|
+
private accessFrom;
|
|
7406
7408
|
}
|
|
7407
7409
|
|
|
7408
7410
|
/**
|
|
@@ -9696,6 +9698,11 @@ declare class SessionService {
|
|
|
9696
9698
|
* caller told only that "a hash" was malformed cannot act on it.
|
|
9697
9699
|
*/
|
|
9698
9700
|
rotateSession(oldHash: string, newHash: string, ip: string, userAgent: string): Promise<void>;
|
|
9701
|
+
/**
|
|
9702
|
+
* Reads the creation time of the session being rotated, so that its age is stable across token
|
|
9703
|
+
* rotations; the current time when its detail is missing or unparseable.
|
|
9704
|
+
*/
|
|
9705
|
+
private readRotatedCreatedAt;
|
|
9699
9706
|
/**
|
|
9700
9707
|
* Asserts that a session hash string is a valid 64-character lowercase hex string.
|
|
9701
9708
|
*
|
|
@@ -9736,6 +9743,10 @@ declare class SessionService {
|
|
|
9736
9743
|
* rotation script writes it.
|
|
9737
9744
|
*/
|
|
9738
9745
|
private graceSuccessor;
|
|
9746
|
+
/** Drops the grace pointers that have expired from the index, without making the listing wait for it. */
|
|
9747
|
+
private pruneGracePointers;
|
|
9748
|
+
/** Drops the members of the index that name nothing, without making the listing wait for it. */
|
|
9749
|
+
private pruneDeadPointers;
|
|
9739
9750
|
/**
|
|
9740
9751
|
* The Redis key of this user's session index.
|
|
9741
9752
|
*
|
|
@@ -9801,6 +9812,8 @@ declare class SessionService {
|
|
|
9801
9812
|
* @returns Maximum allowed concurrent sessions for the given user.
|
|
9802
9813
|
*/
|
|
9803
9814
|
private resolveSessionLimit;
|
|
9815
|
+
/** Reads the creation time of every member together; a failed read throws, after the reads before it settled. */
|
|
9816
|
+
private readAges;
|
|
9804
9817
|
}
|
|
9805
9818
|
|
|
9806
9819
|
/**
|
|
@@ -9839,16 +9852,7 @@ declare class TokenManagerService {
|
|
|
9839
9852
|
* @returns Signed JWT string.
|
|
9840
9853
|
*/
|
|
9841
9854
|
private issuePlatformAccess;
|
|
9842
|
-
/**
|
|
9843
|
-
* Builds JwtSignOptions from resolved configuration.
|
|
9844
|
-
*
|
|
9845
|
-
* The double-cast through `unknown` is required because:
|
|
9846
|
-
* 1. `@nestjs/jwt` types `expiresIn` as the branded `StringValue` from `ms`
|
|
9847
|
-
* (not a plain `string`), and
|
|
9848
|
-
* 2. `exactOptionalPropertyTypes` rejects `string | undefined` as the value
|
|
9849
|
-
* type of an optional property typed as `StringValue`.
|
|
9850
|
-
* At runtime the value is always a valid `ms` string — the cast is safe.
|
|
9851
|
-
*/
|
|
9855
|
+
/** The options of an access-token `sign` call: the resolved configuration, over a neutral value for every option the library does not choose. */
|
|
9852
9856
|
private accessSignOptions;
|
|
9853
9857
|
/**
|
|
9854
9858
|
* The `iss`/`aud` pair to stamp and to require, or nothing when the deployment configured
|
|
@@ -10424,6 +10428,8 @@ declare class AuthService {
|
|
|
10424
10428
|
password: string;
|
|
10425
10429
|
tenantId?: string;
|
|
10426
10430
|
}, req: Request): Promise<AuthResult | MfaChallengeResult>;
|
|
10431
|
+
/** Issues the tokens of a signed-in user and, when sessions are enabled, records the session that holds them. */
|
|
10432
|
+
private openSession;
|
|
10427
10433
|
/**
|
|
10428
10434
|
* Logs out a dashboard user by revoking the access token and deleting the refresh session.
|
|
10429
10435
|
*
|
|
@@ -10769,6 +10775,10 @@ declare class AuthService {
|
|
|
10769
10775
|
* refused login into a different refusal, nor a successful one into a failure.
|
|
10770
10776
|
*/
|
|
10771
10777
|
private fireAndForget;
|
|
10778
|
+
/** Records the time of a login without making the login wait for it; a failure is logged, never raised. */
|
|
10779
|
+
private touchLastLogin;
|
|
10780
|
+
/** Moves the detail of a session to its rotated token without making the refresh wait for it. */
|
|
10781
|
+
private rotateSessionDetail;
|
|
10772
10782
|
/** Writes the event of a password login that reached its end: tokens issued, or an MFA challenge. */
|
|
10773
10783
|
private logLogin;
|
|
10774
10784
|
private assertUserNotBlocked;
|
|
@@ -11083,6 +11093,15 @@ declare class MfaRecordService {
|
|
|
11083
11093
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
11084
11094
|
*/
|
|
11085
11095
|
transition(context: 'dashboard' | 'platform', userId: string, tenantId: string | undefined, mutate: (current: AuthUser | AuthPlatformUser) => MfaRecordUpdate | null): Promise<boolean>;
|
|
11096
|
+
/**
|
|
11097
|
+
* Writes an update inside the lock, to the repository of the plane the account belongs to.
|
|
11098
|
+
*
|
|
11099
|
+
* @param context - Which identity plane the account belongs to.
|
|
11100
|
+
* @param userId - The account being written.
|
|
11101
|
+
* @param tenantId - The account's tenant, required on the dashboard plane.
|
|
11102
|
+
* @param update - What `mutate` asked to be stored.
|
|
11103
|
+
*/
|
|
11104
|
+
private persist;
|
|
11086
11105
|
/**
|
|
11087
11106
|
* Releases the transition lock this call took, whatever the store answers.
|
|
11088
11107
|
*
|
|
@@ -11209,6 +11228,13 @@ declare class MfaChallengeService {
|
|
|
11209
11228
|
* @throws `MFA_INVALID_CODE` if the submitted code is incorrect.
|
|
11210
11229
|
*/
|
|
11211
11230
|
challenge(mfaTempToken: string, code: string, ip: string, userAgent: string, mfa: MfaConfig): Promise<AuthResult | PlatformAuthResult>;
|
|
11231
|
+
/** The checks and the session of one challenge, run on the plane the temp token names. */
|
|
11232
|
+
private admitChallenge;
|
|
11233
|
+
/**
|
|
11234
|
+
* Consumes the temp token, and the consume must WIN: two concurrent submissions both see the marker, and on the recovery-code
|
|
11235
|
+
* path one code and one token would mint two sessions. The loser is reported as an invalid temp token.
|
|
11236
|
+
*/
|
|
11237
|
+
private consumeOrRefuse;
|
|
11212
11238
|
/**
|
|
11213
11239
|
* Refuses a challenge for an account at its failure ceiling.
|
|
11214
11240
|
*
|
|
@@ -11566,21 +11592,6 @@ interface MfaSetupResult {
|
|
|
11566
11592
|
/** Plain-text recovery codes. Display once and never persist in this form. */
|
|
11567
11593
|
recoveryCodes: string[];
|
|
11568
11594
|
}
|
|
11569
|
-
/**
|
|
11570
|
-
* Manages TOTP-based multi-factor authentication lifecycle.
|
|
11571
|
-
*
|
|
11572
|
-
* Handles the complete MFA flow for both dashboard users and platform admins:
|
|
11573
|
-
* - **Setup**: generate TOTP secret + recovery codes, store temporarily in Redis
|
|
11574
|
-
* - **Verify & Enable**: confirm first TOTP code, persist encrypted secret to DB
|
|
11575
|
-
* - **Challenge**: exchange a valid MFA temp token + code for full access tokens
|
|
11576
|
-
* - **Disable**: require a current TOTP code to disable MFA
|
|
11577
|
-
*
|
|
11578
|
-
* @remarks
|
|
11579
|
-
* This service is only registered when `options.mfa` is configured in
|
|
11580
|
-
* `BymaxAuthModule.registerAsync()`. All crypto operations use `node:crypto` only.
|
|
11581
|
-
*
|
|
11582
|
-
* @layer Service
|
|
11583
|
-
*/
|
|
11584
11595
|
declare class MfaService {
|
|
11585
11596
|
private readonly options;
|
|
11586
11597
|
private readonly userRepo;
|
|
@@ -11605,6 +11616,8 @@ declare class MfaService {
|
|
|
11605
11616
|
* here eliminates repetitive `!` assertions throughout the class.
|
|
11606
11617
|
*/
|
|
11607
11618
|
private get mfaOptions();
|
|
11619
|
+
/** The setup a first request stored, read back for the account's address. */
|
|
11620
|
+
private storedSetup;
|
|
11608
11621
|
/**
|
|
11609
11622
|
* Initiates the MFA setup flow for a dashboard user or platform administrator.
|
|
11610
11623
|
*
|
|
@@ -12213,6 +12226,10 @@ declare class PasswordResetService {
|
|
|
12213
12226
|
* the configured breach checker.
|
|
12214
12227
|
*/
|
|
12215
12228
|
changePassword(userId: string, tenantId: string, dto: ChangePasswordDto, currentRefreshToken?: string): Promise<void>;
|
|
12229
|
+
/**
|
|
12230
|
+
* Counts a failed proof of the current password and refuses a locked account, a wrong password included.
|
|
12231
|
+
*/
|
|
12232
|
+
private assertCurrentPassword;
|
|
12216
12233
|
/**
|
|
12217
12234
|
* The hash of the live session a presented refresh token stands for, or `undefined` when the
|
|
12218
12235
|
* request carried none. Refuses a token that names no live session of the account; a token that
|
|
@@ -12272,6 +12289,8 @@ declare class PasswordResetService {
|
|
|
12272
12289
|
* Errors are caught and logged — they must not propagate to `initiateReset`.
|
|
12273
12290
|
*/
|
|
12274
12291
|
private sendToken;
|
|
12292
|
+
/** Deletes the token of a reset whose delivery failed, so nothing keeps a working reset nobody was sent. */
|
|
12293
|
+
private dropUnsentToken;
|
|
12275
12294
|
/**
|
|
12276
12295
|
* Generates and stores a password-reset OTP, then sends it to the user's email.
|
|
12277
12296
|
* Errors are caught and logged — they must not propagate to `initiateReset`.
|
|
@@ -12347,6 +12366,8 @@ declare class PlatformAuthService {
|
|
|
12347
12366
|
* account status is configured as blocked.
|
|
12348
12367
|
*/
|
|
12349
12368
|
login(dto: PlatformLoginDto, ip: string, userAgent: string): Promise<PlatformAuthResult | MfaChallengeResult>;
|
|
12369
|
+
/** Records the time of a login without making the login wait for it; a failure is logged, never raised. */
|
|
12370
|
+
private touchLastLogin;
|
|
12350
12371
|
/**
|
|
12351
12372
|
* Logs out a platform administrator by revoking the access token JTI and
|
|
12352
12373
|
* deleting the associated platform refresh session from Redis.
|
|
@@ -13213,6 +13234,8 @@ declare class OAuthService {
|
|
|
13213
13234
|
* @returns The auth result.
|
|
13214
13235
|
*/
|
|
13215
13236
|
private openSession;
|
|
13237
|
+
/** Starts the non-blocking side effects of a login; nothing waits for them. */
|
|
13238
|
+
private runLoginSideEffects;
|
|
13216
13239
|
/**
|
|
13217
13240
|
* Validates and spends the `state` of a callback.
|
|
13218
13241
|
*
|
|
@@ -13473,7 +13496,12 @@ declare function sanitizeHeaders(headers: Record<string, string | string[] | und
|
|
|
13473
13496
|
* ```typescript
|
|
13474
13497
|
* const MIN_RESPONSE_MS = 300
|
|
13475
13498
|
* const start = Date.now()
|
|
13476
|
-
*
|
|
13499
|
+
* let user = null
|
|
13500
|
+
* try {
|
|
13501
|
+
* user = await userRepo.findByEmail(dto.email)
|
|
13502
|
+
* } catch {
|
|
13503
|
+
* // an unknown account and a failed lookup take the same time
|
|
13504
|
+
* }
|
|
13477
13505
|
* const elapsed = Date.now() - start
|
|
13478
13506
|
* await sleep(Math.max(0, MIN_RESPONSE_MS - elapsed)) // always >= 300 ms total
|
|
13479
13507
|
* ```
|
|
@@ -13826,6 +13854,8 @@ declare class ApiKeyGuard implements CanActivate {
|
|
|
13826
13854
|
* @returns The scopes, or `null` when the route declares none.
|
|
13827
13855
|
*/
|
|
13828
13856
|
private declaredScopes;
|
|
13857
|
+
/** Audits a denial and refuses with the code of its reason; never returns. */
|
|
13858
|
+
private refuse;
|
|
13829
13859
|
/**
|
|
13830
13860
|
* Emits the audit event.
|
|
13831
13861
|
*
|
|
@@ -14078,12 +14108,6 @@ declare const AllowPendingWorkspace: () => MethodDecorator & ClassDecorator;
|
|
|
14078
14108
|
*/
|
|
14079
14109
|
declare const CurrentWsWorkspace: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
14080
14110
|
|
|
14081
|
-
/**
|
|
14082
|
-
* @fileoverview Names scoped to a workspace: the keys, rooms and prefixes a host builds for
|
|
14083
|
-
* storage, cache, sockets and queues, encoded so two workspaces can never share one.
|
|
14084
|
-
*
|
|
14085
|
-
* @layer Utility
|
|
14086
|
-
*/
|
|
14087
14111
|
/**
|
|
14088
14112
|
* Builds the name of something that belongs to one workspace.
|
|
14089
14113
|
*
|