authhero 9.29.0 → 9.31.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 (54) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +72 -72
  3. package/dist/authhero.d.ts +314 -261
  4. package/dist/authhero.mjs +11033 -10730
  5. package/dist/mfa-attempts-DXiY4U74.js +275 -0
  6. package/dist/{mfa-attempts-CQiD6hxP.mjs → mfa-attempts-Dl3I8pop.mjs} +1695 -1684
  7. package/dist/{passkey-enrollment-D_WVyvv2.js → passkey-enrollment-2Toeaevy.js} +1 -1
  8. package/dist/tsconfig.types.tsbuildinfo +1 -1
  9. package/dist/types/authentication-flows/passwordless.d.ts +5 -5
  10. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  11. package/dist/types/hooks/lifecycle-codehooks.d.ts +22 -0
  12. package/dist/types/hooks/pre-account-action.d.ts +65 -0
  13. package/dist/types/index.d.ts +252 -252
  14. package/dist/types/routes/auth-api/account.d.ts +2 -2
  15. package/dist/types/routes/auth-api/index.d.ts +18 -18
  16. package/dist/types/routes/auth-api/passwordless.d.ts +16 -16
  17. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  18. package/dist/types/routes/management-api/action-triggers.d.ts +27 -27
  19. package/dist/types/routes/management-api/actions.d.ts +14 -14
  20. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  21. package/dist/types/routes/management-api/branding.d.ts +5 -5
  22. package/dist/types/routes/management-api/clients.d.ts +4 -4
  23. package/dist/types/routes/management-api/connections.d.ts +14 -14
  24. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  25. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  26. package/dist/types/routes/management-api/emails.d.ts +6 -6
  27. package/dist/types/routes/management-api/failed-events.d.ts +2 -2
  28. package/dist/types/routes/management-api/flows.d.ts +8 -8
  29. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  30. package/dist/types/routes/management-api/helpers.d.ts +1 -1
  31. package/dist/types/routes/management-api/hooks.d.ts +56 -56
  32. package/dist/types/routes/management-api/index.d.ts +229 -229
  33. package/dist/types/routes/management-api/jobs.d.ts +2 -2
  34. package/dist/types/routes/management-api/keys.d.ts +12 -12
  35. package/dist/types/routes/management-api/logs.d.ts +4 -4
  36. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  37. package/dist/types/routes/management-api/organizations.d.ts +2 -2
  38. package/dist/types/routes/management-api/prompts.d.ts +6 -6
  39. package/dist/types/routes/management-api/resource-servers.d.ts +8 -8
  40. package/dist/types/routes/management-api/roles.d.ts +1 -1
  41. package/dist/types/routes/management-api/rollouts.d.ts +6 -6
  42. package/dist/types/routes/management-api/tenant-members.d.ts +8 -8
  43. package/dist/types/routes/management-api/tenant-operations.d.ts +4 -4
  44. package/dist/types/routes/management-api/tenants.d.ts +11 -11
  45. package/dist/types/routes/management-api/users.d.ts +15 -15
  46. package/dist/types/routes/universal-login/common.d.ts +10 -10
  47. package/dist/types/routes/universal-login/screens/account-helpers.d.ts +27 -1
  48. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  49. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  50. package/dist/types/seed.d.ts +6 -0
  51. package/dist/types/state-machines/login-session.d.ts +1 -1
  52. package/dist/types/types/Hooks.d.ts +47 -0
  53. package/package.json +6 -6
  54. package/dist/mfa-attempts-DwATCXqC.js +0 -254
@@ -243,7 +243,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
243
243
  pushed_authorization_requests_supported?: boolean | undefined;
244
244
  authorization_response_iss_parameter_supported?: boolean | undefined;
245
245
  deployment_type?: "shared" | "wfp" | undefined;
246
- provisioning_state?: "pending" | "ready" | "failed" | undefined;
246
+ provisioning_state?: "failed" | "pending" | "ready" | undefined;
247
247
  provisioning_error?: string | undefined;
248
248
  provisioning_state_changed_at?: string | undefined;
249
249
  bundle_configuration?: string | undefined;
@@ -391,7 +391,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
391
391
  } | undefined;
392
392
  unique?: boolean | undefined;
393
393
  profile_required?: boolean | undefined;
394
- verification_method?: "link" | "code" | undefined;
394
+ verification_method?: "code" | "link" | undefined;
395
395
  } | undefined;
396
396
  username?: {
397
397
  identifier?: {
@@ -441,7 +441,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
441
441
  } | undefined;
442
442
  set_user_root_attributes?: "on_each_login" | "on_first_login" | "never_on_login" | undefined;
443
443
  };
444
- scope?: "shared" | "local" | "platform" | undefined;
444
+ scope?: "local" | "shared" | "platform" | undefined;
445
445
  override?: "none" | "secrets" | "fields" | undefined;
446
446
  enforce?: boolean | undefined;
447
447
  id?: string | undefined;
@@ -569,8 +569,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
569
569
  } | undefined;
570
570
  authenticated_at?: string | undefined;
571
571
  };
572
- connectionType: "email" | "sms" | "username";
573
- authConnection: "email" | "sms" | "username";
572
+ connectionType: "username" | "email" | "sms";
573
+ authConnection: "username" | "email" | "sms";
574
574
  session_id: string | undefined;
575
575
  authParams: {
576
576
  audience?: string | undefined;
@@ -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: ("sub" | "sid" | "client_id" | "scope" | "tenant_id" | "org_name" | "jti" | "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: ("client_id" | "scope" | "sub" | "tenant_id" | "org_name" | "jti" | "sid" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "gty" | "permissions" | "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: ("sub" | "sid" | "client_id" | "scope" | "tenant_id" | "org_name" | "jti" | "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: ("client_id" | "scope" | "sub" | "tenant_id" | "org_name" | "jti" | "sid" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "azp" | "gty" | "permissions" | "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
  /**
@@ -1,6 +1,28 @@
1
1
  import { Context } from "hono";
2
2
  import { Bindings, Variables } from "../types";
3
3
  import { CodeHookEventInput } from "./codehooks";
4
+ /**
5
+ * The enabled code hooks bound to `triggerId`, highest priority first. Reads
6
+ * through the executor data, so platform-scoped policies hidden from
7
+ * management reads are included.
8
+ */
9
+ export declare function listEnabledCodeHooks(ctx: Context<{
10
+ Bindings: Bindings;
11
+ Variables: Variables;
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-account-action";
14
+ enabled: boolean;
15
+ synchronous: boolean;
16
+ created_at: string;
17
+ updated_at: string;
18
+ hook_id: string;
19
+ code_id: string;
20
+ scope?: "local" | "shared" | "platform" | undefined;
21
+ override?: "none" | "secrets" | "fields" | undefined;
22
+ enforce?: boolean | undefined;
23
+ priority?: number | undefined;
24
+ metadata?: Record<string, unknown> | undefined;
25
+ }[]>;
4
26
  /** Blocking policies run before signup validation or a write, and fail closed. */
5
27
  export declare function runBlockingActions(ctx: Context<{
6
28
  Bindings: Bindings;
@@ -0,0 +1,65 @@
1
+ import { Context } from "hono";
2
+ import { User } from "@authhero/adapter-interfaces";
3
+ import { Bindings, Variables } from "../types";
4
+ import { AccountActionOperation } from "../types/Hooks";
5
+ import { EnrichedClient } from "../helpers/client";
6
+ export declare const PRE_ACCOUNT_ACTION_TRIGGER = "pre-account-action";
7
+ /**
8
+ * Host wait for the `onExecutePreAccountAction` config callback, matching the
9
+ * bound on code Actions. A callback that never settles must not leave account
10
+ * requests hanging.
11
+ */
12
+ export declare const PRE_ACCOUNT_ACTION_TIMEOUT_MS = 5000;
13
+ /** Shown when an action denies without a reason, or fails. */
14
+ export declare const DEFAULT_ACCOUNT_ACTION_DENIAL = "This action isn't available for your account.";
15
+ export type PreAccountActionDecision = {
16
+ type: "continue";
17
+ } | {
18
+ type: "redirect";
19
+ url: string;
20
+ } | {
21
+ type: "deny";
22
+ reason: string;
23
+ };
24
+ /**
25
+ * Thrown by the universal-login account screens when a `pre-account-action`
26
+ * Action denies the operation. The universal-login error handler renders
27
+ * `reason` on the branded error page (other error messages are replaced by a
28
+ * generic text there, which would hide the tenant's explanation).
29
+ */
30
+ export declare class AccountActionDeniedError extends Error {
31
+ readonly reason: string;
32
+ readonly status = 403;
33
+ constructor(reason: string);
34
+ }
35
+ /**
36
+ * Run the `pre-account-action` trigger: the `onExecutePreAccountAction` config
37
+ * hook first, then the code Actions bound to the trigger in priority order.
38
+ * The first one that redirects or denies decides the outcome and later ones
39
+ * don't run. An Action that throws or fails denies the operation (fail
40
+ * closed), like the other blocking triggers.
41
+ */
42
+ export declare function runPreAccountAction(ctx: Context<{
43
+ Bindings: Bindings;
44
+ Variables: Variables;
45
+ }>, params: {
46
+ tenantId: string;
47
+ operation: AccountActionOperation;
48
+ /**
49
+ * The user, or a loader for it. A loader only runs when something is bound
50
+ * to the trigger, so screens don't pay for the lookup otherwise.
51
+ */
52
+ user?: User | (() => Promise<User | undefined>);
53
+ client?: EnrichedClient;
54
+ details?: Record<string, string>;
55
+ }): Promise<PreAccountActionDecision>;
56
+ /**
57
+ * Run the trigger from a universal-login route and act on the result: throws
58
+ * `RedirectException` to send the user elsewhere and `AccountActionDeniedError`
59
+ * to stop the operation. Both are rendered by the universal-login error
60
+ * handler. Returns normally when the operation may continue.
61
+ */
62
+ export declare function enforcePreAccountAction(ctx: Context<{
63
+ Bindings: Bindings;
64
+ Variables: Variables;
65
+ }>, params: Parameters<typeof runPreAccountAction>[1]): Promise<void>;