@bymax-one/nest-auth 1.4.2 → 1.4.3

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.
@@ -1684,7 +1684,7 @@ declare const AUTH_THROTTLE_CONFIGS: {
1684
1684
  readonly ttl: 60000;
1685
1685
  };
1686
1686
  };
1687
- /** DELETE /auth/sessions/all — 5 requests per minute per IP. */
1687
+ /** POST /auth/sessions/revoke-all — 5 requests per minute per IP. */
1688
1688
  readonly revokeAllSessions: {
1689
1689
  readonly default: {
1690
1690
  readonly limit: 5;
@@ -5155,8 +5155,25 @@ declare class WsJwtGuard implements CanActivate, OnModuleInit {
5155
5155
  * stack detail or a connection string reaches a response body, so the answer carries the
5156
5156
  * generic code and nothing else.
5157
5157
  *
5158
+ * **Do not register this alongside `@bymax-one/nest-core`'s envelope filter.** They are mutually
5159
+ * exclusive in practice and this one wins: `useGlobalFilters` binds ahead of an `APP_FILTER`
5160
+ * provider, and `@Catch()` with no argument catches everything, so nest-core's filter never runs.
5161
+ * Measured on a composed application — the same request answers
5162
+ * `{error: {code, message, details}}` with this filter registered and the flat
5163
+ * `{statusCode, code, message, timestamp, path, details}` without it. A derived backend that
5164
+ * registers both therefore loses `statusCode`, `timestamp`, `path` and the correlation id, which
5165
+ * is the opposite of what registering an extra filter looks like it should do.
5166
+ *
5167
+ * Pick one. On a backend built on nest-core, take theirs: it already recognises this library's
5168
+ * envelope and passes the code, message and per-field details through unchanged.
5169
+ *
5170
+ * Nothing in this repository asserts that, and deliberately so — verifying it would mean this
5171
+ * library depending on a consumer's stack. The behaviour above was measured once and the
5172
+ * dependency removed; the standing assertion belongs to whoever composes the two.
5173
+ *
5158
5174
  * @example
5159
5175
  * ```typescript
5176
+ * // Only when nest-core's envelope filter is NOT in the application.
5160
5177
  * app.useGlobalFilters(new AuthExceptionFilter())
5161
5178
  * ```
5162
5179
  *
@@ -5173,6 +5190,59 @@ declare class AuthExceptionFilter implements ExceptionFilter {
5173
5190
  catch(exception: unknown, host: ArgumentsHost): void;
5174
5191
  }
5175
5192
 
5193
+ /**
5194
+ * Gives a refused WebSocket client the library's error envelope instead of a generic failure.
5195
+ *
5196
+ * Register it on a gateway that applies {@link WsJwtGuard}. Without it, the guard's refusals do
5197
+ * not survive the transport: `AuthException` extends `HttpException`, Nest's WebSocket exception
5198
+ * layer understands only `WsException`, and everything else is delivered as
5199
+ * `{status: 'error', message: 'Internal server error'}` — so the whole `auth.*` catalogue stops
5200
+ * at the socket boundary.
5201
+ *
5202
+ * That is not only untidy. A client cannot tell a dead credential from a crashed handler, and a
5203
+ * reconnect policy has to choose: retrying an unknown error is the sensible default, so every
5204
+ * expired token becomes a reconnect loop against an endpoint that will refuse it forever. With
5205
+ * this filter the client reads `error.code` and can send the user to sign in instead.
5206
+ *
5207
+ * The payload keeps `status: 'error'` — the field Nest's own layer sets and every socket.io
5208
+ * client already branches on — and adds the envelope beside it, so a consumer handling both
5209
+ * shapes does not need a second listener:
5210
+ *
5211
+ * ```
5212
+ * without { status: 'error', message: 'Internal server error' }
5213
+ * with { status: 'error', error: { code: 'auth.token_invalid', message, details } }
5214
+ * ```
5215
+ *
5216
+ * **Scoped to `AuthException` on purpose.** An argument-less `@Catch()` would claim every
5217
+ * exception a gateway raises, so a `WsException` an unrelated handler throws — a domain error
5218
+ * with its own contract — would be rewritten as `auth.internal`, and following the README would
5219
+ * silently break a consumer's existing WebSocket errors. Everything that is not this library's
5220
+ * refusal keeps travelling through Nest's own exception layer.
5221
+ *
5222
+ * **Both transports.** A Socket.IO client is dispatched to with `emit`; a native `ws` client —
5223
+ * which also extends `EventEmitter`, so emitting on it succeeds and sends NOTHING — is written
5224
+ * to with `send`, in the `{event, data}` envelope `@nestjs/platform-ws` uses for every other
5225
+ * message. Both are driven over a real handshake in `test/e2e/ws-guard.e2e-spec.ts`.
5226
+ *
5227
+ * @example
5228
+ * ```typescript
5229
+ * @UseFilters(new WsAuthExceptionFilter())
5230
+ * @UseGuards(WsJwtGuard)
5231
+ * @WebSocketGateway()
5232
+ * export class FeedGateway { ... }
5233
+ * ```
5234
+ */
5235
+ declare class WsAuthExceptionFilter implements ExceptionFilter {
5236
+ private readonly logger;
5237
+ /**
5238
+ * Delivers the library envelope to the client whose request was refused.
5239
+ *
5240
+ * @param exception - The `AuthException` a guard, pipe or handler raised.
5241
+ * @param host - The arguments host, used to reach the connected client.
5242
+ */
5243
+ catch(exception: AuthException, host: ArgumentsHost): void;
5244
+ }
5245
+
5176
5246
  /**
5177
5247
  * @fileoverview The validation pipe every auth controller mounts.
5178
5248
  *
@@ -5816,6 +5886,23 @@ declare class ChangePasswordDto {
5816
5886
  * Hashed immediately by the service layer — never persisted in plaintext.
5817
5887
  */
5818
5888
  newPassword: string;
5889
+ /**
5890
+ * The caller's own refresh token, so the device making the change stays signed in.
5891
+ *
5892
+ * Declared because the handler reads it. `TokenDeliveryService.extractRefreshToken` takes it
5893
+ * from the refresh cookie under `tokenDelivery: 'cookie'` and from **this body field** under
5894
+ * `'bearer'`, cookie-first-then-body under `'both'` — and the controller pipe runs
5895
+ * `forbidNonWhitelisted: true`, so an undeclared property is refused. A bearer-mode caller
5896
+ * therefore could not send the field the endpoint needs: the request was answered
5897
+ * `auth.validation` naming `refreshToken`, and the only way to change a password was to give
5898
+ * up every other session.
5899
+ *
5900
+ * It stayed invisible because the E2E harness installed a global `ValidationPipe` with
5901
+ * `whitelist: true`, which STRIPPED the property before the controller's own pipe could refuse
5902
+ * it — so the suite exercised a request production never sees. Optional, because under cookie
5903
+ * delivery the credential arrives in the cookie and no body field exists to declare.
5904
+ */
5905
+ refreshToken?: string;
5819
5906
  }
5820
5907
 
5821
5908
  /**
@@ -6737,7 +6824,21 @@ declare class TokenManagerService {
6737
6824
  * The `status` claim in the issued access token is intentionally empty during
6738
6825
  * rotation — the Redis session does not store full user data. Guards that enforce
6739
6826
  * status checks must read from the user repository or a status cache, not the
6740
- * JWT `status` claim.
6827
+ * JWT `status` claim. `rust-auth` stamps the same empty string at the same point, with a
6828
+ * test pinning it, so this is a shared contract rather than a local shortcut.
6829
+ *
6830
+ * **What that means for a consumer, which is where the cost lands.** `issueTokens` stamps the
6831
+ * account's value at that moment, this path stamps nothing, and `AuthService.refresh` re-stamps
6832
+ * it from the account when `role`, `tenantId` or `mfaEnabled` changed — so a session's tokens
6833
+ * carry a populated claim, then an empty one, then possibly a populated one again, with no
6834
+ * signal a client can read. A derived backend reading `request.user.status` is wrong in both
6835
+ * directions: `!== 'active'` refuses everyone whose session refreshed ordinarily, and
6836
+ * `=== 'suspended'` refuses nobody, ever.
6837
+ *
6838
+ * Backfilling it here would be worse than leaving it empty: the claim would become *usually*
6839
+ * true, which is the failure mode that survives testing, since status can still change under an
6840
+ * unexpired token. The claim cannot be authoritative, so it is not made to look like it — and
6841
+ * the empty string is the one state that cannot be mistaken for an answer.
6741
6842
  *
6742
6843
  * `mfaVerified` is always `false` after rotation because the Redis session does not
6743
6844
  * persist MFA verification state. A user who authenticated with MFA will lose the
@@ -6878,10 +6979,9 @@ declare class TokenManagerService {
6878
6979
  * @param token - The MFA temp JWT issued by {@link issueMfaTempToken}.
6879
6980
  * @returns The `userId`, `context`, and `jti` from the token. Pass the
6880
6981
  * `jti` to {@link consumeMfaTempToken} after TOTP validation succeeds.
6881
- * @throws {@link AuthException} with `MFA_TEMP_TOKEN_INVALID` if the
6882
- * Redis entry is missing (already consumed, expired, or never issued).
6883
- * @throws {Error} When JWT signature or expiry validation fails (propagated
6884
- * directly from `JwtService.verify()` — not wrapped in {@link AuthException}).
6982
+ * @throws {@link AuthException} with `MFA_TEMP_TOKEN_INVALID` for every way the token can be
6983
+ * unusable — a bad signature, an expired one, a shape no secret accepts, or a missing Redis
6984
+ * entry (already consumed, expired, or never issued).
6885
6985
  */
6886
6986
  verifyMfaTempToken(token: string): Promise<{
6887
6987
  userId: string;
@@ -8748,4 +8848,4 @@ declare function AuthRateLimit(config: {
8748
8848
  default: AuthRateLimitWindow;
8749
8849
  }): MethodDecorator;
8750
8850
 
8751
- export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, type SessionInfo as ActiveSessionInfo, AllowAllBreachChecker, type AuthEmailCatalogue, type AuthEmailMessage, type AuthEmailSink, type AuthErrorCode, AuthException, AuthExceptionFilter, type AuthFieldError, type AuthModuleAsyncOptions, type AuthPlatformUser, AuthRateLimit, AuthRateLimitGuard, type AuthRateLimitWindow, type AuthResult, AuthRevocationService, AuthService, type AuthUser, Authenticated, type AuthenticatedRequest, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, type BearerAuthResponse, type BeforeRegisterResult, type BothAuthResponse, BruteForceService, BymaxAuthModule, type BymaxAuthModuleOptions, type BymaxAuthRateLimitOptions, ChangePasswordDto, type ClientIpSource, CommonPasswordChecker, type CookieAuthResponse, CreateInvitationDto, type CreateUserData, type CreateWithOAuthData, CurrentUser, type DashboardJwtPayload, DefaultAuthEmailProvider, type DefaultAuthEmailProviderOptions, type DeliveryErrorPolicy, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, type HookContext, type IAuthHooks, type IEmailProvider, type IPasswordBreachChecker, type IPlatformUserRepository, IS_PUBLIC_KEY, type IUserRepository, InvitationService, type InviteData, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, type MfaChallengeResult, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, type MfaSetupResult, type MfaTempPayload, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, type OAuthLoginResult, type OAuthMfaChallengeResult, type OAuthProfile, type OAuthProviderPlugin, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, type PlatformAuthResult, PlatformAuthService, type PlatformAuthenticatedRequest, type PlatformBearerAuthResponse, type PlatformJwtPayload, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, type ResolvedOptions, type RevocableTokenPayload, Roles, RolesGuard, type RotatedTokenResult, SKIP_MFA_KEY, type SafeAuthPlatformUser, type SafeAuthUser, SelfOrAdminGuard, type SessionInfo$1 as SessionInfo, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, type UpdateMfaData, type UpdatePlatformMfaData, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsJwtGuard, WsTicketService, type WsTicketSnapshot, createAuthValidationPipe, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
8851
+ export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, type SessionInfo as ActiveSessionInfo, AllowAllBreachChecker, type AuthEmailCatalogue, type AuthEmailMessage, type AuthEmailSink, type AuthErrorCode, AuthException, AuthExceptionFilter, type AuthFieldError, type AuthModuleAsyncOptions, type AuthPlatformUser, AuthRateLimit, AuthRateLimitGuard, type AuthRateLimitWindow, type AuthResult, AuthRevocationService, AuthService, type AuthUser, Authenticated, type AuthenticatedRequest, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, type BearerAuthResponse, type BeforeRegisterResult, type BothAuthResponse, BruteForceService, BymaxAuthModule, type BymaxAuthModuleOptions, type BymaxAuthRateLimitOptions, ChangePasswordDto, type ClientIpSource, CommonPasswordChecker, type CookieAuthResponse, CreateInvitationDto, type CreateUserData, type CreateWithOAuthData, CurrentUser, type DashboardJwtPayload, DefaultAuthEmailProvider, type DefaultAuthEmailProviderOptions, type DeliveryErrorPolicy, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, type HookContext, type IAuthHooks, type IEmailProvider, type IPasswordBreachChecker, type IPlatformUserRepository, IS_PUBLIC_KEY, type IUserRepository, InvitationService, type InviteData, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, type MfaChallengeResult, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, type MfaSetupResult, type MfaTempPayload, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, type OAuthLoginResult, type OAuthMfaChallengeResult, type OAuthProfile, type OAuthProviderPlugin, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, type PlatformAuthResult, PlatformAuthService, type PlatformAuthenticatedRequest, type PlatformBearerAuthResponse, type PlatformJwtPayload, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, type ResolvedOptions, type RevocableTokenPayload, Roles, RolesGuard, type RotatedTokenResult, SKIP_MFA_KEY, type SafeAuthPlatformUser, type SafeAuthUser, SelfOrAdminGuard, type SessionInfo$1 as SessionInfo, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, type UpdateMfaData, type UpdatePlatformMfaData, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, type WsTicketSnapshot, createAuthValidationPipe, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
@@ -1684,7 +1684,7 @@ declare const AUTH_THROTTLE_CONFIGS: {
1684
1684
  readonly ttl: 60000;
1685
1685
  };
1686
1686
  };
1687
- /** DELETE /auth/sessions/all — 5 requests per minute per IP. */
1687
+ /** POST /auth/sessions/revoke-all — 5 requests per minute per IP. */
1688
1688
  readonly revokeAllSessions: {
1689
1689
  readonly default: {
1690
1690
  readonly limit: 5;
@@ -5155,8 +5155,25 @@ declare class WsJwtGuard implements CanActivate, OnModuleInit {
5155
5155
  * stack detail or a connection string reaches a response body, so the answer carries the
5156
5156
  * generic code and nothing else.
5157
5157
  *
5158
+ * **Do not register this alongside `@bymax-one/nest-core`'s envelope filter.** They are mutually
5159
+ * exclusive in practice and this one wins: `useGlobalFilters` binds ahead of an `APP_FILTER`
5160
+ * provider, and `@Catch()` with no argument catches everything, so nest-core's filter never runs.
5161
+ * Measured on a composed application — the same request answers
5162
+ * `{error: {code, message, details}}` with this filter registered and the flat
5163
+ * `{statusCode, code, message, timestamp, path, details}` without it. A derived backend that
5164
+ * registers both therefore loses `statusCode`, `timestamp`, `path` and the correlation id, which
5165
+ * is the opposite of what registering an extra filter looks like it should do.
5166
+ *
5167
+ * Pick one. On a backend built on nest-core, take theirs: it already recognises this library's
5168
+ * envelope and passes the code, message and per-field details through unchanged.
5169
+ *
5170
+ * Nothing in this repository asserts that, and deliberately so — verifying it would mean this
5171
+ * library depending on a consumer's stack. The behaviour above was measured once and the
5172
+ * dependency removed; the standing assertion belongs to whoever composes the two.
5173
+ *
5158
5174
  * @example
5159
5175
  * ```typescript
5176
+ * // Only when nest-core's envelope filter is NOT in the application.
5160
5177
  * app.useGlobalFilters(new AuthExceptionFilter())
5161
5178
  * ```
5162
5179
  *
@@ -5173,6 +5190,59 @@ declare class AuthExceptionFilter implements ExceptionFilter {
5173
5190
  catch(exception: unknown, host: ArgumentsHost): void;
5174
5191
  }
5175
5192
 
5193
+ /**
5194
+ * Gives a refused WebSocket client the library's error envelope instead of a generic failure.
5195
+ *
5196
+ * Register it on a gateway that applies {@link WsJwtGuard}. Without it, the guard's refusals do
5197
+ * not survive the transport: `AuthException` extends `HttpException`, Nest's WebSocket exception
5198
+ * layer understands only `WsException`, and everything else is delivered as
5199
+ * `{status: 'error', message: 'Internal server error'}` — so the whole `auth.*` catalogue stops
5200
+ * at the socket boundary.
5201
+ *
5202
+ * That is not only untidy. A client cannot tell a dead credential from a crashed handler, and a
5203
+ * reconnect policy has to choose: retrying an unknown error is the sensible default, so every
5204
+ * expired token becomes a reconnect loop against an endpoint that will refuse it forever. With
5205
+ * this filter the client reads `error.code` and can send the user to sign in instead.
5206
+ *
5207
+ * The payload keeps `status: 'error'` — the field Nest's own layer sets and every socket.io
5208
+ * client already branches on — and adds the envelope beside it, so a consumer handling both
5209
+ * shapes does not need a second listener:
5210
+ *
5211
+ * ```
5212
+ * without { status: 'error', message: 'Internal server error' }
5213
+ * with { status: 'error', error: { code: 'auth.token_invalid', message, details } }
5214
+ * ```
5215
+ *
5216
+ * **Scoped to `AuthException` on purpose.** An argument-less `@Catch()` would claim every
5217
+ * exception a gateway raises, so a `WsException` an unrelated handler throws — a domain error
5218
+ * with its own contract — would be rewritten as `auth.internal`, and following the README would
5219
+ * silently break a consumer's existing WebSocket errors. Everything that is not this library's
5220
+ * refusal keeps travelling through Nest's own exception layer.
5221
+ *
5222
+ * **Both transports.** A Socket.IO client is dispatched to with `emit`; a native `ws` client —
5223
+ * which also extends `EventEmitter`, so emitting on it succeeds and sends NOTHING — is written
5224
+ * to with `send`, in the `{event, data}` envelope `@nestjs/platform-ws` uses for every other
5225
+ * message. Both are driven over a real handshake in `test/e2e/ws-guard.e2e-spec.ts`.
5226
+ *
5227
+ * @example
5228
+ * ```typescript
5229
+ * @UseFilters(new WsAuthExceptionFilter())
5230
+ * @UseGuards(WsJwtGuard)
5231
+ * @WebSocketGateway()
5232
+ * export class FeedGateway { ... }
5233
+ * ```
5234
+ */
5235
+ declare class WsAuthExceptionFilter implements ExceptionFilter {
5236
+ private readonly logger;
5237
+ /**
5238
+ * Delivers the library envelope to the client whose request was refused.
5239
+ *
5240
+ * @param exception - The `AuthException` a guard, pipe or handler raised.
5241
+ * @param host - The arguments host, used to reach the connected client.
5242
+ */
5243
+ catch(exception: AuthException, host: ArgumentsHost): void;
5244
+ }
5245
+
5176
5246
  /**
5177
5247
  * @fileoverview The validation pipe every auth controller mounts.
5178
5248
  *
@@ -5816,6 +5886,23 @@ declare class ChangePasswordDto {
5816
5886
  * Hashed immediately by the service layer — never persisted in plaintext.
5817
5887
  */
5818
5888
  newPassword: string;
5889
+ /**
5890
+ * The caller's own refresh token, so the device making the change stays signed in.
5891
+ *
5892
+ * Declared because the handler reads it. `TokenDeliveryService.extractRefreshToken` takes it
5893
+ * from the refresh cookie under `tokenDelivery: 'cookie'` and from **this body field** under
5894
+ * `'bearer'`, cookie-first-then-body under `'both'` — and the controller pipe runs
5895
+ * `forbidNonWhitelisted: true`, so an undeclared property is refused. A bearer-mode caller
5896
+ * therefore could not send the field the endpoint needs: the request was answered
5897
+ * `auth.validation` naming `refreshToken`, and the only way to change a password was to give
5898
+ * up every other session.
5899
+ *
5900
+ * It stayed invisible because the E2E harness installed a global `ValidationPipe` with
5901
+ * `whitelist: true`, which STRIPPED the property before the controller's own pipe could refuse
5902
+ * it — so the suite exercised a request production never sees. Optional, because under cookie
5903
+ * delivery the credential arrives in the cookie and no body field exists to declare.
5904
+ */
5905
+ refreshToken?: string;
5819
5906
  }
5820
5907
 
5821
5908
  /**
@@ -6737,7 +6824,21 @@ declare class TokenManagerService {
6737
6824
  * The `status` claim in the issued access token is intentionally empty during
6738
6825
  * rotation — the Redis session does not store full user data. Guards that enforce
6739
6826
  * status checks must read from the user repository or a status cache, not the
6740
- * JWT `status` claim.
6827
+ * JWT `status` claim. `rust-auth` stamps the same empty string at the same point, with a
6828
+ * test pinning it, so this is a shared contract rather than a local shortcut.
6829
+ *
6830
+ * **What that means for a consumer, which is where the cost lands.** `issueTokens` stamps the
6831
+ * account's value at that moment, this path stamps nothing, and `AuthService.refresh` re-stamps
6832
+ * it from the account when `role`, `tenantId` or `mfaEnabled` changed — so a session's tokens
6833
+ * carry a populated claim, then an empty one, then possibly a populated one again, with no
6834
+ * signal a client can read. A derived backend reading `request.user.status` is wrong in both
6835
+ * directions: `!== 'active'` refuses everyone whose session refreshed ordinarily, and
6836
+ * `=== 'suspended'` refuses nobody, ever.
6837
+ *
6838
+ * Backfilling it here would be worse than leaving it empty: the claim would become *usually*
6839
+ * true, which is the failure mode that survives testing, since status can still change under an
6840
+ * unexpired token. The claim cannot be authoritative, so it is not made to look like it — and
6841
+ * the empty string is the one state that cannot be mistaken for an answer.
6741
6842
  *
6742
6843
  * `mfaVerified` is always `false` after rotation because the Redis session does not
6743
6844
  * persist MFA verification state. A user who authenticated with MFA will lose the
@@ -6878,10 +6979,9 @@ declare class TokenManagerService {
6878
6979
  * @param token - The MFA temp JWT issued by {@link issueMfaTempToken}.
6879
6980
  * @returns The `userId`, `context`, and `jti` from the token. Pass the
6880
6981
  * `jti` to {@link consumeMfaTempToken} after TOTP validation succeeds.
6881
- * @throws {@link AuthException} with `MFA_TEMP_TOKEN_INVALID` if the
6882
- * Redis entry is missing (already consumed, expired, or never issued).
6883
- * @throws {Error} When JWT signature or expiry validation fails (propagated
6884
- * directly from `JwtService.verify()` — not wrapped in {@link AuthException}).
6982
+ * @throws {@link AuthException} with `MFA_TEMP_TOKEN_INVALID` for every way the token can be
6983
+ * unusable — a bad signature, an expired one, a shape no secret accepts, or a missing Redis
6984
+ * entry (already consumed, expired, or never issued).
6885
6985
  */
6886
6986
  verifyMfaTempToken(token: string): Promise<{
6887
6987
  userId: string;
@@ -8748,4 +8848,4 @@ declare function AuthRateLimit(config: {
8748
8848
  default: AuthRateLimitWindow;
8749
8849
  }): MethodDecorator;
8750
8850
 
8751
- export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, type SessionInfo as ActiveSessionInfo, AllowAllBreachChecker, type AuthEmailCatalogue, type AuthEmailMessage, type AuthEmailSink, type AuthErrorCode, AuthException, AuthExceptionFilter, type AuthFieldError, type AuthModuleAsyncOptions, type AuthPlatformUser, AuthRateLimit, AuthRateLimitGuard, type AuthRateLimitWindow, type AuthResult, AuthRevocationService, AuthService, type AuthUser, Authenticated, type AuthenticatedRequest, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, type BearerAuthResponse, type BeforeRegisterResult, type BothAuthResponse, BruteForceService, BymaxAuthModule, type BymaxAuthModuleOptions, type BymaxAuthRateLimitOptions, ChangePasswordDto, type ClientIpSource, CommonPasswordChecker, type CookieAuthResponse, CreateInvitationDto, type CreateUserData, type CreateWithOAuthData, CurrentUser, type DashboardJwtPayload, DefaultAuthEmailProvider, type DefaultAuthEmailProviderOptions, type DeliveryErrorPolicy, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, type HookContext, type IAuthHooks, type IEmailProvider, type IPasswordBreachChecker, type IPlatformUserRepository, IS_PUBLIC_KEY, type IUserRepository, InvitationService, type InviteData, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, type MfaChallengeResult, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, type MfaSetupResult, type MfaTempPayload, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, type OAuthLoginResult, type OAuthMfaChallengeResult, type OAuthProfile, type OAuthProviderPlugin, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, type PlatformAuthResult, PlatformAuthService, type PlatformAuthenticatedRequest, type PlatformBearerAuthResponse, type PlatformJwtPayload, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, type ResolvedOptions, type RevocableTokenPayload, Roles, RolesGuard, type RotatedTokenResult, SKIP_MFA_KEY, type SafeAuthPlatformUser, type SafeAuthUser, SelfOrAdminGuard, type SessionInfo$1 as SessionInfo, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, type UpdateMfaData, type UpdatePlatformMfaData, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsJwtGuard, WsTicketService, type WsTicketSnapshot, createAuthValidationPipe, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
8851
+ export { AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, type SessionInfo as ActiveSessionInfo, AllowAllBreachChecker, type AuthEmailCatalogue, type AuthEmailMessage, type AuthEmailSink, type AuthErrorCode, AuthException, AuthExceptionFilter, type AuthFieldError, type AuthModuleAsyncOptions, type AuthPlatformUser, AuthRateLimit, AuthRateLimitGuard, type AuthRateLimitWindow, type AuthResult, AuthRevocationService, AuthService, type AuthUser, Authenticated, type AuthenticatedRequest, BYMAX_AUTH_BREACH_CHECKER, BYMAX_AUTH_EMAIL_PROVIDER, BYMAX_AUTH_HOOKS, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, type BearerAuthResponse, type BeforeRegisterResult, type BothAuthResponse, BruteForceService, BymaxAuthModule, type BymaxAuthModuleOptions, type BymaxAuthRateLimitOptions, ChangePasswordDto, type ClientIpSource, CommonPasswordChecker, type CookieAuthResponse, CreateInvitationDto, type CreateUserData, type CreateWithOAuthData, CurrentUser, type DashboardJwtPayload, DefaultAuthEmailProvider, type DefaultAuthEmailProviderOptions, type DeliveryErrorPolicy, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, type HookContext, type IAuthHooks, type IEmailProvider, type IPasswordBreachChecker, type IPlatformUserRepository, IS_PUBLIC_KEY, type IUserRepository, InvitationService, type InviteData, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, type MfaChallengeResult, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, type MfaSetupResult, type MfaTempPayload, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, type OAuthLoginResult, type OAuthMfaChallengeResult, type OAuthProfile, type OAuthProviderPlugin, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, type PlatformAuthResult, PlatformAuthService, type PlatformAuthenticatedRequest, type PlatformBearerAuthResponse, type PlatformJwtPayload, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, type ResolvedOptions, type RevocableTokenPayload, Roles, RolesGuard, type RotatedTokenResult, SKIP_MFA_KEY, type SafeAuthPlatformUser, type SafeAuthUser, SelfOrAdminGuard, type SessionInfo$1 as SessionInfo, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, type UpdateMfaData, type UpdatePlatformMfaData, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, type WsTicketSnapshot, createAuthValidationPipe, decrypt, encrypt, generateSecureToken, hasRole, hmacSha256, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };