authhero 9.33.0 → 9.34.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.
Files changed (64) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +137 -137
  3. package/dist/authhero.d.ts +280 -248
  4. package/dist/authhero.mjs +15984 -15876
  5. package/dist/mfa-CDFRupfM.mjs +128 -0
  6. package/dist/mfa-DF3O3Z8H.js +1 -0
  7. package/dist/mfa-attempts-BOWgbEPg.js +275 -0
  8. package/dist/{mfa-attempts-dhkGMzI5.mjs → mfa-attempts-C06Bkdy9.mjs} +14489 -14408
  9. package/dist/{passkey-enrollment-B_o8pQ1z.js → passkey-enrollment-RGw-WaSq.js} +1 -1
  10. package/dist/tsconfig.types.tsbuildinfo +1 -1
  11. package/dist/types/authentication-flows/passwordless.d.ts +12 -10
  12. package/dist/types/authentication-flows/remember-browser.d.ts +77 -0
  13. package/dist/types/constants.d.ts +1 -0
  14. package/dist/types/generated/locale-types.d.ts +6 -0
  15. package/dist/types/helpers/client.d.ts +8 -6
  16. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  17. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  18. package/dist/types/hooks/lifecycle-codehooks.d.ts +1 -1
  19. package/dist/types/index.d.ts +272 -242
  20. package/dist/types/routes/auth-api/account.d.ts +2 -2
  21. package/dist/types/routes/auth-api/device.d.ts +8 -8
  22. package/dist/types/routes/auth-api/index.d.ts +31 -31
  23. package/dist/types/routes/auth-api/oidc-logout.d.ts +3 -3
  24. package/dist/types/routes/auth-api/passwordless.d.ts +10 -10
  25. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  26. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  27. package/dist/types/routes/management-api/action-triggers.d.ts +2 -2
  28. package/dist/types/routes/management-api/actions.d.ts +13 -13
  29. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  30. package/dist/types/routes/management-api/branding.d.ts +19 -19
  31. package/dist/types/routes/management-api/clients.d.ts +26 -26
  32. package/dist/types/routes/management-api/connections.d.ts +32 -32
  33. package/dist/types/routes/management-api/emails.d.ts +6 -6
  34. package/dist/types/routes/management-api/failed-events.d.ts +2 -2
  35. package/dist/types/routes/management-api/flows.d.ts +8 -8
  36. package/dist/types/routes/management-api/helpers.d.ts +11 -1
  37. package/dist/types/routes/management-api/hooks.d.ts +35 -35
  38. package/dist/types/routes/management-api/index.d.ts +237 -207
  39. package/dist/types/routes/management-api/keys.d.ts +8 -8
  40. package/dist/types/routes/management-api/logs.d.ts +4 -4
  41. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  42. package/dist/types/routes/management-api/organizations.d.ts +7 -7
  43. package/dist/types/routes/management-api/prompts.d.ts +8 -8
  44. package/dist/types/routes/management-api/resource-servers.d.ts +8 -8
  45. package/dist/types/routes/management-api/roles.d.ts +1 -1
  46. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  47. package/dist/types/routes/management-api/tenant-operations.d.ts +9 -9
  48. package/dist/types/routes/management-api/tenants.d.ts +20 -12
  49. package/dist/types/routes/management-api/themes.d.ts +9 -9
  50. package/dist/types/routes/management-api/users.d.ts +57 -27
  51. package/dist/types/routes/saml/index.d.ts +6 -6
  52. package/dist/types/routes/saml/samlp.d.ts +6 -6
  53. package/dist/types/routes/universal-login/common.d.ts +34 -26
  54. package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
  55. package/dist/types/routes/universal-login/identifier.d.ts +2 -2
  56. package/dist/types/routes/universal-login/impersonate.d.ts +2 -2
  57. package/dist/types/routes/universal-login/index.d.ts +4 -4
  58. package/dist/types/routes/universal-login/screens/mfa-remember-browser.d.ts +28 -0
  59. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  60. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  61. package/dist/types/state-machines/login-session.d.ts +4 -1
  62. package/dist/types/utils/cookies.d.ts +14 -0
  63. package/package.json +6 -6
  64. package/dist/mfa-attempts-DNgUKmta.js +0 -275
@@ -291,7 +291,6 @@ export declare function passwordlessGrantUser(ctx: Context<{
291
291
  } | undefined;
292
292
  } | undefined;
293
293
  mfa?: {
294
- policy?: "never" | "always" | "all-applications" | "confidence-score" | undefined;
295
294
  factors?: {
296
295
  sms: boolean;
297
296
  otp: boolean;
@@ -314,6 +313,9 @@ export declare function passwordlessGrantUser(ctx: Context<{
314
313
  phone_message?: {
315
314
  message?: string | undefined;
316
315
  } | undefined;
316
+ allow_remember_browser?: boolean | undefined;
317
+ remember_browser_lifetime_in_days?: number | undefined;
318
+ policy?: "never" | "always" | "all-applications" | "confidence-score" | undefined;
317
319
  } | undefined;
318
320
  is_control_plane?: boolean | undefined;
319
321
  has_children?: boolean | undefined;
@@ -381,7 +383,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
381
383
  active?: boolean | undefined;
382
384
  } | undefined;
383
385
  signup?: {
384
- status?: "optional" | "required" | "disabled" | undefined;
386
+ status?: "required" | "optional" | "disabled" | undefined;
385
387
  verification?: {
386
388
  active?: boolean | undefined;
387
389
  } | undefined;
@@ -391,14 +393,14 @@ export declare function passwordlessGrantUser(ctx: Context<{
391
393
  } | undefined;
392
394
  unique?: boolean | undefined;
393
395
  profile_required?: boolean | undefined;
394
- verification_method?: "code" | "link" | undefined;
396
+ verification_method?: "link" | "code" | undefined;
395
397
  } | undefined;
396
398
  username?: {
397
399
  identifier?: {
398
400
  active?: boolean | undefined;
399
401
  } | undefined;
400
402
  signup?: {
401
- status?: "optional" | "required" | "disabled" | undefined;
403
+ status?: "required" | "optional" | "disabled" | undefined;
402
404
  } | undefined;
403
405
  validation?: {
404
406
  max_length?: number | undefined;
@@ -415,7 +417,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
415
417
  active?: boolean | undefined;
416
418
  } | undefined;
417
419
  signup?: {
418
- status?: "optional" | "required" | "disabled" | undefined;
420
+ status?: "required" | "optional" | "disabled" | undefined;
419
421
  } | undefined;
420
422
  } | undefined;
421
423
  } | undefined;
@@ -441,7 +443,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
441
443
  } | undefined;
442
444
  set_user_root_attributes?: "on_each_login" | "on_first_login" | "never_on_login" | undefined;
443
445
  };
444
- scope?: "shared" | "local" | "platform" | undefined;
446
+ scope?: "local" | "shared" | "platform" | undefined;
445
447
  override?: "none" | "secrets" | "fields" | undefined;
446
448
  enforce?: boolean | undefined;
447
449
  id?: string | undefined;
@@ -456,7 +458,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
456
458
  }[];
457
459
  description?: string | undefined;
458
460
  client_secret?: string | undefined;
459
- app_type?: "native" | "spa" | "regular_web" | "non_interactive" | "resource_server" | "express_configuration" | "rms" | "box" | "cloudbees" | "concur" | "dropbox" | "mscrm" | "echosign" | "egnyte" | "newrelic" | "office365" | "salesforce" | "sentry" | "sharepoint" | "slack" | "springcm" | "zendesk" | "zoom" | "sso_integration" | "oag" | undefined;
461
+ app_type?: "resource_server" | "native" | "spa" | "regular_web" | "non_interactive" | "express_configuration" | "rms" | "box" | "cloudbees" | "concur" | "dropbox" | "mscrm" | "echosign" | "egnyte" | "newrelic" | "office365" | "salesforce" | "sentry" | "sharepoint" | "slack" | "springcm" | "zendesk" | "zoom" | "sso_integration" | "oag" | undefined;
460
462
  logo_uri?: string | undefined;
461
463
  callbacks?: string[] | undefined;
462
464
  allowed_origins?: string[] | undefined;
@@ -493,7 +495,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
493
495
  custom_login_page_preview?: string | undefined;
494
496
  form_template?: string | undefined;
495
497
  addons?: Record<string, any> | undefined;
496
- token_endpoint_auth_method?: "none" | "private_key_jwt" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | undefined;
498
+ token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "private_key_jwt" | "client_secret_jwt" | undefined;
497
499
  client_metadata?: Record<string, string> | undefined;
498
500
  hide_sign_up_disabled_error?: boolean | undefined;
499
501
  mobile?: Record<string, any> | undefined;
@@ -580,8 +582,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
580
582
  authenticated_at?: string | undefined;
581
583
  tenant_id?: string | undefined;
582
584
  };
583
- connectionType: "sms" | "email" | "username";
584
- authConnection: "sms" | "email" | "username";
585
+ connectionType: "username" | "sms" | "email";
586
+ authConnection: "username" | "sms" | "email";
585
587
  session_id: string | undefined;
586
588
  authParams: {
587
589
  audience?: string | undefined;
@@ -0,0 +1,77 @@
1
+ import { Context } from "hono";
2
+ import { Tenant } from "@authhero/adapter-interfaces";
3
+ import { Bindings, Variables } from "../types";
4
+ import { MfaRequiredByAction } from "../state-machines/login-session";
5
+ /**
6
+ * "Remember this device" for MFA (#1670).
7
+ *
8
+ * After a successful MFA challenge the user can ask for the browser to be
9
+ * remembered. The browser then gets an opaque random token in a cookie, and
10
+ * only the token's SHA-256 is stored, as a `codes` row of type
11
+ * `mfa_remember_browser` that carries the user id and expiry. A later login
12
+ * of the same user from that browser skips the MFA challenge until the token
13
+ * expires, the user's remembered browsers are invalidated, or the user no
14
+ * longer has a confirmed MFA enrollment.
15
+ *
16
+ * A remembered browser satisfies MFA but is not MFA: no `amr` claim is
17
+ * emitted and the browser session is not marked as having completed MFA.
18
+ */
19
+ type RememberBrowserContext = Context<{
20
+ Bindings: Bindings;
21
+ Variables: Variables;
22
+ }>;
23
+ export declare const MFA_REMEMBER_BROWSER_DEFAULT_LIFETIME_IN_DAYS = 30;
24
+ /** How long a remembered browser skips MFA for this tenant, in days. */
25
+ export declare function rememberBrowserLifetimeInDays(tenant: Pick<Tenant, "mfa">): number;
26
+ /**
27
+ * Whether a remembered browser may stand in for MFA in this login. Every
28
+ * source that requires MFA must allow it: the tenant policy through
29
+ * `mfa.allow_remember_browser`, and a post-login action through
30
+ * `api.multifactor.enable(provider, { allowRememberBrowser: true })`.
31
+ */
32
+ export declare function isRememberBrowserAllowed(tenant: Pick<Tenant, "mfa">, actionRequest: MfaRequiredByAction | undefined): boolean;
33
+ /** `isRememberBrowserAllowed` for the MFA a login session is going through. */
34
+ export declare function isRememberBrowserAllowedForLoginSession(tenant: Pick<Tenant, "mfa">, loginSession: {
35
+ state_data?: string | null;
36
+ }): boolean;
37
+ /** The value of the "remember this device" checkbox in a screen POST. */
38
+ export declare function wantsRememberBrowser(value: unknown): boolean;
39
+ /** Form field id of the "remember this device" checkbox. */
40
+ export declare const REMEMBER_BROWSER_FIELD = "remember_browser";
41
+ /**
42
+ * Remember this browser for `userId`: store a new token and return the
43
+ * Set-Cookie values that hand it to the browser. Tokens of other users the
44
+ * browser is remembered for are kept; this user's older tokens and tokens that
45
+ * no longer resolve are dropped.
46
+ */
47
+ export declare function rememberBrowser(ctx: RememberBrowserContext, params: {
48
+ tenant: Pick<Tenant, "id" | "mfa">;
49
+ userId: string;
50
+ loginId?: string;
51
+ }): Promise<string[]>;
52
+ /**
53
+ * Whether this browser is remembered for `userId`, so the MFA challenge can be
54
+ * skipped. False unless remembering is allowed for this login (see
55
+ * `isRememberBrowserAllowed`), the browser presents a live token of this user
56
+ * issued after the user's last invalidation and within the tenant's current
57
+ * lifetime, and the user still has a confirmed MFA enrollment.
58
+ */
59
+ export declare function isBrowserRememberedForMfa(ctx: RememberBrowserContext, params: {
60
+ tenant: Pick<Tenant, "id" | "mfa">;
61
+ userId: string;
62
+ actionRequest?: MfaRequiredByAction;
63
+ }): Promise<boolean>;
64
+ /**
65
+ * Forget every browser remembered for `userId` (Auth0
66
+ * `POST /users/{id}/multifactor/actions/invalidate-remember-browser`). Records
67
+ * the time instead of deleting rows, because codes can't be listed by user in
68
+ * every adapter. The marker outlives every token issued before it.
69
+ *
70
+ * The new marker goes into an empty slot, or replaces the older of the two.
71
+ * The newer marker, the one in force, is left alone, so validation never sees
72
+ * an earlier invalidation undone, not even while this runs or if it fails. Two
73
+ * invalidations racing for the same slot both succeed: the one that loses the
74
+ * write finds the winner's marker, which covers it.
75
+ */
76
+ export declare function invalidateRememberedBrowsers(ctx: RememberBrowserContext, tenantId: string, userId: string): Promise<void>;
77
+ export {};
@@ -7,6 +7,7 @@ export declare const UNIVERSAL_AUTH_SESSION_EXPIRES_IN_SECONDS: number;
7
7
  export declare const SILENT_COOKIE_NAME = "auth-token";
8
8
  export declare const LAST_USED_CONNECTION_COOKIE_NAME = "last-used-connection";
9
9
  export declare const LAST_USED_CONNECTION_MAX_AGE_IN_SECONDS: number;
10
+ export declare const MFA_REMEMBER_BROWSER_COOKIE_NAME = "mfa-remember-browser";
10
11
  export declare const OTP_EXPIRATION_TIME: number;
11
12
  export declare const EMAIL_VERIFICATION_EXPIRATION_TIME: number;
12
13
  export declare const AUTHORIZATION_CODE_EXPIRES_IN_SECONDS: number;
@@ -636,6 +636,9 @@ export interface MfaOtpMfaTotpChallengeScreen {
636
636
  clientName: string;
637
637
  }) => string;
638
638
  "too-many-failures": () => string;
639
+ rememberMeText: (vars: {
640
+ days: string;
641
+ }) => string;
639
642
  }
640
643
  export interface MfaPhoneMfaPhoneChallengeScreen {
641
644
  pageTitle: (vars: {
@@ -669,6 +672,9 @@ export interface MfaPhoneMfaPhoneChallengeScreen {
669
672
  resendSuccess: () => string;
670
673
  enrollmentComplete: () => string;
671
674
  "too-many-failures": () => string;
675
+ rememberMeText: (vars: {
676
+ days: string;
677
+ }) => string;
672
678
  }
673
679
  export interface MfaPhoneMfaPhoneEnrollmentScreen {
674
680
  pageTitle: (vars: {
@@ -338,12 +338,6 @@ export declare const enrichedClientSchema: z.ZodObject<{
338
338
  }, z.core.$strip>>;
339
339
  }, z.core.$strip>>;
340
340
  mfa: z.ZodOptional<z.ZodObject<{
341
- policy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
342
- never: "never";
343
- always: "always";
344
- "all-applications": "all-applications";
345
- "confidence-score": "confidence-score";
346
- }>>>;
347
341
  factors: z.ZodOptional<z.ZodObject<{
348
342
  sms: z.ZodDefault<z.ZodBoolean>;
349
343
  otp: z.ZodDefault<z.ZodBoolean>;
@@ -371,6 +365,14 @@ export declare const enrichedClientSchema: z.ZodObject<{
371
365
  phone_message: z.ZodOptional<z.ZodObject<{
372
366
  message: z.ZodOptional<z.ZodString>;
373
367
  }, z.core.$strip>>;
368
+ allow_remember_browser: z.ZodOptional<z.ZodBoolean>;
369
+ remember_browser_lifetime_in_days: z.ZodOptional<z.ZodNumber>;
370
+ policy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
371
+ never: "never";
372
+ always: "always";
373
+ "all-applications": "all-applications";
374
+ "confidence-score": "confidence-score";
375
+ }>>>;
374
376
  }, z.core.$strip>>;
375
377
  id: z.ZodString;
376
378
  is_control_plane: z.ZodOptional<z.ZodBoolean>;
@@ -24,9 +24,9 @@ export declare const dcrRequestSchema: z.ZodObject<{
24
24
  response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
25
  token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
26
26
  none: "none";
27
- private_key_jwt: "private_key_jwt";
28
27
  client_secret_post: "client_secret_post";
29
28
  client_secret_basic: "client_secret_basic";
29
+ private_key_jwt: "private_key_jwt";
30
30
  client_secret_jwt: "client_secret_jwt";
31
31
  }>>;
32
32
  jwks_uri: z.ZodOptional<z.ZodString>;
@@ -14,9 +14,9 @@ export declare const USERINFO_RESERVED_CLAIMS: readonly ["iss", "sub", "aud", "e
14
14
  * vendor/tenant for downstream APIs while `sub` stays `auth-service`.
15
15
  * Client-bound mints keep `azp` locked (see below).
16
16
  */
17
- export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("client_id" | "sid" | "scope" | "tenant_id" | "org_name" | "jti" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "gty" | "permissions" | "nbf" | "act" | "requested_userinfo_claims")[];
17
+ export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("sub" | "scope" | "tenant_id" | "client_id" | "org_name" | "sid" | "jti" | "permissions" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "gty" | "nbf" | "act" | "requested_userinfo_claims")[];
18
18
  /** Client-bound mints: `azp` must stay the registered client id. */
19
- export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("client_id" | "sid" | "scope" | "tenant_id" | "org_name" | "jti" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "azp" | "gty" | "permissions" | "nbf" | "act" | "requested_userinfo_claims")[];
19
+ export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("sub" | "scope" | "tenant_id" | "client_id" | "org_name" | "sid" | "jti" | "permissions" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "azp" | "gty" | "nbf" | "act" | "requested_userinfo_claims")[];
20
20
  export type AccessTokenReservedClaim = (typeof ACCESS_TOKEN_RESERVED_CLAIMS)[number];
21
21
  export type IdTokenReservedClaim = (typeof ID_TOKEN_RESERVED_CLAIMS)[number];
22
22
  /**
@@ -17,7 +17,7 @@ export declare function listEnabledCodeHooks(ctx: Context<{
17
17
  updated_at: string;
18
18
  hook_id: string;
19
19
  code_id: string;
20
- scope?: "shared" | "local" | "platform" | undefined;
20
+ scope?: "local" | "shared" | "platform" | undefined;
21
21
  override?: "none" | "secrets" | "fields" | undefined;
22
22
  enforce?: boolean | undefined;
23
23
  priority?: number | undefined;