@spfn/auth 0.3.0-beta.27 → 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-BvRw8b8t.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-BvRw8b8t.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
  }>;
@@ -8007,6 +8017,160 @@ declare class DeviceAuthorizationsRepository extends BaseRepository {
8007
8017
  }
8008
8018
  declare const deviceAuthorizationsRepository: DeviceAuthorizationsRepository;
8009
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
+
8010
8174
  /**
8011
8175
  * Roles Repository
8012
8176
  *
@@ -8083,8 +8247,8 @@ declare class RolesRepository extends BaseRepository {
8083
8247
  */
8084
8248
  create(data: NewRoleEntity): Promise<{
8085
8249
  description: string | null;
8086
- name: string;
8087
8250
  id: number;
8251
+ name: string;
8088
8252
  displayName: string;
8089
8253
  isBuiltin: boolean;
8090
8254
  isSystem: boolean;
@@ -8113,8 +8277,8 @@ declare class RolesRepository extends BaseRepository {
8113
8277
  */
8114
8278
  deleteById(id: number): Promise<{
8115
8279
  description: string | null;
8116
- name: string;
8117
8280
  id: number;
8281
+ name: string;
8118
8282
  displayName: string;
8119
8283
  isBuiltin: boolean;
8120
8284
  isSystem: boolean;
@@ -8147,7 +8311,7 @@ declare class PermissionsRepository extends BaseRepository {
8147
8311
  name: string;
8148
8312
  displayName: string;
8149
8313
  description: string | null;
8150
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
8314
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
8151
8315
  isBuiltin: boolean;
8152
8316
  isSystem: boolean;
8153
8317
  isActive: boolean;
@@ -8163,7 +8327,7 @@ declare class PermissionsRepository extends BaseRepository {
8163
8327
  name: string;
8164
8328
  displayName: string;
8165
8329
  description: string | null;
8166
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
8330
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
8167
8331
  isBuiltin: boolean;
8168
8332
  isSystem: boolean;
8169
8333
  isActive: boolean;
@@ -8203,7 +8367,7 @@ declare class PermissionsRepository extends BaseRepository {
8203
8367
  name: string;
8204
8368
  displayName: string;
8205
8369
  description: string | null;
8206
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
8370
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
8207
8371
  isBuiltin: boolean;
8208
8372
  isSystem: boolean;
8209
8373
  isActive: boolean;
@@ -8214,16 +8378,16 @@ declare class PermissionsRepository extends BaseRepository {
8214
8378
  */
8215
8379
  deleteById(id: number): Promise<{
8216
8380
  description: string | null;
8217
- metadata: Record<string, any> | null;
8218
- name: string;
8219
8381
  id: number;
8382
+ name: string;
8220
8383
  displayName: string;
8221
8384
  isBuiltin: boolean;
8222
8385
  isSystem: boolean;
8223
8386
  isActive: boolean;
8224
8387
  createdAt: Date;
8225
8388
  updatedAt: Date;
8226
- category: "auth" | "custom" | "user" | "rbac" | "system" | null;
8389
+ metadata: Record<string, any> | null;
8390
+ category: "custom" | "user" | "auth" | "rbac" | "system" | null;
8227
8391
  }>;
8228
8392
  }
8229
8393
  declare const permissionsRepository: PermissionsRepository;
@@ -8268,9 +8432,9 @@ declare class RolePermissionsRepository extends BaseRepository {
8268
8432
  */
8269
8433
  createMany(data: NewRolePermission[]): Promise<{
8270
8434
  id: number;
8271
- roleId: number;
8272
8435
  createdAt: Date;
8273
8436
  updatedAt: Date;
8437
+ roleId: number;
8274
8438
  permissionId: number;
8275
8439
  }[]>;
8276
8440
  /**
@@ -8286,9 +8450,9 @@ declare class RolePermissionsRepository extends BaseRepository {
8286
8450
  */
8287
8451
  setPermissionsForRole(roleId: number, permissionIds: number[]): Promise<{
8288
8452
  id: number;
8289
- roleId: number;
8290
8453
  createdAt: Date;
8291
8454
  updatedAt: Date;
8455
+ roleId: number;
8292
8456
  permissionId: number;
8293
8457
  }[]>;
8294
8458
  }
@@ -8350,12 +8514,12 @@ declare class UserPermissionsRepository extends BaseRepository {
8350
8514
  */
8351
8515
  create(data: NewUserPermission): Promise<{
8352
8516
  userId: number;
8353
- expiresAt: Date | null;
8354
8517
  id: number;
8355
8518
  createdAt: Date;
8356
8519
  updatedAt: Date;
8357
- permissionId: number;
8520
+ expiresAt: Date | null;
8358
8521
  reason: string | null;
8522
+ permissionId: number;
8359
8523
  granted: boolean;
8360
8524
  }>;
8361
8525
  /**
@@ -8376,12 +8540,12 @@ declare class UserPermissionsRepository extends BaseRepository {
8376
8540
  */
8377
8541
  deleteByUserIdAndPermissionId(userId: number, permissionId: number): Promise<{
8378
8542
  userId: number;
8379
- expiresAt: Date | null;
8380
8543
  id: number;
8381
8544
  createdAt: Date;
8382
8545
  updatedAt: Date;
8383
- permissionId: number;
8546
+ expiresAt: Date | null;
8384
8547
  reason: string | null;
8548
+ permissionId: number;
8385
8549
  granted: boolean;
8386
8550
  }>;
8387
8551
  /**
@@ -8460,7 +8624,6 @@ declare class UserProfilesRepository extends BaseRepository {
8460
8624
  * 프로필 생성
8461
8625
  */
8462
8626
  create(data: NewUserProfile): Promise<{
8463
- metadata: Record<string, any> | null;
8464
8627
  userId: number;
8465
8628
  id: number;
8466
8629
  displayName: string | null;
@@ -8478,6 +8641,7 @@ declare class UserProfilesRepository extends BaseRepository {
8478
8641
  location: string | null;
8479
8642
  company: string | null;
8480
8643
  jobTitle: string | null;
8644
+ metadata: Record<string, any> | null;
8481
8645
  }>;
8482
8646
  /**
8483
8647
  * 프로필 업데이트 (by ID)
@@ -8529,7 +8693,6 @@ declare class UserProfilesRepository extends BaseRepository {
8529
8693
  * 프로필 삭제 (by ID)
8530
8694
  */
8531
8695
  deleteById(id: number): Promise<{
8532
- metadata: Record<string, any> | null;
8533
8696
  userId: number;
8534
8697
  id: number;
8535
8698
  displayName: string | null;
@@ -8547,12 +8710,12 @@ declare class UserProfilesRepository extends BaseRepository {
8547
8710
  location: string | null;
8548
8711
  company: string | null;
8549
8712
  jobTitle: string | null;
8713
+ metadata: Record<string, any> | null;
8550
8714
  }>;
8551
8715
  /**
8552
8716
  * 프로필 삭제 (by User ID)
8553
8717
  */
8554
8718
  deleteByUserId(userId: number): Promise<{
8555
- metadata: Record<string, any> | null;
8556
8719
  userId: number;
8557
8720
  id: number;
8558
8721
  displayName: string | null;
@@ -8570,6 +8733,7 @@ declare class UserProfilesRepository extends BaseRepository {
8570
8733
  location: string | null;
8571
8734
  company: string | null;
8572
8735
  jobTitle: string | null;
8736
+ metadata: Record<string, any> | null;
8573
8737
  }>;
8574
8738
  /**
8575
8739
  * 프로필 Upsert (by User ID)
@@ -8578,7 +8742,6 @@ declare class UserProfilesRepository extends BaseRepository {
8578
8742
  * 새로 생성 시 displayName은 필수 (없으면 'User'로 설정)
8579
8743
  */
8580
8744
  upsertByUserId(userId: number, data: Partial<Omit<NewUserProfile, 'userId'>>): Promise<{
8581
- metadata: Record<string, any> | null;
8582
8745
  userId: number;
8583
8746
  id: number;
8584
8747
  displayName: string | null;
@@ -8596,6 +8759,7 @@ declare class UserProfilesRepository extends BaseRepository {
8596
8759
  location: string | null;
8597
8760
  company: string | null;
8598
8761
  jobTitle: string | null;
8762
+ metadata: Record<string, any> | null;
8599
8763
  }>;
8600
8764
  /**
8601
8765
  * User ID로 프로필 데이터 조회 (formatted)
@@ -8722,15 +8886,15 @@ declare class InvitationsRepository extends BaseRepository {
8722
8886
  * 초대 생성
8723
8887
  */
8724
8888
  create(data: NewInvitation): Promise<{
8725
- email: string;
8726
- metadata: Record<string, any> | null;
8727
- token: string;
8728
8889
  status: "pending" | "accepted" | "expired" | "cancelled";
8729
- expiresAt: Date;
8890
+ email: string;
8730
8891
  id: number;
8731
- roleId: number;
8732
8892
  createdAt: Date;
8733
8893
  updatedAt: Date;
8894
+ roleId: number;
8895
+ metadata: Record<string, any> | null;
8896
+ expiresAt: Date;
8897
+ token: string;
8734
8898
  invitedBy: number;
8735
8899
  acceptedAt: Date | null;
8736
8900
  cancelledAt: Date | null;
@@ -8756,15 +8920,15 @@ declare class InvitationsRepository extends BaseRepository {
8756
8920
  * 초대 삭제
8757
8921
  */
8758
8922
  deleteById(id: number): Promise<{
8759
- email: string;
8760
- metadata: Record<string, any> | null;
8761
- token: string;
8762
8923
  status: "pending" | "accepted" | "expired" | "cancelled";
8763
- expiresAt: Date;
8924
+ email: string;
8764
8925
  id: number;
8765
- roleId: number;
8766
8926
  createdAt: Date;
8767
8927
  updatedAt: Date;
8928
+ roleId: number;
8929
+ metadata: Record<string, any> | null;
8930
+ expiresAt: Date;
8931
+ token: string;
8768
8932
  invitedBy: number;
8769
8933
  acceptedAt: Date | null;
8770
8934
  cancelledAt: Date | null;
@@ -9003,9 +9167,9 @@ declare class SocialAccountsRepository extends BaseRepository {
9003
9167
  createdAt: Date;
9004
9168
  updatedAt: Date;
9005
9169
  provider: "google" | "apple" | "github" | "kakao" | "naver" | "superself";
9006
- accessToken: string | null;
9007
9170
  providerUserId: string;
9008
9171
  providerEmail: string | null;
9172
+ accessToken: string | null;
9009
9173
  refreshToken: string | null;
9010
9174
  tokenExpiresAt: Date | null;
9011
9175
  }>;
@@ -9019,9 +9183,9 @@ declare class SocialAccountsRepository extends BaseRepository {
9019
9183
  createdAt: Date;
9020
9184
  updatedAt: Date;
9021
9185
  provider: "google" | "apple" | "github" | "kakao" | "naver" | "superself";
9022
- accessToken: string | null;
9023
9186
  providerUserId: string;
9024
9187
  providerEmail: string | null;
9188
+ accessToken: string | null;
9025
9189
  refreshToken: string | null;
9026
9190
  tokenExpiresAt: Date | null;
9027
9191
  }>;
@@ -9081,7 +9245,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9081
9245
  requestedAt: Date;
9082
9246
  purgeScheduledAt: Date;
9083
9247
  status: "pending" | "cancelled" | "completed";
9084
- requestedBy: "admin" | "self";
9248
+ requestedBy: "self" | "admin";
9085
9249
  reason: string | null;
9086
9250
  cancelledAt: Date | null;
9087
9251
  completedAt: Date | null;
@@ -9100,7 +9264,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9100
9264
  requestedAt: Date;
9101
9265
  purgeScheduledAt: Date;
9102
9266
  status: "pending" | "cancelled" | "completed";
9103
- requestedBy: "admin" | "self";
9267
+ requestedBy: "self" | "admin";
9104
9268
  reason: string | null;
9105
9269
  cancelledAt: Date | null;
9106
9270
  completedAt: Date | null;
@@ -9122,7 +9286,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9122
9286
  requestedAt: Date;
9123
9287
  purgeScheduledAt: Date;
9124
9288
  status: "pending" | "cancelled" | "completed";
9125
- requestedBy: "admin" | "self";
9289
+ requestedBy: "self" | "admin";
9126
9290
  reason: string | null;
9127
9291
  cancelledAt: Date | null;
9128
9292
  completedAt: Date | null;
@@ -9141,7 +9305,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9141
9305
  requestedAt: Date;
9142
9306
  purgeScheduledAt: Date;
9143
9307
  status: "pending" | "cancelled" | "completed";
9144
- requestedBy: "admin" | "self";
9308
+ requestedBy: "self" | "admin";
9145
9309
  reason: string | null;
9146
9310
  cancelledAt: Date | null;
9147
9311
  completedAt: Date | null;
@@ -9154,16 +9318,16 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9154
9318
  create(data: NewAccountDeletionRequest): Promise<{
9155
9319
  status: "pending" | "cancelled" | "completed";
9156
9320
  userId: number | null;
9321
+ purgeScheduledAt: Date;
9157
9322
  id: number;
9158
9323
  createdAt: Date;
9159
9324
  updatedAt: Date;
9160
- reason: string | null;
9161
- purgeScheduledAt: Date;
9162
- cancelledAt: Date | null;
9163
9325
  completedAt: Date | null;
9326
+ reason: string | null;
9164
9327
  userPublicId: string;
9165
- requestedBy: "admin" | "self";
9328
+ requestedBy: "self" | "admin";
9166
9329
  purgeStrategy: "anonymize" | "hard-delete" | null;
9330
+ cancelledAt: Date | null;
9167
9331
  requestedAt: Date;
9168
9332
  }>;
9169
9333
  /**
@@ -9183,7 +9347,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9183
9347
  requestedAt: Date;
9184
9348
  purgeScheduledAt: Date;
9185
9349
  status: "pending" | "cancelled" | "completed";
9186
- requestedBy: "admin" | "self";
9350
+ requestedBy: "self" | "admin";
9187
9351
  reason: string | null;
9188
9352
  cancelledAt: Date | null;
9189
9353
  completedAt: Date | null;
@@ -9208,7 +9372,7 @@ declare class AccountDeletionRequestsRepository extends BaseRepository {
9208
9372
  requestedAt: Date;
9209
9373
  purgeScheduledAt: Date;
9210
9374
  status: "pending" | "cancelled" | "completed";
9211
- requestedBy: "admin" | "self";
9375
+ requestedBy: "self" | "admin";
9212
9376
  reason: string | null;
9213
9377
  cancelledAt: Date | null;
9214
9378
  completedAt: Date | null;
@@ -10102,18 +10266,18 @@ declare function getOptionalAuth(c: Context | {
10102
10266
  declare function getUser(c: Context | {
10103
10267
  raw: Context;
10104
10268
  }): {
10105
- email: string | null;
10106
- phone: string | null;
10107
10269
  status: "active" | "inactive" | "suspended" | "pending_deletion" | "deleted";
10108
10270
  publicId: string;
10271
+ email: string | null;
10272
+ phone: string | null;
10109
10273
  passwordChangeRequired: boolean;
10110
10274
  sessionBinding: "none" | "passkey";
10111
- id: number;
10112
10275
  username: string | null;
10113
- passwordHash: string | null;
10114
- roleId: number;
10276
+ id: number;
10115
10277
  createdAt: Date;
10116
10278
  updatedAt: Date;
10279
+ passwordHash: string | null;
10280
+ roleId: number;
10117
10281
  emailVerifiedAt: Date | null;
10118
10282
  phoneVerifiedAt: Date | null;
10119
10283
  keyEpoch: number;
@@ -10644,6 +10808,41 @@ declare function configureDeviceAuth(options?: Partial<AuthDeviceAuthConfig>): v
10644
10808
  */
10645
10809
  declare function getDeviceAuthConfig(): AuthDeviceAuthConfig;
10646
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
+
10647
10846
  /**
10648
10847
  * @spfn/auth - Device code generation
10649
10848
  *
@@ -10945,6 +11144,29 @@ interface AuthLifecycleOptions extends AuthInitOptions {
10945
11144
  */
10946
11145
  maxWaitMs?: number;
10947
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;
11169
+ };
10948
11170
  /**
10949
11171
  * OAuth 2.1 authorization server for MCP clients
10950
11172
  *
@@ -11127,4 +11349,4 @@ declare const authJobRouter: _spfn_core_job.JobRouter<{
11127
11349
  */
11128
11350
  declare const createAuthDeletionJobRouter: typeof createAuthJobRouter;
11129
11351
 
11130
- 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_MAX_WAIT_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 };