@spfn/auth 0.3.0-beta.26 → 0.3.0-beta.28

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/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AuthInitOptions, z as OAuthProvider, N as NewUserPublicKey, x as VerificationPurpose, B as NewPasskey, E as Passkey, G as MfaVerification, H as MfaVerificationMethod, J as NewMfaChallenge, Q as MfaChallenge, u as PermissionCategory, W as UserPublicKey, X as AuthContext } from './machine-principals-CdEgxOB1.js';
2
- export { Y as ApproveDeviceAuthParams, Z as AssertStepUpParams, _ as AuthDeletionCancelledPayload, $ as AuthDeletionCompletedPayload, a0 as AuthDeletionRequestedPayload, a1 as AuthDeviceRegisteredPayload, a2 as AuthLoginPayload, a3 as AuthPasswordResetPayload, a4 as AuthProfileOutcome, a5 as AuthProfileVerifier, a6 as AuthProviderSchema, a7 as AuthRegisterPayload, a8 as BearerOutcome, a9 as BearerRefusal, aa as ChangePasswordParams, ab as CompletePasswordResetParams, ac as CompleteSignupParams, ad as ConfirmPasswordResetParams, d as ConfirmPasswordResetResult, ae as ConfirmSignupLinkParams, C as ConfirmSignupLinkResult, af as ConfirmTotpParams, g as ConfirmTotpResult, ag as DeferredLoginEvent, ah as DenyDeviceAuthParams, ai as DeviceAuthApprovedResult, aj as DeviceAuthInfoParams, D as DeviceAuthInfoResult, ak as DeviceAuthPendingResult, al as DeviceAuthPollResponseSchema, am as DeviceNameSchema, an as DeviceRegistrationChannel, ao as DisableSessionBindingParams, ap as EmailSchema, aq as FingerprintSchema, ar as FinishPasskeyEnrollmentParams, F as FinishPasskeyEnrollmentResult, as as FinishPasskeyLoginParams, at as FinishSessionRenewParams, au as InvitationAcceptedPayload, av as InvitationCreatedPayload, I as IssueOneTimeTokenResult, aw as KEY_FINGERPRINT_PREFIX_LENGTH, ax as KeyIdSchema, K as KeySummary, ay as LoginParams, L as LoginResult, az as LogoutParams, aA as MFA_CHALLENGE_ATTEMPT_LIMIT, aB as MFA_CHALLENGE_CHANNELS, aC as MFA_VERIFICATION_METHODS, aD as MachinePrincipal, aE as MachineVerifierRegistration, aF as MarkPasskeyParams, aG as MfaChallengeChannel, aH as MfaChallengeHandle, M as MfaStatus, aI as NativeVerifyOptions, aJ as NewMfaVerification, aK as NormalizedIdentity, q as OAuth2AuthorizationCodeIssued, aL as OAuth2AuthorizeParams, p as OAuth2ConsentView, r as OAuth2GrantSummary, aM as OAuth2ScopeDescription, aN as OAuthCallbackParams, aO as OAuthCallbackResult, aP as OAuthCodeExchangeOptions, aQ as OAuthNativeParams, n as OAuthNativeResult, aR as OAuthStartParams, O as OAuthStartResult, aS as OAuthTokens, aT as OAuthUnlinkedPayload, aU as OpenStepUpChallengeParams, aV as PASSKEY_DEVICE_TYPES, aW as PASSKEY_LABEL_MAX_LENGTH, aX as PasskeyDeviceType, f as PasskeySummary, aY as PasswordSchema, aZ as PhoneSchema, a_ as PlatformSchema, a$ as PollDeviceAuthParams, b0 as PollDeviceAuthResult, b1 as PublicKeySchema, b2 as RecentAuthenticationParams, b3 as RegisterParams, b4 as RegisterPublicKeyParams, b5 as RegisterPublicKeyResult, a as RegisterResult, b6 as RenamePasskeyParams, b7 as RequestPasswordResetParams, c as RequestPasswordResetResult, b8 as RequestSignupLinkParams, b as RequestSignupLinkResult, b9 as RevokeAllKeysParams, i as RevokeAllKeysResult, ba as RevokeKeyParams, bb as RevokePasskeyParams, bc as RotateKeyParams, h as RotateKeyResult, bd as SendVerificationCodeParams, S as SendVerificationCodeResult, be as SessionBindingParams, j as SessionBindingResult, bf as StartDeviceAuthParams, e as StartDeviceAuthResult, bg as StartPasskeyEnrollmentParams, bh as StartSessionRenewParams, bi as StepUpParams, bj as TargetTypeSchema, T as TotpEnrolmentResult, bk as UnlinkNotification, bl as UnlinkNotifyRejection, bm as UnlinkNotifyRequest, bn as UnlinkNotifyResult, bo as UserCodeSchema, v as VERIFICATION_PURPOSES, w as VERIFICATION_TARGET_TYPES, bp as VerificationPurposeSchema, y as VerificationTargetType, bq as VerifyCodeParams, br as VerifyCodeResult, bs as VerifyMfaChallengeParams, V as VerifyMfaChallengeResult, bt as admitBearerKey, bu as approveDeviceAuthService, bv as approveOAuth2AuthorizeService, bw as assertNotLastRecoveryCredential, bx as assertRecentAuthentication, by as assertStepUp, bz as attemptSecondFactor, bA as authDeletionCancelledEvent, bB as authDeletionCompletedEvent, bC as authDeletionRequestedEvent, bD as authDeviceRegisteredEvent, bE as authLoginEvent, bF as authPasswordResetEvent, bG as authRegisterEvent, m as authRouter, bH as authenticate, bI as bearerAuthContext, bJ as buildOAuthErrorUrl, bK as carryStepUpVerification, bL as changePasswordService, bM as completePasswordResetService, bN as completeSignupService, bO as confirmPasswordResetService, bP as confirmSignupLinkService, bQ as confirmTotpEnrolmentService, bR as denyDeviceAuthService, bS as denyOAuth2AuthorizeService, bT as describeOAuth2AuthorizeRequestService, bU as disableMfaService, bV as disableSessionBindingService, bW as enableSessionBindingService, bX as finishPasskeyEnrollmentService, bY as finishPasskeyLoginService, bZ as finishSessionRenewService, b_ as getDeviceAuthInfoService, b$ as getEnabledOAuthProviders, c0 as getGoogleAccessToken, c1 as getMachinePrincipal, c2 as getOAuthProvider, c3 as getRegisteredProviders, c4 as getSessionBindingService, c5 as invitationAcceptedEvent, c6 as invitationCreatedEvent, c7 as isOAuthProviderEnabled, c8 as issueOneTimeTokenService, c9 as keySessionBindingService, ca as listKeysService, cb as listOAuth2GrantsService, cc as listPasskeysService, cd as loginService, ce as logoutService, cf as machineAuth, cg as markPasskeySecondFactorService, ch as mfaChallenges, ci as mfaEnrolledForUser, cj as mfaStatusService, ck as mfaVerifications, cl as oauthCallbackService, cm as oauthNativeService, cn as oauthStartService, co as oauthUnlinkNotifyService, cp as oauthUnlinkedEvent, cq as openStepUpChallengeService, cr as optionalAuth, cs as passkeys, ct as pollDeviceAuthService, cu as regenerateRecoveryCodesService, cv as registerAuthProfile, cw as registerMachineVerifier, cx as registerOAuthProvider, cy as registerPublicKeyService, cz as registerService, cA as registeredBinding, cB as renamePasskeyService, cC as requestPasswordResetService, cD as requestSignupLinkService, cE as requireEnabledProvider, cF as requireMachineScope, cG as resolveAuthenticatedUser, cH as resumeStepUpChallengeService, cI as revokeAllKeysService, cJ as revokeAllOAuth2GrantsForUser, cK as revokeKeyService, cL as revokeOAuth2GrantService, cM as revokePasskeyService, cN as rotateKeyService, cO as runAuthProfile, cP as selectAuthProfile, cQ as sendVerificationCodeService, cR as startDeviceAuthService, cS as startMfaChallengeAssertionService, cT as startPasskeyEnrollmentService, cU as startPasskeyLoginService, cV as startSessionBindingDisableService, cW as startSessionRenewService, cX as startStepUpService, cY as startTotpEnrolmentService, cZ as stepUpService, c_ as sweepMfaChallengesService, c$ as sweepUnconfirmedMfaService, d0 as userPublicKeys, d1 as verifyCodeService, d2 as verifyMfaChallengeService, d3 as verifyOneTimeTokenService, d4 as verifySecondFactor } from './machine-principals-CdEgxOB1.js';
1
+ import { A as AuthInitOptions, G as OAuthProvider, N as NewUserPublicKey, B as VerificationPurpose, H as NewPasskey, J as Passkey, Q as MfaVerification, W as MfaVerificationMethod, X as NewMfaChallenge, Y as MfaChallenge, Z as DeviceLink, _ as NewDeviceLink, x as PermissionCategory, $ as UserPublicKey, a0 as AuthContext } from './machine-principals-B0bjs-0K.js';
2
+ export { a1 as ApproveDeviceAuthParams, a2 as AssertStepUpParams, a3 as AuthDeletionCancelledPayload, a4 as AuthDeletionCompletedPayload, a5 as AuthDeletionRequestedPayload, a6 as AuthDeviceRegisteredPayload, a7 as AuthLoginPayload, a8 as AuthPasswordResetPayload, a9 as AuthProfileOutcome, aa as AuthProfileVerifier, ab as AuthProviderSchema, ac as AuthRegisterPayload, ad as BearerOutcome, ae as BearerRefusal, af as ChangePasswordParams, ag as CompletePasswordResetParams, ah as CompleteSignupParams, ai as ConfirmDeviceLinkParams, aj as ConfirmPasswordResetParams, n as ConfirmPasswordResetResult, ak as ConfirmSignupLinkParams, C as ConfirmSignupLinkResult, al as ConfirmTotpParams, p as ConfirmTotpResult, am as DEVICE_LINK_STATUSES, an as DeferredLoginEvent, ao as DenyDeviceAuthParams, ap as DeviceAuthApprovedResult, aq as DeviceAuthInfoParams, D as DeviceAuthInfoResult, ar as DeviceAuthPendingResult, as as DeviceAuthPollResponseSchema, at as DeviceLinkIssuer, au as DeviceLinkParams, av as DeviceLinkStatus, d as DeviceLinkStatusResult, aw as DeviceNameSchema, ax as DeviceRegistrationChannel, ay as DisableSessionBindingParams, az as EmailSchema, aA as FingerprintSchema, aB as FinishPasskeyEnrollmentParams, F as FinishPasskeyEnrollmentResult, aC as FinishPasskeyLoginParams, aD as FinishSessionRenewParams, aE as InvitationAcceptedPayload, aF as InvitationCreatedPayload, I as IssueDeviceLinkResult, g as IssueOneTimeTokenResult, aG as KEY_FINGERPRINT_PREFIX_LENGTH, aH as KeyIdSchema, K as KeySummary, aI as LinkIdSchema, aJ as LoginParams, L as LoginResult, aK as LogoutParams, aL as MFA_CHALLENGE_ATTEMPT_LIMIT, aM as MFA_CHALLENGE_CHANNELS, aN as MFA_VERIFICATION_METHODS, aO as MachinePrincipal, aP as MachineVerifierRegistration, aQ as MarkPasskeyParams, aR as MatchChoiceSchema, aS as MfaChallengeChannel, aT as MfaChallengeHandle, M as MfaStatus, aU as NativeVerifyOptions, aV as NewMfaVerification, aW as NormalizedIdentity, t as OAuth2AuthorizationCodeIssued, aX as OAuth2AuthorizeParams, s as OAuth2ConsentView, u as OAuth2GrantSummary, aY as OAuth2ScopeDescription, aZ as OAuthCallbackParams, a_ as OAuthCallbackResult, a$ as OAuthCodeExchangeOptions, b0 as OAuthNativeParams, j as OAuthNativeResult, b1 as OAuthStartParams, O as OAuthStartResult, b2 as OAuthTokens, b3 as OAuthUnlinkedPayload, b4 as OpenStepUpChallengeParams, b5 as PASSKEY_DEVICE_TYPES, b6 as PASSKEY_LABEL_MAX_LENGTH, b7 as PasskeyDeviceType, o as PasskeySummary, b8 as PasswordSchema, b9 as PhoneSchema, ba as PlatformSchema, bb as PollDeviceAuthParams, bc as PollDeviceAuthResult, bd as PollDeviceLinkParams, be as PublicKeySchema, bf as RecentAuthenticationParams, bg as RedeemDeviceLinkParams, c as RedeemDeviceLinkResult, bh as RegisterParams, bi as RegisterPublicKeyParams, bj as RegisterPublicKeyResult, a as RegisterResult, bk as RenamePasskeyParams, bl as RequestPasswordResetParams, l as RequestPasswordResetResult, bm as RequestSignupLinkParams, k as RequestSignupLinkResult, bn as RevokeAllKeysParams, f as RevokeAllKeysResult, bo as RevokeKeyParams, bp as RevokePasskeyParams, bq as RotateKeyParams, e as RotateKeyResult, br as SendVerificationCodeParams, S as SendVerificationCodeResult, bs as SessionBindingParams, q as SessionBindingResult, bt as StartDeviceAuthParams, b as StartDeviceAuthResult, bu as StartPasskeyEnrollmentParams, bv as StartSessionRenewParams, bw as StepUpParams, bx as TargetTypeSchema, T as TotpEnrolmentResult, by as UnlinkNotification, bz as UnlinkNotifyRejection, bA as UnlinkNotifyRequest, bB as UnlinkNotifyResult, bC as UserCodeSchema, y as VERIFICATION_PURPOSES, z as VERIFICATION_TARGET_TYPES, bD as VerificationPurposeSchema, E as VerificationTargetType, bE as VerifyCodeParams, bF as VerifyCodeResult, bG as VerifyMfaChallengeParams, V as VerifyMfaChallengeResult, bH as admitBearerKey, bI as approveDeviceAuthService, bJ as approveOAuth2AuthorizeService, bK as assertNotLastRecoveryCredential, bL as assertRecentAuthentication, bM as assertStepUp, bN as attemptSecondFactor, bO as authDeletionCancelledEvent, bP as authDeletionCompletedEvent, bQ as authDeletionRequestedEvent, bR as authDeviceRegisteredEvent, bS as authLoginEvent, bT as authPasswordResetEvent, bU as authRegisterEvent, m as authRouter, bV as authenticate, bW as bearerAuthContext, bX as buildOAuthErrorUrl, bY as cancelDeviceLinkService, bZ as carryStepUpVerification, b_ as changePasswordService, b$ as completePasswordResetService, c0 as completeSignupService, c1 as confirmDeviceLinkService, c2 as confirmPasswordResetService, c3 as confirmSignupLinkService, c4 as confirmTotpEnrolmentService, c5 as denyDeviceAuthService, c6 as denyDeviceLinkService, c7 as denyOAuth2AuthorizeService, c8 as describeOAuth2AuthorizeRequestService, c9 as deviceLinks, ca as disableMfaService, cb as disableSessionBindingService, cc as enableSessionBindingService, cd as finishPasskeyEnrollmentService, ce as finishPasskeyLoginService, cf as finishSessionRenewService, cg as getDeviceAuthInfoService, ch as getDeviceLinkStatusService, ci as getEnabledOAuthProviders, cj as getGoogleAccessToken, ck as getMachinePrincipal, cl as getOAuthProvider, cm as getRegisteredProviders, cn as getSessionBindingService, co as invitationAcceptedEvent, cp as invitationCreatedEvent, cq as isOAuthProviderEnabled, cr as issueDeviceLinkService, cs as issueOneTimeTokenService, ct as keySessionBindingService, cu as listKeysService, cv as listOAuth2GrantsService, cw as listPasskeysService, cx as loginService, cy as logoutService, cz as machineAuth, cA as markPasskeySecondFactorService, cB as mfaChallenges, cC as mfaEnrolledForUser, cD as mfaStatusService, cE as mfaVerifications, cF as oauthCallbackService, cG as oauthNativeService, cH as oauthStartService, cI as oauthUnlinkNotifyService, cJ as oauthUnlinkedEvent, cK as openStepUpChallengeService, cL as optionalAuth, cM as passkeys, cN as pollDeviceAuthService, cO as pollDeviceLinkService, cP as redeemDeviceLinkService, cQ as regenerateRecoveryCodesService, cR as registerAuthProfile, cS as registerMachineVerifier, cT as registerOAuthProvider, cU as registerPublicKeyService, cV as registerService, cW as registeredBinding, cX as renamePasskeyService, cY as requestPasswordResetService, cZ as requestSignupLinkService, c_ as requireEnabledProvider, c$ as requireMachineScope, d0 as resolveAuthenticatedUser, d1 as resumeStepUpChallengeService, d2 as revokeAllKeysService, d3 as revokeAllOAuth2GrantsForUser, d4 as revokeKeyService, d5 as revokeOAuth2GrantService, d6 as revokePasskeyService, d7 as rotateKeyService, d8 as runAuthProfile, d9 as selectAuthProfile, da as sendVerificationCodeService, db as startDeviceAuthService, dc as startMfaChallengeAssertionService, dd as startPasskeyEnrollmentService, de as startPasskeyLoginService, df as startSessionBindingDisableService, dg as startSessionRenewService, dh as startStepUpService, di as startTotpEnrolmentService, dj as stepUpService, dk as sweepMfaChallengesService, dl as sweepUnconfirmedMfaService, dm as userPublicKeys, dn as verifyCodeService, dp as verifyMfaChallengeService, dq as verifyOneTimeTokenService, dr as verifySecondFactor } from './machine-principals-B0bjs-0K.js';
3
3
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
4
4
  import { l as SocialProvider, K as KeyAlgorithmType, d as InvitationStatus, c as AccountDeletionRequestedBy, i as PurgeStrategy } from './types-CTdoTOxM.js';
5
5
  export { A as ACCOUNT_DELETION_REQUESTED_BY, a as ACCOUNT_DELETION_REQUEST_STATUSES, b as AccountDeletionRequestStatus, I as INVITATION_STATUSES, e as KEY_ALGORITHM, f as KEY_DEVICE_NAME_MAX_LENGTH, g as KEY_PLATFORM, h as KeyPlatformType, P as PURGE_STRATEGIES, j as SESSION_BINDINGS, k as SOCIAL_PROVIDERS, S as SessionBindingType, U as USER_STATUSES, m as UserStatus } from './types-CTdoTOxM.js';
@@ -21,95 +21,6 @@ import '@spfn/core/event';
21
21
  import '@spfn/auth/server';
22
22
  import 'jsonwebtoken';
23
23
 
24
- /**
25
- * @spfn/auth - Signed Sign-Out-Everywhere Link
26
- *
27
- * A link an app mails to an account's proven address, which signs every device
28
- * of that account out without a session. It exists for the case the rest of the
29
- * key surface cannot serve: the owner suspects a device they do not recognise,
30
- * and the device they would have to sign in on to do something about it is the
31
- * one they no longer trust.
32
- *
33
- * Three calls, and each is deliberately not the other two. `createRevokeAllLink`
34
- * mints the capability and hands the app a URL. `describeRevokeAllLink` says
35
- * whether that URL still works and changes nothing, so a mail scanner opening
36
- * the page costs nothing. `consumeRevokeAllLink` is the only one that revokes,
37
- * and it takes the owner pressing the button.
38
- *
39
- * The caller's obligation, which this package cannot enforce: the URL
40
- * `createRevokeAllLink` returns carries the plaintext token, because the package
41
- * sends no mail here. Do not log it, do not persist it, do not put it in a job
42
- * payload — hand it to the mail template and let it go. Every other link in this
43
- * package is minted inside the worker that sends it precisely so that no caller
44
- * ever holds one; this one cannot be, and the obligation moves to the app.
45
- */
46
- interface CreateRevokeAllLinkOptions {
47
- /**
48
- * Minutes the link stays valid. Defaults to
49
- * `SPFN_AUTH_REVOKE_ALL_LINK_TTL_MINUTES`, itself 30.
50
- */
51
- ttlMinutes?: number;
52
- }
53
- interface RevokeAllLink {
54
- /** Absolute URL of the app page, token in its query string. Never log it. */
55
- url: string;
56
- expiresAt: Date;
57
- }
58
- /** What the describe call tells the page, so it can say what pressing the button does. */
59
- interface RevokeAllLinkDescription {
60
- expiresAt: Date;
61
- activeKeyCount: number;
62
- }
63
- /**
64
- * Mint a sign-out-everywhere link for an account.
65
- *
66
- * Issuing supersedes every live link the account already has, the rule the
67
- * password-reset flow follows: an owner who asks twice must not leave the first
68
- * capability working in their mailbox after using the second.
69
- *
70
- * The row records the account's key generation, so the link dies the moment any
71
- * other path signs every device out — a password reset, a password change, a
72
- * deletion request, or the ordinary revoke-all route.
73
- *
74
- * Send it beside a password reset link. It ends the sessions; it does not change
75
- * the password that let them start.
76
- *
77
- * @param userId - The account to issue for
78
- * @throws ValidationError `ttlMinutes` that is not a positive integer — no row is written
79
- * @throws NotFoundError no such account, rather than a foreign-key failure at the insert
80
- */
81
- declare function createRevokeAllLink(userId: string | number, options?: CreateRevokeAllLinkOptions): Promise<RevokeAllLink>;
82
- /**
83
- * Say whether a presented link still works, and what pressing the button would
84
- * do. Changes nothing — a mail scanner that opens the page has done nothing.
85
- *
86
- * @throws RevokeAllLinkError every refusal, in one shape
87
- */
88
- declare function describeRevokeAllLink(token: string): Promise<RevokeAllLinkDescription>;
89
- /**
90
- * Spend a link and sign every device of the account out.
91
- *
92
- * The claim is one statement, so of two requests carrying the same token exactly
93
- * one revokes and the other is refused as if the token were unknown — which by
94
- * then it is. `includeCurrent` is true because there is no current device here:
95
- * the caller holds a mailbox, not a session, and sparing something would mean
96
- * sparing whatever the owner is trying to cut off.
97
- *
98
- * @returns how many device keys were revoked; zero is a success, not a refusal
99
- * @throws RevokeAllLinkError every refusal, in the same shape `describe` uses
100
- */
101
- declare function consumeRevokeAllLink(token: string): Promise<{
102
- revokedCount: number;
103
- }>;
104
- /**
105
- * Delete link rows that can no longer answer anything.
106
- *
107
- * @returns number of rows deleted
108
- */
109
- declare function purgeRevokeAllTokensService(): Promise<{
110
- deleted: number;
111
- }>;
112
-
113
24
  /**
114
25
  * @spfn/auth - Global Configuration
115
26
  *
@@ -461,6 +372,95 @@ interface MfaConfig {
461
372
  */
462
373
  declare function getMfaConfig(): MfaConfig;
463
374
 
375
+ /**
376
+ * @spfn/auth - Signed Sign-Out-Everywhere Link
377
+ *
378
+ * A link an app mails to an account's proven address, which signs every device
379
+ * of that account out without a session. It exists for the case the rest of the
380
+ * key surface cannot serve: the owner suspects a device they do not recognise,
381
+ * and the device they would have to sign in on to do something about it is the
382
+ * one they no longer trust.
383
+ *
384
+ * Three calls, and each is deliberately not the other two. `createRevokeAllLink`
385
+ * mints the capability and hands the app a URL. `describeRevokeAllLink` says
386
+ * whether that URL still works and changes nothing, so a mail scanner opening
387
+ * the page costs nothing. `consumeRevokeAllLink` is the only one that revokes,
388
+ * and it takes the owner pressing the button.
389
+ *
390
+ * The caller's obligation, which this package cannot enforce: the URL
391
+ * `createRevokeAllLink` returns carries the plaintext token, because the package
392
+ * sends no mail here. Do not log it, do not persist it, do not put it in a job
393
+ * payload — hand it to the mail template and let it go. Every other link in this
394
+ * package is minted inside the worker that sends it precisely so that no caller
395
+ * ever holds one; this one cannot be, and the obligation moves to the app.
396
+ */
397
+ interface CreateRevokeAllLinkOptions {
398
+ /**
399
+ * Minutes the link stays valid. Defaults to
400
+ * `SPFN_AUTH_REVOKE_ALL_LINK_TTL_MINUTES`, itself 30.
401
+ */
402
+ ttlMinutes?: number;
403
+ }
404
+ interface RevokeAllLink {
405
+ /** Absolute URL of the app page, token in its query string. Never log it. */
406
+ url: string;
407
+ expiresAt: Date;
408
+ }
409
+ /** What the describe call tells the page, so it can say what pressing the button does. */
410
+ interface RevokeAllLinkDescription {
411
+ expiresAt: Date;
412
+ activeKeyCount: number;
413
+ }
414
+ /**
415
+ * Mint a sign-out-everywhere link for an account.
416
+ *
417
+ * Issuing supersedes every live link the account already has, the rule the
418
+ * password-reset flow follows: an owner who asks twice must not leave the first
419
+ * capability working in their mailbox after using the second.
420
+ *
421
+ * The row records the account's key generation, so the link dies the moment any
422
+ * other path signs every device out — a password reset, a password change, a
423
+ * deletion request, or the ordinary revoke-all route.
424
+ *
425
+ * Send it beside a password reset link. It ends the sessions; it does not change
426
+ * the password that let them start.
427
+ *
428
+ * @param userId - The account to issue for
429
+ * @throws ValidationError `ttlMinutes` that is not a positive integer — no row is written
430
+ * @throws NotFoundError no such account, rather than a foreign-key failure at the insert
431
+ */
432
+ declare function createRevokeAllLink(userId: string | number, options?: CreateRevokeAllLinkOptions): Promise<RevokeAllLink>;
433
+ /**
434
+ * Say whether a presented link still works, and what pressing the button would
435
+ * do. Changes nothing — a mail scanner that opens the page has done nothing.
436
+ *
437
+ * @throws RevokeAllLinkError every refusal, in one shape
438
+ */
439
+ declare function describeRevokeAllLink(token: string): Promise<RevokeAllLinkDescription>;
440
+ /**
441
+ * Spend a link and sign every device of the account out.
442
+ *
443
+ * The claim is one statement, so of two requests carrying the same token exactly
444
+ * one revokes and the other is refused as if the token were unknown — which by
445
+ * then it is. `includeCurrent` is true because there is no current device here:
446
+ * the caller holds a mailbox, not a session, and sparing something would mean
447
+ * sparing whatever the owner is trying to cut off.
448
+ *
449
+ * @returns how many device keys were revoked; zero is a success, not a refusal
450
+ * @throws RevokeAllLinkError every refusal, in the same shape `describe` uses
451
+ */
452
+ declare function consumeRevokeAllLink(token: string): Promise<{
453
+ revokedCount: number;
454
+ }>;
455
+ /**
456
+ * Delete link rows that can no longer answer anything.
457
+ *
458
+ * @returns number of rows deleted
459
+ */
460
+ declare function purgeRevokeAllTokensService(): Promise<{
461
+ deleted: number;
462
+ }>;
463
+
464
464
  /**
465
465
  * @spfn/auth - Users Entity
466
466
  *
@@ -1858,7 +1858,7 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
1858
1858
  id: number;
1859
1859
  name: string;
1860
1860
  displayName: string;
1861
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
1861
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
1862
1862
  }[];
1863
1863
  userId: number;
1864
1864
  publicId: string;
@@ -2327,7 +2327,7 @@ declare const accountDeletionRequests: drizzle_orm_pg_core.PgTableWithColumns<{
2327
2327
  name: string;
2328
2328
  tableName: "account_deletion_requests";
2329
2329
  dataType: "string enum";
2330
- data: "admin" | "self";
2330
+ data: "self" | "admin";
2331
2331
  driverParam: string;
2332
2332
  notNull: true;
2333
2333
  hasDefault: true;
@@ -4984,7 +4984,7 @@ declare const permissions: drizzle_orm_pg_core.PgTableWithColumns<{
4984
4984
  name: string;
4985
4985
  tableName: "permissions";
4986
4986
  dataType: "string enum";
4987
- data: "auth" | "custom" | "user" | "rbac" | "system";
4987
+ data: "custom" | "user" | "auth" | "rbac" | "system";
4988
4988
  driverParam: string;
4989
4989
  notNull: false;
4990
4990
  hasDefault: false;
@@ -6315,18 +6315,18 @@ declare class UsersRepository extends BaseRepository {
6315
6315
  * Write primary 사용
6316
6316
  */
6317
6317
  create(data: NewUser): Promise<{
6318
- email: string | null;
6319
- phone: string | null;
6320
6318
  status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
6321
6319
  publicId: string;
6320
+ email: string | null;
6321
+ phone: string | null;
6322
6322
  passwordChangeRequired: boolean;
6323
6323
  sessionBinding: "none" | "passkey";
6324
- id: number;
6325
6324
  username: string | null;
6326
- passwordHash: string | null;
6327
- roleId: number;
6325
+ id: number;
6328
6326
  createdAt: Date;
6329
6327
  updatedAt: Date;
6328
+ passwordHash: string | null;
6329
+ roleId: number;
6330
6330
  emailVerifiedAt: Date | null;
6331
6331
  phoneVerifiedAt: Date | null;
6332
6332
  keyEpoch: number;
@@ -6490,18 +6490,18 @@ declare class UsersRepository extends BaseRepository {
6490
6490
  * Write primary 사용
6491
6491
  */
6492
6492
  deleteById(id: number): Promise<{
6493
- email: string | null;
6494
- phone: string | null;
6495
6493
  status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
6496
6494
  publicId: string;
6495
+ email: string | null;
6496
+ phone: string | null;
6497
6497
  passwordChangeRequired: boolean;
6498
6498
  sessionBinding: "none" | "passkey";
6499
- id: number;
6500
6499
  username: string | null;
6501
- passwordHash: string | null;
6502
- roleId: number;
6500
+ id: number;
6503
6501
  createdAt: Date;
6504
6502
  updatedAt: Date;
6503
+ passwordHash: string | null;
6504
+ roleId: number;
6505
6505
  emailVerifiedAt: Date | null;
6506
6506
  phoneVerifiedAt: Date | null;
6507
6507
  keyEpoch: number;
@@ -6528,7 +6528,7 @@ declare class UsersRepository extends BaseRepository {
6528
6528
  id: number;
6529
6529
  name: string;
6530
6530
  displayName: string;
6531
- category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
6531
+ category: "custom" | "user" | "auth" | "rbac" | "system" | undefined;
6532
6532
  }[];
6533
6533
  }>;
6534
6534
  /**
@@ -6731,19 +6731,16 @@ declare class KeysRepository extends BaseRepository {
6731
6731
  * Write primary 사용
6732
6732
  */
6733
6733
  create(data: NewUserPublicKey): Promise<{
6734
- publicKey: string;
6735
- keyId: string;
6736
- fingerprint: string;
6737
- algorithm: "ES256" | "RS256";
6738
- deviceName: string | null;
6739
- platform: "ios" | "android" | "web" | "desktop" | null;
6740
6734
  userId: number;
6741
- expiresAt: Date | null;
6735
+ keyId: string;
6742
6736
  id: number;
6743
6737
  isActive: boolean;
6744
6738
  createdAt: Date;
6745
- revokedAt: Date | null;
6746
- lastUsedAt: Date | null;
6739
+ publicKey: string;
6740
+ algorithm: "ES256" | "RS256";
6741
+ fingerprint: string;
6742
+ deviceName: string | null;
6743
+ platform: "ios" | "android" | "web" | "desktop" | null;
6747
6744
  registeredIp: string | null;
6748
6745
  registeredUserAgent: string | null;
6749
6746
  registeredUaFamily: string | null;
@@ -6756,6 +6753,9 @@ declare class KeysRepository extends BaseRepository {
6756
6753
  clientContractVersion: string | null;
6757
6754
  clientSeenAt: Date | null;
6758
6755
  pendingMfaChallengeId: number | null;
6756
+ lastUsedAt: Date | null;
6757
+ expiresAt: Date | null;
6758
+ revokedAt: Date | null;
6759
6759
  revokedReason: string | null;
6760
6760
  }>;
6761
6761
  /**
@@ -6815,6 +6815,16 @@ declare class KeysRepository extends BaseRepository {
6815
6815
  * Write primary 사용
6816
6816
  */
6817
6817
  revokeAllActiveByUserIdExcept(userId: number, keepKeyId: string, reason: string): Promise<RevokedKey[]>;
6818
+ /**
6819
+ * Lock the user's active key rows until the transaction ends, for a revocation
6820
+ * that has to touch other rows before it revokes the keys.
6821
+ *
6822
+ * Device-link statements lock the issuing key row before the link row. A
6823
+ * transaction that expires links and then revokes keys takes them the other
6824
+ * way round, and deadlocks against an issue, redeem, approve or consume in
6825
+ * flight on the same key. Calling this first restores the key-before-link order.
6826
+ */
6827
+ lockActiveByUserId(userId: number): Promise<void>;
6818
6828
  /**
6819
6829
  * The one statement behind both global revocations.
6820
6830
  *
@@ -6844,19 +6854,16 @@ declare class KeysRepository extends BaseRepository {
6844
6854
  * Write primary 사용
6845
6855
  */
6846
6856
  deleteByKeyIdAndUserId(keyId: string, userId: number): Promise<{
6847
- publicKey: string;
6848
- keyId: string;
6849
- fingerprint: string;
6850
- algorithm: "ES256" | "RS256";
6851
- deviceName: string | null;
6852
- platform: "ios" | "android" | "web" | "desktop" | null;
6853
6857
  userId: number;
6854
- expiresAt: Date | null;
6858
+ keyId: string;
6855
6859
  id: number;
6856
6860
  isActive: boolean;
6857
6861
  createdAt: Date;
6858
- revokedAt: Date | null;
6859
- lastUsedAt: Date | null;
6862
+ publicKey: string;
6863
+ algorithm: "ES256" | "RS256";
6864
+ fingerprint: string;
6865
+ deviceName: string | null;
6866
+ platform: "ios" | "android" | "web" | "desktop" | null;
6860
6867
  registeredIp: string | null;
6861
6868
  registeredUserAgent: string | null;
6862
6869
  registeredUaFamily: string | null;
@@ -6869,6 +6876,9 @@ declare class KeysRepository extends BaseRepository {
6869
6876
  clientContractVersion: string | null;
6870
6877
  clientSeenAt: Date | null;
6871
6878
  pendingMfaChallengeId: number | null;
6879
+ lastUsedAt: Date | null;
6880
+ expiresAt: Date | null;
6881
+ revokedAt: Date | null;
6872
6882
  revokedReason: string | null;
6873
6883
  }>;
6874
6884
  /**
@@ -7153,14 +7163,14 @@ declare class VerificationCodesRepository extends BaseRepository {
7153
7163
  * Write primary 사용
7154
7164
  */
7155
7165
  create(data: NewVerificationCode): Promise<{
7156
- target: string;
7157
- targetType: "email" | "phone";
7158
- purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change" | "account_deletion";
7159
- code: string;
7160
- expiresAt: Date;
7161
7166
  id: number;
7162
7167
  createdAt: Date;
7163
7168
  updatedAt: Date;
7169
+ expiresAt: Date;
7170
+ target: string;
7171
+ targetType: "email" | "phone";
7172
+ code: string;
7173
+ purpose: "registration" | "login" | "password_reset" | "email_change" | "phone_change" | "account_deletion";
7164
7174
  usedAt: Date | null;
7165
7175
  attempts: number;
7166
7176
  }>;
@@ -7896,6 +7906,12 @@ declare const mfaEnrolmentRepository: MfaEnrolmentRepository;
7896
7906
  * most of all, since the poll that spends it is the one call that registers a
7897
7907
  * key. Judging the clock only in the read would let that key be registered after
7898
7908
  * the code was dead.
7909
+ *
7910
+ * The three transitions that answer a record — approve, deny, and the global
7911
+ * revocation's sweep — also wake any long poll parked on it, after commit. That
7912
+ * is done here rather than in each caller because the sweep has four callers
7913
+ * across the revocation paths, and a caller that forgot would leave a waiting
7914
+ * device on its slower recheck instead of telling it no.
7899
7915
  */
7900
7916
 
7901
7917
  declare class DeviceAuthorizationsRepository extends BaseRepository {
@@ -7930,6 +7946,16 @@ declare class DeviceAuthorizationsRepository extends BaseRepository {
7930
7946
  * Read replica.
7931
7947
  */
7932
7948
  findByDeviceCodeHash(deviceCodeHash: string): Promise<DeviceAuthorization | null>;
7949
+ /**
7950
+ * `findByDeviceCodeHash`, read from the primary even outside a transaction.
7951
+ *
7952
+ * For the long poll's wait, which runs before any transaction opens: it is
7953
+ * woken right after an answer commits, and a replica that has not caught up
7954
+ * yet would show it the record still pending and send it back to sleep.
7955
+ *
7956
+ * Write primary.
7957
+ */
7958
+ findByDeviceCodeHashOnPrimary(deviceCodeHash: string): Promise<DeviceAuthorization | null>;
7933
7959
  /**
7934
7960
  * Bind the approving user and move the record to `approved`, but only from
7935
7961
  * `pending`.
@@ -7986,9 +8012,165 @@ declare class DeviceAuthorizationsRepository extends BaseRepository {
7986
8012
  * @returns the spent row, or null if it was not approved (any more), or expired
7987
8013
  */
7988
8014
  consumeApproved(deviceCodeHash: string): Promise<DeviceAuthorization | null>;
8015
+ /** Wake the polls parked on a record this call moved, and hand the row back. */
8016
+ private answered;
7989
8017
  }
7990
8018
  declare const deviceAuthorizationsRepository: DeviceAuthorizationsRepository;
7991
8019
 
8020
+ /**
8021
+ * Device Links Repository
8022
+ *
8023
+ * Data access for device link. Extends BaseRepository for transaction context
8024
+ * detection and read/write splitting.
8025
+ *
8026
+ * Built the way `device-authorizations.repository.ts` is, for its reasons: every
8027
+ * state change is a conditional UPDATE naming the state it moves from and
8028
+ * carrying the TTL as the database's `now()`, and returns the row only when this
8029
+ * call was the one that moved it. Two devices redeeming one code, or two polls
8030
+ * collecting one approval, produce one winner.
8031
+ *
8032
+ * One condition more than device-code login has: the issuing key. A link belongs
8033
+ * to the key that signed its issue request, and it is worth nothing once that key
8034
+ * is revoked or has run out — a signed-out session must not be able to let a new
8035
+ * device into the account. The transitions that move a link toward a registered
8036
+ * key (redeem, confirm, consume) carry that condition in the same statement, and
8037
+ * lock the key row while they judge it, so a revocation committing at the same
8038
+ * moment is either seen or waited for — never read around.
8039
+ *
8040
+ * Every read here gates authorization — who may see a link, whether a key may be
8041
+ * parked or registered — so every read goes to the primary.
8042
+ *
8043
+ * Every transition wakes the long polls parked on the link, after commit.
8044
+ */
8045
+
8046
+ /** A link as read, with whether its issuing key can still sign. */
8047
+ type DeviceLinkRecord = DeviceLink & {
8048
+ issuerKeyLive: boolean;
8049
+ };
8050
+ /** The key material and labels a redeeming device parks, with the codes drawn for it. */
8051
+ interface DeviceLinkRedemption {
8052
+ deviceCodeHash: string;
8053
+ publicKey: string;
8054
+ keyId: string;
8055
+ fingerprint: string;
8056
+ algorithm: DeviceLink['algorithm'];
8057
+ deviceName?: string;
8058
+ platform?: DeviceLink['platform'];
8059
+ matchNumber: number;
8060
+ choices: number[];
8061
+ }
8062
+ declare class DeviceLinksRepository extends BaseRepository {
8063
+ /**
8064
+ * Insert an issued link, unless its user code is already taken.
8065
+ *
8066
+ * `onConflictDoNothing` for the reason `DeviceAuthorizationsRepository.create`
8067
+ * gives: a raised unique violation would abort the issue route's transaction
8068
+ * and leave no way to retry with a fresh code.
8069
+ *
8070
+ * @returns the inserted row, or null if the code collided
8071
+ */
8072
+ create(data: NewDeviceLink): Promise<DeviceLink | null>;
8073
+ /**
8074
+ * Find a link by the issuer's handle, in any state.
8075
+ *
8076
+ * Unfiltered, as `DeviceAuthorizationsRepository.findByUserCode` is: which
8077
+ * refusal a caller is owed is the service's decision.
8078
+ */
8079
+ findByLinkId(linkId: string): Promise<DeviceLinkRecord | null>;
8080
+ /** Find a link by its normalized user code, in any state. */
8081
+ findByUserCode(userCode: string): Promise<DeviceLinkRecord | null>;
8082
+ /** Find a link by the hash of the device code its redeemer holds, in any state. */
8083
+ findByDeviceCodeHash(deviceCodeHash: string): Promise<DeviceLinkRecord | null>;
8084
+ /**
8085
+ * Park a device's key on an issued link and move it to `redeemed`.
8086
+ *
8087
+ * From `issued` only, so of two devices redeeming one code exactly one wins;
8088
+ * the other matches nothing and is answered as if the code were unknown.
8089
+ *
8090
+ * @returns the updated row, or null if it was no longer issued, expired, or its issuer signed out
8091
+ */
8092
+ redeem(id: number, redemption: DeviceLinkRedemption): Promise<DeviceLink | null>;
8093
+ /**
8094
+ * The issuer picked the right number: move the link to `approved`, from
8095
+ * `redeemed` only.
8096
+ *
8097
+ * The key is not registered here, for the reason device-code approval gives:
8098
+ * the redeeming device may never come back for it.
8099
+ *
8100
+ * @returns the updated row, or null if it was no longer redeemed, expired, or its issuer signed out
8101
+ */
8102
+ approve(id: number): Promise<DeviceLink | null>;
8103
+ /**
8104
+ * Refuse a redeemed link — the issuer said no, or picked the wrong number.
8105
+ *
8106
+ * No issuing-key condition: refusing is always safe, and a signed-out issuer's
8107
+ * link is refused anyway.
8108
+ *
8109
+ * @returns the updated row, or null if it was no longer redeemed, or expired
8110
+ */
8111
+ deny(id: number): Promise<DeviceLink | null>;
8112
+ /**
8113
+ * The issuer closed the link before anyone was let in: `issued` or `redeemed`
8114
+ * to `expired`.
8115
+ *
8116
+ * @returns the updated row, or null if it had moved past redeemed, or expired
8117
+ */
8118
+ cancel(id: number): Promise<DeviceLink | null>;
8119
+ /**
8120
+ * Spend an approved link, addressed by the device code hash the caller
8121
+ * presented — the one-shot `DeviceAuthorizationsRepository.consumeApproved`
8122
+ * is, with the issuing key judged in the same statement.
8123
+ *
8124
+ * @returns the spent row, or null if it was not approved (any more), expired, or its issuer signed out
8125
+ */
8126
+ consumeApproved(deviceCodeHash: string): Promise<DeviceLink | null>;
8127
+ /**
8128
+ * Lock the issuing key's row until the transaction ends, so two issues from
8129
+ * one key run one after the other: each expires the other's link or waits for
8130
+ * it to be inserted, and never both read "nothing live" and insert.
8131
+ *
8132
+ * `no key update` is the lock a plain UPDATE of the row takes: it conflicts
8133
+ * with itself, with the share lock `issuerKeyLive(true)` takes and with a
8134
+ * revocation's UPDATE, and it leaves foreign-key checks on the row alone.
8135
+ * Taken first, before any link row, so every path that locks both — redeem,
8136
+ * approve, consume and the revocations — locks the key row before the link.
8137
+ */
8138
+ lockIssuerKey(issuerKeyId: string): Promise<void>;
8139
+ /**
8140
+ * Expire the live link a key issued, so a fresh issue leaves one link per key.
8141
+ *
8142
+ * Race-free only after `lockIssuerKey` in the same transaction.
8143
+ *
8144
+ * @returns the rows this call expired
8145
+ */
8146
+ expireLiveByIssuerKey(issuerKeyId: string): Promise<DeviceLink[]>;
8147
+ /**
8148
+ * Expire every link an account still has in play — the device-link half of a
8149
+ * global revocation, beside `DeviceAuthorizationsRepository.denyAllActiveByUserId`.
8150
+ *
8151
+ * A revoke-all that spares the calling device spares its key too, so the
8152
+ * issuing-key condition alone would leave that device's link able to let a
8153
+ * new device in seconds after the owner signed everything else out.
8154
+ *
8155
+ * @returns the rows this call expired
8156
+ */
8157
+ expireAllLiveByUserId(userId: number): Promise<DeviceLink[]>;
8158
+ private expireLive;
8159
+ /** Apply one conditional UPDATE, wake the waiters of the row it moved, and hand the row back. */
8160
+ private transition;
8161
+ /** One link with its issuing key's standing. */
8162
+ private findOne;
8163
+ /**
8164
+ * Whether the link's issuing key is still registered to its issuer, active
8165
+ * and unexpired — the test `authenticate` applies to the same row.
8166
+ *
8167
+ * @param lock take a share lock on the key row, so a transition waits for a
8168
+ * revocation in flight instead of judging the version before it
8169
+ */
8170
+ private issuerKeyLive;
8171
+ }
8172
+ declare const deviceLinksRepository: DeviceLinksRepository;
8173
+
7992
8174
  /**
7993
8175
  * Roles Repository
7994
8176
  *
@@ -8065,8 +8247,8 @@ declare class RolesRepository extends BaseRepository {
8065
8247
  */
8066
8248
  create(data: NewRoleEntity): Promise<{
8067
8249
  description: string | null;
8068
- name: string;
8069
8250
  id: number;
8251
+ name: string;
8070
8252
  displayName: string;
8071
8253
  isBuiltin: boolean;
8072
8254
  isSystem: boolean;
@@ -8095,8 +8277,8 @@ declare class RolesRepository extends BaseRepository {
8095
8277
  */
8096
8278
  deleteById(id: number): Promise<{
8097
8279
  description: string | null;
8098
- name: string;
8099
8280
  id: number;
8281
+ name: string;
8100
8282
  displayName: string;
8101
8283
  isBuiltin: boolean;
8102
8284
  isSystem: boolean;
@@ -8129,7 +8311,7 @@ declare class PermissionsRepository extends BaseRepository {
8129
8311
  name: string;
8130
8312
  displayName: string;
8131
8313
  description: string | null;
8132
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
8314
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
8133
8315
  isBuiltin: boolean;
8134
8316
  isSystem: boolean;
8135
8317
  isActive: boolean;
@@ -8145,7 +8327,7 @@ declare class PermissionsRepository extends BaseRepository {
8145
8327
  name: string;
8146
8328
  displayName: string;
8147
8329
  description: string | null;
8148
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
8330
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
8149
8331
  isBuiltin: boolean;
8150
8332
  isSystem: boolean;
8151
8333
  isActive: boolean;
@@ -8185,7 +8367,7 @@ declare class PermissionsRepository extends BaseRepository {
8185
8367
  name: string;
8186
8368
  displayName: string;
8187
8369
  description: string | null;
8188
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
8370
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
8189
8371
  isBuiltin: boolean;
8190
8372
  isSystem: boolean;
8191
8373
  isActive: boolean;
@@ -8196,16 +8378,16 @@ declare class PermissionsRepository extends BaseRepository {
8196
8378
  */
8197
8379
  deleteById(id: number): Promise<{
8198
8380
  description: string | null;
8199
- metadata: Record<string, any> | null;
8200
- name: string;
8201
8381
  id: number;
8382
+ name: string;
8202
8383
  displayName: string;
8203
8384
  isBuiltin: boolean;
8204
8385
  isSystem: boolean;
8205
8386
  isActive: boolean;
8206
8387
  createdAt: Date;
8207
8388
  updatedAt: Date;
8208
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
8389
+ metadata: Record<string, any> | null;
8390
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
8209
8391
  }>;
8210
8392
  }
8211
8393
  declare const permissionsRepository: PermissionsRepository;
@@ -8250,9 +8432,9 @@ declare class RolePermissionsRepository extends BaseRepository {
8250
8432
  */
8251
8433
  createMany(data: NewRolePermission[]): Promise<{
8252
8434
  id: number;
8253
- roleId: number;
8254
8435
  createdAt: Date;
8255
8436
  updatedAt: Date;
8437
+ roleId: number;
8256
8438
  permissionId: number;
8257
8439
  }[]>;
8258
8440
  /**
@@ -8268,9 +8450,9 @@ declare class RolePermissionsRepository extends BaseRepository {
8268
8450
  */
8269
8451
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
8270
8452
  id: number;
8271
- roleId: number;
8272
8453
  createdAt: Date;
8273
8454
  updatedAt: Date;
8455
+ roleId: number;
8274
8456
  permissionId: number;
8275
8457
  }[]>;
8276
8458
  }
@@ -8332,12 +8514,12 @@ declare class UserPermissionsRepository extends BaseRepository {
8332
8514
  */
8333
8515
  create(data: NewUserPermission): Promise<{
8334
8516
  userId: number;
8335
- expiresAt: Date | null;
8336
8517
  id: number;
8337
8518
  createdAt: Date;
8338
8519
  updatedAt: Date;
8339
- permissionId: number;
8520
+ expiresAt: Date | null;
8340
8521
  reason: string | null;
8522
+ permissionId: number;
8341
8523
  granted: boolean;
8342
8524
  }>;
8343
8525
  /**
@@ -8358,12 +8540,12 @@ declare class UserPermissionsRepository extends BaseRepository {
8358
8540
  */
8359
8541
  deleteByUserIdAndPermissionId(userId: number, permissionId: number): Promise<{
8360
8542
  userId: number;
8361
- expiresAt: Date | null;
8362
8543
  id: number;
8363
8544
  createdAt: Date;
8364
8545
  updatedAt: Date;
8365
- permissionId: number;
8546
+ expiresAt: Date | null;
8366
8547
  reason: string | null;
8548
+ permissionId: number;
8367
8549
  granted: boolean;
8368
8550
  }>;
8369
8551
  /**
@@ -8442,7 +8624,6 @@ declare class UserProfilesRepository extends BaseRepository {
8442
8624
  * 프로필 생성
8443
8625
  */
8444
8626
  create(data: NewUserProfile): Promise<{
8445
- metadata: Record<string, any> | null;
8446
8627
  userId: number;
8447
8628
  id: number;
8448
8629
  displayName: string | null;
@@ -8460,6 +8641,7 @@ declare class UserProfilesRepository extends BaseRepository {
8460
8641
  location: string | null;
8461
8642
  company: string | null;
8462
8643
  jobTitle: string | null;
8644
+ metadata: Record<string, any> | null;
8463
8645
  }>;
8464
8646
  /**
8465
8647
  * 프로필 업데이트 (by ID)
@@ -8511,7 +8693,6 @@ declare class UserProfilesRepository extends BaseRepository {
8511
8693
  * 프로필 삭제 (by ID)
8512
8694
  */
8513
8695
  deleteById(id: number): Promise<{
8514
- metadata: Record<string, any> | null;
8515
8696
  userId: number;
8516
8697
  id: number;
8517
8698
  displayName: string | null;
@@ -8529,12 +8710,12 @@ declare class UserProfilesRepository extends BaseRepository {
8529
8710
  location: string | null;
8530
8711
  company: string | null;
8531
8712
  jobTitle: string | null;
8713
+ metadata: Record<string, any> | null;
8532
8714
  }>;
8533
8715
  /**
8534
8716
  * 프로필 삭제 (by User ID)
8535
8717
  */
8536
8718
  deleteByUserId(userId: number): Promise<{
8537
- metadata: Record<string, any> | null;
8538
8719
  userId: number;
8539
8720
  id: number;
8540
8721
  displayName: string | null;
@@ -8552,6 +8733,7 @@ declare class UserProfilesRepository extends BaseRepository {
8552
8733
  location: string | null;
8553
8734
  company: string | null;
8554
8735
  jobTitle: string | null;
8736
+ metadata: Record<string, any> | null;
8555
8737
  }>;
8556
8738
  /**
8557
8739
  * 프로필 Upsert (by User ID)
@@ -8560,7 +8742,6 @@ declare class UserProfilesRepository extends BaseRepository {
8560
8742
  * 새로 생성 시 displayName은 필수 (없으면 'User'로 설정)
8561
8743
  */
8562
8744
  upsertByUserId(userId: number, data: Partial<Omit<NewUserProfile, 'userId'>>): Promise<{
8563
- metadata: Record<string, any> | null;
8564
8745
  userId: number;
8565
8746
  id: number;
8566
8747
  displayName: string | null;
@@ -8578,6 +8759,7 @@ declare class UserProfilesRepository extends BaseRepository {
8578
8759
  location: string | null;
8579
8760
  company: string | null;
8580
8761
  jobTitle: string | null;
8762
+ metadata: Record<string, any> | null;
8581
8763
  }>;
8582
8764
  /**
8583
8765
  * User ID로 프로필 데이터 조회 (formatted)
@@ -8704,15 +8886,15 @@ declare class InvitationsRepository extends BaseRepository {
8704
8886
  * 초대 생성
8705
8887
  */
8706
8888
  create(data: NewInvitation): Promise<{
8707
- email: string;
8708
- metadata: Record<string, any> | null;
8709
- token: string;
8710
8889
  status: "pending" | "accepted" | "expired" | "cancelled";
8711
- expiresAt: Date;
8890
+ email: string;
8712
8891
  id: number;
8713
- roleId: number;
8714
8892
  createdAt: Date;
8715
8893
  updatedAt: Date;
8894
+ roleId: number;
8895
+ metadata: Record<string, any> | null;
8896
+ expiresAt: Date;
8897
+ token: string;
8716
8898
  invitedBy: number;
8717
8899
  acceptedAt: Date | null;
8718
8900
  cancelledAt: Date | null;
@@ -8738,15 +8920,15 @@ declare class InvitationsRepository extends BaseRepository {
8738
8920
  * 초대 삭제
8739
8921
  */
8740
8922
  deleteById(id: number): Promise<{
8741
- email: string;
8742
- metadata: Record<string, any> | null;
8743
- token: string;
8744
8923
  status: "pending" | "accepted" | "expired" | "cancelled";
8745
- expiresAt: Date;
8924
+ email: string;
8746
8925
  id: number;
8747
- roleId: number;
8748
8926
  createdAt: Date;
8749
8927
  updatedAt: Date;
8928
+ roleId: number;
8929
+ metadata: Record<string, any> | null;
8930
+ expiresAt: Date;
8931
+ token: string;
8750
8932
  invitedBy: number;
8751
8933
  acceptedAt: Date | null;
8752
8934
  cancelledAt: Date | null;
@@ -8985,9 +9167,9 @@ declare class SocialAccountsRepository extends BaseRepository {
8985
9167
  createdAt: Date;
8986
9168
  updatedAt: Date;
8987
9169
  provider: "google" | "apple" | "github" | "kakao" | "naver" | "superself";
8988
- accessToken: string | null;
8989
9170
  providerUserId: string;
8990
9171
  providerEmail: string | null;
9172
+ accessToken: string | null;
8991
9173
  refreshToken: string | null;
8992
9174
  tokenExpiresAt: Date | null;
8993
9175
  }>;
@@ -9001,9 +9183,9 @@ declare class SocialAccountsRepository extends BaseRepository {
9001
9183
  createdAt: Date;
9002
9184
  updatedAt: Date;
9003
9185
  provider: "google" | "apple" | "github" | "kakao" | "naver" | "superself";
9004
- accessToken: string | null;
9005
9186
  providerUserId: string;
9006
9187
  providerEmail: string | null;
9188
+ accessToken: string | null;
9007
9189
  refreshToken: string | null;
9008
9190
  tokenExpiresAt: Date | null;
9009
9191
  }>;
@@ -9063,7 +9245,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9063
9245
  requestedAt: Date;
9064
9246
  purgeScheduledAt: Date;
9065
9247
  status: "pending" | "cancelled" | "completed";
9066
- requestedBy: "admin" | "self";
9248
+ requestedBy: "self" | "admin";
9067
9249
  reason: string | null;
9068
9250
  cancelledAt: Date | null;
9069
9251
  completedAt: Date | null;
@@ -9082,7 +9264,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9082
9264
  requestedAt: Date;
9083
9265
  purgeScheduledAt: Date;
9084
9266
  status: "pending" | "cancelled" | "completed";
9085
- requestedBy: "admin" | "self";
9267
+ requestedBy: "self" | "admin";
9086
9268
  reason: string | null;
9087
9269
  cancelledAt: Date | null;
9088
9270
  completedAt: Date | null;
@@ -9104,7 +9286,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9104
9286
  requestedAt: Date;
9105
9287
  purgeScheduledAt: Date;
9106
9288
  status: "pending" | "cancelled" | "completed";
9107
- requestedBy: "admin" | "self";
9289
+ requestedBy: "self" | "admin";
9108
9290
  reason: string | null;
9109
9291
  cancelledAt: Date | null;
9110
9292
  completedAt: Date | null;
@@ -9123,7 +9305,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9123
9305
  requestedAt: Date;
9124
9306
  purgeScheduledAt: Date;
9125
9307
  status: "pending" | "cancelled" | "completed";
9126
- requestedBy: "admin" | "self";
9308
+ requestedBy: "self" | "admin";
9127
9309
  reason: string | null;
9128
9310
  cancelledAt: Date | null;
9129
9311
  completedAt: Date | null;
@@ -9136,16 +9318,16 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9136
9318
  create(data: NewAccountDeletionRequest): Promise<{
9137
9319
  status: "pending" | "cancelled" | "completed";
9138
9320
  userId: number | null;
9321
+ purgeScheduledAt: Date;
9139
9322
  id: number;
9140
9323
  createdAt: Date;
9141
9324
  updatedAt: Date;
9142
- reason: string | null;
9143
- purgeScheduledAt: Date;
9144
- cancelledAt: Date | null;
9145
9325
  completedAt: Date | null;
9326
+ reason: string | null;
9146
9327
  userPublicId: string;
9147
- requestedBy: "admin" | "self";
9328
+ requestedBy: "self" | "admin";
9148
9329
  purgeStrategy: "anonymize" | "hard-delete" | null;
9330
+ cancelledAt: Date | null;
9149
9331
  requestedAt: Date;
9150
9332
  }>;
9151
9333
  /**
@@ -9165,7 +9347,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9165
9347
  requestedAt: Date;
9166
9348
  purgeScheduledAt: Date;
9167
9349
  status: "pending" | "cancelled" | "completed";
9168
- requestedBy: "admin" | "self";
9350
+ requestedBy: "self" | "admin";
9169
9351
  reason: string | null;
9170
9352
  cancelledAt: Date | null;
9171
9353
  completedAt: Date | null;
@@ -9190,7 +9372,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9190
9372
  requestedAt: Date;
9191
9373
  purgeScheduledAt: Date;
9192
9374
  status: "pending" | "cancelled" | "completed";
9193
- requestedBy: "admin" | "self";
9375
+ requestedBy: "self" | "admin";
9194
9376
  reason: string | null;
9195
9377
  cancelledAt: Date | null;
9196
9378
  completedAt: Date | null;
@@ -10084,18 +10266,18 @@ declare function getOptionalAuth(c: Context | {
10084
10266
  declare function getUser(c: Context | {
10085
10267
  raw: Context;
10086
10268
  }): {
10087
- email: string | null;
10088
- phone: string | null;
10089
10269
  status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
10090
10270
  publicId: string;
10271
+ email: string | null;
10272
+ phone: string | null;
10091
10273
  passwordChangeRequired: boolean;
10092
10274
  sessionBinding: "none" | "passkey";
10093
- id: number;
10094
10275
  username: string | null;
10095
- passwordHash: string | null;
10096
- roleId: number;
10276
+ id: number;
10097
10277
  createdAt: Date;
10098
10278
  updatedAt: Date;
10279
+ passwordHash: string | null;
10280
+ roleId: number;
10099
10281
  emailVerifiedAt: Date | null;
10100
10282
  phoneVerifiedAt: Date | null;
10101
10283
  keyEpoch: number;
@@ -10590,6 +10772,8 @@ interface AuthDeviceAuthConfig {
10590
10772
  ttlMs: number;
10591
10773
  /** How long the waiting device should wait between polls, in milliseconds. */
10592
10774
  intervalMs: number;
10775
+ /** The longest a poll that asks to wait (`waitMillis`) is held open, in milliseconds. */
10776
+ maxWaitMs: number;
10593
10777
  }
10594
10778
  /**
10595
10779
  * Ten minutes. Long enough to walk to the other device and type the code, short
@@ -10598,12 +10782,19 @@ interface AuthDeviceAuthConfig {
10598
10782
  declare const DEFAULT_DEVICE_AUTH_TTL_MS: number;
10599
10783
  /** Five seconds. The interval the server asks for; the rate limit is what enforces it. */
10600
10784
  declare const DEFAULT_DEVICE_AUTH_INTERVAL_MS: number;
10785
+ /**
10786
+ * Twenty seconds. Load balancers commonly close a request that has sent nothing
10787
+ * for 30 seconds (Google Cloud's backend service default among them), and a long
10788
+ * poll cut off there reaches the device as a network error rather than as a
10789
+ * pending answer. Twenty leaves room under that for the request's own work.
10790
+ */
10791
+ declare const DEFAULT_DEVICE_AUTH_MAX_WAIT_MS: number;
10601
10792
  /**
10602
10793
  * Set the resolved device-auth config. Called synchronously from
10603
10794
  * `createAuthLifecycle()` for the same reason `configureDeletion` is: it must
10604
10795
  * take effect before any handler that reads `getDeviceAuthConfig()` can run.
10605
10796
  *
10606
- * Both knobs are whole millisecond counts, and one that is not is refused here
10797
+ * Every knob is a whole millisecond count, and one that is not is refused here
10607
10798
  * rather than served. `intervalMs` is the reason the check exists: it leaves as
10608
10799
  * `intervalMillis` in the start and poll answers, which `DeviceAuthPollResponseSchema`
10609
10800
  * declares an integer and the mobile contract exports as one, so a fractional
@@ -10617,6 +10808,41 @@ declare function configureDeviceAuth(options?: Partial<AuthDeviceAuthConfig>): v
10617
10808
  */
10618
10809
  declare function getDeviceAuthConfig(): AuthDeviceAuthConfig;
10619
10810
 
10811
+ /**
10812
+ * Device Link Configuration
10813
+ *
10814
+ * Singleton config for device link, set once during `createAuthLifecycle()` and
10815
+ * read at request time, as `device-auth-config.ts` is.
10816
+ *
10817
+ * One knob of its own. The poll interval and the long-poll cap are device-code
10818
+ * login's (`deviceAuth.intervalMs`, `deviceAuth.maxWaitMs`): both flows wait the
10819
+ * same way, behind the same proxies, so two settings for one idle timeout would
10820
+ * only be two chances to get it wrong.
10821
+ */
10822
+ interface AuthDeviceLinkConfig {
10823
+ /** How long a link code stays usable, in milliseconds. */
10824
+ ttlMs: number;
10825
+ }
10826
+ /**
10827
+ * Five minutes. Half of device-code login's ten, because the code is on the
10828
+ * issuer's own screen and the new device is in the same hand: there is no walk
10829
+ * to another room, and a code left showing on a desk is worth less the sooner
10830
+ * it dies.
10831
+ */
10832
+ declare const DEFAULT_DEVICE_LINK_TTL_MS: number;
10833
+ /**
10834
+ * Set the resolved device-link config. Called synchronously from
10835
+ * `createAuthLifecycle()` beside `configureDeviceAuth`, so it takes effect before
10836
+ * any handler can run.
10837
+ *
10838
+ * `ttlMs` leaves as `expiresAtMillis`, an integer in the issue and redeem
10839
+ * answers, so a value that is not a positive whole number of milliseconds is
10840
+ * refused here rather than served.
10841
+ */
10842
+ declare function configureDeviceLink(options?: Partial<AuthDeviceLinkConfig>): void;
10843
+ /** Read the current device-link config. Defaults apply until `configureDeviceLink` runs. */
10844
+ declare function getDeviceLinkConfig(): AuthDeviceLinkConfig;
10845
+
10620
10846
  /**
10621
10847
  * @spfn/auth - Device code generation
10622
10848
  *
@@ -10911,6 +11137,35 @@ interface AuthLifecycleOptions extends AuthInitOptions {
10911
11137
  * @default 5000
10912
11138
  */
10913
11139
  intervalMs?: number;
11140
+ /**
11141
+ * The longest a poll that sends `waitMillis` is held open, in milliseconds.
11142
+ * Keep it under the idle timeout of every proxy in front of the server.
11143
+ * @default 20000
11144
+ */
11145
+ maxWaitMs?: number;
11146
+ };
11147
+ /**
11148
+ * Device link configuration
11149
+ *
11150
+ * Controls the codes handed out by `POST /_auth/device/link/issue`. The poll
11151
+ * interval and the long-poll cap are `deviceAuth`'s: both flows wait the same
11152
+ * way behind the same proxies.
11153
+ *
11154
+ * @example
11155
+ * ```typescript
11156
+ * createAuthLifecycle({
11157
+ * deviceLink: {
11158
+ * ttlMs: 3 * 60 * 1000, // a link code lives 3 minutes
11159
+ * },
11160
+ * })
11161
+ * ```
11162
+ */
11163
+ deviceLink?: {
11164
+ /**
11165
+ * How long a link code stays usable, in milliseconds.
11166
+ * @default 300000 (5 minutes)
11167
+ */
11168
+ ttlMs?: number;
10914
11169
  };
10915
11170
  /**
10916
11171
  * OAuth 2.1 authorization server for MCP clients
@@ -11094,4 +11349,4 @@ declare const authJobRouter: _spfn_core_job.JobRouter<{
11094
11349
  */
11095
11350
  declare const createAuthDeletionJobRouter: typeof createAuthJobRouter;
11096
11351
 
11097
- export { AUTHORIZE_PATH, type AccountDeletionPurgeUser, type AccountDeletionRequest, AccountDeletionRequestedBy, AccountDeletionRequestsRepository, type AuthConfig, AuthContext, type AuthCsrfConfig, type AuthDeletionConfig, type AuthDeviceAuthConfig, type AuthLifecycleConfig, type AuthLifecycleOptions, type AuthMetadataEntity, AuthMetadataRepository, type AuthorizationServerConfig, type AuthorizationServerOptions, type BeforeRegisterContext, COOKIE_NAMES, CSRF_HEADER, type CancelAccountDeletionParams, type CancelAccountDeletionResult, type CreateOAuthStateParams, type CreateRevokeAllLinkOptions, type CsrfMode, DEFAULT_ACCESS_TOKEN_TTL_MS, DEFAULT_CODE_TTL_MS, DEFAULT_DELETION_ALLOW_SELF_IMMEDIATE, DEFAULT_DELETION_GRACE_PERIOD_DAYS, DEFAULT_DELETION_PURGE_CRON, DEFAULT_DELETION_PURGE_STRATEGY, DEFAULT_DELETION_SEND_NOTIFICATIONS, DEFAULT_DEVICE_AUTH_INTERVAL_MS, DEFAULT_DEVICE_AUTH_TTL_MS, DEFAULT_REFRESH_TOKEN_TTL_MS, DEFAULT_REVOKE_ALL_TOKEN_PURGE_CRON, DEVICE_AUTH_STATUSES, type DecryptedOAuthToken, type DeviceAuthStatus, type DeviceAuthorization, DeviceAuthorizationsRepository, type EmailNormalizationResult, EnvironmentKeyringTokenCipher, type GoogleTokenResponse, type GoogleUserInfo, type Invitation, InvitationStatus, InvitationsRepository, type IssuedOpsToken, KeyAlgorithmType, type KeyRevokeAllToken, KeyRevokeAllTokensRepository, KeysRepository, type LiveRevokeAllLink, MAX_UNGRANTED_CLIENTS_PER_IP, MFA_CONFIRM_ATTEMPT_LIMIT, MfaChallenge, MfaChallengesRepository, type MfaConfig, MfaEnrolmentRepository, type MfaRecoveryCode, MfaRecoveryCodesRepository, type MfaTotp, MfaTotpRepository, MfaVerification, MfaVerificationMethod, MfaVerificationsRepository, type NewAccountDeletionRequest, type NewAuthMetadataEntity, type NewDeviceAuthorization, type NewInvitation, type NewKeyRevokeAllToken, NewMfaChallenge, type NewMfaRecoveryCode, type NewMfaTotp, type NewOAuth2AuthorizationCode, type NewOAuth2Client, type NewOAuth2Grant, type NewOAuth2Token, type NewOpsToken, NewPasskey, type NewPasswordResetToken, type NewPermission, type NewPermissionEntity, type NewRole, type NewRoleEntity, type NewRolePermission, type NewSignupLinkToken, type NewUser, type NewUserPermission, type NewUserProfile, NewUserPublicKey, type NewUserSocialAccount, type NewVerificationCode, type NewWebAuthnChallenge, OAUTH2_ACCESS_TOKEN_PREFIX, OAUTH2_REFRESH_TOKEN_PREFIX, OAUTH2_TOKEN_KINDS, type OAuth2AuthorizationCode, OAuth2AuthorizationCodesRepository, type OAuth2Client, OAuth2ClientsRepository, type OAuth2Grant, type OAuth2GrantWithClient, OAuth2GrantsRepository, type OAuth2RegisterRefusal, type OAuth2RegisterRequest, type OAuth2RegisterResult, type OAuth2RegisteredClient, type OAuth2Token, type OAuth2TokenKind, type OAuth2TokenRefusal, type OAuth2TokenRequest, type OAuth2TokenResponse, type OAuth2TokenResult, OAuth2TokensRepository, OAuthProvider, type OAuthState, type OAuthTokenCipher, type OAuthTokenContext, type OAuthTokenType, OPS_TOKEN_PREFIX, type OpsOrUserConfig, type OpsToken, OpsTokensRepository, Passkey, type PasskeyConfig, type PasskeyUserVerification, PasskeysRepository, type PasswordResetToken, PasswordResetTokensRepository, type PendingDeletionInfo, type Permission, type PermissionEntity, PermissionsRepository, PurgeStrategy, type PurgeUserResult, type RedirectUriRefusal, type RegisterChannel, type RequestAccountDeletionParams, type RequestAccountDeletionResult, type RevokeAllLink, type RevokeAllLinkDescription, type RevokedKey, type Role, type RoleEntity, type RoleGuardOptions, type RolePermission, RolePermissionsRepository, RolesRepository, STALE_CLIENT_MAX_AGE_MS, SUPPORTED_GRANT_TYPES, SUPPORTED_RESPONSE_TYPES, type SessionPayload, type SignupLinkToken, SignupLinkTokensRepository, SocialAccountsRepository, SocialProvider, type SweepDuePurgesResult, type TokenEncryptionKey, type TokenPayload, USER_CODE_ALPHABET, USER_CODE_LENGTH, type UpdateProfileParams, type User, type UserPermission, UserPermissionsRepository, type UserProfile, UserProfilesRepository, UserPublicKey, type UserSocialAccount, UsersRepository, V2_PREFIX, type VerificationCode, VerificationCodesRepository, VerificationPurpose, type VerifiedOAuth2AccessToken, type VerifiedOpsToken, type VerifyIdTokenParams, WEBAUTHN_CHALLENGE_KINDS, type WebAuthnChallenge, type WebAuthnChallengeKind, WebAuthnChallengesRepository, acceptInvitation, accountDeletionRequests, accountDeletionRequestsRepository, addPermissionToRole, admitsForRenewal, appleProvider, assertAuthorizationServerIssuer, assertCanAssignRole, assertKeyMatchesAlgorithm, assertPasskeyConfig, authJobRouter, authLogger, authMetadata, authMetadataRepository, authSchema, authenticateForRenewal, cancelAccountDeletionService, cancelInvitation, checkUsernameAvailableService, configureAuth, configureAuthorizationServer, configureDeletion, configureDeviceAuth, configureOAuthTokenCipher, consumeRevokeAllLink, createAuthDeletionJobRouter, createAuthDeletionPurgeJob, createAuthJobRouter, createAuthLifecycle, createInvitation, createOAuthState, createRevokeAllLink, createRevokeAllTokenPurgeJob, createRole, decodeToken, decryptToken, deleteInvitation, deleteRole, deriveCsrfToken, describeRevokeAllLink, deviceAuthorizations, deviceAuthorizationsRepository, encryptToken, exchangeCodeForTokens, expireOldInvitations, formatUserCode, generateAccessToken, generateAuthorizationCode, generateDeviceCode, generateOAuthNonce, generateRefreshToken, generateToken, generateUserCode, getAllRoles, getAuth, getAuthConfig, getAuthSessionService, getAuthorizationServerConfig, getBoundKeyRenewGraceMs, getBoundKeyTtlMs, getConcurrentUseWindowMs, getCsrfExemptPaths, getCsrfMode, getDeletionConfig, getDeviceAuthConfig, getDummyPasswordHash, getEncryptionKeyring, getGoogleAuthUrl, getGoogleOAuthConfig, getGoogleUserInfo, getInvitationByToken, getInvitationWithDetails, getKeyId, getLocale, getMfaConfig, getOneTimeTokenManager, getOpsToken, getOptionalAuth, getPasskeyConfig, getPendingDeletionInfo, getRole, getRoleByName, getRolePermissions, getSessionRenewPath, getSessionTtl, getUser, getUserByEmailService, getUserByIdService, getUserByPhoneService, getUserId, getUserPermissions, getUserProfileService, getUserRole, githubProvider, googleProvider, hasAllPermissions, hasAnyPermission, hasAnyRole, hasPermission, hasRole, hashDeviceCode, hashOAuth2Secret, hashPassword, initOneTimeTokenManager, initializeAuth, invitationsRepository, isAccessTokenShaped, isEncrypted, isGoogleOAuthEnabled, isLoopbackHostname, isOpsToken, isPkceS256ChallengeShaped, isPkceVerifierShaped, issueOpsTokenService, kakaoProvider, keyRevokeAllTokens, keyRevokeAllTokensRepository, keysRepository, linkMailJob, listInvitations, listOpsTokensService, matchOAuthCsrfCookies, matchesCsrfToken, matchesRegisteredRedirectUri, mfaChallengesRepository, mfaEnrolmentRepository, mfaRecoveryCodes, mfaRecoveryCodesRepository, mfaTotp, mfaTotpRepository, mfaVerificationsRepository, naverProvider, normalizeEmail, normalizeOptionalEmail, normalizeResource, normalizeStoredEmails, normalizeUserCode, oauth2AuthorizationCodes, oauth2AuthorizationCodesRepository, oauth2Clients, oauth2ClientsRepository, oauth2Grants, oauth2GrantsRepository, oauth2TokenService, oauth2Tokens, oauth2TokensRepository, oneTimeTokenAuth, opsOrUser, opsTokenAuth, opsTokens, opsTokensRepository, parseDuration, passkeysRepository, passwordResetTokens, passwordResetTokensRepository, permissions, permissionsRepository, pkceChallengeFor, purgeRevokeAllTokensService, purgeStaleOAuth2ClientsService, purgeUserService, redirectHostOf, refreshAccessToken, refuseRedirectUriRegistration, registerOAuth2ClientService, removePermissionFromRole, requestAccountDeletionService, requireAnyPermission, requireOpsScope, requirePermissions, requireRole, resendInvitation, resolveIssuerSource, revokeOAuth2TokenService, revokeOpsTokenService, roleGuard, rolePermissions, rolePermissionsRepository, roles, rolesRepository, runBeforeRegister, sameOAuth2Hash, sameResource, secondsUntil, setRolePermissions, signupLinkTokens, signupLinkTokensRepository, socialAccountsRepository, sweepDuePurges, toEpochSeconds, updateLastLoginService, updateLocaleService, updateRole, updateUserProfileService, updateUserService, updateUsernameService, userInvitations, userPermissions, userPermissionsRepository, userProfiles, userProfilesRepository, userSocialAccounts, users, usersRepository, validateInvitation, validatePasswordStrength, verificationCodes, verificationCodesRepository, verifyAccessToken, verifyClientToken, verifyIdToken, verifyKeyFingerprint, verifyOAuthState, verifyOpsTokenService, verifyPassword, verifyToken, webauthnChallenges, webauthnChallengesRepository };
11352
+ export { AUTHORIZE_PATH, type AccountDeletionPurgeUser, type AccountDeletionRequest, AccountDeletionRequestedBy, AccountDeletionRequestsRepository, type AuthConfig, AuthContext, type AuthCsrfConfig, type AuthDeletionConfig, type AuthDeviceAuthConfig, type AuthDeviceLinkConfig, type AuthLifecycleConfig, type AuthLifecycleOptions, type AuthMetadataEntity, AuthMetadataRepository, type AuthorizationServerConfig, type AuthorizationServerOptions, type BeforeRegisterContext, COOKIE_NAMES, CSRF_HEADER, type CancelAccountDeletionParams, type CancelAccountDeletionResult, type CreateOAuthStateParams, type CreateRevokeAllLinkOptions, type CsrfMode, DEFAULT_ACCESS_TOKEN_TTL_MS, DEFAULT_CODE_TTL_MS, DEFAULT_DELETION_ALLOW_SELF_IMMEDIATE, DEFAULT_DELETION_GRACE_PERIOD_DAYS, DEFAULT_DELETION_PURGE_CRON, DEFAULT_DELETION_PURGE_STRATEGY, DEFAULT_DELETION_SEND_NOTIFICATIONS, DEFAULT_DEVICE_AUTH_INTERVAL_MS, DEFAULT_DEVICE_AUTH_MAX_WAIT_MS, DEFAULT_DEVICE_AUTH_TTL_MS, DEFAULT_DEVICE_LINK_TTL_MS, DEFAULT_REFRESH_TOKEN_TTL_MS, DEFAULT_REVOKE_ALL_TOKEN_PURGE_CRON, DEVICE_AUTH_STATUSES, type DecryptedOAuthToken, type DeviceAuthStatus, type DeviceAuthorization, DeviceAuthorizationsRepository, DeviceLink, type DeviceLinkRecord, type DeviceLinkRedemption, DeviceLinksRepository, type EmailNormalizationResult, EnvironmentKeyringTokenCipher, type GoogleTokenResponse, type GoogleUserInfo, type Invitation, InvitationStatus, InvitationsRepository, type IssuedOpsToken, KeyAlgorithmType, type KeyRevokeAllToken, KeyRevokeAllTokensRepository, KeysRepository, type LiveRevokeAllLink, MAX_UNGRANTED_CLIENTS_PER_IP, MFA_CONFIRM_ATTEMPT_LIMIT, MfaChallenge, MfaChallengesRepository, type MfaConfig, MfaEnrolmentRepository, type MfaRecoveryCode, MfaRecoveryCodesRepository, type MfaTotp, MfaTotpRepository, MfaVerification, MfaVerificationMethod, MfaVerificationsRepository, type NewAccountDeletionRequest, type NewAuthMetadataEntity, type NewDeviceAuthorization, NewDeviceLink, type NewInvitation, type NewKeyRevokeAllToken, NewMfaChallenge, type NewMfaRecoveryCode, type NewMfaTotp, type NewOAuth2AuthorizationCode, type NewOAuth2Client, type NewOAuth2Grant, type NewOAuth2Token, type NewOpsToken, NewPasskey, type NewPasswordResetToken, type NewPermission, type NewPermissionEntity, type NewRole, type NewRoleEntity, type NewRolePermission, type NewSignupLinkToken, type NewUser, type NewUserPermission, type NewUserProfile, NewUserPublicKey, type NewUserSocialAccount, type NewVerificationCode, type NewWebAuthnChallenge, OAUTH2_ACCESS_TOKEN_PREFIX, OAUTH2_REFRESH_TOKEN_PREFIX, OAUTH2_TOKEN_KINDS, type OAuth2AuthorizationCode, OAuth2AuthorizationCodesRepository, type OAuth2Client, OAuth2ClientsRepository, type OAuth2Grant, type OAuth2GrantWithClient, OAuth2GrantsRepository, type OAuth2RegisterRefusal, type OAuth2RegisterRequest, type OAuth2RegisterResult, type OAuth2RegisteredClient, type OAuth2Token, type OAuth2TokenKind, type OAuth2TokenRefusal, type OAuth2TokenRequest, type OAuth2TokenResponse, type OAuth2TokenResult, OAuth2TokensRepository, OAuthProvider, type OAuthState, type OAuthTokenCipher, type OAuthTokenContext, type OAuthTokenType, OPS_TOKEN_PREFIX, type OpsOrUserConfig, type OpsToken, OpsTokensRepository, Passkey, type PasskeyConfig, type PasskeyUserVerification, PasskeysRepository, type PasswordResetToken, PasswordResetTokensRepository, type PendingDeletionInfo, type Permission, type PermissionEntity, PermissionsRepository, PurgeStrategy, type PurgeUserResult, type RedirectUriRefusal, type RegisterChannel, type RequestAccountDeletionParams, type RequestAccountDeletionResult, type RevokeAllLink, type RevokeAllLinkDescription, type RevokedKey, type Role, type RoleEntity, type RoleGuardOptions, type RolePermission, RolePermissionsRepository, RolesRepository, STALE_CLIENT_MAX_AGE_MS, SUPPORTED_GRANT_TYPES, SUPPORTED_RESPONSE_TYPES, type SessionPayload, type SignupLinkToken, SignupLinkTokensRepository, SocialAccountsRepository, SocialProvider, type SweepDuePurgesResult, type TokenEncryptionKey, type TokenPayload, USER_CODE_ALPHABET, USER_CODE_LENGTH, type UpdateProfileParams, type User, type UserPermission, UserPermissionsRepository, type UserProfile, UserProfilesRepository, UserPublicKey, type UserSocialAccount, UsersRepository, V2_PREFIX, type VerificationCode, VerificationCodesRepository, VerificationPurpose, type VerifiedOAuth2AccessToken, type VerifiedOpsToken, type VerifyIdTokenParams, WEBAUTHN_CHALLENGE_KINDS, type WebAuthnChallenge, type WebAuthnChallengeKind, WebAuthnChallengesRepository, acceptInvitation, accountDeletionRequests, accountDeletionRequestsRepository, addPermissionToRole, admitsForRenewal, appleProvider, assertAuthorizationServerIssuer, assertCanAssignRole, assertKeyMatchesAlgorithm, assertPasskeyConfig, authJobRouter, authLogger, authMetadata, authMetadataRepository, authSchema, authenticateForRenewal, cancelAccountDeletionService, cancelInvitation, checkUsernameAvailableService, configureAuth, configureAuthorizationServer, configureDeletion, configureDeviceAuth, configureDeviceLink, configureOAuthTokenCipher, consumeRevokeAllLink, createAuthDeletionJobRouter, createAuthDeletionPurgeJob, createAuthJobRouter, createAuthLifecycle, createInvitation, createOAuthState, createRevokeAllLink, createRevokeAllTokenPurgeJob, createRole, decodeToken, decryptToken, deleteInvitation, deleteRole, deriveCsrfToken, describeRevokeAllLink, deviceAuthorizations, deviceAuthorizationsRepository, deviceLinksRepository, encryptToken, exchangeCodeForTokens, expireOldInvitations, formatUserCode, generateAccessToken, generateAuthorizationCode, generateDeviceCode, generateOAuthNonce, generateRefreshToken, generateToken, generateUserCode, getAllRoles, getAuth, getAuthConfig, getAuthSessionService, getAuthorizationServerConfig, getBoundKeyRenewGraceMs, getBoundKeyTtlMs, getConcurrentUseWindowMs, getCsrfExemptPaths, getCsrfMode, getDeletionConfig, getDeviceAuthConfig, getDeviceLinkConfig, getDummyPasswordHash, getEncryptionKeyring, getGoogleAuthUrl, getGoogleOAuthConfig, getGoogleUserInfo, getInvitationByToken, getInvitationWithDetails, getKeyId, getLocale, getMfaConfig, getOneTimeTokenManager, getOpsToken, getOptionalAuth, getPasskeyConfig, getPendingDeletionInfo, getRole, getRoleByName, getRolePermissions, getSessionRenewPath, getSessionTtl, getUser, getUserByEmailService, getUserByIdService, getUserByPhoneService, getUserId, getUserPermissions, getUserProfileService, getUserRole, githubProvider, googleProvider, hasAllPermissions, hasAnyPermission, hasAnyRole, hasPermission, hasRole, hashDeviceCode, hashOAuth2Secret, hashPassword, initOneTimeTokenManager, initializeAuth, invitationsRepository, isAccessTokenShaped, isEncrypted, isGoogleOAuthEnabled, isLoopbackHostname, isOpsToken, isPkceS256ChallengeShaped, isPkceVerifierShaped, issueOpsTokenService, kakaoProvider, keyRevokeAllTokens, keyRevokeAllTokensRepository, keysRepository, linkMailJob, listInvitations, listOpsTokensService, matchOAuthCsrfCookies, matchesCsrfToken, matchesRegisteredRedirectUri, mfaChallengesRepository, mfaEnrolmentRepository, mfaRecoveryCodes, mfaRecoveryCodesRepository, mfaTotp, mfaTotpRepository, mfaVerificationsRepository, naverProvider, normalizeEmail, normalizeOptionalEmail, normalizeResource, normalizeStoredEmails, normalizeUserCode, oauth2AuthorizationCodes, oauth2AuthorizationCodesRepository, oauth2Clients, oauth2ClientsRepository, oauth2Grants, oauth2GrantsRepository, oauth2TokenService, oauth2Tokens, oauth2TokensRepository, oneTimeTokenAuth, opsOrUser, opsTokenAuth, opsTokens, opsTokensRepository, parseDuration, passkeysRepository, passwordResetTokens, passwordResetTokensRepository, permissions, permissionsRepository, pkceChallengeFor, purgeRevokeAllTokensService, purgeStaleOAuth2ClientsService, purgeUserService, redirectHostOf, refreshAccessToken, refuseRedirectUriRegistration, registerOAuth2ClientService, removePermissionFromRole, requestAccountDeletionService, requireAnyPermission, requireOpsScope, requirePermissions, requireRole, resendInvitation, resolveIssuerSource, revokeOAuth2TokenService, revokeOpsTokenService, roleGuard, rolePermissions, rolePermissionsRepository, roles, rolesRepository, runBeforeRegister, sameOAuth2Hash, sameResource, secondsUntil, setRolePermissions, signupLinkTokens, signupLinkTokensRepository, socialAccountsRepository, sweepDuePurges, toEpochSeconds, updateLastLoginService, updateLocaleService, updateRole, updateUserProfileService, updateUserService, updateUsernameService, userInvitations, userPermissions, userPermissionsRepository, userProfiles, userProfilesRepository, userSocialAccounts, users, usersRepository, validateInvitation, validatePasswordStrength, verificationCodes, verificationCodesRepository, verifyAccessToken, verifyClientToken, verifyIdToken, verifyKeyFingerprint, verifyOAuthState, verifyOpsTokenService, verifyPassword, verifyToken, webauthnChallenges, webauthnChallengesRepository };