authhero 9.40.0 → 9.41.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 (58) hide show
  1. package/dist/assets/u/widget/authhero-widget.esm.js +1 -1
  2. package/dist/assets/u/widget/index.esm.js +1 -1
  3. package/dist/assets/u/widget/p-6774edd2.entry.js +1 -0
  4. package/dist/authhero.cjs +110 -110
  5. package/dist/authhero.d.ts +399 -385
  6. package/dist/authhero.mjs +10465 -10289
  7. package/dist/{mfa-Ddp9JT1l.mjs → mfa-CdC-9ysu.mjs} +80 -80
  8. package/dist/{mfa-BlaRHQgI.js → mfa-Dx8-AJ6U.js} +2 -2
  9. package/dist/{mfa-attempts-bPJnyu2c.js → mfa-attempts-CtWWceg2.js} +34 -26
  10. package/dist/{mfa-attempts-YsmteBp0.mjs → mfa-attempts-mBkfX0wf.mjs} +4827 -4657
  11. package/dist/{passkey-enrollment-CLg7RteL.js → passkey-enrollment-KQcVF_QM.js} +1 -1
  12. package/dist/tsconfig.types.tsbuildinfo +1 -1
  13. package/dist/types/authentication-flows/mfa-attempts.d.ts +7 -0
  14. package/dist/types/generated/locale-types.d.ts +6 -0
  15. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  16. package/dist/types/hooks/codehooks.d.ts +45 -0
  17. package/dist/types/hooks/lifecycle-codehooks.d.ts +1 -1
  18. package/dist/types/index.d.ts +162 -162
  19. package/dist/types/routes/auth-api/device.d.ts +8 -8
  20. package/dist/types/routes/auth-api/index.d.ts +10 -10
  21. package/dist/types/routes/auth-api/passwordless.d.ts +16 -16
  22. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  23. package/dist/types/routes/management-api/action-triggers.d.ts +26 -26
  24. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  25. package/dist/types/routes/management-api/branding-uploads.d.ts +4 -4
  26. package/dist/types/routes/management-api/branding.d.ts +17 -17
  27. package/dist/types/routes/management-api/client-registration-tokens.d.ts +3 -3
  28. package/dist/types/routes/management-api/clients.d.ts +8 -8
  29. package/dist/types/routes/management-api/connections.d.ts +1 -1
  30. package/dist/types/routes/management-api/failed-events.d.ts +4 -4
  31. package/dist/types/routes/management-api/forms.d.ts +152 -152
  32. package/dist/types/routes/management-api/helpers.d.ts +1 -1
  33. package/dist/types/routes/management-api/hooks.d.ts +14 -14
  34. package/dist/types/routes/management-api/index.d.ts +147 -147
  35. package/dist/types/routes/management-api/keys.d.ts +8 -8
  36. package/dist/types/routes/management-api/log-streams.d.ts +6 -6
  37. package/dist/types/routes/management-api/logs.d.ts +4 -4
  38. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  39. package/dist/types/routes/management-api/organizations.d.ts +7 -7
  40. package/dist/types/routes/management-api/prompts.d.ts +6 -6
  41. package/dist/types/routes/management-api/roles.d.ts +1 -1
  42. package/dist/types/routes/management-api/rollouts.d.ts +6 -6
  43. package/dist/types/routes/management-api/self-service-profiles.d.ts +8 -8
  44. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  45. package/dist/types/routes/management-api/tenants.d.ts +15 -15
  46. package/dist/types/routes/management-api/themes.d.ts +9 -9
  47. package/dist/types/routes/management-api/users.d.ts +27 -27
  48. package/dist/types/routes/universal-login/common.d.ts +10 -10
  49. package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
  50. package/dist/types/routes/universal-login/screens/login-otp.d.ts +79 -5
  51. package/dist/types/routes/universal-login/screens/magic-link-sent.d.ts +8 -1
  52. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  53. package/dist/types/routes/universal-login/u2-routes.d.ts +6 -5
  54. package/dist/types/state-machines/login-session-data.d.ts +36 -1
  55. package/dist/types/state-machines/login-session.d.ts +17 -1
  56. package/dist/types/types/Variables.d.ts +2 -0
  57. package/package.json +6 -6
  58. package/dist/assets/u/widget/p-d0eb5acc.entry.js +0 -1
@@ -40,6 +40,13 @@ export declare function resetMfaFailures(ctx: MfaContext, tenantId: string, logi
40
40
  * Count an MFA SMS send on the login session and consume the per-user (or,
41
41
  * without a user, per-number) rate limit. Throws MfaSmsRateLimitError when
42
42
  * either limit is reached. Counted before sending, so failed sends count too.
43
+ *
44
+ * Order: check the session without writing (finalized or expired sessions
45
+ * throw FinalizedLoginSessionError, at the cap MfaSmsRateLimitError), then the
46
+ * rate limit, then reserve the slot atomically (see
47
+ * reserveLoginSessionCounter). Neither a finished session nor a send the rate
48
+ * limit rejects uses up the shared rate limit or the session's allowance, and
49
+ * concurrent sends on one session cannot exceed MFA_MAX_SMS_SENDS.
43
50
  */
44
51
  export declare function enforceMfaSmsSendLimit(ctx: MfaContext, tenantId: string, loginSessionId: string, phoneNumber: string, userId?: string): Promise<void>;
45
52
  export {};
@@ -324,6 +324,8 @@ export interface EmailOtpChallengeScreen {
324
324
  clientName: string;
325
325
  }) => string;
326
326
  resendText: () => string;
327
+ resendSuccess: () => string;
328
+ resendFailed: () => string;
327
329
  sessionExpired: () => string;
328
330
  title: () => string;
329
331
  unexpectedError: () => string;
@@ -609,6 +611,8 @@ export interface MagicLinkSentScreen {
609
611
  username: string;
610
612
  }) => string;
611
613
  resendText: () => string;
614
+ resendSuccess: () => string;
615
+ resendFailed: () => string;
612
616
  spamText: () => string;
613
617
  title: () => string;
614
618
  }
@@ -985,6 +989,8 @@ export interface SmsOtpChallengeScreen {
985
989
  clientName: string;
986
990
  }) => string;
987
991
  resendText: () => string;
992
+ resendSuccess: () => string;
993
+ resendFailed: () => string;
988
994
  sessionExpired: () => string;
989
995
  title: () => string;
990
996
  unexpectedError: () => string;
@@ -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" | "scope" | "sub" | "tenant_id" | "org_name" | "jti" | "sid" | "org_id" | "iss" | "exp" | "iat" | "aud" | "auth_time" | "acr" | "amr" | "gty" | "nbf" | "act" | "permissions" | "requested_userinfo_claims")[];
17
+ export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("sub" | "scope" | "tenant_id" | "jti" | "client_id" | "org_name" | "sid" | "permissions" | "auth_time" | "iss" | "aud" | "exp" | "nbf" | "iat" | "acr" | "amr" | "act" | "org_id" | "requested_userinfo_claims" | "gty")[];
18
18
  /** Client-bound mints: `azp` must stay the registered client id. */
19
- export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("client_id" | "scope" | "sub" | "tenant_id" | "org_name" | "jti" | "sid" | "org_id" | "iss" | "exp" | "iat" | "aud" | "auth_time" | "acr" | "amr" | "azp" | "gty" | "nbf" | "act" | "permissions" | "requested_userinfo_claims")[];
19
+ export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("sub" | "scope" | "tenant_id" | "jti" | "client_id" | "org_name" | "sid" | "permissions" | "auth_time" | "iss" | "aud" | "exp" | "nbf" | "iat" | "azp" | "acr" | "amr" | "act" | "org_id" | "requested_userinfo_claims" | "gty")[];
20
20
  export type AccessTokenReservedClaim = (typeof ACCESS_TOKEN_RESERVED_CLAIMS)[number];
21
21
  export type IdTokenReservedClaim = (typeof ID_TOKEN_RESERVED_CLAIMS)[number];
22
22
  /**
@@ -74,12 +74,44 @@ export declare function replayApiCalls(apiCalls: Array<{
74
74
  method: string;
75
75
  args: unknown[];
76
76
  }>, api: CodeHookApi): Promise<void>;
77
+ /**
78
+ * Why an action produced no usable result: it ran past the host's timeout, or
79
+ * it failed (threw, returned `success: false`, its code is missing, or no code
80
+ * executor is configured). Used by the fail-closed option (issue #1816).
81
+ */
82
+ export type CodeHookFailure = "action_timeout" | "action_failed";
77
83
  export type HandleCodeHookOutcome = {
78
84
  result: ActionExecutionResult;
79
85
  logs: CodeExecutionLog[];
80
86
  /** True if the executor recorded an API call that cancels the flow. */
81
87
  denied: boolean;
88
+ /** Set when the action did not run to completion. */
89
+ failure?: CodeHookFailure;
82
90
  };
91
+ /**
92
+ * Hook `metadata` key: `true` makes a failing action deny the request instead
93
+ * of letting it continue. Shared with `pre-screen`, which reads the same key.
94
+ */
95
+ export declare const HOOK_FAIL_CLOSED_METADATA_KEY = "fail_closed";
96
+ /**
97
+ * True when the hook binding opted into failing closed: a timeout, a failed
98
+ * execution or a non-HTTP throw denies the request (issue #1816). Off by
99
+ * default, so an action that breaks lets the request through as before.
100
+ */
101
+ export declare function isFailClosedHook(hook: {
102
+ metadata?: Record<string, unknown>;
103
+ }): boolean;
104
+ /**
105
+ * The outcome to record for an action that threw outside the executor (for
106
+ * example a replayed API call throwing a plain `Error`).
107
+ */
108
+ export declare function thrownOutcome(actionName: string, err: unknown, denied?: boolean): HandleCodeHookOutcome;
109
+ /**
110
+ * The outcome to record when no code executor (or no tenant) was available to
111
+ * run a bound action. Only recorded for fail-closed bindings: a fail-open
112
+ * binding keeps skipping silently, as before.
113
+ */
114
+ export declare function unavailableOutcome(actionName: string): HandleCodeHookOutcome;
83
115
  /**
84
116
  * Core code-hook execution, decoupled from the Hono request `ctx`.
85
117
  *
@@ -180,9 +212,22 @@ export declare function persistActionExecution(data: Pick<DataAdapters, "actionE
180
212
  * surrounding tenant log (the standard token-exchange log entry). The
181
213
  * execution record itself follows Auth0's shape — see
182
214
  * GET /api/v2/actions/executions/:id.
215
+ *
216
+ * `api.access.deny` stops token issuance: the execution is persisted as
217
+ * canceled and the 400 from `deny` is rethrown, so no tokens are signed and
218
+ * later actions don't run. A binding with `metadata.fail_closed` also denies
219
+ * when its action times out, fails or throws (issue #1816).
183
220
  */
184
221
  export declare function handleCredentialsExchangeCodeHooks(ctx: Context<{
185
222
  Bindings: Bindings;
186
223
  Variables: Variables;
187
224
  }>, hooks: any[], event: HookEvent, api: OnExecuteCredentialsExchangeAPI): Promise<string | null>;
225
+ /**
226
+ * Store the execution record of a denied request, then rethrow the denial.
227
+ * Storing it must not replace the denial with a 500.
228
+ */
229
+ export declare function persistThenThrow(ctx: Context<{
230
+ Bindings: Bindings;
231
+ Variables: Variables;
232
+ }>, persist: () => Promise<string | null>, err: unknown): Promise<never>;
188
233
  export {};
@@ -10,7 +10,7 @@ export declare function listEnabledCodeHooks(ctx: Context<{
10
10
  Bindings: Bindings;
11
11
  Variables: Variables;
12
12
  }>, tenantId: string, triggerId: string): Promise<{
13
- trigger_id: "post-user-login" | "credentials-exchange" | "pre-user-registration" | "post-user-registration" | "post-user-update" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion" | "pre-user-update" | "pre-screen" | "custom-email-provider" | "custom-phone-provider";
13
+ trigger_id: "post-user-login" | "pre-user-registration" | "post-user-registration" | "post-user-update" | "validate-registration-username" | "pre-user-deletion" | "post-user-deletion" | "credentials-exchange" | "pre-user-update" | "pre-screen" | "custom-email-provider" | "custom-phone-provider";
14
14
  enabled: boolean;
15
15
  synchronous: boolean;
16
16
  created_at: string;