@bymax-one/nest-auth 1.4.16 → 1.4.18
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 +126 -1
- package/dist/server/index.cjs +1061 -726
- package/dist/server/index.d.cts +182 -16
- package/dist/server/index.d.ts +182 -16
- package/dist/server/index.mjs +1062 -728
- package/package.json +3 -1
package/dist/server/index.d.cts
CHANGED
|
@@ -772,6 +772,10 @@ interface BymaxAuthModuleOptions {
|
|
|
772
772
|
* @remarks
|
|
773
773
|
* Set this explicitly to `true` in a non-production environment that is nonetheless served
|
|
774
774
|
* over HTTPS, so the cookies are marked `Secure` there too.
|
|
775
|
+
*
|
|
776
|
+
* `false` is refused at startup unless {@link BymaxAuthModuleOptions.environment} is
|
|
777
|
+
* `'development'` or `'test'`: a session cookie without `Secure` travels over plain HTTP, and a
|
|
778
|
+
* TLS-terminating proxy does not change that for the browser's side of the connection.
|
|
775
779
|
*/
|
|
776
780
|
secureCookies?: boolean;
|
|
777
781
|
/**
|
|
@@ -5675,6 +5679,41 @@ declare class AuthRateLimitGuard implements CanActivate {
|
|
|
5675
5679
|
private clientIp;
|
|
5676
5680
|
}
|
|
5677
5681
|
|
|
5682
|
+
/**
|
|
5683
|
+
* Answers `415` for a request carrying a `Content-Encoding` other than `identity`.
|
|
5684
|
+
*
|
|
5685
|
+
* @remarks
|
|
5686
|
+
* Whether a compressed request body is decompressed is the host's body parser's decision, not the
|
|
5687
|
+
* library's: Express's default inflates `gzip`, `deflate` and `br`, a host that sets
|
|
5688
|
+
* `inflate: false` refuses them, and a framework that does not decode accepts nothing. The
|
|
5689
|
+
* contract the library shares with its sibling is the stricter one, and a library that relies on
|
|
5690
|
+
* host configuration for it holds that contract only where the host happened to set it. So the
|
|
5691
|
+
* refusal is made here, before any handler.
|
|
5692
|
+
*
|
|
5693
|
+
* Auth payloads are a few hundred bytes and browsers do not compress request bodies, so nothing
|
|
5694
|
+
* legitimate is lost. The parser has already decompressed the body by the time a guard runs, and
|
|
5695
|
+
* its size limit counts decompressed bytes, so the work this guard declines to do is bounded by
|
|
5696
|
+
* that limit either way; the refusal is for the contract, with the parser-level `inflate: false`
|
|
5697
|
+
* refusing earlier on a host that sets it.
|
|
5698
|
+
*
|
|
5699
|
+
* The answer is an `HttpException` whose body already is the library's error envelope. The
|
|
5700
|
+
* optional `AuthExceptionFilter` passes such a body through untouched and, without it, Nest
|
|
5701
|
+
* serialises the same object, so the response is identical either way. It is not an
|
|
5702
|
+
* `AuthException` because the status of `auth.validation` in the error catalog is `400`, one
|
|
5703
|
+
* status per code.
|
|
5704
|
+
*/
|
|
5705
|
+
declare class RequestEncodingGuard implements CanActivate {
|
|
5706
|
+
private readonly reflector;
|
|
5707
|
+
constructor(reflector: Reflector);
|
|
5708
|
+
/**
|
|
5709
|
+
* @param context - The execution context of the request.
|
|
5710
|
+
* @returns `true` when the route does not check, the request declares no encoding or only
|
|
5711
|
+
* `identity`, or the route checks only requests with a body and this one has none.
|
|
5712
|
+
* @throws {@link HttpException} `415` in the `auth.validation` envelope otherwise.
|
|
5713
|
+
*/
|
|
5714
|
+
canActivate(context: ExecutionContext): boolean;
|
|
5715
|
+
}
|
|
5716
|
+
|
|
5678
5717
|
/**
|
|
5679
5718
|
* Blocks a cross-site request that would otherwise be authenticated by the browser's ambient
|
|
5680
5719
|
* session cookie.
|
|
@@ -6069,6 +6108,11 @@ declare class WsJwtGuard implements CanActivate, OnModuleInit {
|
|
|
6069
6108
|
* stack detail or a connection string reaches a response body, so the answer carries the
|
|
6070
6109
|
* generic code and nothing else.
|
|
6071
6110
|
*
|
|
6111
|
+
* Requests the HTTP layer refused before any route ran — a malformed body, an oversized one, an
|
|
6112
|
+
* unsupported charset or content-encoding — answer `auth.validation` with a fixed message and the
|
|
6113
|
+
* status the transport reported, never the parser's text. Express only: the filter writes through
|
|
6114
|
+
* Express's `Response` and reads `req.route`, so its behaviour on another adapter is not defined.
|
|
6115
|
+
*
|
|
6072
6116
|
* **Do not register this alongside `@bymax-one/nest-core`'s envelope filter.** They are mutually
|
|
6073
6117
|
* exclusive in practice and this one wins: `useGlobalFilters` binds ahead of an `APP_FILTER`
|
|
6074
6118
|
* provider, and `@Catch()` with no argument catches everything, so nest-core's filter never runs.
|
|
@@ -6298,6 +6342,33 @@ declare const IS_PUBLIC_KEY: unique symbol;
|
|
|
6298
6342
|
*/
|
|
6299
6343
|
declare const Public: () => MethodDecorator & ClassDecorator;
|
|
6300
6344
|
|
|
6345
|
+
/**
|
|
6346
|
+
* How a route treats a request whose `Content-Encoding` is not `identity`.
|
|
6347
|
+
*
|
|
6348
|
+
* - `'unchecked'`: never refused. The routes that take no JSON body to decode (refresh, logout,
|
|
6349
|
+
* revoke-all, a ticket request) and that the shared contract leaves unchecked.
|
|
6350
|
+
* - `'when-body'`: refused only when the request carries a body. The MFA setup routes take an
|
|
6351
|
+
* optional body, and an empty one takes the default.
|
|
6352
|
+
*
|
|
6353
|
+
* A route with no policy is strict: every non-`identity` encoding is refused, so a route added
|
|
6354
|
+
* later is checked unless someone says it should not be.
|
|
6355
|
+
*/
|
|
6356
|
+
type RequestEncodingPolicy = 'unchecked' | 'when-body';
|
|
6357
|
+
/**
|
|
6358
|
+
* Sets how strictly {@link RequestEncodingGuard} checks the route's `Content-Encoding`.
|
|
6359
|
+
*
|
|
6360
|
+
* @param policy - See {@link RequestEncodingPolicy}.
|
|
6361
|
+
* @returns A method decorator.
|
|
6362
|
+
*
|
|
6363
|
+
* @example
|
|
6364
|
+
* ```typescript
|
|
6365
|
+
* @RequestEncoding('unchecked')
|
|
6366
|
+
* @Post('refresh')
|
|
6367
|
+
* refresh() { ... }
|
|
6368
|
+
* ```
|
|
6369
|
+
*/
|
|
6370
|
+
declare const RequestEncoding: (policy: RequestEncodingPolicy) => MethodDecorator;
|
|
6371
|
+
|
|
6301
6372
|
/**
|
|
6302
6373
|
* Metadata key used by {@link RolesGuard} to read the required roles for a route.
|
|
6303
6374
|
*
|
|
@@ -7494,13 +7565,30 @@ declare class SessionService {
|
|
|
7494
7565
|
* Refuses a session hash that names no live session of this user.
|
|
7495
7566
|
*
|
|
7496
7567
|
* For an operation that keeps one session and ends the rest and so has to be told which one,
|
|
7497
|
-
* checked before it changes anything. The membership test is the
|
|
7498
|
-
*
|
|
7568
|
+
* checked before it changes anything. The membership test is the one {@link resolveLiveSession}
|
|
7569
|
+
* applies, so a token that has just rotated is accepted here exactly as it is there.
|
|
7499
7570
|
*
|
|
7500
7571
|
* @param params - See {@link LiveSessionParams}.
|
|
7501
7572
|
* @throws {@link AuthException} `SESSION_NOT_FOUND` when the hash is not a live session.
|
|
7502
7573
|
*/
|
|
7503
|
-
assertLiveSession(
|
|
7574
|
+
assertLiveSession(params: LiveSessionParams): Promise<void>;
|
|
7575
|
+
/**
|
|
7576
|
+
* Names the live session a presented refresh-token hash stands for.
|
|
7577
|
+
*
|
|
7578
|
+
* The hash itself when it is a live session. When it is a token that rotated away moments ago,
|
|
7579
|
+
* the session the rotation produced: the rotation grace pointer `rp:{hash}` names that successor,
|
|
7580
|
+
* and the presented token still identifies the same device. A request that carries a refresh
|
|
7581
|
+
* token can lose a race to a refresh of the same session, and an operation that must keep "the
|
|
7582
|
+
* caller's session" would otherwise refuse the caller for having been refreshed. The pointer is
|
|
7583
|
+
* read, never consumed, and the successor has to be live in the index too, so a pointer left
|
|
7584
|
+
* behind by a session that was since revoked names nothing.
|
|
7585
|
+
*
|
|
7586
|
+
* @param params - See {@link LiveSessionParams}.
|
|
7587
|
+
* @returns The hash of the live session to keep: `sessionHash`, or its live successor.
|
|
7588
|
+
* @throws {@link AuthException} `SESSION_NOT_FOUND` when the hash is neither a live session nor
|
|
7589
|
+
* the predecessor of one.
|
|
7590
|
+
*/
|
|
7591
|
+
resolveLiveSession({ userId, tenantId, sessionHash }: LiveSessionParams): Promise<string>;
|
|
7504
7592
|
/**
|
|
7505
7593
|
* Revokes all sessions for a user except the caller's current session.
|
|
7506
7594
|
*
|
|
@@ -7585,11 +7673,20 @@ declare class SessionService {
|
|
|
7585
7673
|
*/
|
|
7586
7674
|
private assertValidSessionHash;
|
|
7587
7675
|
/**
|
|
7588
|
-
*
|
|
7676
|
+
* The hash of the live refresh session `sessionHash` stands for within `members`.
|
|
7589
7677
|
*
|
|
7590
7678
|
* @throws {@link AuthException} `SESSION_NOT_FOUND`.
|
|
7591
7679
|
*/
|
|
7592
|
-
private
|
|
7680
|
+
private resolveLiveMember;
|
|
7681
|
+
/** Whether `members` holds a live refresh session with this hash. */
|
|
7682
|
+
private isLiveMember;
|
|
7683
|
+
/**
|
|
7684
|
+
* The successor hash a rotation grace pointer names, or `undefined` when there is none.
|
|
7685
|
+
*
|
|
7686
|
+
* The pointer's value is `{successorHash}:{record}`, split on the first colon exactly as the
|
|
7687
|
+
* rotation script writes it.
|
|
7688
|
+
*/
|
|
7689
|
+
private graceSuccessor;
|
|
7593
7690
|
/**
|
|
7594
7691
|
* The Redis key of this user's session index.
|
|
7595
7692
|
*
|
|
@@ -7626,6 +7723,15 @@ declare class SessionService {
|
|
|
7626
7723
|
* @param userAgent - User-Agent string (forwarded to the `onSessionEvicted` hook context).
|
|
7627
7724
|
*/
|
|
7628
7725
|
private enforceSessionLimit;
|
|
7726
|
+
/**
|
|
7727
|
+
* The creation time of a session, for ranking sessions by age.
|
|
7728
|
+
*
|
|
7729
|
+
* An absent record and one that is not a detail record both rank as `0`, the oldest: a state the
|
|
7730
|
+
* store reported, not a fault. A read the store fails propagates, because no age can be named.
|
|
7731
|
+
*
|
|
7732
|
+
* @param memberHash - SHA-256 hash of the session's refresh token.
|
|
7733
|
+
*/
|
|
7734
|
+
private readCreatedAt;
|
|
7629
7735
|
/**
|
|
7630
7736
|
* Resolves the maximum number of concurrent sessions allowed for a user.
|
|
7631
7737
|
*
|
|
@@ -8283,6 +8389,37 @@ declare class AuthService {
|
|
|
8283
8389
|
* matched the presented refresh token (already logged out, or expired).
|
|
8284
8390
|
*/
|
|
8285
8391
|
logout(accessToken: string, rawRefreshToken: string): Promise<string>;
|
|
8392
|
+
/**
|
|
8393
|
+
* The access-token blacklist write for a logout, or none when there is nothing to revoke.
|
|
8394
|
+
*
|
|
8395
|
+
* Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
|
|
8396
|
+
* forged one must not blacklist an id it does not own. Only the verification is tolerant.
|
|
8397
|
+
*
|
|
8398
|
+
* @param accessToken - Raw access token; absent, malformed or expired yields no write.
|
|
8399
|
+
* @returns The writes to hand to `settleWrites`.
|
|
8400
|
+
*/
|
|
8401
|
+
private blacklistWrites;
|
|
8402
|
+
/**
|
|
8403
|
+
* Cleans up the session's metadata through `SessionService.revokeSession()`.
|
|
8404
|
+
*
|
|
8405
|
+
* It performs an atomic SISMEMBER ownership check before deleting `sd:{hash}` and SREMing from
|
|
8406
|
+
* `sess:{userId}`. The `rt:{hash}` DEL already ran — revokeSession's internal DEL is a no-op
|
|
8407
|
+
* (Redis DEL is idempotent when the key is absent). SESSION_NOT_FOUND means the session was
|
|
8408
|
+
* evicted, already revoked, or the refresh token does not belong to this user — in all cases
|
|
8409
|
+
* authentication is already invalidated.
|
|
8410
|
+
*
|
|
8411
|
+
* The tenant is REQUIRED to name the index, and it comes off the record rather than from the
|
|
8412
|
+
* caller. A record without one is a pre-upgrade write: the contract lists `tenantId` among the
|
|
8413
|
+
* refresh session's fields, so a live record always has it. Skipping the call is the honest end
|
|
8414
|
+
* for one that does not — `rt:{hash}` is already deleted, so the session is dead either way, and
|
|
8415
|
+
* guessing a tenant would name an index belonging to nobody while reading like a revocation that
|
|
8416
|
+
* happened.
|
|
8417
|
+
*
|
|
8418
|
+
* @param userId - The owner, empty when none is known.
|
|
8419
|
+
* @param tenantId - The owner's tenant, absent when the record carried none.
|
|
8420
|
+
* @param sessionHash - The SHA-256 of the raw refresh token.
|
|
8421
|
+
*/
|
|
8422
|
+
private revokeSessionMetadata;
|
|
8286
8423
|
/**
|
|
8287
8424
|
* Announces a completed logout, the only hook `AuthService.logout` emits.
|
|
8288
8425
|
*
|
|
@@ -8814,10 +8951,16 @@ declare class MfaService {
|
|
|
8814
8951
|
* Detached from the challenge it follows: the user is already authenticated and the retired
|
|
8815
8952
|
* key still opens the secret, so a failure here costs the migration and nothing else.
|
|
8816
8953
|
*
|
|
8954
|
+
* The write replaces the whole MFA record, so it runs as a serialized transition and lands only
|
|
8955
|
+
* on a record that still holds this secret. One that no longer does was disabled or re-enrolled
|
|
8956
|
+
* since, and writing the re-encrypted old secret over it would restore a factor the user removed
|
|
8957
|
+
* and unspend the recovery codes they replaced. The comparison is on the decrypted secret, not
|
|
8958
|
+
* the ciphertext: a sibling challenge that only re-encrypted the same secret changes the
|
|
8959
|
+
* ciphertext and nothing else, and must not be mistaken for a re-enrolment.
|
|
8960
|
+
*
|
|
8817
8961
|
* @param userId - The account whose stored secret is being re-encrypted.
|
|
8818
8962
|
* @param context - Which identity plane the account belongs to.
|
|
8819
8963
|
* @param secretBase32 - The decrypted secret.
|
|
8820
|
-
* @param recoveryCodes - The stored recovery digests, written back unchanged.
|
|
8821
8964
|
* @param tenantId - The tenant the account belongs to, so the write is scoped like the read.
|
|
8822
8965
|
*/
|
|
8823
8966
|
private reencryptSecret;
|
|
@@ -8859,6 +9002,13 @@ declare class MfaService {
|
|
|
8859
9002
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
8860
9003
|
*/
|
|
8861
9004
|
private transitionMfaRecord;
|
|
9005
|
+
/**
|
|
9006
|
+
* Whether `stored` decrypts, under the current or a retired key, to `secretBase32`.
|
|
9007
|
+
*
|
|
9008
|
+
* Compares plaintext, so a record that was only re-encrypted still matches and one holding a
|
|
9009
|
+
* different secret does not. A ciphertext no key opens does not match either.
|
|
9010
|
+
*/
|
|
9011
|
+
private holdsSecret;
|
|
8862
9012
|
/**
|
|
8863
9013
|
* Encrypts a TOTP secret for storage in the database using AES-256-GCM.
|
|
8864
9014
|
*/
|
|
@@ -9779,16 +9929,20 @@ declare class PasswordResetService {
|
|
|
9779
9929
|
* the configured breach checker.
|
|
9780
9930
|
*/
|
|
9781
9931
|
changePassword(userId: string, tenantId: string, dto: ChangePasswordDto, currentRefreshToken?: string): Promise<void>;
|
|
9782
|
-
/** Refuses a presented refresh token that names no live session of the account. */
|
|
9783
|
-
private requireLiveCurrentSession;
|
|
9784
9932
|
/**
|
|
9785
|
-
*
|
|
9933
|
+
* The hash of the live session a presented refresh token stands for, or `undefined` when the
|
|
9934
|
+
* request carried none. Refuses a token that names no live session of the account; a token that
|
|
9935
|
+
* rotated away while the password was being verified stands for the session that replaced it.
|
|
9936
|
+
*/
|
|
9937
|
+
private resolveCurrentSession;
|
|
9938
|
+
/**
|
|
9939
|
+
* Ends every session but the one to keep, once the new password is already written.
|
|
9786
9940
|
*
|
|
9787
|
-
* With no
|
|
9788
|
-
*
|
|
9789
|
-
* no current session left to
|
|
9790
|
-
* change safe is never aborted by the session it was told to spare. Any other failure of
|
|
9791
|
-
* sweep propagates.
|
|
9941
|
+
* With no session to keep every session ends. A kept session can rotate away while the new
|
|
9942
|
+
* password is hashed; the sweep follows it to its successor, and when it cannot be followed
|
|
9943
|
+
* there is no current session left to spare, so every session ends and the cleanup that makes
|
|
9944
|
+
* the change safe is never aborted by the session it was told to spare. Any other failure of
|
|
9945
|
+
* the sweep propagates.
|
|
9792
9946
|
*/
|
|
9793
9947
|
private endOtherSessions;
|
|
9794
9948
|
/** Ends every session the account has and advances its token epoch. */
|
|
@@ -9919,6 +10073,18 @@ declare class PlatformAuthService {
|
|
|
9919
10073
|
* @param rawRefreshToken - The raw opaque platform refresh token.
|
|
9920
10074
|
*/
|
|
9921
10075
|
logout(accessToken: string, rawRefreshToken: string): Promise<string>;
|
|
10076
|
+
/**
|
|
10077
|
+
* The access-token blacklist write for a platform logout, or none when there is nothing to
|
|
10078
|
+
* revoke.
|
|
10079
|
+
*
|
|
10080
|
+
* Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
|
|
10081
|
+
* forged one must not be able to blacklist an id it does not own. Only the verification is
|
|
10082
|
+
* tolerant: a token nobody can verify has nothing to blacklist, but a refused write is not.
|
|
10083
|
+
*
|
|
10084
|
+
* @param accessToken - Raw platform access token; absent, malformed or expired yields no write.
|
|
10085
|
+
* @returns The writes to hand to `settleWrites`.
|
|
10086
|
+
*/
|
|
10087
|
+
private blacklistWrites;
|
|
9922
10088
|
/**
|
|
9923
10089
|
* Announces a completed platform logout, the only hook `PlatformAuthService` emits.
|
|
9924
10090
|
*
|
|
@@ -11039,5 +11205,5 @@ declare class ApiKeyService {
|
|
|
11039
11205
|
private validatedExpiry;
|
|
11040
11206
|
}
|
|
11041
11207
|
|
|
11042
|
-
export { API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, 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, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, authDocumentSecurity, createAuthValidationPipe, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|
|
11043
|
-
export type { ApiKeyAccessEvent, ApiKeyClock, ApiKeyDenyReason, ApiKeyPrincipal, AuthApiKey, AuthApiKeySummary, AuthDocumentSecurityParams, AuthEmailCatalogue, AuthEmailContext, AuthEmailKind, AuthEmailMessage, AuthEmailSink, AuthErrorCode, AuthFieldError, AuthGuardFamily, AuthModuleAsyncOptions, AuthPlane, AuthPlatformUser, AuthRateLimitWindow, AuthResult, AuthUser, AuthenticatedRequest, BearerAuthResponse, BeforeRegisterResult, BothAuthResponse, BymaxAuthModuleOptions, BymaxAuthRateLimitOptions, ClientIpSource, CookieAuthResponse, CreateSessionParams, CreateUserData, CreateWithOAuthData, DashboardJwtPayload, DefaultAuthEmailProviderOptions, DeliveryErrorPolicy, DeliveryErrorPolicyMap, FindUserByEmailParams, FindUserByOAuthIdParams, HookContext, IApiKeyRepository, IAuthHooks, IEmailProvider, IPasswordBreachChecker, IPlatformUserRepository, IUserRepository, InviteData, IssueApiKeyInput, IssuedApiKey, LinkOAuthParams, ListSessionsParams, LiveSessionParams, MfaChallengeResult, MfaSetupResult, MfaTempPayload, OAuthLoginResult, OAuthMfaChallengeResult, OAuthProfile, OAuthProviderPlugin, OpenApiSecurityRequirement, PlatformAuthResult, PlatformAuthenticatedRequest, PlatformBearerAuthResponse, PlatformJwtPayload, ResolvedOptions, RevocableTokenPayload, RevokeAllExceptCurrentParams, RevokeAllSessionsParams, RevokeSessionParams, RotateApiKeyInput, RotatedTokenResult, SafeAuthPlatformUser, SafeAuthUser, SessionAlertInfo, SessionInfo, TenantResolverRequest, TenantScopedUserRef, UpdateEmailParams, UpdateEmailVerifiedParams, UpdateMfaData, UpdateMfaParams, UpdatePasswordParams, UpdatePlatformMfaData, UpdateStatusParams, VerifiedAccessToken, VerifyAccessTokenOptions, WsTicketSnapshot };
|
|
11208
|
+
export { API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, 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, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, authDocumentSecurity, createAuthValidationPipe, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|
|
11209
|
+
export type { ApiKeyAccessEvent, ApiKeyClock, ApiKeyDenyReason, ApiKeyPrincipal, AuthApiKey, AuthApiKeySummary, AuthDocumentSecurityParams, AuthEmailCatalogue, AuthEmailContext, AuthEmailKind, AuthEmailMessage, AuthEmailSink, AuthErrorCode, AuthFieldError, AuthGuardFamily, AuthModuleAsyncOptions, AuthPlane, AuthPlatformUser, AuthRateLimitWindow, AuthResult, AuthUser, AuthenticatedRequest, BearerAuthResponse, BeforeRegisterResult, BothAuthResponse, BymaxAuthModuleOptions, BymaxAuthRateLimitOptions, ClientIpSource, CookieAuthResponse, CreateSessionParams, CreateUserData, CreateWithOAuthData, DashboardJwtPayload, DefaultAuthEmailProviderOptions, DeliveryErrorPolicy, DeliveryErrorPolicyMap, FindUserByEmailParams, FindUserByOAuthIdParams, HookContext, IApiKeyRepository, IAuthHooks, IEmailProvider, IPasswordBreachChecker, IPlatformUserRepository, IUserRepository, InviteData, IssueApiKeyInput, IssuedApiKey, LinkOAuthParams, ListSessionsParams, LiveSessionParams, MfaChallengeResult, MfaSetupResult, MfaTempPayload, OAuthLoginResult, OAuthMfaChallengeResult, OAuthProfile, OAuthProviderPlugin, OpenApiSecurityRequirement, PlatformAuthResult, PlatformAuthenticatedRequest, PlatformBearerAuthResponse, PlatformJwtPayload, RequestEncodingPolicy, ResolvedOptions, RevocableTokenPayload, RevokeAllExceptCurrentParams, RevokeAllSessionsParams, RevokeSessionParams, RotateApiKeyInput, RotatedTokenResult, SafeAuthPlatformUser, SafeAuthUser, SessionAlertInfo, SessionInfo, TenantResolverRequest, TenantScopedUserRef, UpdateEmailParams, UpdateEmailVerifiedParams, UpdateMfaData, UpdateMfaParams, UpdatePasswordParams, UpdatePlatformMfaData, UpdateStatusParams, VerifiedAccessToken, VerifyAccessTokenOptions, WsTicketSnapshot };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -772,6 +772,10 @@ interface BymaxAuthModuleOptions {
|
|
|
772
772
|
* @remarks
|
|
773
773
|
* Set this explicitly to `true` in a non-production environment that is nonetheless served
|
|
774
774
|
* over HTTPS, so the cookies are marked `Secure` there too.
|
|
775
|
+
*
|
|
776
|
+
* `false` is refused at startup unless {@link BymaxAuthModuleOptions.environment} is
|
|
777
|
+
* `'development'` or `'test'`: a session cookie without `Secure` travels over plain HTTP, and a
|
|
778
|
+
* TLS-terminating proxy does not change that for the browser's side of the connection.
|
|
775
779
|
*/
|
|
776
780
|
secureCookies?: boolean;
|
|
777
781
|
/**
|
|
@@ -5675,6 +5679,41 @@ declare class AuthRateLimitGuard implements CanActivate {
|
|
|
5675
5679
|
private clientIp;
|
|
5676
5680
|
}
|
|
5677
5681
|
|
|
5682
|
+
/**
|
|
5683
|
+
* Answers `415` for a request carrying a `Content-Encoding` other than `identity`.
|
|
5684
|
+
*
|
|
5685
|
+
* @remarks
|
|
5686
|
+
* Whether a compressed request body is decompressed is the host's body parser's decision, not the
|
|
5687
|
+
* library's: Express's default inflates `gzip`, `deflate` and `br`, a host that sets
|
|
5688
|
+
* `inflate: false` refuses them, and a framework that does not decode accepts nothing. The
|
|
5689
|
+
* contract the library shares with its sibling is the stricter one, and a library that relies on
|
|
5690
|
+
* host configuration for it holds that contract only where the host happened to set it. So the
|
|
5691
|
+
* refusal is made here, before any handler.
|
|
5692
|
+
*
|
|
5693
|
+
* Auth payloads are a few hundred bytes and browsers do not compress request bodies, so nothing
|
|
5694
|
+
* legitimate is lost. The parser has already decompressed the body by the time a guard runs, and
|
|
5695
|
+
* its size limit counts decompressed bytes, so the work this guard declines to do is bounded by
|
|
5696
|
+
* that limit either way; the refusal is for the contract, with the parser-level `inflate: false`
|
|
5697
|
+
* refusing earlier on a host that sets it.
|
|
5698
|
+
*
|
|
5699
|
+
* The answer is an `HttpException` whose body already is the library's error envelope. The
|
|
5700
|
+
* optional `AuthExceptionFilter` passes such a body through untouched and, without it, Nest
|
|
5701
|
+
* serialises the same object, so the response is identical either way. It is not an
|
|
5702
|
+
* `AuthException` because the status of `auth.validation` in the error catalog is `400`, one
|
|
5703
|
+
* status per code.
|
|
5704
|
+
*/
|
|
5705
|
+
declare class RequestEncodingGuard implements CanActivate {
|
|
5706
|
+
private readonly reflector;
|
|
5707
|
+
constructor(reflector: Reflector);
|
|
5708
|
+
/**
|
|
5709
|
+
* @param context - The execution context of the request.
|
|
5710
|
+
* @returns `true` when the route does not check, the request declares no encoding or only
|
|
5711
|
+
* `identity`, or the route checks only requests with a body and this one has none.
|
|
5712
|
+
* @throws {@link HttpException} `415` in the `auth.validation` envelope otherwise.
|
|
5713
|
+
*/
|
|
5714
|
+
canActivate(context: ExecutionContext): boolean;
|
|
5715
|
+
}
|
|
5716
|
+
|
|
5678
5717
|
/**
|
|
5679
5718
|
* Blocks a cross-site request that would otherwise be authenticated by the browser's ambient
|
|
5680
5719
|
* session cookie.
|
|
@@ -6069,6 +6108,11 @@ declare class WsJwtGuard implements CanActivate, OnModuleInit {
|
|
|
6069
6108
|
* stack detail or a connection string reaches a response body, so the answer carries the
|
|
6070
6109
|
* generic code and nothing else.
|
|
6071
6110
|
*
|
|
6111
|
+
* Requests the HTTP layer refused before any route ran — a malformed body, an oversized one, an
|
|
6112
|
+
* unsupported charset or content-encoding — answer `auth.validation` with a fixed message and the
|
|
6113
|
+
* status the transport reported, never the parser's text. Express only: the filter writes through
|
|
6114
|
+
* Express's `Response` and reads `req.route`, so its behaviour on another adapter is not defined.
|
|
6115
|
+
*
|
|
6072
6116
|
* **Do not register this alongside `@bymax-one/nest-core`'s envelope filter.** They are mutually
|
|
6073
6117
|
* exclusive in practice and this one wins: `useGlobalFilters` binds ahead of an `APP_FILTER`
|
|
6074
6118
|
* provider, and `@Catch()` with no argument catches everything, so nest-core's filter never runs.
|
|
@@ -6298,6 +6342,33 @@ declare const IS_PUBLIC_KEY: unique symbol;
|
|
|
6298
6342
|
*/
|
|
6299
6343
|
declare const Public: () => MethodDecorator & ClassDecorator;
|
|
6300
6344
|
|
|
6345
|
+
/**
|
|
6346
|
+
* How a route treats a request whose `Content-Encoding` is not `identity`.
|
|
6347
|
+
*
|
|
6348
|
+
* - `'unchecked'`: never refused. The routes that take no JSON body to decode (refresh, logout,
|
|
6349
|
+
* revoke-all, a ticket request) and that the shared contract leaves unchecked.
|
|
6350
|
+
* - `'when-body'`: refused only when the request carries a body. The MFA setup routes take an
|
|
6351
|
+
* optional body, and an empty one takes the default.
|
|
6352
|
+
*
|
|
6353
|
+
* A route with no policy is strict: every non-`identity` encoding is refused, so a route added
|
|
6354
|
+
* later is checked unless someone says it should not be.
|
|
6355
|
+
*/
|
|
6356
|
+
type RequestEncodingPolicy = 'unchecked' | 'when-body';
|
|
6357
|
+
/**
|
|
6358
|
+
* Sets how strictly {@link RequestEncodingGuard} checks the route's `Content-Encoding`.
|
|
6359
|
+
*
|
|
6360
|
+
* @param policy - See {@link RequestEncodingPolicy}.
|
|
6361
|
+
* @returns A method decorator.
|
|
6362
|
+
*
|
|
6363
|
+
* @example
|
|
6364
|
+
* ```typescript
|
|
6365
|
+
* @RequestEncoding('unchecked')
|
|
6366
|
+
* @Post('refresh')
|
|
6367
|
+
* refresh() { ... }
|
|
6368
|
+
* ```
|
|
6369
|
+
*/
|
|
6370
|
+
declare const RequestEncoding: (policy: RequestEncodingPolicy) => MethodDecorator;
|
|
6371
|
+
|
|
6301
6372
|
/**
|
|
6302
6373
|
* Metadata key used by {@link RolesGuard} to read the required roles for a route.
|
|
6303
6374
|
*
|
|
@@ -7494,13 +7565,30 @@ declare class SessionService {
|
|
|
7494
7565
|
* Refuses a session hash that names no live session of this user.
|
|
7495
7566
|
*
|
|
7496
7567
|
* For an operation that keeps one session and ends the rest and so has to be told which one,
|
|
7497
|
-
* checked before it changes anything. The membership test is the
|
|
7498
|
-
*
|
|
7568
|
+
* checked before it changes anything. The membership test is the one {@link resolveLiveSession}
|
|
7569
|
+
* applies, so a token that has just rotated is accepted here exactly as it is there.
|
|
7499
7570
|
*
|
|
7500
7571
|
* @param params - See {@link LiveSessionParams}.
|
|
7501
7572
|
* @throws {@link AuthException} `SESSION_NOT_FOUND` when the hash is not a live session.
|
|
7502
7573
|
*/
|
|
7503
|
-
assertLiveSession(
|
|
7574
|
+
assertLiveSession(params: LiveSessionParams): Promise<void>;
|
|
7575
|
+
/**
|
|
7576
|
+
* Names the live session a presented refresh-token hash stands for.
|
|
7577
|
+
*
|
|
7578
|
+
* The hash itself when it is a live session. When it is a token that rotated away moments ago,
|
|
7579
|
+
* the session the rotation produced: the rotation grace pointer `rp:{hash}` names that successor,
|
|
7580
|
+
* and the presented token still identifies the same device. A request that carries a refresh
|
|
7581
|
+
* token can lose a race to a refresh of the same session, and an operation that must keep "the
|
|
7582
|
+
* caller's session" would otherwise refuse the caller for having been refreshed. The pointer is
|
|
7583
|
+
* read, never consumed, and the successor has to be live in the index too, so a pointer left
|
|
7584
|
+
* behind by a session that was since revoked names nothing.
|
|
7585
|
+
*
|
|
7586
|
+
* @param params - See {@link LiveSessionParams}.
|
|
7587
|
+
* @returns The hash of the live session to keep: `sessionHash`, or its live successor.
|
|
7588
|
+
* @throws {@link AuthException} `SESSION_NOT_FOUND` when the hash is neither a live session nor
|
|
7589
|
+
* the predecessor of one.
|
|
7590
|
+
*/
|
|
7591
|
+
resolveLiveSession({ userId, tenantId, sessionHash }: LiveSessionParams): Promise<string>;
|
|
7504
7592
|
/**
|
|
7505
7593
|
* Revokes all sessions for a user except the caller's current session.
|
|
7506
7594
|
*
|
|
@@ -7585,11 +7673,20 @@ declare class SessionService {
|
|
|
7585
7673
|
*/
|
|
7586
7674
|
private assertValidSessionHash;
|
|
7587
7675
|
/**
|
|
7588
|
-
*
|
|
7676
|
+
* The hash of the live refresh session `sessionHash` stands for within `members`.
|
|
7589
7677
|
*
|
|
7590
7678
|
* @throws {@link AuthException} `SESSION_NOT_FOUND`.
|
|
7591
7679
|
*/
|
|
7592
|
-
private
|
|
7680
|
+
private resolveLiveMember;
|
|
7681
|
+
/** Whether `members` holds a live refresh session with this hash. */
|
|
7682
|
+
private isLiveMember;
|
|
7683
|
+
/**
|
|
7684
|
+
* The successor hash a rotation grace pointer names, or `undefined` when there is none.
|
|
7685
|
+
*
|
|
7686
|
+
* The pointer's value is `{successorHash}:{record}`, split on the first colon exactly as the
|
|
7687
|
+
* rotation script writes it.
|
|
7688
|
+
*/
|
|
7689
|
+
private graceSuccessor;
|
|
7593
7690
|
/**
|
|
7594
7691
|
* The Redis key of this user's session index.
|
|
7595
7692
|
*
|
|
@@ -7626,6 +7723,15 @@ declare class SessionService {
|
|
|
7626
7723
|
* @param userAgent - User-Agent string (forwarded to the `onSessionEvicted` hook context).
|
|
7627
7724
|
*/
|
|
7628
7725
|
private enforceSessionLimit;
|
|
7726
|
+
/**
|
|
7727
|
+
* The creation time of a session, for ranking sessions by age.
|
|
7728
|
+
*
|
|
7729
|
+
* An absent record and one that is not a detail record both rank as `0`, the oldest: a state the
|
|
7730
|
+
* store reported, not a fault. A read the store fails propagates, because no age can be named.
|
|
7731
|
+
*
|
|
7732
|
+
* @param memberHash - SHA-256 hash of the session's refresh token.
|
|
7733
|
+
*/
|
|
7734
|
+
private readCreatedAt;
|
|
7629
7735
|
/**
|
|
7630
7736
|
* Resolves the maximum number of concurrent sessions allowed for a user.
|
|
7631
7737
|
*
|
|
@@ -8283,6 +8389,37 @@ declare class AuthService {
|
|
|
8283
8389
|
* matched the presented refresh token (already logged out, or expired).
|
|
8284
8390
|
*/
|
|
8285
8391
|
logout(accessToken: string, rawRefreshToken: string): Promise<string>;
|
|
8392
|
+
/**
|
|
8393
|
+
* The access-token blacklist write for a logout, or none when there is nothing to revoke.
|
|
8394
|
+
*
|
|
8395
|
+
* Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
|
|
8396
|
+
* forged one must not blacklist an id it does not own. Only the verification is tolerant.
|
|
8397
|
+
*
|
|
8398
|
+
* @param accessToken - Raw access token; absent, malformed or expired yields no write.
|
|
8399
|
+
* @returns The writes to hand to `settleWrites`.
|
|
8400
|
+
*/
|
|
8401
|
+
private blacklistWrites;
|
|
8402
|
+
/**
|
|
8403
|
+
* Cleans up the session's metadata through `SessionService.revokeSession()`.
|
|
8404
|
+
*
|
|
8405
|
+
* It performs an atomic SISMEMBER ownership check before deleting `sd:{hash}` and SREMing from
|
|
8406
|
+
* `sess:{userId}`. The `rt:{hash}` DEL already ran — revokeSession's internal DEL is a no-op
|
|
8407
|
+
* (Redis DEL is idempotent when the key is absent). SESSION_NOT_FOUND means the session was
|
|
8408
|
+
* evicted, already revoked, or the refresh token does not belong to this user — in all cases
|
|
8409
|
+
* authentication is already invalidated.
|
|
8410
|
+
*
|
|
8411
|
+
* The tenant is REQUIRED to name the index, and it comes off the record rather than from the
|
|
8412
|
+
* caller. A record without one is a pre-upgrade write: the contract lists `tenantId` among the
|
|
8413
|
+
* refresh session's fields, so a live record always has it. Skipping the call is the honest end
|
|
8414
|
+
* for one that does not — `rt:{hash}` is already deleted, so the session is dead either way, and
|
|
8415
|
+
* guessing a tenant would name an index belonging to nobody while reading like a revocation that
|
|
8416
|
+
* happened.
|
|
8417
|
+
*
|
|
8418
|
+
* @param userId - The owner, empty when none is known.
|
|
8419
|
+
* @param tenantId - The owner's tenant, absent when the record carried none.
|
|
8420
|
+
* @param sessionHash - The SHA-256 of the raw refresh token.
|
|
8421
|
+
*/
|
|
8422
|
+
private revokeSessionMetadata;
|
|
8286
8423
|
/**
|
|
8287
8424
|
* Announces a completed logout, the only hook `AuthService.logout` emits.
|
|
8288
8425
|
*
|
|
@@ -8814,10 +8951,16 @@ declare class MfaService {
|
|
|
8814
8951
|
* Detached from the challenge it follows: the user is already authenticated and the retired
|
|
8815
8952
|
* key still opens the secret, so a failure here costs the migration and nothing else.
|
|
8816
8953
|
*
|
|
8954
|
+
* The write replaces the whole MFA record, so it runs as a serialized transition and lands only
|
|
8955
|
+
* on a record that still holds this secret. One that no longer does was disabled or re-enrolled
|
|
8956
|
+
* since, and writing the re-encrypted old secret over it would restore a factor the user removed
|
|
8957
|
+
* and unspend the recovery codes they replaced. The comparison is on the decrypted secret, not
|
|
8958
|
+
* the ciphertext: a sibling challenge that only re-encrypted the same secret changes the
|
|
8959
|
+
* ciphertext and nothing else, and must not be mistaken for a re-enrolment.
|
|
8960
|
+
*
|
|
8817
8961
|
* @param userId - The account whose stored secret is being re-encrypted.
|
|
8818
8962
|
* @param context - Which identity plane the account belongs to.
|
|
8819
8963
|
* @param secretBase32 - The decrypted secret.
|
|
8820
|
-
* @param recoveryCodes - The stored recovery digests, written back unchanged.
|
|
8821
8964
|
* @param tenantId - The tenant the account belongs to, so the write is scoped like the read.
|
|
8822
8965
|
*/
|
|
8823
8966
|
private reencryptSecret;
|
|
@@ -8859,6 +9002,13 @@ declare class MfaService {
|
|
|
8859
9002
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
8860
9003
|
*/
|
|
8861
9004
|
private transitionMfaRecord;
|
|
9005
|
+
/**
|
|
9006
|
+
* Whether `stored` decrypts, under the current or a retired key, to `secretBase32`.
|
|
9007
|
+
*
|
|
9008
|
+
* Compares plaintext, so a record that was only re-encrypted still matches and one holding a
|
|
9009
|
+
* different secret does not. A ciphertext no key opens does not match either.
|
|
9010
|
+
*/
|
|
9011
|
+
private holdsSecret;
|
|
8862
9012
|
/**
|
|
8863
9013
|
* Encrypts a TOTP secret for storage in the database using AES-256-GCM.
|
|
8864
9014
|
*/
|
|
@@ -9779,16 +9929,20 @@ declare class PasswordResetService {
|
|
|
9779
9929
|
* the configured breach checker.
|
|
9780
9930
|
*/
|
|
9781
9931
|
changePassword(userId: string, tenantId: string, dto: ChangePasswordDto, currentRefreshToken?: string): Promise<void>;
|
|
9782
|
-
/** Refuses a presented refresh token that names no live session of the account. */
|
|
9783
|
-
private requireLiveCurrentSession;
|
|
9784
9932
|
/**
|
|
9785
|
-
*
|
|
9933
|
+
* The hash of the live session a presented refresh token stands for, or `undefined` when the
|
|
9934
|
+
* request carried none. Refuses a token that names no live session of the account; a token that
|
|
9935
|
+
* rotated away while the password was being verified stands for the session that replaced it.
|
|
9936
|
+
*/
|
|
9937
|
+
private resolveCurrentSession;
|
|
9938
|
+
/**
|
|
9939
|
+
* Ends every session but the one to keep, once the new password is already written.
|
|
9786
9940
|
*
|
|
9787
|
-
* With no
|
|
9788
|
-
*
|
|
9789
|
-
* no current session left to
|
|
9790
|
-
* change safe is never aborted by the session it was told to spare. Any other failure of
|
|
9791
|
-
* sweep propagates.
|
|
9941
|
+
* With no session to keep every session ends. A kept session can rotate away while the new
|
|
9942
|
+
* password is hashed; the sweep follows it to its successor, and when it cannot be followed
|
|
9943
|
+
* there is no current session left to spare, so every session ends and the cleanup that makes
|
|
9944
|
+
* the change safe is never aborted by the session it was told to spare. Any other failure of
|
|
9945
|
+
* the sweep propagates.
|
|
9792
9946
|
*/
|
|
9793
9947
|
private endOtherSessions;
|
|
9794
9948
|
/** Ends every session the account has and advances its token epoch. */
|
|
@@ -9919,6 +10073,18 @@ declare class PlatformAuthService {
|
|
|
9919
10073
|
* @param rawRefreshToken - The raw opaque platform refresh token.
|
|
9920
10074
|
*/
|
|
9921
10075
|
logout(accessToken: string, rawRefreshToken: string): Promise<string>;
|
|
10076
|
+
/**
|
|
10077
|
+
* The access-token blacklist write for a platform logout, or none when there is nothing to
|
|
10078
|
+
* revoke.
|
|
10079
|
+
*
|
|
10080
|
+
* Verifies signature and algorithm but not expiry: an expired token is the normal case here, a
|
|
10081
|
+
* forged one must not be able to blacklist an id it does not own. Only the verification is
|
|
10082
|
+
* tolerant: a token nobody can verify has nothing to blacklist, but a refused write is not.
|
|
10083
|
+
*
|
|
10084
|
+
* @param accessToken - Raw platform access token; absent, malformed or expired yields no write.
|
|
10085
|
+
* @returns The writes to hand to `settleWrites`.
|
|
10086
|
+
*/
|
|
10087
|
+
private blacklistWrites;
|
|
9922
10088
|
/**
|
|
9923
10089
|
* Announces a completed platform logout, the only hook `PlatformAuthService` emits.
|
|
9924
10090
|
*
|
|
@@ -11039,5 +11205,5 @@ declare class ApiKeyService {
|
|
|
11039
11205
|
private validatedExpiry;
|
|
11040
11206
|
}
|
|
11041
11207
|
|
|
11042
|
-
export { API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, 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, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, authDocumentSecurity, createAuthValidationPipe, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|
|
11043
|
-
export type { ApiKeyAccessEvent, ApiKeyClock, ApiKeyDenyReason, ApiKeyPrincipal, AuthApiKey, AuthApiKeySummary, AuthDocumentSecurityParams, AuthEmailCatalogue, AuthEmailContext, AuthEmailKind, AuthEmailMessage, AuthEmailSink, AuthErrorCode, AuthFieldError, AuthGuardFamily, AuthModuleAsyncOptions, AuthPlane, AuthPlatformUser, AuthRateLimitWindow, AuthResult, AuthUser, AuthenticatedRequest, BearerAuthResponse, BeforeRegisterResult, BothAuthResponse, BymaxAuthModuleOptions, BymaxAuthRateLimitOptions, ClientIpSource, CookieAuthResponse, CreateSessionParams, CreateUserData, CreateWithOAuthData, DashboardJwtPayload, DefaultAuthEmailProviderOptions, DeliveryErrorPolicy, DeliveryErrorPolicyMap, FindUserByEmailParams, FindUserByOAuthIdParams, HookContext, IApiKeyRepository, IAuthHooks, IEmailProvider, IPasswordBreachChecker, IPlatformUserRepository, IUserRepository, InviteData, IssueApiKeyInput, IssuedApiKey, LinkOAuthParams, ListSessionsParams, LiveSessionParams, MfaChallengeResult, MfaSetupResult, MfaTempPayload, OAuthLoginResult, OAuthMfaChallengeResult, OAuthProfile, OAuthProviderPlugin, OpenApiSecurityRequirement, PlatformAuthResult, PlatformAuthenticatedRequest, PlatformBearerAuthResponse, PlatformJwtPayload, ResolvedOptions, RevocableTokenPayload, RevokeAllExceptCurrentParams, RevokeAllSessionsParams, RevokeSessionParams, RotateApiKeyInput, RotatedTokenResult, SafeAuthPlatformUser, SafeAuthUser, SessionAlertInfo, SessionInfo, TenantResolverRequest, TenantScopedUserRef, UpdateEmailParams, UpdateEmailVerifiedParams, UpdateMfaData, UpdateMfaParams, UpdatePasswordParams, UpdatePlatformMfaData, UpdateStatusParams, VerifiedAccessToken, VerifyAccessTokenOptions, WsTicketSnapshot };
|
|
11208
|
+
export { API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, ApiKeyGuard, ApiKeyScopes, ApiKeyService, AuthException, AuthExceptionFilter, AuthRateLimit, AuthRateLimitGuard, AuthRevocationService, AuthService, AuthTokenVerifierService, Authenticated, BYMAX_AUTH_API_KEY_CLOCK, BYMAX_AUTH_API_KEY_REPOSITORY, 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, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WS_TICKET_TTL_SECONDS, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, authDocumentSecurity, createAuthValidationPipe, decrypt, describeChannelStatus, describeError, encrypt, generateSecureToken, hasRole, hmacSha256, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, timingSafeCompare };
|
|
11209
|
+
export type { ApiKeyAccessEvent, ApiKeyClock, ApiKeyDenyReason, ApiKeyPrincipal, AuthApiKey, AuthApiKeySummary, AuthDocumentSecurityParams, AuthEmailCatalogue, AuthEmailContext, AuthEmailKind, AuthEmailMessage, AuthEmailSink, AuthErrorCode, AuthFieldError, AuthGuardFamily, AuthModuleAsyncOptions, AuthPlane, AuthPlatformUser, AuthRateLimitWindow, AuthResult, AuthUser, AuthenticatedRequest, BearerAuthResponse, BeforeRegisterResult, BothAuthResponse, BymaxAuthModuleOptions, BymaxAuthRateLimitOptions, ClientIpSource, CookieAuthResponse, CreateSessionParams, CreateUserData, CreateWithOAuthData, DashboardJwtPayload, DefaultAuthEmailProviderOptions, DeliveryErrorPolicy, DeliveryErrorPolicyMap, FindUserByEmailParams, FindUserByOAuthIdParams, HookContext, IApiKeyRepository, IAuthHooks, IEmailProvider, IPasswordBreachChecker, IPlatformUserRepository, IUserRepository, InviteData, IssueApiKeyInput, IssuedApiKey, LinkOAuthParams, ListSessionsParams, LiveSessionParams, MfaChallengeResult, MfaSetupResult, MfaTempPayload, OAuthLoginResult, OAuthMfaChallengeResult, OAuthProfile, OAuthProviderPlugin, OpenApiSecurityRequirement, PlatformAuthResult, PlatformAuthenticatedRequest, PlatformBearerAuthResponse, PlatformJwtPayload, RequestEncodingPolicy, ResolvedOptions, RevocableTokenPayload, RevokeAllExceptCurrentParams, RevokeAllSessionsParams, RevokeSessionParams, RotateApiKeyInput, RotatedTokenResult, SafeAuthPlatformUser, SafeAuthUser, SessionAlertInfo, SessionInfo, TenantResolverRequest, TenantScopedUserRef, UpdateEmailParams, UpdateEmailVerifiedParams, UpdateMfaData, UpdateMfaParams, UpdatePasswordParams, UpdatePlatformMfaData, UpdateStatusParams, VerifiedAccessToken, VerifyAccessTokenOptions, WsTicketSnapshot };
|