@bymax-one/nest-auth 1.5.6 → 1.5.7
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 +49 -1
- package/README.md +7 -1
- package/dist/react/index.cjs +3 -1
- package/dist/react/index.d.cts +3 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.mjs +3 -1
- package/dist/server/index.cjs +178 -82
- package/dist/server/index.d.cts +71 -13
- package/dist/server/index.d.ts +71 -13
- package/dist/server/index.mjs +178 -83
- package/package.json +1 -1
package/dist/server/index.d.cts
CHANGED
|
@@ -2951,6 +2951,25 @@ interface AuthDocumentSecurityParams {
|
|
|
2951
2951
|
*/
|
|
2952
2952
|
declare function authDocumentSecurity({ guard, tokenDelivery }: AuthDocumentSecurityParams): readonly OpenApiSecurityRequirement[];
|
|
2953
2953
|
|
|
2954
|
+
/**
|
|
2955
|
+
* @fileoverview Tells a Redis outage from a Redis error, and answers the first with a typed 503.
|
|
2956
|
+
*
|
|
2957
|
+
* Every authentication decision here awaits Redis. When the store cannot answer, the request has
|
|
2958
|
+
* nothing to decide with: it is refused, and what the client can act on is that the refusal is
|
|
2959
|
+
* temporary. The answer is `AuthException(SERVICE_UNAVAILABLE)`, whose body carries the library
|
|
2960
|
+
* code and nothing of the store, and whose `cause` keeps the ioredis error for a host's logger.
|
|
2961
|
+
*
|
|
2962
|
+
* @layer Service
|
|
2963
|
+
*/
|
|
2964
|
+
|
|
2965
|
+
/**
|
|
2966
|
+
* Whether an error is the typed 503 this module raises.
|
|
2967
|
+
*
|
|
2968
|
+
* @param error - A caught value.
|
|
2969
|
+
* @returns `true` for an `AuthException` carrying `SERVICE_UNAVAILABLE`.
|
|
2970
|
+
*/
|
|
2971
|
+
declare function isServiceUnavailable(error: unknown): error is AuthException;
|
|
2972
|
+
|
|
2954
2973
|
/**
|
|
2955
2974
|
* Email provider plugin contract for @bymax-one/nest-auth.
|
|
2956
2975
|
*
|
|
@@ -5758,6 +5777,18 @@ declare class AllowAllBreachChecker implements IPasswordBreachChecker {
|
|
|
5758
5777
|
isBreached(_password: string): Promise<boolean>;
|
|
5759
5778
|
}
|
|
5760
5779
|
|
|
5780
|
+
/**
|
|
5781
|
+
* The Lua script that writes a new refresh session, and the check of what is passed to it.
|
|
5782
|
+
*
|
|
5783
|
+
* @layer Redis
|
|
5784
|
+
*/
|
|
5785
|
+
/** A record written in the same step as the session: its key, its value and its lifetime in seconds. */
|
|
5786
|
+
interface SessionExtra {
|
|
5787
|
+
readonly key: string;
|
|
5788
|
+
readonly value: string;
|
|
5789
|
+
readonly ttl: number;
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5761
5792
|
/**
|
|
5762
5793
|
* @fileoverview The verified-identity snapshot bound to a WebSocket upgrade ticket.
|
|
5763
5794
|
*
|
|
@@ -6020,6 +6051,8 @@ declare class AuthRedisService {
|
|
|
6020
6051
|
familyId: string;
|
|
6021
6052
|
userId: string;
|
|
6022
6053
|
refreshTtl: number;
|
|
6054
|
+
/** Records written in the same step, each with its own TTL; see {@link CREATE_SESSION_LUA}. */
|
|
6055
|
+
extras?: readonly SessionExtra[];
|
|
6023
6056
|
}): Promise<void>;
|
|
6024
6057
|
/**
|
|
6025
6058
|
* Writes the session a grace recovery produced, atomically with the check that the account
|
|
@@ -7058,6 +7091,7 @@ declare class AccountStatusService {
|
|
|
7058
7091
|
private readonly userRepo;
|
|
7059
7092
|
private readonly options;
|
|
7060
7093
|
private readonly platformUserRepo?;
|
|
7094
|
+
private readonly logger;
|
|
7061
7095
|
/**
|
|
7062
7096
|
* @param redis - The auth module's Redis service, holding the status and verified caches.
|
|
7063
7097
|
* @param userRepo - The consumer's dashboard user repository, read on a cache miss.
|
|
@@ -7124,6 +7158,19 @@ declare class AccountStatusService {
|
|
|
7124
7158
|
readonly userId: string;
|
|
7125
7159
|
readonly tenantId: string;
|
|
7126
7160
|
}): Promise<void>;
|
|
7161
|
+
/**
|
|
7162
|
+
* Stores one cached fact, best effort.
|
|
7163
|
+
*
|
|
7164
|
+
* The repository has already answered when this runs, so the decision does not depend on the
|
|
7165
|
+
* write: a store that cannot take it must not turn that decision into an error, and above all
|
|
7166
|
+
* must not answer a blocked account with an outage a client retries. A failed write is logged
|
|
7167
|
+
* without the store's text and the next request reads the repository again.
|
|
7168
|
+
*
|
|
7169
|
+
* @param key - The cache key.
|
|
7170
|
+
* @param value - The fact just read from the repository.
|
|
7171
|
+
* @param ttl - The cache lifetime in seconds.
|
|
7172
|
+
*/
|
|
7173
|
+
private fillCache;
|
|
7127
7174
|
/**
|
|
7128
7175
|
* The same decision as {@link assertDashboardAccountUsable}, read from the repository now.
|
|
7129
7176
|
*
|
|
@@ -9429,10 +9476,10 @@ declare class SessionService {
|
|
|
9429
9476
|
/**
|
|
9430
9477
|
* Records a new session in Redis and enforces the concurrent session limit.
|
|
9431
9478
|
*
|
|
9432
|
-
*
|
|
9433
|
-
*
|
|
9434
|
-
* session when the user has exceeded
|
|
9435
|
-
* hook (fire-and-forget)
|
|
9479
|
+
* The device and activity record under `sd:{hash}` is written with the session itself, by
|
|
9480
|
+
* `TokenManagerService.issueTokens`, so it cannot be missing for a session that exists. This
|
|
9481
|
+
* method calls `enforceSessionLimit` to evict the oldest session when the user has exceeded
|
|
9482
|
+
* their limit, and fires the `onNewSession` hook (fire-and-forget).
|
|
9436
9483
|
*
|
|
9437
9484
|
* @remarks
|
|
9438
9485
|
* **Caller ordering contract:** This method must be called **after**
|
|
@@ -9786,13 +9833,14 @@ declare class TokenManagerService {
|
|
|
9786
9833
|
credentialProved?: boolean;
|
|
9787
9834
|
}): Promise<AuthResult>;
|
|
9788
9835
|
/**
|
|
9789
|
-
*
|
|
9836
|
+
* The records a new dashboard session is written with, beyond the session itself.
|
|
9790
9837
|
*
|
|
9791
|
-
*
|
|
9792
|
-
* possession of a token, so `reissueTokens` never writes
|
|
9793
|
-
* another session of the same account cannot
|
|
9838
|
+
* The recent-authentication mark is there only when a credential was presented in this request;
|
|
9839
|
+
* a refresh proves possession of a token, so `reissueTokens` never writes it. It keeps its own
|
|
9840
|
+
* short lifetime and its key names the session, so another session of the same account cannot
|
|
9841
|
+
* use it. The session detail is there only when sessions are enabled.
|
|
9794
9842
|
*/
|
|
9795
|
-
private
|
|
9843
|
+
private dashboardExtras;
|
|
9796
9844
|
/**
|
|
9797
9845
|
* Issues access + refresh tokens for a successfully authenticated platform admin.
|
|
9798
9846
|
*
|
|
@@ -9811,9 +9859,7 @@ declare class TokenManagerService {
|
|
|
9811
9859
|
/**
|
|
9812
9860
|
* Writes the per-session detail record for a platform session under `psd:{hash}`.
|
|
9813
9861
|
*
|
|
9814
|
-
* The
|
|
9815
|
-
* but platform sessions never had one, so a session listing had nothing to describe them
|
|
9816
|
-
* with. The field set and the Unix-millisecond timestamps mirror the dashboard record
|
|
9862
|
+
* The field set and the Unix-millisecond timestamps mirror the dashboard record
|
|
9817
9863
|
* exactly, so either backend sharing this Redis reads the same shape.
|
|
9818
9864
|
*
|
|
9819
9865
|
* @param tokenHash - SHA-256 of the raw refresh token; the key's `{hash}` segment.
|
|
@@ -10973,6 +11019,18 @@ declare class MfaRecordService {
|
|
|
10973
11019
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
10974
11020
|
*/
|
|
10975
11021
|
transition(context: 'dashboard' | 'platform', userId: string, tenantId: string | undefined, mutate: (current: AuthUser | AuthPlatformUser) => MfaRecordUpdate | null): Promise<boolean>;
|
|
11022
|
+
/**
|
|
11023
|
+
* Releases the transition lock this call took, whatever the store answers.
|
|
11024
|
+
*
|
|
11025
|
+
* A compare-and-delete: only a lock still holding this call's nonce is removed. A release that
|
|
11026
|
+
* fails is logged and swallowed, because the transition has already been decided by then: an
|
|
11027
|
+
* error here would replace the transition's own result, answering failure for a write that
|
|
11028
|
+
* committed or hiding the error that did occur. The lock's short TTL ends it on its own.
|
|
11029
|
+
*
|
|
11030
|
+
* @param lockKey - The account's lock key.
|
|
11031
|
+
* @param lockToken - The nonce this call wrote when it took the lock.
|
|
11032
|
+
*/
|
|
11033
|
+
private releaseLock;
|
|
10976
11034
|
/**
|
|
10977
11035
|
* Claims a matched recovery code for exactly one challenge.
|
|
10978
11036
|
*
|
|
@@ -14564,5 +14622,5 @@ declare class WorkspaceInvitationService {
|
|
|
14564
14622
|
private activeWorkspace;
|
|
14565
14623
|
}
|
|
14566
14624
|
|
|
14567
|
-
export { ALLOW_PENDING_WORKSPACE_KEY, ANY_WORKSPACE_MEMBER, API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECRET_MIN_LENGTH, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, AllowPendingWorkspace, 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_MEMBERSHIP_REPOSITORY, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BYMAX_AUTH_WORKSPACE_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, CurrentWorkspace, CurrentWsWorkspace, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MembershipBumpFailedError, MembershipService, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, ReauthenticationService, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WORKSPACE_CURSOR_MAX_LENGTH, WORKSPACE_CURSOR_PART_MAX_LENGTH, WORKSPACE_ID_MAX_LENGTH, WORKSPACE_OWNER_ROLE_MAX_LENGTH, WORKSPACE_PERMISSION_KEY, WORKSPACE_ROLES_KEY, WS_TICKET_TTL_SECONDS, WorkspaceAccessService, WorkspaceActionsService, WorkspaceCallerService, WorkspaceGuard, WorkspaceInvitationService, WorkspacePermission, WorkspaceRoles, WorkspaceService, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, WsWorkspaceGuard, assertWorkspaceId, authDocumentSecurity, createAuthValidationPipe, decodeWorkspaceCursor, decodeWorkspaceScopedName, decrypt, describeChannelStatus, describeError, encodeWorkspaceCursor, encrypt, generateSecureToken, hasRole, hmacSha256, isWorkspaceOwnerRole, readWorkspacePosition, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, stampJobContext, timingSafeCompare, workspacePositionOf, workspaceQueryKey, workspaceScopedName };
|
|
14625
|
+
export { ALLOW_PENDING_WORKSPACE_KEY, ANY_WORKSPACE_MEMBER, API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECRET_MIN_LENGTH, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, AllowPendingWorkspace, 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_MEMBERSHIP_REPOSITORY, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BYMAX_AUTH_WORKSPACE_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, CurrentWorkspace, CurrentWsWorkspace, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MembershipBumpFailedError, MembershipService, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, ReauthenticationService, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WORKSPACE_CURSOR_MAX_LENGTH, WORKSPACE_CURSOR_PART_MAX_LENGTH, WORKSPACE_ID_MAX_LENGTH, WORKSPACE_OWNER_ROLE_MAX_LENGTH, WORKSPACE_PERMISSION_KEY, WORKSPACE_ROLES_KEY, WS_TICKET_TTL_SECONDS, WorkspaceAccessService, WorkspaceActionsService, WorkspaceCallerService, WorkspaceGuard, WorkspaceInvitationService, WorkspacePermission, WorkspaceRoles, WorkspaceService, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, WsWorkspaceGuard, assertWorkspaceId, authDocumentSecurity, createAuthValidationPipe, decodeWorkspaceCursor, decodeWorkspaceScopedName, decrypt, describeChannelStatus, describeError, encodeWorkspaceCursor, encrypt, generateSecureToken, hasRole, hmacSha256, isServiceUnavailable, isWorkspaceOwnerRole, readWorkspacePosition, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, stampJobContext, timingSafeCompare, workspacePositionOf, workspaceQueryKey, workspaceScopedName };
|
|
14568
14626
|
export type { AcceptedInvitation, AcceptedSignup, AccountRemovalAudit, ActingMember, ApiKeyAccessEvent, ApiKeyClock, ApiKeyDenyReason, ApiKeyPrincipal, AuthApiKey, AuthApiKeySummary, AuthDocumentSecurityParams, AuthEmailCatalogue, AuthEmailContext, AuthEmailKind, AuthEmailMessage, AuthEmailSink, AuthErrorCode, AuthFieldError, AuthGuardFamily, AuthMembership, AuthModuleAsyncOptions, AuthPlane, AuthPlatformUser, AuthRateLimitWindow, AuthResult, AuthUser, AuthWorkspace, AuthenticatedRequest, BearerAuthResponse, BeforeRegisterResult, BeforeWorkspaceCreateResult, BootstrapInvitationRecord, BothAuthResponse, BymaxAuthModuleOptions, BymaxAuthRateLimitOptions, ChangeMembershipRoleParams, ClientIpSource, CookieAuthResponse, CountOwnedParams, CreateMembershipParams, CreateMembershipResult, CreateSessionParams, CreateUserData, CreateWithOAuthData, CreateWorkspaceResult, CreateWorkspaceWithOwnerParams, CurrentWorkspaceContext, DashboardJwtPayload, DefaultAuthEmailProviderOptions, DeliveryErrorPolicy, DeliveryErrorPolicyMap, FinalizeResult, FindUserByEmailParams, FindUserByOAuthIdParams, GuardedWriteResult, HookContext, IApiKeyRepository, IAuthHooks, IEmailProvider, IMembershipRepository, IPasswordBreachChecker, IPlatformUserRepository, IUserRepository, IWorkspaceRepository, InviteData, IssueApiKeyInput, IssuedApiKey, LastActiveWorkspaceRef, LinkOAuthParams, ListMembershipsForUserParams, ListMembershipsForWorkspaceParams, ListSessionsParams, ListSoleOwnedParams, LiveSessionParams, MemberChangeResult, MemberInvitationRecord, MembershipPage, MembershipRef, MembershipStatus, MembershipWithWorkspace, MfaChallengeResult, MfaSetupResult, MfaTempPayload, MyWorkspaces, OAuthLoginResult, OAuthMfaChallengeResult, OAuthProfile, OAuthProviderPlugin, OpenApiSecurityRequirement, PlatformAuthResult, PlatformAuthenticatedRequest, PlatformBearerAuthResponse, PlatformJwtPayload, RegistrationMode, RemoveAllMembershipsParams, RemoveAllMembershipsResult, RemoveMembershipParams, RemovedMembership, RenameWorkspaceParams, RenameWorkspaceResult, RequestEncodingPolicy, ResolvedOptions, ResolvedWorkspaceMember, RevocableTokenPayload, RevokeAllExceptCurrentParams, RevokeAllSessionsParams, RevokeSessionParams, RotateApiKeyInput, RotatedTokenResult, SafeAuthPlatformUser, SafeAuthUser, ScheduledDeletion, SessionAlertInfo, SessionInfo, SetLastActiveWorkspaceParams, SignupRequest, StoredWorkspaceInvitation, TenantResolverRequest, TenantScopedUserRef, TransferOwnershipParams, TransferOwnershipResult, UpdateEmailParams, UpdateEmailVerifiedParams, UpdateMfaData, UpdateMfaParams, UpdatePasswordParams, UpdatePlatformMfaData, UpdateStatusParams, UpdateWorkspaceStatusParams, UpdateWorkspaceStatusResult, VerifiedAccessToken, VerifiedWorkspaceAccessToken, VerifyAccessTokenOptions, WorkspaceAccess, WorkspaceAccessView, WorkspaceAction, WorkspaceActor, WorkspaceAuditEvent, WorkspaceCheck, WorkspaceInvitationPreview, WorkspaceInvitationView, WorkspaceInviteData, WorkspaceJobContext, WorkspaceOptions, WorkspacePermissionOptions, WorkspaceRef, WorkspaceRequest, WorkspaceRoleList, WorkspaceStatus, WsTicketSnapshot };
|
package/dist/server/index.d.ts
CHANGED
|
@@ -2951,6 +2951,25 @@ interface AuthDocumentSecurityParams {
|
|
|
2951
2951
|
*/
|
|
2952
2952
|
declare function authDocumentSecurity({ guard, tokenDelivery }: AuthDocumentSecurityParams): readonly OpenApiSecurityRequirement[];
|
|
2953
2953
|
|
|
2954
|
+
/**
|
|
2955
|
+
* @fileoverview Tells a Redis outage from a Redis error, and answers the first with a typed 503.
|
|
2956
|
+
*
|
|
2957
|
+
* Every authentication decision here awaits Redis. When the store cannot answer, the request has
|
|
2958
|
+
* nothing to decide with: it is refused, and what the client can act on is that the refusal is
|
|
2959
|
+
* temporary. The answer is `AuthException(SERVICE_UNAVAILABLE)`, whose body carries the library
|
|
2960
|
+
* code and nothing of the store, and whose `cause` keeps the ioredis error for a host's logger.
|
|
2961
|
+
*
|
|
2962
|
+
* @layer Service
|
|
2963
|
+
*/
|
|
2964
|
+
|
|
2965
|
+
/**
|
|
2966
|
+
* Whether an error is the typed 503 this module raises.
|
|
2967
|
+
*
|
|
2968
|
+
* @param error - A caught value.
|
|
2969
|
+
* @returns `true` for an `AuthException` carrying `SERVICE_UNAVAILABLE`.
|
|
2970
|
+
*/
|
|
2971
|
+
declare function isServiceUnavailable(error: unknown): error is AuthException;
|
|
2972
|
+
|
|
2954
2973
|
/**
|
|
2955
2974
|
* Email provider plugin contract for @bymax-one/nest-auth.
|
|
2956
2975
|
*
|
|
@@ -5758,6 +5777,18 @@ declare class AllowAllBreachChecker implements IPasswordBreachChecker {
|
|
|
5758
5777
|
isBreached(_password: string): Promise<boolean>;
|
|
5759
5778
|
}
|
|
5760
5779
|
|
|
5780
|
+
/**
|
|
5781
|
+
* The Lua script that writes a new refresh session, and the check of what is passed to it.
|
|
5782
|
+
*
|
|
5783
|
+
* @layer Redis
|
|
5784
|
+
*/
|
|
5785
|
+
/** A record written in the same step as the session: its key, its value and its lifetime in seconds. */
|
|
5786
|
+
interface SessionExtra {
|
|
5787
|
+
readonly key: string;
|
|
5788
|
+
readonly value: string;
|
|
5789
|
+
readonly ttl: number;
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5761
5792
|
/**
|
|
5762
5793
|
* @fileoverview The verified-identity snapshot bound to a WebSocket upgrade ticket.
|
|
5763
5794
|
*
|
|
@@ -6020,6 +6051,8 @@ declare class AuthRedisService {
|
|
|
6020
6051
|
familyId: string;
|
|
6021
6052
|
userId: string;
|
|
6022
6053
|
refreshTtl: number;
|
|
6054
|
+
/** Records written in the same step, each with its own TTL; see {@link CREATE_SESSION_LUA}. */
|
|
6055
|
+
extras?: readonly SessionExtra[];
|
|
6023
6056
|
}): Promise<void>;
|
|
6024
6057
|
/**
|
|
6025
6058
|
* Writes the session a grace recovery produced, atomically with the check that the account
|
|
@@ -7058,6 +7091,7 @@ declare class AccountStatusService {
|
|
|
7058
7091
|
private readonly userRepo;
|
|
7059
7092
|
private readonly options;
|
|
7060
7093
|
private readonly platformUserRepo?;
|
|
7094
|
+
private readonly logger;
|
|
7061
7095
|
/**
|
|
7062
7096
|
* @param redis - The auth module's Redis service, holding the status and verified caches.
|
|
7063
7097
|
* @param userRepo - The consumer's dashboard user repository, read on a cache miss.
|
|
@@ -7124,6 +7158,19 @@ declare class AccountStatusService {
|
|
|
7124
7158
|
readonly userId: string;
|
|
7125
7159
|
readonly tenantId: string;
|
|
7126
7160
|
}): Promise<void>;
|
|
7161
|
+
/**
|
|
7162
|
+
* Stores one cached fact, best effort.
|
|
7163
|
+
*
|
|
7164
|
+
* The repository has already answered when this runs, so the decision does not depend on the
|
|
7165
|
+
* write: a store that cannot take it must not turn that decision into an error, and above all
|
|
7166
|
+
* must not answer a blocked account with an outage a client retries. A failed write is logged
|
|
7167
|
+
* without the store's text and the next request reads the repository again.
|
|
7168
|
+
*
|
|
7169
|
+
* @param key - The cache key.
|
|
7170
|
+
* @param value - The fact just read from the repository.
|
|
7171
|
+
* @param ttl - The cache lifetime in seconds.
|
|
7172
|
+
*/
|
|
7173
|
+
private fillCache;
|
|
7127
7174
|
/**
|
|
7128
7175
|
* The same decision as {@link assertDashboardAccountUsable}, read from the repository now.
|
|
7129
7176
|
*
|
|
@@ -9429,10 +9476,10 @@ declare class SessionService {
|
|
|
9429
9476
|
/**
|
|
9430
9477
|
* Records a new session in Redis and enforces the concurrent session limit.
|
|
9431
9478
|
*
|
|
9432
|
-
*
|
|
9433
|
-
*
|
|
9434
|
-
* session when the user has exceeded
|
|
9435
|
-
* hook (fire-and-forget)
|
|
9479
|
+
* The device and activity record under `sd:{hash}` is written with the session itself, by
|
|
9480
|
+
* `TokenManagerService.issueTokens`, so it cannot be missing for a session that exists. This
|
|
9481
|
+
* method calls `enforceSessionLimit` to evict the oldest session when the user has exceeded
|
|
9482
|
+
* their limit, and fires the `onNewSession` hook (fire-and-forget).
|
|
9436
9483
|
*
|
|
9437
9484
|
* @remarks
|
|
9438
9485
|
* **Caller ordering contract:** This method must be called **after**
|
|
@@ -9786,13 +9833,14 @@ declare class TokenManagerService {
|
|
|
9786
9833
|
credentialProved?: boolean;
|
|
9787
9834
|
}): Promise<AuthResult>;
|
|
9788
9835
|
/**
|
|
9789
|
-
*
|
|
9836
|
+
* The records a new dashboard session is written with, beyond the session itself.
|
|
9790
9837
|
*
|
|
9791
|
-
*
|
|
9792
|
-
* possession of a token, so `reissueTokens` never writes
|
|
9793
|
-
* another session of the same account cannot
|
|
9838
|
+
* The recent-authentication mark is there only when a credential was presented in this request;
|
|
9839
|
+
* a refresh proves possession of a token, so `reissueTokens` never writes it. It keeps its own
|
|
9840
|
+
* short lifetime and its key names the session, so another session of the same account cannot
|
|
9841
|
+
* use it. The session detail is there only when sessions are enabled.
|
|
9794
9842
|
*/
|
|
9795
|
-
private
|
|
9843
|
+
private dashboardExtras;
|
|
9796
9844
|
/**
|
|
9797
9845
|
* Issues access + refresh tokens for a successfully authenticated platform admin.
|
|
9798
9846
|
*
|
|
@@ -9811,9 +9859,7 @@ declare class TokenManagerService {
|
|
|
9811
9859
|
/**
|
|
9812
9860
|
* Writes the per-session detail record for a platform session under `psd:{hash}`.
|
|
9813
9861
|
*
|
|
9814
|
-
* The
|
|
9815
|
-
* but platform sessions never had one, so a session listing had nothing to describe them
|
|
9816
|
-
* with. The field set and the Unix-millisecond timestamps mirror the dashboard record
|
|
9862
|
+
* The field set and the Unix-millisecond timestamps mirror the dashboard record
|
|
9817
9863
|
* exactly, so either backend sharing this Redis reads the same shape.
|
|
9818
9864
|
*
|
|
9819
9865
|
* @param tokenHash - SHA-256 of the raw refresh token; the key's `{hash}` segment.
|
|
@@ -10973,6 +11019,18 @@ declare class MfaRecordService {
|
|
|
10973
11019
|
* @throws {@link AuthException} `MFA_STATE_CONFLICT` when another transition holds the lock.
|
|
10974
11020
|
*/
|
|
10975
11021
|
transition(context: 'dashboard' | 'platform', userId: string, tenantId: string | undefined, mutate: (current: AuthUser | AuthPlatformUser) => MfaRecordUpdate | null): Promise<boolean>;
|
|
11022
|
+
/**
|
|
11023
|
+
* Releases the transition lock this call took, whatever the store answers.
|
|
11024
|
+
*
|
|
11025
|
+
* A compare-and-delete: only a lock still holding this call's nonce is removed. A release that
|
|
11026
|
+
* fails is logged and swallowed, because the transition has already been decided by then: an
|
|
11027
|
+
* error here would replace the transition's own result, answering failure for a write that
|
|
11028
|
+
* committed or hiding the error that did occur. The lock's short TTL ends it on its own.
|
|
11029
|
+
*
|
|
11030
|
+
* @param lockKey - The account's lock key.
|
|
11031
|
+
* @param lockToken - The nonce this call wrote when it took the lock.
|
|
11032
|
+
*/
|
|
11033
|
+
private releaseLock;
|
|
10976
11034
|
/**
|
|
10977
11035
|
* Claims a matched recovery code for exactly one challenge.
|
|
10978
11036
|
*
|
|
@@ -14564,5 +14622,5 @@ declare class WorkspaceInvitationService {
|
|
|
14564
14622
|
private activeWorkspace;
|
|
14565
14623
|
}
|
|
14566
14624
|
|
|
14567
|
-
export { ALLOW_PENDING_WORKSPACE_KEY, ANY_WORKSPACE_MEMBER, API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECRET_MIN_LENGTH, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, AllowPendingWorkspace, 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_MEMBERSHIP_REPOSITORY, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BYMAX_AUTH_WORKSPACE_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, CurrentWorkspace, CurrentWsWorkspace, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MembershipBumpFailedError, MembershipService, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, ReauthenticationService, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WORKSPACE_CURSOR_MAX_LENGTH, WORKSPACE_CURSOR_PART_MAX_LENGTH, WORKSPACE_ID_MAX_LENGTH, WORKSPACE_OWNER_ROLE_MAX_LENGTH, WORKSPACE_PERMISSION_KEY, WORKSPACE_ROLES_KEY, WS_TICKET_TTL_SECONDS, WorkspaceAccessService, WorkspaceActionsService, WorkspaceCallerService, WorkspaceGuard, WorkspaceInvitationService, WorkspacePermission, WorkspaceRoles, WorkspaceService, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, WsWorkspaceGuard, assertWorkspaceId, authDocumentSecurity, createAuthValidationPipe, decodeWorkspaceCursor, decodeWorkspaceScopedName, decrypt, describeChannelStatus, describeError, encodeWorkspaceCursor, encrypt, generateSecureToken, hasRole, hmacSha256, isWorkspaceOwnerRole, readWorkspacePosition, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, stampJobContext, timingSafeCompare, workspacePositionOf, workspaceQueryKey, workspaceScopedName };
|
|
14625
|
+
export { ALLOW_PENDING_WORKSPACE_KEY, ANY_WORKSPACE_MEMBER, API_KEY_MAX_LABEL_LENGTH, API_KEY_MAX_OVERLAP_SECONDS, AUTH_EMAIL_KINDS, AUTH_ERROR_CODES, AUTH_ERROR_MESSAGES, AUTH_ERROR_STATUS, AUTH_SECRET_MIN_LENGTH, AUTH_SECURITY_SCHEMES, AUTH_THROTTLE_CONFIGS, AcceptInvitationDto, AccountStatusService, AllowAllBreachChecker, AllowPendingWorkspace, 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_MEMBERSHIP_REPOSITORY, BYMAX_AUTH_OPTIONS, BYMAX_AUTH_PLATFORM_USER_REPOSITORY, BYMAX_AUTH_REDIS_CLIENT, BYMAX_AUTH_USER_REPOSITORY, BYMAX_AUTH_WORKSPACE_REPOSITORY, BruteForceService, BymaxAuthModule, ChangePasswordDto, CommonPasswordChecker, CreateInvitationDto, CurrentApiKey, CurrentUser, CurrentWorkspace, CurrentWsWorkspace, DefaultAuthEmailProvider, EmailChangeService, ForgotPasswordDto, HibpBreachChecker, IS_PUBLIC_KEY, InvitationService, JwtAuthGuard, JwtPlatformGuard, LoginDto, MembershipBumpFailedError, MembershipService, MfaChallengeDto, MfaDisableDto, MfaRegenerateRecoveryCodesDto, MfaRequiredGuard, MfaService, MfaVerifyDto, NoOpAuthHooks, NoOpEmailProvider, OAuthService, OptionalAuthGuard, OtpService, PLATFORM_ROLES_KEY, PasswordResetService, PlatformAuthService, PlatformLoginDto, PlatformRoles, PlatformRolesGuard, Public, ROLES_KEY, ReauthenticationService, RegisterDto, RequestEncoding, RequestEncodingGuard, ResendOtpDto, ResendVerificationDto, ResetPasswordDto, Roles, RolesGuard, SKIP_MFA_KEY, SelfOrAdminGuard, ServiceKey, SessionService, SkipMfa, TokenDeliveryService, TrustedOriginGuard, UserStatusGuard, VerifyEmailDto, VerifyOtpDto, WORKSPACE_CURSOR_MAX_LENGTH, WORKSPACE_CURSOR_PART_MAX_LENGTH, WORKSPACE_ID_MAX_LENGTH, WORKSPACE_OWNER_ROLE_MAX_LENGTH, WORKSPACE_PERMISSION_KEY, WORKSPACE_ROLES_KEY, WS_TICKET_TTL_SECONDS, WorkspaceAccessService, WorkspaceActionsService, WorkspaceCallerService, WorkspaceGuard, WorkspaceInvitationService, WorkspacePermission, WorkspaceRoles, WorkspaceService, WsAuthExceptionFilter, WsJwtGuard, WsTicketService, WsWorkspaceGuard, assertWorkspaceId, authDocumentSecurity, createAuthValidationPipe, decodeWorkspaceCursor, decodeWorkspaceScopedName, decrypt, describeChannelStatus, describeError, encodeWorkspaceCursor, encrypt, generateSecureToken, hasRole, hmacSha256, isServiceUnavailable, isWorkspaceOwnerRole, readWorkspacePosition, redactSecrets, reduceToBaseWord, sanitizeHeaders, sha256, sleep, stampJobContext, timingSafeCompare, workspacePositionOf, workspaceQueryKey, workspaceScopedName };
|
|
14568
14626
|
export type { AcceptedInvitation, AcceptedSignup, AccountRemovalAudit, ActingMember, ApiKeyAccessEvent, ApiKeyClock, ApiKeyDenyReason, ApiKeyPrincipal, AuthApiKey, AuthApiKeySummary, AuthDocumentSecurityParams, AuthEmailCatalogue, AuthEmailContext, AuthEmailKind, AuthEmailMessage, AuthEmailSink, AuthErrorCode, AuthFieldError, AuthGuardFamily, AuthMembership, AuthModuleAsyncOptions, AuthPlane, AuthPlatformUser, AuthRateLimitWindow, AuthResult, AuthUser, AuthWorkspace, AuthenticatedRequest, BearerAuthResponse, BeforeRegisterResult, BeforeWorkspaceCreateResult, BootstrapInvitationRecord, BothAuthResponse, BymaxAuthModuleOptions, BymaxAuthRateLimitOptions, ChangeMembershipRoleParams, ClientIpSource, CookieAuthResponse, CountOwnedParams, CreateMembershipParams, CreateMembershipResult, CreateSessionParams, CreateUserData, CreateWithOAuthData, CreateWorkspaceResult, CreateWorkspaceWithOwnerParams, CurrentWorkspaceContext, DashboardJwtPayload, DefaultAuthEmailProviderOptions, DeliveryErrorPolicy, DeliveryErrorPolicyMap, FinalizeResult, FindUserByEmailParams, FindUserByOAuthIdParams, GuardedWriteResult, HookContext, IApiKeyRepository, IAuthHooks, IEmailProvider, IMembershipRepository, IPasswordBreachChecker, IPlatformUserRepository, IUserRepository, IWorkspaceRepository, InviteData, IssueApiKeyInput, IssuedApiKey, LastActiveWorkspaceRef, LinkOAuthParams, ListMembershipsForUserParams, ListMembershipsForWorkspaceParams, ListSessionsParams, ListSoleOwnedParams, LiveSessionParams, MemberChangeResult, MemberInvitationRecord, MembershipPage, MembershipRef, MembershipStatus, MembershipWithWorkspace, MfaChallengeResult, MfaSetupResult, MfaTempPayload, MyWorkspaces, OAuthLoginResult, OAuthMfaChallengeResult, OAuthProfile, OAuthProviderPlugin, OpenApiSecurityRequirement, PlatformAuthResult, PlatformAuthenticatedRequest, PlatformBearerAuthResponse, PlatformJwtPayload, RegistrationMode, RemoveAllMembershipsParams, RemoveAllMembershipsResult, RemoveMembershipParams, RemovedMembership, RenameWorkspaceParams, RenameWorkspaceResult, RequestEncodingPolicy, ResolvedOptions, ResolvedWorkspaceMember, RevocableTokenPayload, RevokeAllExceptCurrentParams, RevokeAllSessionsParams, RevokeSessionParams, RotateApiKeyInput, RotatedTokenResult, SafeAuthPlatformUser, SafeAuthUser, ScheduledDeletion, SessionAlertInfo, SessionInfo, SetLastActiveWorkspaceParams, SignupRequest, StoredWorkspaceInvitation, TenantResolverRequest, TenantScopedUserRef, TransferOwnershipParams, TransferOwnershipResult, UpdateEmailParams, UpdateEmailVerifiedParams, UpdateMfaData, UpdateMfaParams, UpdatePasswordParams, UpdatePlatformMfaData, UpdateStatusParams, UpdateWorkspaceStatusParams, UpdateWorkspaceStatusResult, VerifiedAccessToken, VerifiedWorkspaceAccessToken, VerifyAccessTokenOptions, WorkspaceAccess, WorkspaceAccessView, WorkspaceAction, WorkspaceActor, WorkspaceAuditEvent, WorkspaceCheck, WorkspaceInvitationPreview, WorkspaceInvitationView, WorkspaceInviteData, WorkspaceJobContext, WorkspaceOptions, WorkspacePermissionOptions, WorkspaceRef, WorkspaceRequest, WorkspaceRoleList, WorkspaceStatus, WsTicketSnapshot };
|