@spfn/auth 0.3.0-beta.21 → 0.3.0-beta.23

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, u as OAuthProvider, s as VerificationPurpose, N as NewPasskey, v as Passkey, q as PermissionCategory, w as AuthContext } from './machine-principals-B7N8gux0.js';
2
- export { x as ApproveDeviceAuthParams, y as AuthDeletionCancelledPayload, z as AuthDeletionCompletedPayload, B as AuthDeletionRequestedPayload, E as AuthDeviceRegisteredPayload, G as AuthLoginPayload, H as AuthPasswordResetPayload, J as AuthProfileOutcome, M as AuthProfileVerifier, Q as AuthProviderSchema, T as AuthRegisterPayload, W as ChangePasswordParams, X as CompletePasswordResetParams, Y as CompleteSignupParams, Z as ConfirmPasswordResetParams, d as ConfirmPasswordResetResult, _ as ConfirmSignupLinkParams, C as ConfirmSignupLinkResult, $ as DenyDeviceAuthParams, a0 as DeviceAuthApprovedResult, a1 as DeviceAuthInfoParams, D as DeviceAuthInfoResult, a2 as DeviceAuthPendingResult, a3 as DeviceAuthPollResponseSchema, a4 as DeviceNameSchema, a5 as DeviceRegistrationChannel, a6 as EmailSchema, a7 as FingerprintSchema, a8 as FinishPasskeyEnrollmentParams, F as FinishPasskeyEnrollmentResult, a9 as FinishPasskeyLoginParams, aa as InvitationAcceptedPayload, ab as InvitationCreatedPayload, I as IssueOneTimeTokenResult, ac as KEY_FINGERPRINT_PREFIX_LENGTH, ad as KeyIdSchema, K as KeySummary, ae as LoginParams, L as LoginResult, af as LogoutParams, ag as MachinePrincipal, ah as MachineVerifierRegistration, ai as NativeVerifyOptions, aj as NormalizedIdentity, l as OAuth2AuthorizationCodeIssued, ak as OAuth2AuthorizeParams, k as OAuth2ConsentView, n as OAuth2GrantSummary, al as OAuth2ScopeDescription, am as OAuthCallbackParams, an as OAuthCallbackResult, ao as OAuthCodeExchangeOptions, ap as OAuthNativeParams, i as OAuthNativeResult, aq as OAuthStartParams, O as OAuthStartResult, ar as OAuthTokens, as as OAuthUnlinkedPayload, at as PASSKEY_DEVICE_TYPES, au as PASSKEY_LABEL_MAX_LENGTH, av as PasskeyDeviceType, f as PasskeySummary, aw as PasswordSchema, ax as PhoneSchema, ay as PlatformSchema, az as PollDeviceAuthParams, aA as PollDeviceAuthResult, aB as PublicKeySchema, aC as RecentAuthenticationParams, aD as RegisterParams, aE as RegisterPublicKeyParams, a as RegisterResult, aF as RenamePasskeyParams, aG as RequestPasswordResetParams, c as RequestPasswordResetResult, aH as RequestSignupLinkParams, b as RequestSignupLinkResult, aI as RevokeAllKeysParams, h as RevokeAllKeysResult, aJ as RevokeKeyParams, aK as RevokePasskeyParams, aL as RotateKeyParams, g as RotateKeyResult, aM as SendVerificationCodeParams, S as SendVerificationCodeResult, aN as StartDeviceAuthParams, e as StartDeviceAuthResult, aO as StartPasskeyEnrollmentParams, aP as TargetTypeSchema, aQ as UnlinkNotification, aR as UnlinkNotifyRejection, aS as UnlinkNotifyRequest, aT as UnlinkNotifyResult, aU as UserCodeSchema, V as VERIFICATION_PURPOSES, r as VERIFICATION_TARGET_TYPES, aV as VerificationPurposeSchema, t as VerificationTargetType, aW as VerifyCodeParams, aX as VerifyCodeResult, aY as approveDeviceAuthService, aZ as approveOAuth2AuthorizeService, a_ as assertNotLastRecoveryCredential, a$ as assertRecentAuthentication, b0 as authDeletionCancelledEvent, b1 as authDeletionCompletedEvent, b2 as authDeletionRequestedEvent, b3 as authDeviceRegisteredEvent, b4 as authLoginEvent, b5 as authPasswordResetEvent, b6 as authRegisterEvent, m as authRouter, b7 as authenticate, b8 as buildOAuthErrorUrl, b9 as changePasswordService, ba as completePasswordResetService, bb as completeSignupService, bc as confirmPasswordResetService, bd as confirmSignupLinkService, be as denyDeviceAuthService, bf as denyOAuth2AuthorizeService, bg as describeOAuth2AuthorizeRequestService, bh as finishPasskeyEnrollmentService, bi as finishPasskeyLoginService, bj as getDeviceAuthInfoService, bk as getEnabledOAuthProviders, bl as getGoogleAccessToken, bm as getMachinePrincipal, bn as getOAuthProvider, bo as getRegisteredProviders, bp as invitationAcceptedEvent, bq as invitationCreatedEvent, br as isOAuthProviderEnabled, bs as issueOneTimeTokenService, bt as listKeysService, bu as listOAuth2GrantsService, bv as listPasskeysService, bw as loginService, bx as logoutService, by as machineAuth, bz as oauthCallbackService, bA as oauthNativeService, bB as oauthStartService, bC as oauthUnlinkNotifyService, bD as oauthUnlinkedEvent, bE as optionalAuth, bF as passkeys, bG as pollDeviceAuthService, bH as registerAuthProfile, bI as registerMachineVerifier, bJ as registerOAuthProvider, bK as registerPublicKeyService, bL as registerService, bM as renamePasskeyService, bN as requestPasswordResetService, bO as requestSignupLinkService, bP as requireEnabledProvider, bQ as requireMachineScope, bR as resolveAuthenticatedUser, bS as revokeAllKeysService, bT as revokeAllOAuth2GrantsForUser, bU as revokeKeyService, bV as revokeOAuth2GrantService, bW as revokePasskeyService, bX as rotateKeyService, bY as runAuthProfile, bZ as selectAuthProfile, b_ as sendVerificationCodeService, b$ as startDeviceAuthService, c0 as startPasskeyEnrollmentService, c1 as startPasskeyLoginService, c2 as verifyCodeService, c3 as verifyOneTimeTokenService } from './machine-principals-B7N8gux0.js';
1
+ import { A as AuthInitOptions, v as OAuthProvider, t as VerificationPurpose, N as NewPasskey, w as Passkey, x as MfaVerification, y as MfaVerificationMethod, r as PermissionCategory, z as AuthContext } from './machine-principals-CaEFq61K.js';
2
+ export { B as ApproveDeviceAuthParams, E as AssertStepUpParams, G as AuthDeletionCancelledPayload, H as AuthDeletionCompletedPayload, J as AuthDeletionRequestedPayload, Q as AuthDeviceRegisteredPayload, W as AuthLoginPayload, X as AuthPasswordResetPayload, Y as AuthProfileOutcome, Z as AuthProfileVerifier, _ as AuthProviderSchema, $ as AuthRegisterPayload, a0 as ChangePasswordParams, a1 as CompletePasswordResetParams, a2 as CompleteSignupParams, a3 as ConfirmPasswordResetParams, d as ConfirmPasswordResetResult, a4 as ConfirmSignupLinkParams, C as ConfirmSignupLinkResult, a5 as ConfirmTotpParams, g as ConfirmTotpResult, a6 as DenyDeviceAuthParams, a7 as DeviceAuthApprovedResult, a8 as DeviceAuthInfoParams, D as DeviceAuthInfoResult, a9 as DeviceAuthPendingResult, aa as DeviceAuthPollResponseSchema, ab as DeviceNameSchema, ac as DeviceRegistrationChannel, ad as EmailSchema, ae as FingerprintSchema, af as FinishPasskeyEnrollmentParams, F as FinishPasskeyEnrollmentResult, ag as FinishPasskeyLoginParams, ah as InvitationAcceptedPayload, ai as InvitationCreatedPayload, I as IssueOneTimeTokenResult, aj as KEY_FINGERPRINT_PREFIX_LENGTH, ak as KeyIdSchema, K as KeySummary, al as LoginParams, L as LoginResult, am as LogoutParams, an as MFA_VERIFICATION_METHODS, ao as MachinePrincipal, ap as MachineVerifierRegistration, aq as MarkPasskeyParams, M as MfaStatus, ar as NativeVerifyOptions, as as NewMfaVerification, at as NormalizedIdentity, n as OAuth2AuthorizationCodeIssued, au as OAuth2AuthorizeParams, l as OAuth2ConsentView, o as OAuth2GrantSummary, av as OAuth2ScopeDescription, aw as OAuthCallbackParams, ax as OAuthCallbackResult, ay as OAuthCodeExchangeOptions, az as OAuthNativeParams, j as OAuthNativeResult, aA as OAuthStartParams, O as OAuthStartResult, aB as OAuthTokens, aC as OAuthUnlinkedPayload, aD as PASSKEY_DEVICE_TYPES, aE as PASSKEY_LABEL_MAX_LENGTH, aF as PasskeyDeviceType, f as PasskeySummary, aG as PasswordSchema, aH as PhoneSchema, aI as PlatformSchema, aJ as PollDeviceAuthParams, aK as PollDeviceAuthResult, aL as PublicKeySchema, aM as RecentAuthenticationParams, aN as RegisterParams, aO as RegisterPublicKeyParams, a as RegisterResult, aP as RenamePasskeyParams, aQ as RequestPasswordResetParams, c as RequestPasswordResetResult, aR as RequestSignupLinkParams, b as RequestSignupLinkResult, aS as RevokeAllKeysParams, i as RevokeAllKeysResult, aT as RevokeKeyParams, aU as RevokePasskeyParams, aV as RotateKeyParams, h as RotateKeyResult, aW as SendVerificationCodeParams, S as SendVerificationCodeResult, aX as StartDeviceAuthParams, e as StartDeviceAuthResult, aY as StartPasskeyEnrollmentParams, aZ as StepUpParams, a_ as TargetTypeSchema, T as TotpEnrolmentResult, a$ as UnlinkNotification, b0 as UnlinkNotifyRejection, b1 as UnlinkNotifyRequest, b2 as UnlinkNotifyResult, b3 as UserCodeSchema, V as VERIFICATION_PURPOSES, s as VERIFICATION_TARGET_TYPES, b4 as VerificationPurposeSchema, u as VerificationTargetType, b5 as VerifyCodeParams, b6 as VerifyCodeResult, b7 as approveDeviceAuthService, b8 as approveOAuth2AuthorizeService, b9 as assertNotLastRecoveryCredential, ba as assertRecentAuthentication, bb as assertStepUp, bc as authDeletionCancelledEvent, bd as authDeletionCompletedEvent, be as authDeletionRequestedEvent, bf as authDeviceRegisteredEvent, bg as authLoginEvent, bh as authPasswordResetEvent, bi as authRegisterEvent, m as authRouter, bj as authenticate, bk as buildOAuthErrorUrl, bl as carryStepUpVerification, bm as changePasswordService, bn as completePasswordResetService, bo as completeSignupService, bp as confirmPasswordResetService, bq as confirmSignupLinkService, br as confirmTotpEnrolmentService, bs as denyDeviceAuthService, bt as denyOAuth2AuthorizeService, bu as describeOAuth2AuthorizeRequestService, bv as disableMfaService, bw as finishPasskeyEnrollmentService, bx as finishPasskeyLoginService, by as getDeviceAuthInfoService, bz as getEnabledOAuthProviders, bA as getGoogleAccessToken, bB as getMachinePrincipal, bC as getOAuthProvider, bD as getRegisteredProviders, bE as invitationAcceptedEvent, bF as invitationCreatedEvent, bG as isOAuthProviderEnabled, bH as issueOneTimeTokenService, bI as listKeysService, bJ as listOAuth2GrantsService, bK as listPasskeysService, bL as loginService, bM as logoutService, bN as machineAuth, bO as markPasskeySecondFactorService, bP as mfaEnrolledForUser, bQ as mfaStatusService, bR as mfaVerifications, bS as oauthCallbackService, bT as oauthNativeService, bU as oauthStartService, bV as oauthUnlinkNotifyService, bW as oauthUnlinkedEvent, bX as optionalAuth, bY as passkeys, bZ as pollDeviceAuthService, b_ as regenerateRecoveryCodesService, b$ as registerAuthProfile, c0 as registerMachineVerifier, c1 as registerOAuthProvider, c2 as registerPublicKeyService, c3 as registerService, c4 as renamePasskeyService, c5 as requestPasswordResetService, c6 as requestSignupLinkService, c7 as requireEnabledProvider, c8 as requireMachineScope, c9 as resolveAuthenticatedUser, ca as revokeAllKeysService, cb as revokeAllOAuth2GrantsForUser, cc as revokeKeyService, cd as revokeOAuth2GrantService, ce as revokePasskeyService, cf as rotateKeyService, cg as runAuthProfile, ch as selectAuthProfile, ci as sendVerificationCodeService, cj as startDeviceAuthService, ck as startPasskeyEnrollmentService, cl as startPasskeyLoginService, cm as startStepUpService, cn as startTotpEnrolmentService, co as stepUpService, cp as sweepUnconfirmedMfaService, cq as verifyCodeService, cr as verifyOneTimeTokenService, cs as verifySecondFactor } from './machine-principals-CaEFq61K.js';
3
3
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
4
4
  import { j as SocialProvider, K as KeyAlgorithmType, d as InvitationStatus, c as AccountDeletionRequestedBy, i as PurgeStrategy } from './types-DYyhze28.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, S as SOCIAL_PROVIDERS, U as USER_STATUSES, k as UserStatus } from './types-DYyhze28.js';
@@ -399,6 +399,27 @@ declare function getPasskeyConfig(env?: PasskeyEnvSource): PasskeyConfig;
399
399
  * @throws PasskeyConfigError when a passkey variable is set and cannot be honoured
400
400
  */
401
401
  declare function assertPasskeyConfig(env?: PasskeyEnvSource): void;
402
+ /** What the second-factor routes read out of the environment. */
403
+ interface MfaConfig {
404
+ /** Name the authenticator app files the account under. */
405
+ issuer: string;
406
+ /** How long a device's step-up stays good for a sensitive change. */
407
+ stepUpWindowMs: number;
408
+ }
409
+ /**
410
+ * Resolve the second-factor configuration.
411
+ *
412
+ * Deliberately reads no passkey setting beyond `SPFN_AUTH_PASSKEY_RP_NAME`,
413
+ * and reads that as a plain string rather than through `getPasskeyConfig()`:
414
+ * an app with no passkeys configured at all must be able to enrol a TOTP and
415
+ * to step up, and `getPasskeyConfig()` refuses to resolve for such an app.
416
+ *
417
+ * Nothing here can fail the way the passkey config can, so there is no boot
418
+ * check to match: a bad step-up window falls back to the default rather than
419
+ * refusing to start, because the value it would refuse over is a number of
420
+ * minutes and the default is the safe one.
421
+ */
422
+ declare function getMfaConfig(): MfaConfig;
402
423
 
403
424
  /**
404
425
  * @spfn/auth - Users Entity
@@ -2002,6 +2023,14 @@ declare function verifyIdToken(params: VerifyIdTokenParams): Promise<JWTPayload>
2002
2023
  * Never include token or key material in logs or error messages.
2003
2024
  */
2004
2025
 
2026
+ /**
2027
+ * Framing prefix of the current at-rest format: `enc:v2:<keyId>:<payload>`.
2028
+ *
2029
+ * Exported because the MFA secret cipher writes the same frame over the same
2030
+ * keyring (`lib/mfa-cipher.ts`) — one format for everything this package
2031
+ * encrypts at rest, rather than a second one nobody would remember to rotate.
2032
+ */
2033
+ declare const V2_PREFIX = "enc:v2:";
2005
2034
  type OAuthTokenType = 'access' | 'refresh';
2006
2035
  interface OAuthTokenContext {
2007
2036
  provider: SocialProvider;
@@ -2017,6 +2046,21 @@ interface OAuthTokenCipher {
2017
2046
  encrypt(value: string, context: OAuthTokenContext): Promise<string>;
2018
2047
  decrypt(value: string, context: OAuthTokenContext): Promise<DecryptedOAuthToken>;
2019
2048
  }
2049
+ interface TokenEncryptionKey {
2050
+ keyId: string;
2051
+ key: Buffer;
2052
+ }
2053
+ /**
2054
+ * Parse `<keyId>:<base64-encoded 32-byte key>` entries. The first entry is active.
2055
+ *
2056
+ * Empty when the variable is unset — whether that is a configuration error is
2057
+ * the caller's to decide, and the two callers answer it differently: an OAuth
2058
+ * token refuses outright, while an MFA secret raises `MfaConfigError` so the
2059
+ * refusal cannot be mistaken for a wrong code.
2060
+ *
2061
+ * @throws Error when an entry is present but malformed
2062
+ */
2063
+ declare function getEncryptionKeyring(): TokenEncryptionKey[];
2020
2064
  declare class EnvironmentKeyringTokenCipher implements OAuthTokenCipher {
2021
2065
  encrypt(value: string, context: OAuthTokenContext): Promise<string>;
2022
2066
  decrypt(value: string, context: OAuthTokenContext): Promise<DecryptedOAuthToken>;
@@ -4379,8 +4423,14 @@ type NewKeyRevokeAllToken = typeof keyRevokeAllTokens.$inferInsert;
4379
4423
  * presented to `login/verify` or the other way round — the two ceremonies
4380
4424
  * authorize very different things, and only the kind tells them apart once the
4381
4425
  * value itself is just 32 random bytes.
4426
+ *
4427
+ * `'mfa'` is the third: a step-up assertion, minted for an identified account
4428
+ * and spent by `POST /_auth/mfa/step-up`. It buys the same separation in the
4429
+ * direction that matters most — an assertion collected as a second factor is
4430
+ * not a sign-in, and `passkeys/login/verify` refuses it for exactly the reason
4431
+ * the column exists.
4382
4432
  */
4383
- declare const WEBAUTHN_CHALLENGE_KINDS: readonly ["registration", "authentication"];
4433
+ declare const WEBAUTHN_CHALLENGE_KINDS: readonly ["registration", "authentication", "mfa"];
4384
4434
  type WebAuthnChallengeKind = typeof WEBAUTHN_CHALLENGE_KINDS[number];
4385
4435
  declare const webauthnChallenges: drizzle_orm_pg_core.PgTableWithColumns<{
4386
4436
  name: "webauthn_challenges";
@@ -4416,18 +4466,18 @@ declare const webauthnChallenges: drizzle_orm_pg_core.PgTableWithColumns<{
4416
4466
  identity: undefined;
4417
4467
  generated: undefined;
4418
4468
  }>;
4419
- kind: drizzle_orm_pg_core.PgBuildColumn<"webauthn_challenges", drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgTextBuilder<["registration", "authentication"] & [string, ...string[]]>>, {
4469
+ kind: drizzle_orm_pg_core.PgBuildColumn<"webauthn_challenges", drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgTextBuilder<["registration", "authentication", "mfa"] & [string, ...string[]]>>, {
4420
4470
  name: string;
4421
4471
  tableName: "webauthn_challenges";
4422
4472
  dataType: "string enum";
4423
- data: "registration" | "authentication";
4473
+ data: "registration" | "authentication" | "mfa";
4424
4474
  driverParam: string;
4425
4475
  notNull: true;
4426
4476
  hasDefault: false;
4427
4477
  isPrimaryKey: false;
4428
4478
  isAutoincrement: false;
4429
4479
  hasRuntimeDefault: false;
4430
- enumValues: ["registration", "authentication"] & [string, ...string[]];
4480
+ enumValues: ["registration", "authentication", "mfa"] & [string, ...string[]];
4431
4481
  identity: undefined;
4432
4482
  generated: undefined;
4433
4483
  }>;
@@ -4497,6 +4547,287 @@ declare const webauthnChallenges: drizzle_orm_pg_core.PgTableWithColumns<{
4497
4547
  type WebAuthnChallenge = typeof webauthnChallenges.$inferSelect;
4498
4548
  type NewWebAuthnChallenge = typeof webauthnChallenges.$inferInsert;
4499
4549
 
4550
+ /**
4551
+ * @spfn/auth - TOTP Enrolment Entity
4552
+ *
4553
+ * One row per account that has started enrolling an authenticator app. The row
4554
+ * exists from the moment `totp/enroll` mints a secret; `confirmed_at` is what
4555
+ * turns it into a second factor, so an abandoned enrolment never gates anything
4556
+ * and is swept away a day later.
4557
+ *
4558
+ * `secret_enc` is the ciphertext `lib/mfa-cipher.ts` produces, bound to this
4559
+ * `user_id` by the AEAD's additional data. A row copied to another account does
4560
+ * not decrypt.
4561
+ */
4562
+ /**
4563
+ * How many wrong codes an unconfirmed enrolment survives.
4564
+ *
4565
+ * Small, because the row is throwaway: five wrong codes means the person is
4566
+ * reading the wrong entry in their app, and starting over with a fresh secret
4567
+ * is both the remedy and the thing that resets the counter. A confirmed row is
4568
+ * never deleted this way — that would be a remote way to strip someone's second
4569
+ * factor.
4570
+ */
4571
+ declare const MFA_CONFIRM_ATTEMPT_LIMIT = 5;
4572
+ declare const mfaTotp: drizzle_orm_pg_core.PgTableWithColumns<{
4573
+ name: "mfa_totp";
4574
+ schema: string;
4575
+ columns: {
4576
+ createdAt: drizzle_orm_pg_core.PgBuildColumn<"mfa_totp", drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.PgTimestampBuilder>>, {
4577
+ name: string;
4578
+ tableName: "mfa_totp";
4579
+ dataType: "object date";
4580
+ data: Date;
4581
+ driverParam: string;
4582
+ notNull: true;
4583
+ hasDefault: true;
4584
+ isPrimaryKey: false;
4585
+ isAutoincrement: false;
4586
+ hasRuntimeDefault: false;
4587
+ enumValues: undefined;
4588
+ identity: undefined;
4589
+ generated: undefined;
4590
+ }>;
4591
+ updatedAt: drizzle_orm_pg_core.PgBuildColumn<"mfa_totp", drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.PgTimestampBuilder>>>, {
4592
+ name: string;
4593
+ tableName: "mfa_totp";
4594
+ dataType: "object date";
4595
+ data: Date;
4596
+ driverParam: string;
4597
+ notNull: true;
4598
+ hasDefault: true;
4599
+ isPrimaryKey: false;
4600
+ isAutoincrement: false;
4601
+ hasRuntimeDefault: false;
4602
+ enumValues: undefined;
4603
+ identity: undefined;
4604
+ generated: undefined;
4605
+ }>;
4606
+ id: drizzle_orm_pg_core.PgBuildColumn<"mfa_totp", drizzle_orm_pg_core.SetIsPrimaryKey<drizzle_orm_pg_core.PgBigSerial53Builder>, {
4607
+ name: string;
4608
+ tableName: "mfa_totp";
4609
+ dataType: "number int53";
4610
+ data: number;
4611
+ driverParam: number;
4612
+ notNull: true;
4613
+ hasDefault: true;
4614
+ isPrimaryKey: false;
4615
+ isAutoincrement: false;
4616
+ hasRuntimeDefault: false;
4617
+ enumValues: undefined;
4618
+ identity: undefined;
4619
+ generated: undefined;
4620
+ }>;
4621
+ userId: drizzle_orm_pg_core.PgBuildColumn<"mfa_totp", drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgBigInt53Builder>, {
4622
+ name: string;
4623
+ tableName: "mfa_totp";
4624
+ dataType: "number int53";
4625
+ data: number;
4626
+ driverParam: string | number;
4627
+ notNull: true;
4628
+ hasDefault: false;
4629
+ isPrimaryKey: false;
4630
+ isAutoincrement: false;
4631
+ hasRuntimeDefault: false;
4632
+ enumValues: undefined;
4633
+ identity: undefined;
4634
+ generated: undefined;
4635
+ }>;
4636
+ secretEnc: drizzle_orm_pg_core.PgBuildColumn<"mfa_totp", drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgTextBuilder<[string, ...string[]]>>, {
4637
+ name: string;
4638
+ tableName: "mfa_totp";
4639
+ dataType: "string";
4640
+ data: string;
4641
+ driverParam: string;
4642
+ notNull: true;
4643
+ hasDefault: false;
4644
+ isPrimaryKey: false;
4645
+ isAutoincrement: false;
4646
+ hasRuntimeDefault: false;
4647
+ enumValues: undefined;
4648
+ identity: undefined;
4649
+ generated: undefined;
4650
+ }>;
4651
+ confirmedAt: drizzle_orm_pg_core.PgBuildColumn<"mfa_totp", drizzle_orm_pg_core.PgTimestampBuilder, {
4652
+ name: string;
4653
+ tableName: "mfa_totp";
4654
+ dataType: "object date";
4655
+ data: Date;
4656
+ driverParam: string;
4657
+ notNull: false;
4658
+ hasDefault: false;
4659
+ isPrimaryKey: false;
4660
+ isAutoincrement: false;
4661
+ hasRuntimeDefault: false;
4662
+ enumValues: undefined;
4663
+ identity: undefined;
4664
+ generated: undefined;
4665
+ }>;
4666
+ lastUsedStep: drizzle_orm_pg_core.PgBuildColumn<"mfa_totp", drizzle_orm_pg_core.PgBigInt53Builder, {
4667
+ name: string;
4668
+ tableName: "mfa_totp";
4669
+ dataType: "number int53";
4670
+ data: number;
4671
+ driverParam: string | number;
4672
+ notNull: false;
4673
+ hasDefault: false;
4674
+ isPrimaryKey: false;
4675
+ isAutoincrement: false;
4676
+ hasRuntimeDefault: false;
4677
+ enumValues: undefined;
4678
+ identity: undefined;
4679
+ generated: undefined;
4680
+ }>;
4681
+ failedConfirmAttempts: drizzle_orm_pg_core.PgBuildColumn<"mfa_totp", drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgIntegerBuilder>>, {
4682
+ name: string;
4683
+ tableName: "mfa_totp";
4684
+ dataType: "number int32";
4685
+ data: number;
4686
+ driverParam: string | number;
4687
+ notNull: true;
4688
+ hasDefault: true;
4689
+ isPrimaryKey: false;
4690
+ isAutoincrement: false;
4691
+ hasRuntimeDefault: false;
4692
+ enumValues: undefined;
4693
+ identity: undefined;
4694
+ generated: undefined;
4695
+ }>;
4696
+ };
4697
+ dialect: "pg";
4698
+ }>;
4699
+ type MfaTotp = typeof mfaTotp.$inferSelect;
4700
+ type NewMfaTotp = typeof mfaTotp.$inferInsert;
4701
+
4702
+ /**
4703
+ * @spfn/auth - Recovery Codes Entity
4704
+ *
4705
+ * The ten single-use codes an enrolled account is shown once. Only the hash is
4706
+ * stored, and it is a **password** hash rather than the unsalted SHA-256 the
4707
+ * link flows use — a code a human transcribes is short enough that a leaked
4708
+ * dump of unsalted hashes falls to an offline sweep. `lib/recovery-codes.ts`
4709
+ * sets out the reasoning.
4710
+ *
4711
+ * Codes come in generations. Regenerating raises the generation rather than
4712
+ * deleting the old rows, so a code someone wrote down last year is refused with
4713
+ * the same body as one that never existed, and the history of which generation
4714
+ * a code was spent from survives.
4715
+ */
4716
+ declare const mfaRecoveryCodes: drizzle_orm_pg_core.PgTableWithColumns<{
4717
+ name: "mfa_recovery_codes";
4718
+ schema: string;
4719
+ columns: {
4720
+ createdAt: drizzle_orm_pg_core.PgBuildColumn<"mfa_recovery_codes", drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.PgTimestampBuilder>>, {
4721
+ name: string;
4722
+ tableName: "mfa_recovery_codes";
4723
+ dataType: "object date";
4724
+ data: Date;
4725
+ driverParam: string;
4726
+ notNull: true;
4727
+ hasDefault: true;
4728
+ isPrimaryKey: false;
4729
+ isAutoincrement: false;
4730
+ hasRuntimeDefault: false;
4731
+ enumValues: undefined;
4732
+ identity: undefined;
4733
+ generated: undefined;
4734
+ }>;
4735
+ updatedAt: drizzle_orm_pg_core.PgBuildColumn<"mfa_recovery_codes", drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.SetHasDefault<drizzle_orm_pg_core.PgTimestampBuilder>>>, {
4736
+ name: string;
4737
+ tableName: "mfa_recovery_codes";
4738
+ dataType: "object date";
4739
+ data: Date;
4740
+ driverParam: string;
4741
+ notNull: true;
4742
+ hasDefault: true;
4743
+ isPrimaryKey: false;
4744
+ isAutoincrement: false;
4745
+ hasRuntimeDefault: false;
4746
+ enumValues: undefined;
4747
+ identity: undefined;
4748
+ generated: undefined;
4749
+ }>;
4750
+ id: drizzle_orm_pg_core.PgBuildColumn<"mfa_recovery_codes", drizzle_orm_pg_core.SetIsPrimaryKey<drizzle_orm_pg_core.PgBigSerial53Builder>, {
4751
+ name: string;
4752
+ tableName: "mfa_recovery_codes";
4753
+ dataType: "number int53";
4754
+ data: number;
4755
+ driverParam: number;
4756
+ notNull: true;
4757
+ hasDefault: true;
4758
+ isPrimaryKey: false;
4759
+ isAutoincrement: false;
4760
+ hasRuntimeDefault: false;
4761
+ enumValues: undefined;
4762
+ identity: undefined;
4763
+ generated: undefined;
4764
+ }>;
4765
+ userId: drizzle_orm_pg_core.PgBuildColumn<"mfa_recovery_codes", drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgBigInt53Builder>, {
4766
+ name: string;
4767
+ tableName: "mfa_recovery_codes";
4768
+ dataType: "number int53";
4769
+ data: number;
4770
+ driverParam: string | number;
4771
+ notNull: true;
4772
+ hasDefault: false;
4773
+ isPrimaryKey: false;
4774
+ isAutoincrement: false;
4775
+ hasRuntimeDefault: false;
4776
+ enumValues: undefined;
4777
+ identity: undefined;
4778
+ generated: undefined;
4779
+ }>;
4780
+ generation: drizzle_orm_pg_core.PgBuildColumn<"mfa_recovery_codes", drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgIntegerBuilder>, {
4781
+ name: string;
4782
+ tableName: "mfa_recovery_codes";
4783
+ dataType: "number int32";
4784
+ data: number;
4785
+ driverParam: string | number;
4786
+ notNull: true;
4787
+ hasDefault: false;
4788
+ isPrimaryKey: false;
4789
+ isAutoincrement: false;
4790
+ hasRuntimeDefault: false;
4791
+ enumValues: undefined;
4792
+ identity: undefined;
4793
+ generated: undefined;
4794
+ }>;
4795
+ codeHash: drizzle_orm_pg_core.PgBuildColumn<"mfa_recovery_codes", drizzle_orm_pg_core.SetNotNull<drizzle_orm_pg_core.PgTextBuilder<[string, ...string[]]>>, {
4796
+ name: string;
4797
+ tableName: "mfa_recovery_codes";
4798
+ dataType: "string";
4799
+ data: string;
4800
+ driverParam: string;
4801
+ notNull: true;
4802
+ hasDefault: false;
4803
+ isPrimaryKey: false;
4804
+ isAutoincrement: false;
4805
+ hasRuntimeDefault: false;
4806
+ enumValues: undefined;
4807
+ identity: undefined;
4808
+ generated: undefined;
4809
+ }>;
4810
+ usedAt: drizzle_orm_pg_core.PgBuildColumn<"mfa_recovery_codes", drizzle_orm_pg_core.PgTimestampBuilder, {
4811
+ name: string;
4812
+ tableName: "mfa_recovery_codes";
4813
+ dataType: "object date";
4814
+ data: Date;
4815
+ driverParam: string;
4816
+ notNull: false;
4817
+ hasDefault: false;
4818
+ isPrimaryKey: false;
4819
+ isAutoincrement: false;
4820
+ hasRuntimeDefault: false;
4821
+ enumValues: undefined;
4822
+ identity: undefined;
4823
+ generated: undefined;
4824
+ }>;
4825
+ };
4826
+ dialect: "pg";
4827
+ }>;
4828
+ type MfaRecoveryCode = typeof mfaRecoveryCodes.$inferSelect;
4829
+ type NewMfaRecoveryCode = typeof mfaRecoveryCodes.$inferInsert;
4830
+
4500
4831
  /**
4501
4832
  * @spfn/auth - Device Authorizations Entity
4502
4833
  *
@@ -7261,6 +7592,31 @@ declare class PasskeysRepository extends BaseRepository {
7261
7592
  * @returns the updated row, or null if it is not theirs or already revoked
7262
7593
  */
7263
7594
  revokeByIdAndUserId(id: number, userId: number, reason: string): Promise<Passkey | null>;
7595
+ /**
7596
+ * Mark or unmark a live credential as the owner's second factor.
7597
+ *
7598
+ * Owner-scoped and live-only, so somebody else's passkey and an already
7599
+ * revoked one are both "no such row" — the same answer every other
7600
+ * management statement here gives.
7601
+ *
7602
+ * @returns the updated row, or null if it is not theirs or already revoked
7603
+ */
7604
+ markSecondFactorByIdAndUserId(id: number, userId: number, secondFactor: boolean): Promise<Passkey | null>;
7605
+ /**
7606
+ * The account's live credentials that satisfy a step-up.
7607
+ *
7608
+ * Used to check an assertion against the marked ones only: a passkey that
7609
+ * signs the owner in is not a second factor until they say it is.
7610
+ */
7611
+ listLiveSecondFactorByUserId(userId: number): Promise<Passkey[]>;
7612
+ /**
7613
+ * Take the second-factor mark off every one of an account's credentials.
7614
+ *
7615
+ * What `mfa/disable` does to the passkey half of an enrolment. The
7616
+ * credentials themselves are untouched — they still sign the owner in.
7617
+ * Write primary.
7618
+ */
7619
+ clearSecondFactorByUserId(userId: number): Promise<void>;
7264
7620
  /**
7265
7621
  * Delete every passkey of an account (account destruction).
7266
7622
  * Write primary.
@@ -7313,6 +7669,158 @@ declare class WebAuthnChallengesRepository extends BaseRepository {
7313
7669
  }
7314
7670
  declare const webauthnChallengesRepository: WebAuthnChallengesRepository;
7315
7671
 
7672
+ /**
7673
+ * MFA TOTP Repository
7674
+ *
7675
+ * Data access for the one enrolment row an account may have. Extends
7676
+ * BaseRepository for transaction-context detection and read/write splitting.
7677
+ *
7678
+ * `secret_enc` is a ciphertext and is only ever moved through this layer as an
7679
+ * opaque string — nothing here decrypts, and nothing here logs a row.
7680
+ */
7681
+
7682
+ declare class MfaTotpRepository extends BaseRepository {
7683
+ /** The account's enrolment row, confirmed or not. */
7684
+ findByUserId(userId: number): Promise<MfaTotp | null>;
7685
+ /**
7686
+ * Start an enrolment, replacing an unconfirmed one.
7687
+ *
7688
+ * Upsert rather than insert: calling `enroll` twice is the ordinary case —
7689
+ * a user closes the app before scanning — and the second call must hand out
7690
+ * a fresh secret rather than a 409. The failed-attempt counter resets with
7691
+ * it, which is what makes "start over" the documented remedy for a row that
7692
+ * spent its five tries.
7693
+ *
7694
+ * A **confirmed** row is refused by the service before this is reached, so
7695
+ * this can never overwrite a working second factor.
7696
+ */
7697
+ startEnrolment(userId: number, secretEnc: string): Promise<MfaTotp>;
7698
+ /**
7699
+ * Mark the enrolment confirmed and record the step its first code spent.
7700
+ * Write primary.
7701
+ */
7702
+ confirm(userId: number, step: number): Promise<void>;
7703
+ /** Record the newest step this account has spent, so it cannot be replayed. */
7704
+ recordUsedStep(userId: number, step: number): Promise<void>;
7705
+ /**
7706
+ * Count one wrong code against an unconfirmed row.
7707
+ *
7708
+ * @returns the count after this attempt
7709
+ */
7710
+ countFailedConfirm(userId: number): Promise<number>;
7711
+ /** Rewrite the ciphertext in place, after a read on a retired key. */
7712
+ updateSecret(userId: number, secretEnc: string): Promise<void>;
7713
+ /** Drop the account's enrolment. Write primary. */
7714
+ deleteByUserId(userId: number): Promise<void>;
7715
+ /**
7716
+ * Drop enrolments nobody ever confirmed. The sweep job's statement.
7717
+ *
7718
+ * @returns number of rows deleted
7719
+ */
7720
+ deleteUnconfirmedBefore(cutoff: Date): Promise<number>;
7721
+ }
7722
+ declare const mfaTotpRepository: MfaTotpRepository;
7723
+
7724
+ /**
7725
+ * MFA Recovery Codes Repository
7726
+ *
7727
+ * Data access for the ten single-use codes of an account's current generation.
7728
+ * Extends BaseRepository for transaction-context detection and read/write
7729
+ * splitting.
7730
+ *
7731
+ * Every read is scoped by `(user_id, generation)`. A code from an older
7732
+ * generation, or from another account, is not "not found" by accident — it is
7733
+ * outside every query this class can make.
7734
+ */
7735
+
7736
+ declare class MfaRecoveryCodesRepository extends BaseRepository {
7737
+ /**
7738
+ * The account's newest generation, or 0 when it has never had codes.
7739
+ *
7740
+ * 0 rather than null so the caller's `+ 1` is the same expression on both
7741
+ * paths: a first enrolment writes generation 1.
7742
+ */
7743
+ currentGeneration(userId: number): Promise<number>;
7744
+ /** Write one generation of codes. Write primary. */
7745
+ createGeneration(userId: number, generation: number, hashes: string[]): Promise<void>;
7746
+ /** The account's unspent codes of one generation. */
7747
+ listUnused(userId: number, generation: number): Promise<MfaRecoveryCode[]>;
7748
+ /** How many of a generation are left, for `status` and the "2 remaining" warning. */
7749
+ countUnused(userId: number, generation: number): Promise<number>;
7750
+ /**
7751
+ * Spend one code, if this call is the one that spends it.
7752
+ *
7753
+ * One conditional UPDATE, like the WebAuthn challenge consume and for the
7754
+ * same reason: two requests arriving with the same code must produce one
7755
+ * winner, not two, and a read-then-write would let both read it as unused.
7756
+ *
7757
+ * @returns true when this call spent the row
7758
+ */
7759
+ consume(id: number): Promise<boolean>;
7760
+ /** Drop every generation the account has. Write primary. */
7761
+ deleteByUserId(userId: number): Promise<void>;
7762
+ }
7763
+ declare const mfaRecoveryCodesRepository: MfaRecoveryCodesRepository;
7764
+
7765
+ /**
7766
+ * MFA Verifications Repository
7767
+ *
7768
+ * Data access for "when did this device last prove the second factor". Extends
7769
+ * BaseRepository for transaction-context detection and read/write splitting.
7770
+ *
7771
+ * One row per device key, replaced rather than appended to: only the newest
7772
+ * verification decides anything, and a history of them would be a table that
7773
+ * grows with every step-up for no reader.
7774
+ */
7775
+
7776
+ declare class MfaVerificationsRepository extends BaseRepository {
7777
+ /** When this device last stepped up, if it ever did. */
7778
+ findByKeyId(keyId: string): Promise<MfaVerification | null>;
7779
+ /** Record a fresh verification for this device, replacing any earlier one. */
7780
+ record(keyId: string, userId: number, method: MfaVerificationMethod): Promise<void>;
7781
+ /**
7782
+ * Carry a verification across a key rotation.
7783
+ *
7784
+ * Scoped by owner, so a caller naming somebody else's key moves nothing.
7785
+ * Nothing to move is not an error: a device that never stepped up rotates
7786
+ * exactly as it does today.
7787
+ */
7788
+ moveToKeyId(userId: number, fromKeyId: string, toKeyId: string): Promise<void>;
7789
+ /** Forget every device's verification — what disabling the second factor means. */
7790
+ deleteByUserId(userId: number): Promise<void>;
7791
+ }
7792
+ declare const mfaVerificationsRepository: MfaVerificationsRepository;
7793
+
7794
+ /**
7795
+ * MFA Enrolment Repository
7796
+ *
7797
+ * One question, asked on every sensitive route and at every device
7798
+ * registration: does this account have a second factor at all?
7799
+ *
7800
+ * It spans two tables — a confirmed `mfa_totp` row, or at least one live passkey
7801
+ * the owner marked as a second factor — so it lives here rather than in either
7802
+ * table's repository, and it is deliberately **one** statement. `assertStepUp`
7803
+ * asks it first and returns immediately when the answer is no, so an account
7804
+ * that never enrolled pays one round trip against two indexed lookups
7805
+ * (`mfa_totp_user_id_idx`, unique, and `passkeys_user_id_idx`) and nothing else:
7806
+ * no second query, and no passkey configuration read.
7807
+ *
7808
+ * `UNION ALL ... LIMIT 1` rather than two `EXISTS` counts, so Postgres stops at
7809
+ * the first row either side produces. Both halves select `user_id` — a column
7810
+ * rather than a literal, so the two sides agree on a shape without a raw-SQL
7811
+ * alias, and the value is thrown away either way.
7812
+ */
7813
+
7814
+ declare class MfaEnrolmentRepository extends BaseRepository {
7815
+ /** Whether the account has a confirmed TOTP or a live second-factor passkey. */
7816
+ isEnrolled(userId: number): Promise<boolean>;
7817
+ /** The other half of the union, as its own read for `status` to reuse. */
7818
+ private liveSecondFactorPasskeys;
7819
+ /** Whether at least one live passkey is marked as a second factor. */
7820
+ hasSecondFactorPasskey(userId: number): Promise<boolean>;
7821
+ }
7822
+ declare const mfaEnrolmentRepository: MfaEnrolmentRepository;
7823
+
7316
7824
  /**
7317
7825
  * Device Authorizations Repository
7318
7826
  *
@@ -10439,8 +10947,8 @@ declare const linkMailJob: _spfn_core_job.JobDef<{
10439
10947
 
10440
10948
  /**
10441
10949
  * Build the auth job router: the account-deletion purge sweep, the OAuth 2.1
10442
- * stale-client sweep, the sign-out-everywhere link sweep, and the link-mail
10443
- * sender.
10950
+ * stale-client sweep, the sign-out-everywhere link sweep, the abandoned
10951
+ * second-factor enrolment sweep, and the link-mail sender.
10444
10952
  *
10445
10953
  * The cron is a parameter because `job(...).cron(expression)` bakes the string in
10446
10954
  * at module-import time, which always happens before `createAuthLifecycle()` runs
@@ -10451,15 +10959,18 @@ declare const linkMailJob: _spfn_core_job.JobDef<{
10451
10959
  * @param options.purgeCron - Deletion purge schedule; defaults to daily at 04:00
10452
10960
  * @param options.oauth2ClientPurgeCron - Stale OAuth client sweep; defaults to daily at 05:00
10453
10961
  * @param options.revokeAllTokenPurgeCron - Sign-out-everywhere link sweep; defaults to daily at 06:00
10962
+ * @param options.mfaSweepCron - Abandoned second-factor enrolment sweep; defaults to daily at 07:00
10454
10963
  */
10455
10964
  declare function createAuthJobRouter(options?: {
10456
10965
  purgeCron?: string;
10457
10966
  oauth2ClientPurgeCron?: string;
10458
10967
  revokeAllTokenPurgeCron?: string;
10968
+ mfaSweepCron?: string;
10459
10969
  }): _spfn_core_job.JobRouter<{
10460
10970
  deletionPurge: _spfn_core_job.JobDef<void, void>;
10461
10971
  oauth2ClientPurge: _spfn_core_job.JobDef<void, void>;
10462
10972
  revokeAllTokenPurge: _spfn_core_job.JobDef<void, void>;
10973
+ mfaSweep: _spfn_core_job.JobDef<void, void>;
10463
10974
  linkMail: _spfn_core_job.JobDef<{
10464
10975
  kind: "signup-link";
10465
10976
  rowId: number;
@@ -10480,6 +10991,7 @@ declare const authJobRouter: _spfn_core_job.JobRouter<{
10480
10991
  deletionPurge: _spfn_core_job.JobDef<void, void>;
10481
10992
  oauth2ClientPurge: _spfn_core_job.JobDef<void, void>;
10482
10993
  revokeAllTokenPurge: _spfn_core_job.JobDef<void, void>;
10994
+ mfaSweep: _spfn_core_job.JobDef<void, void>;
10483
10995
  linkMail: _spfn_core_job.JobDef<{
10484
10996
  kind: "signup-link";
10485
10997
  rowId: number;
@@ -10499,4 +11011,4 @@ declare const authJobRouter: _spfn_core_job.JobRouter<{
10499
11011
  */
10500
11012
  declare const createAuthDeletionJobRouter: typeof createAuthJobRouter;
10501
11013
 
10502
- 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, type NewAccountDeletionRequest, type NewAuthMetadataEntity, type NewDeviceAuthorization, type NewInvitation, type NewKeyRevokeAllToken, 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, type 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 TokenPayload, USER_CODE_ALPHABET, USER_CODE_LENGTH, type UpdateProfileParams, type User, type UserPermission, UserPermissionsRepository, type UserProfile, UserProfilesRepository, type UserPublicKey, type UserSocialAccount, UsersRepository, type VerificationCode, VerificationCodesRepository, VerificationPurpose, type VerifiedOAuth2AccessToken, type VerifiedOpsToken, type VerifyIdTokenParams, WEBAUTHN_CHALLENGE_KINDS, type WebAuthnChallenge, type WebAuthnChallengeKind, WebAuthnChallengesRepository, acceptInvitation, accountDeletionRequests, accountDeletionRequestsRepository, addPermissionToRole, appleProvider, assertAuthorizationServerIssuer, assertCanAssignRole, assertKeyMatchesAlgorithm, assertPasskeyConfig, authJobRouter, authLogger, authMetadata, authMetadataRepository, authSchema, 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, getCsrfExemptPaths, getCsrfMode, getDeletionConfig, getDeviceAuthConfig, getDummyPasswordHash, getGoogleAuthUrl, getGoogleOAuthConfig, getGoogleUserInfo, getInvitationByToken, getInvitationWithDetails, getKeyId, getLocale, getOneTimeTokenManager, getOpsToken, getOptionalAuth, getPasskeyConfig, getPendingDeletionInfo, getRole, getRoleByName, getRolePermissions, 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, 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, userPublicKeys, userSocialAccounts, users, usersRepository, validateInvitation, validatePasswordStrength, verificationCodes, verificationCodesRepository, verifyAccessToken, verifyClientToken, verifyIdToken, verifyKeyFingerprint, verifyOAuthState, verifyOpsTokenService, verifyPassword, verifyToken, webauthnChallenges, webauthnChallengesRepository };
11014
+ 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, type MfaConfig, MfaEnrolmentRepository, type MfaRecoveryCode, MfaRecoveryCodesRepository, type MfaTotp, MfaTotpRepository, MfaVerification, MfaVerificationMethod, MfaVerificationsRepository, type NewAccountDeletionRequest, type NewAuthMetadataEntity, type NewDeviceAuthorization, type NewInvitation, type NewKeyRevokeAllToken, 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, type 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, type 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, appleProvider, assertAuthorizationServerIssuer, assertCanAssignRole, assertKeyMatchesAlgorithm, assertPasskeyConfig, authJobRouter, authLogger, authMetadata, authMetadataRepository, authSchema, 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, getCsrfExemptPaths, getCsrfMode, getDeletionConfig, getDeviceAuthConfig, getDummyPasswordHash, getEncryptionKeyring, getGoogleAuthUrl, getGoogleOAuthConfig, getGoogleUserInfo, getInvitationByToken, getInvitationWithDetails, getKeyId, getLocale, getMfaConfig, getOneTimeTokenManager, getOpsToken, getOptionalAuth, getPasskeyConfig, getPendingDeletionInfo, getRole, getRoleByName, getRolePermissions, 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, 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, userPublicKeys, userSocialAccounts, users, usersRepository, validateInvitation, validatePasswordStrength, verificationCodes, verificationCodesRepository, verifyAccessToken, verifyClientToken, verifyIdToken, verifyKeyFingerprint, verifyOAuthState, verifyOpsTokenService, verifyPassword, verifyToken, webauthnChallenges, webauthnChallengesRepository };