@authhero/adapter-interfaces 0.148.0 → 0.149.0

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.
@@ -10368,6 +10368,7 @@ export declare const codeTypeSchema: z.ZodEnum<[
10368
10368
  "password_reset",
10369
10369
  "email_verification",
10370
10370
  "otp",
10371
+ "mfa_otp",
10371
10372
  "authorization_code",
10372
10373
  "oauth2_state",
10373
10374
  "ticket"
@@ -10381,6 +10382,7 @@ export declare const codeInsertSchema: z.ZodObject<{
10381
10382
  "password_reset",
10382
10383
  "email_verification",
10383
10384
  "otp",
10385
+ "mfa_otp",
10384
10386
  "authorization_code",
10385
10387
  "oauth2_state",
10386
10388
  "ticket"
@@ -10392,6 +10394,7 @@ export declare const codeInsertSchema: z.ZodObject<{
10392
10394
  "S256"
10393
10395
  ]>>;
10394
10396
  redirect_uri: z.ZodOptional<z.ZodString>;
10397
+ otp: z.ZodOptional<z.ZodString>;
10395
10398
  nonce: z.ZodOptional<z.ZodString>;
10396
10399
  state: z.ZodOptional<z.ZodString>;
10397
10400
  expires_at: z.ZodString;
@@ -10400,7 +10403,7 @@ export declare const codeInsertSchema: z.ZodObject<{
10400
10403
  }, "strip", z.ZodTypeAny, {
10401
10404
  code_id: string;
10402
10405
  login_id: string;
10403
- code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
10406
+ code_type: "password_reset" | "email_verification" | "otp" | "mfa_otp" | "authorization_code" | "oauth2_state" | "ticket";
10404
10407
  expires_at: string;
10405
10408
  connection_id?: string | undefined;
10406
10409
  user_id?: string | undefined;
@@ -10409,12 +10412,13 @@ export declare const codeInsertSchema: z.ZodObject<{
10409
10412
  nonce?: string | undefined;
10410
10413
  code_challenge_method?: "S256" | "plain" | undefined;
10411
10414
  code_challenge?: string | undefined;
10415
+ otp?: string | undefined;
10412
10416
  code_verifier?: string | undefined;
10413
10417
  used_at?: string | undefined;
10414
10418
  }, {
10415
10419
  code_id: string;
10416
10420
  login_id: string;
10417
- code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
10421
+ code_type: "password_reset" | "email_verification" | "otp" | "mfa_otp" | "authorization_code" | "oauth2_state" | "ticket";
10418
10422
  expires_at: string;
10419
10423
  connection_id?: string | undefined;
10420
10424
  user_id?: string | undefined;
@@ -10423,6 +10427,7 @@ export declare const codeInsertSchema: z.ZodObject<{
10423
10427
  nonce?: string | undefined;
10424
10428
  code_challenge_method?: "S256" | "plain" | undefined;
10425
10429
  code_challenge?: string | undefined;
10430
+ otp?: string | undefined;
10426
10431
  code_verifier?: string | undefined;
10427
10432
  used_at?: string | undefined;
10428
10433
  }>;
@@ -10436,6 +10441,7 @@ export declare const codeSchema: z.ZodObject<{
10436
10441
  "password_reset",
10437
10442
  "email_verification",
10438
10443
  "otp",
10444
+ "mfa_otp",
10439
10445
  "authorization_code",
10440
10446
  "oauth2_state",
10441
10447
  "ticket"
@@ -10447,6 +10453,7 @@ export declare const codeSchema: z.ZodObject<{
10447
10453
  "S256"
10448
10454
  ]>>;
10449
10455
  redirect_uri: z.ZodOptional<z.ZodString>;
10456
+ otp: z.ZodOptional<z.ZodString>;
10450
10457
  nonce: z.ZodOptional<z.ZodString>;
10451
10458
  state: z.ZodOptional<z.ZodString>;
10452
10459
  expires_at: z.ZodString;
@@ -10456,7 +10463,7 @@ export declare const codeSchema: z.ZodObject<{
10456
10463
  created_at: string;
10457
10464
  code_id: string;
10458
10465
  login_id: string;
10459
- code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
10466
+ code_type: "password_reset" | "email_verification" | "otp" | "mfa_otp" | "authorization_code" | "oauth2_state" | "ticket";
10460
10467
  expires_at: string;
10461
10468
  connection_id?: string | undefined;
10462
10469
  user_id?: string | undefined;
@@ -10465,13 +10472,14 @@ export declare const codeSchema: z.ZodObject<{
10465
10472
  nonce?: string | undefined;
10466
10473
  code_challenge_method?: "S256" | "plain" | undefined;
10467
10474
  code_challenge?: string | undefined;
10475
+ otp?: string | undefined;
10468
10476
  code_verifier?: string | undefined;
10469
10477
  used_at?: string | undefined;
10470
10478
  }, {
10471
10479
  created_at: string;
10472
10480
  code_id: string;
10473
10481
  login_id: string;
10474
- code_type: "password_reset" | "email_verification" | "otp" | "authorization_code" | "oauth2_state" | "ticket";
10482
+ code_type: "password_reset" | "email_verification" | "otp" | "mfa_otp" | "authorization_code" | "oauth2_state" | "ticket";
10475
10483
  expires_at: string;
10476
10484
  connection_id?: string | undefined;
10477
10485
  user_id?: string | undefined;
@@ -10480,6 +10488,7 @@ export declare const codeSchema: z.ZodObject<{
10480
10488
  nonce?: string | undefined;
10481
10489
  code_challenge_method?: "S256" | "plain" | undefined;
10482
10490
  code_challenge?: string | undefined;
10491
+ otp?: string | undefined;
10483
10492
  code_verifier?: string | undefined;
10484
10493
  used_at?: string | undefined;
10485
10494
  }>;
@@ -41924,6 +41933,8 @@ export declare enum LoginSessionState {
41924
41933
  AUTHENTICATED = "authenticated",
41925
41934
  /** Waiting for email verification */
41926
41935
  AWAITING_EMAIL_VERIFICATION = "awaiting_email_verification",
41936
+ /** Waiting for MFA verification */
41937
+ AWAITING_MFA = "awaiting_mfa",
41927
41938
  /** Waiting for hook/flow completion (form, page redirect) */
41928
41939
  AWAITING_HOOK = "awaiting_hook",
41929
41940
  /** Waiting for user to complete action on continuation page (change-email, account, etc.) */
@@ -43192,6 +43203,10 @@ export declare const tenantInsertSchema: z.ZodObject<{
43192
43203
  pushed_authorization_requests_supported: z.ZodOptional<z.ZodBoolean>;
43193
43204
  authorization_response_iss_parameter_supported: z.ZodOptional<z.ZodBoolean>;
43194
43205
  mfa: z.ZodOptional<z.ZodObject<{
43206
+ policy: z.ZodOptional<z.ZodDefault<z.ZodEnum<[
43207
+ "never",
43208
+ "always"
43209
+ ]>>>;
43195
43210
  factors: z.ZodOptional<z.ZodObject<{
43196
43211
  sms: z.ZodDefault<z.ZodBoolean>;
43197
43212
  otp: z.ZodDefault<z.ZodBoolean>;
@@ -43256,6 +43271,7 @@ export declare const tenantInsertSchema: z.ZodObject<{
43256
43271
  message?: string | undefined;
43257
43272
  }>>;
43258
43273
  }, "strip", z.ZodTypeAny, {
43274
+ policy?: "never" | "always" | undefined;
43259
43275
  factors?: {
43260
43276
  email: boolean;
43261
43277
  otp: boolean;
@@ -43279,6 +43295,7 @@ export declare const tenantInsertSchema: z.ZodObject<{
43279
43295
  message?: string | undefined;
43280
43296
  } | undefined;
43281
43297
  }, {
43298
+ policy?: "never" | "always" | undefined;
43282
43299
  factors?: {
43283
43300
  email?: boolean | undefined;
43284
43301
  otp?: boolean | undefined;
@@ -43402,6 +43419,7 @@ export declare const tenantInsertSchema: z.ZodObject<{
43402
43419
  pushed_authorization_requests_supported?: boolean | undefined;
43403
43420
  authorization_response_iss_parameter_supported?: boolean | undefined;
43404
43421
  mfa?: {
43422
+ policy?: "never" | "always" | undefined;
43405
43423
  factors?: {
43406
43424
  email: boolean;
43407
43425
  otp: boolean;
@@ -43525,6 +43543,7 @@ export declare const tenantInsertSchema: z.ZodObject<{
43525
43543
  pushed_authorization_requests_supported?: boolean | undefined;
43526
43544
  authorization_response_iss_parameter_supported?: boolean | undefined;
43527
43545
  mfa?: {
43546
+ policy?: "never" | "always" | undefined;
43528
43547
  factors?: {
43529
43548
  email?: boolean | undefined;
43530
43549
  otp?: boolean | undefined;
@@ -43787,6 +43806,10 @@ export declare const tenantSchema: z.ZodObject<{
43787
43806
  pushed_authorization_requests_supported: z.ZodOptional<z.ZodBoolean>;
43788
43807
  authorization_response_iss_parameter_supported: z.ZodOptional<z.ZodBoolean>;
43789
43808
  mfa: z.ZodOptional<z.ZodObject<{
43809
+ policy: z.ZodOptional<z.ZodDefault<z.ZodEnum<[
43810
+ "never",
43811
+ "always"
43812
+ ]>>>;
43790
43813
  factors: z.ZodOptional<z.ZodObject<{
43791
43814
  sms: z.ZodDefault<z.ZodBoolean>;
43792
43815
  otp: z.ZodDefault<z.ZodBoolean>;
@@ -43851,6 +43874,7 @@ export declare const tenantSchema: z.ZodObject<{
43851
43874
  message?: string | undefined;
43852
43875
  }>>;
43853
43876
  }, "strip", z.ZodTypeAny, {
43877
+ policy?: "never" | "always" | undefined;
43854
43878
  factors?: {
43855
43879
  email: boolean;
43856
43880
  otp: boolean;
@@ -43874,6 +43898,7 @@ export declare const tenantSchema: z.ZodObject<{
43874
43898
  message?: string | undefined;
43875
43899
  } | undefined;
43876
43900
  }, {
43901
+ policy?: "never" | "always" | undefined;
43877
43902
  factors?: {
43878
43903
  email?: boolean | undefined;
43879
43904
  otp?: boolean | undefined;
@@ -44001,6 +44026,7 @@ export declare const tenantSchema: z.ZodObject<{
44001
44026
  pushed_authorization_requests_supported?: boolean | undefined;
44002
44027
  authorization_response_iss_parameter_supported?: boolean | undefined;
44003
44028
  mfa?: {
44029
+ policy?: "never" | "always" | undefined;
44004
44030
  factors?: {
44005
44031
  email: boolean;
44006
44032
  otp: boolean;
@@ -44126,6 +44152,7 @@ export declare const tenantSchema: z.ZodObject<{
44126
44152
  pushed_authorization_requests_supported?: boolean | undefined;
44127
44153
  authorization_response_iss_parameter_supported?: boolean | undefined;
44128
44154
  mfa?: {
44155
+ policy?: "never" | "always" | undefined;
44129
44156
  factors?: {
44130
44157
  email?: boolean | undefined;
44131
44158
  otp?: boolean | undefined;
@@ -46875,6 +46902,10 @@ export declare const tenantSettingsSchema: z.ZodObject<{
46875
46902
  oidc_logout_prompt_enabled?: boolean | undefined;
46876
46903
  }>>;
46877
46904
  mfa: z.ZodOptional<z.ZodObject<{
46905
+ policy: z.ZodOptional<z.ZodDefault<z.ZodEnum<[
46906
+ "never",
46907
+ "always"
46908
+ ]>>>;
46878
46909
  factors: z.ZodOptional<z.ZodObject<{
46879
46910
  sms: z.ZodDefault<z.ZodBoolean>;
46880
46911
  otp: z.ZodDefault<z.ZodBoolean>;
@@ -46939,6 +46970,7 @@ export declare const tenantSettingsSchema: z.ZodObject<{
46939
46970
  message?: string | undefined;
46940
46971
  }>>;
46941
46972
  }, "strip", z.ZodTypeAny, {
46973
+ policy?: "never" | "always" | undefined;
46942
46974
  factors?: {
46943
46975
  email: boolean;
46944
46976
  otp: boolean;
@@ -46962,6 +46994,7 @@ export declare const tenantSettingsSchema: z.ZodObject<{
46962
46994
  message?: string | undefined;
46963
46995
  } | undefined;
46964
46996
  }, {
46997
+ policy?: "never" | "always" | undefined;
46965
46998
  factors?: {
46966
46999
  email?: boolean | undefined;
46967
47000
  otp?: boolean | undefined;
@@ -47043,6 +47076,7 @@ export declare const tenantSettingsSchema: z.ZodObject<{
47043
47076
  oidc_logout_prompt_enabled?: boolean | undefined;
47044
47077
  } | undefined;
47045
47078
  mfa?: {
47079
+ policy?: "never" | "always" | undefined;
47046
47080
  factors?: {
47047
47081
  email: boolean;
47048
47082
  otp: boolean;
@@ -47124,6 +47158,7 @@ export declare const tenantSettingsSchema: z.ZodObject<{
47124
47158
  oidc_logout_prompt_enabled?: boolean | undefined;
47125
47159
  } | undefined;
47126
47160
  mfa?: {
47161
+ policy?: "never" | "always" | undefined;
47127
47162
  factors?: {
47128
47163
  email?: boolean | undefined;
47129
47164
  otp?: boolean | undefined;
@@ -47193,7 +47228,6 @@ export declare const promptScreenSchema: z.ZodEnum<[
47193
47228
  "mfa-voice",
47194
47229
  "mfa-phone",
47195
47230
  "mfa-webauthn",
47196
- "mfa-sms",
47197
47231
  "mfa-email",
47198
47232
  "mfa-recovery-code",
47199
47233
  "status",
@@ -47235,7 +47269,6 @@ export declare const customTextEntrySchema: z.ZodObject<{
47235
47269
  "mfa-voice",
47236
47270
  "mfa-phone",
47237
47271
  "mfa-webauthn",
47238
- "mfa-sms",
47239
47272
  "mfa-email",
47240
47273
  "mfa-recovery-code",
47241
47274
  "status",
@@ -47253,11 +47286,11 @@ export declare const customTextEntrySchema: z.ZodObject<{
47253
47286
  language: z.ZodString;
47254
47287
  custom_text: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>;
47255
47288
  }, "strip", z.ZodTypeAny, {
47256
- prompt: "status" | "signup" | "organizations" | "mfa" | "login" | "login-id" | "login-password" | "signup-id" | "signup-password" | "reset-password" | "consent" | "mfa-push" | "mfa-otp" | "mfa-voice" | "mfa-phone" | "mfa-webauthn" | "mfa-sms" | "mfa-email" | "mfa-recovery-code" | "device-flow" | "email-verification" | "email-otp-challenge" | "invitation" | "common" | "passkeys" | "captcha" | "custom-form" | "login-passwordless";
47289
+ prompt: "status" | "signup" | "organizations" | "mfa" | "login" | "login-id" | "login-password" | "signup-id" | "signup-password" | "reset-password" | "consent" | "mfa-push" | "mfa-otp" | "mfa-voice" | "mfa-phone" | "mfa-webauthn" | "mfa-email" | "mfa-recovery-code" | "device-flow" | "email-verification" | "email-otp-challenge" | "invitation" | "common" | "passkeys" | "captcha" | "custom-form" | "login-passwordless";
47257
47290
  language: string;
47258
47291
  custom_text: Record<string, Record<string, string>>;
47259
47292
  }, {
47260
- prompt: "status" | "signup" | "organizations" | "mfa" | "login" | "login-id" | "login-password" | "signup-id" | "signup-password" | "reset-password" | "consent" | "mfa-push" | "mfa-otp" | "mfa-voice" | "mfa-phone" | "mfa-webauthn" | "mfa-sms" | "mfa-email" | "mfa-recovery-code" | "device-flow" | "email-verification" | "email-otp-challenge" | "invitation" | "common" | "passkeys" | "captcha" | "custom-form" | "login-passwordless";
47293
+ prompt: "status" | "signup" | "organizations" | "mfa" | "login" | "login-id" | "login-password" | "signup-id" | "signup-password" | "reset-password" | "consent" | "mfa-push" | "mfa-otp" | "mfa-voice" | "mfa-phone" | "mfa-webauthn" | "mfa-email" | "mfa-recovery-code" | "device-flow" | "email-verification" | "email-otp-challenge" | "invitation" | "common" | "passkeys" | "captcha" | "custom-form" | "login-passwordless";
47261
47294
  language: string;
47262
47295
  custom_text: Record<string, Record<string, string>>;
47263
47296
  }>;
@@ -47283,6 +47316,105 @@ export declare const StrategyType: {
47283
47316
  readonly SOCIAL: "social";
47284
47317
  readonly PASSWORDLESS: "passwordless";
47285
47318
  };
47319
+ export declare const mfaEnrollmentTypeSchema: z.ZodEnum<[
47320
+ "phone",
47321
+ "totp",
47322
+ "email",
47323
+ "push",
47324
+ "webauthn"
47325
+ ]>;
47326
+ export type MfaEnrollmentType = z.infer<typeof mfaEnrollmentTypeSchema>;
47327
+ export declare const mfaEnrollmentInsertSchema: z.ZodEffects<z.ZodObject<{
47328
+ user_id: z.ZodString;
47329
+ type: z.ZodEnum<[
47330
+ "phone",
47331
+ "totp",
47332
+ "email",
47333
+ "push",
47334
+ "webauthn"
47335
+ ]>;
47336
+ phone_number: z.ZodOptional<z.ZodString>;
47337
+ totp_secret: z.ZodOptional<z.ZodString>;
47338
+ confirmed: z.ZodDefault<z.ZodBoolean>;
47339
+ }, "strip", z.ZodTypeAny, {
47340
+ type: "push" | "email" | "phone" | "totp" | "webauthn";
47341
+ user_id: string;
47342
+ confirmed: boolean;
47343
+ phone_number?: string | undefined;
47344
+ totp_secret?: string | undefined;
47345
+ }, {
47346
+ type: "push" | "email" | "phone" | "totp" | "webauthn";
47347
+ user_id: string;
47348
+ phone_number?: string | undefined;
47349
+ totp_secret?: string | undefined;
47350
+ confirmed?: boolean | undefined;
47351
+ }>, {
47352
+ type: "push" | "email" | "phone" | "totp" | "webauthn";
47353
+ user_id: string;
47354
+ confirmed: boolean;
47355
+ phone_number?: string | undefined;
47356
+ totp_secret?: string | undefined;
47357
+ }, {
47358
+ type: "push" | "email" | "phone" | "totp" | "webauthn";
47359
+ user_id: string;
47360
+ phone_number?: string | undefined;
47361
+ totp_secret?: string | undefined;
47362
+ confirmed?: boolean | undefined;
47363
+ }>;
47364
+ export type MfaEnrollmentInsert = z.infer<typeof mfaEnrollmentInsertSchema>;
47365
+ export declare const mfaEnrollmentSchema: z.ZodEffects<z.ZodObject<{
47366
+ id: z.ZodString;
47367
+ created_at: z.ZodString;
47368
+ updated_at: z.ZodString;
47369
+ user_id: z.ZodString;
47370
+ type: z.ZodEnum<[
47371
+ "phone",
47372
+ "totp",
47373
+ "email",
47374
+ "push",
47375
+ "webauthn"
47376
+ ]>;
47377
+ phone_number: z.ZodOptional<z.ZodString>;
47378
+ totp_secret: z.ZodOptional<z.ZodString>;
47379
+ confirmed: z.ZodDefault<z.ZodBoolean>;
47380
+ }, "strip", z.ZodTypeAny, {
47381
+ created_at: string;
47382
+ updated_at: string;
47383
+ type: "push" | "email" | "phone" | "totp" | "webauthn";
47384
+ id: string;
47385
+ user_id: string;
47386
+ confirmed: boolean;
47387
+ phone_number?: string | undefined;
47388
+ totp_secret?: string | undefined;
47389
+ }, {
47390
+ created_at: string;
47391
+ updated_at: string;
47392
+ type: "push" | "email" | "phone" | "totp" | "webauthn";
47393
+ id: string;
47394
+ user_id: string;
47395
+ phone_number?: string | undefined;
47396
+ totp_secret?: string | undefined;
47397
+ confirmed?: boolean | undefined;
47398
+ }>, {
47399
+ created_at: string;
47400
+ updated_at: string;
47401
+ type: "push" | "email" | "phone" | "totp" | "webauthn";
47402
+ id: string;
47403
+ user_id: string;
47404
+ confirmed: boolean;
47405
+ phone_number?: string | undefined;
47406
+ totp_secret?: string | undefined;
47407
+ }, {
47408
+ created_at: string;
47409
+ updated_at: string;
47410
+ type: "push" | "email" | "phone" | "totp" | "webauthn";
47411
+ id: string;
47412
+ user_id: string;
47413
+ phone_number?: string | undefined;
47414
+ totp_secret?: string | undefined;
47415
+ confirmed?: boolean | undefined;
47416
+ }>;
47417
+ export type MfaEnrollment = z.infer<typeof mfaEnrollmentSchema>;
47286
47418
  export declare function parseUserId(user_id: string): {
47287
47419
  connection: string;
47288
47420
  id: string;
@@ -47532,6 +47664,11 @@ export interface CodesAdapter {
47532
47664
  get: (tenant_id: string, code_id: string, type: CodeType) => Promise<Code | null>;
47533
47665
  list: (tenant_id: string, params?: ListParams) => Promise<ListCodesResponse>;
47534
47666
  used: (tenant_id: string, code_id: string) => Promise<boolean>;
47667
+ /**
47668
+ * Atomically mark a code as used only if it has not been used yet.
47669
+ * Returns true if the code was successfully consumed (was unused), false otherwise.
47670
+ */
47671
+ consume: (tenant_id: string, code_id: string) => Promise<boolean>;
47535
47672
  remove: (tenant_id: string, code_id: string) => Promise<boolean>;
47536
47673
  }
47537
47674
  export interface PasswordsAdapter {
@@ -47768,6 +47905,13 @@ export interface GeoAdapter {
47768
47905
  */
47769
47906
  getGeoInfo(headers: Record<string, string>): Promise<GeoInfo | null>;
47770
47907
  }
47908
+ export interface MfaEnrollmentsAdapter {
47909
+ create: (tenant_id: string, enrollment: MfaEnrollmentInsert) => Promise<MfaEnrollment>;
47910
+ get: (tenant_id: string, enrollment_id: string) => Promise<MfaEnrollment | null>;
47911
+ list: (tenant_id: string, user_id: string) => Promise<MfaEnrollment[]>;
47912
+ update: (tenant_id: string, enrollment_id: string, data: Partial<MfaEnrollmentInsert>) => Promise<MfaEnrollment>;
47913
+ remove: (tenant_id: string, enrollment_id: string) => Promise<boolean>;
47914
+ }
47771
47915
  export interface StatsListParams {
47772
47916
  from?: string;
47773
47917
  to?: string;
@@ -47854,6 +47998,7 @@ export interface DataAdapters {
47854
47998
  users: UserDataAdapter;
47855
47999
  userRoles: UserRolesAdapter;
47856
48000
  organizations: OrganizationsAdapter;
48001
+ mfaEnrollments: MfaEnrollmentsAdapter;
47857
48002
  userOrganizations: UserOrganizationsAdapter;
47858
48003
  /**
47859
48004
  * Optional session cleanup function.