authhero 9.23.1 → 9.24.1

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 (74) 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-91459994.entry.js → p-210f06bf.entry.js} +1 -1
  4. package/dist/authhero.cjs +116 -116
  5. package/dist/authhero.d.ts +1433 -278
  6. package/dist/authhero.mjs +36511 -35845
  7. package/dist/tsconfig.types.tsbuildinfo +1 -1
  8. package/dist/types/authentication-flows/password.d.ts +6 -0
  9. package/dist/types/authentication-flows/passwordless.d.ts +5 -5
  10. package/dist/types/generated/locale-types.d.ts +1 -0
  11. package/dist/types/helpers/logging.d.ts +7 -0
  12. package/dist/types/helpers/outbox-destinations/log-streams.d.ts +2 -0
  13. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  14. package/dist/types/helpers/session-notice.d.ts +17 -0
  15. package/dist/types/helpers/users.d.ts +5 -0
  16. package/dist/types/index.d.ts +1433 -278
  17. package/dist/types/routes/auth-api/index.d.ts +26 -26
  18. package/dist/types/routes/auth-api/passwordless.d.ts +10 -10
  19. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  20. package/dist/types/routes/auth-api/token.d.ts +10 -10
  21. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  22. package/dist/types/routes/management-api/actions.d.ts +29 -3
  23. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  24. package/dist/types/routes/management-api/branding.d.ts +5 -5
  25. package/dist/types/routes/management-api/clients.d.ts +8 -8
  26. package/dist/types/routes/management-api/connections.d.ts +7 -7
  27. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  28. package/dist/types/routes/management-api/email-templates.d.ts +20 -20
  29. package/dist/types/routes/management-api/emails.d.ts +2 -2
  30. package/dist/types/routes/management-api/failed-events.d.ts +97 -3
  31. package/dist/types/routes/management-api/flows.d.ts +52 -0
  32. package/dist/types/routes/management-api/forms.d.ts +735 -126
  33. package/dist/types/routes/management-api/grants.d.ts +11 -0
  34. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  35. package/dist/types/routes/management-api/helpers.d.ts +34 -4
  36. package/dist/types/routes/management-api/hooks.d.ts +68 -4
  37. package/dist/types/routes/management-api/index.d.ts +1326 -269
  38. package/dist/types/routes/management-api/keys.d.ts +12 -12
  39. package/dist/types/routes/management-api/logs.d.ts +4 -4
  40. package/dist/types/routes/management-api/organizations.d.ts +66 -8
  41. package/dist/types/routes/management-api/prompts.d.ts +6 -6
  42. package/dist/types/routes/management-api/roles.d.ts +1 -1
  43. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  44. package/dist/types/routes/management-api/tenants.d.ts +9 -9
  45. package/dist/types/routes/management-api/users.d.ts +166 -23
  46. package/dist/types/routes/saml/index.d.ts +98 -0
  47. package/dist/types/routes/saml/samlp.d.ts +98 -0
  48. package/dist/types/routes/universal-login/common.d.ts +10 -10
  49. package/dist/types/routes/universal-login/flow-api.d.ts +12 -12
  50. package/dist/types/routes/universal-login/form-node.d.ts +4 -4
  51. package/dist/types/routes/universal-login/screens/account-mfa-phone-enrollment.d.ts +0 -5
  52. package/dist/types/routes/universal-login/screens/account-mfa-totp-enrollment.d.ts +0 -5
  53. package/dist/types/routes/universal-login/screens/account-passkeys.d.ts +0 -5
  54. package/dist/types/routes/universal-login/screens/connect-tenant-select.d.ts +0 -10
  55. package/dist/types/routes/universal-login/screens/identifier.d.ts +0 -5
  56. package/dist/types/routes/universal-login/screens/login.d.ts +0 -8
  57. package/dist/types/routes/universal-login/screens/mfa-login-options.d.ts +0 -5
  58. package/dist/types/routes/universal-login/screens/mfa-phone-challenge.d.ts +0 -5
  59. package/dist/types/routes/universal-login/screens/mfa-phone-enrollment.d.ts +0 -5
  60. package/dist/types/routes/universal-login/screens/mfa-totp-challenge.d.ts +0 -5
  61. package/dist/types/routes/universal-login/screens/mfa-totp-enrollment.d.ts +0 -5
  62. package/dist/types/routes/universal-login/screens/passkey-challenge.d.ts +0 -14
  63. package/dist/types/routes/universal-login/screens/passkey-enrollment-nudge.d.ts +0 -15
  64. package/dist/types/routes/universal-login/screens/passkey-enrollment.d.ts +0 -9
  65. package/dist/types/routes/universal-login/screens/reset-password-code.d.ts +0 -9
  66. package/dist/types/routes/universal-login/screens/reset-password.d.ts +2 -6
  67. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  68. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  69. package/dist/types/state-machines/index.d.ts +3 -1
  70. package/dist/types/state-machines/login-session-data.d.ts +19 -0
  71. package/dist/types/state-machines/login-session.d.ts +67 -3
  72. package/dist/types/state-machines/password-reset.d.ts +46 -0
  73. package/dist/types/strategies/saml.d.ts +1 -1
  74. package/package.json +6 -6
@@ -43,7 +43,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
43
43
  hint?: string | undefined;
44
44
  messages?: {
45
45
  text: string;
46
- type: "success" | "error" | "info" | "warning";
46
+ type: "error" | "success" | "info" | "warning";
47
47
  id?: number | undefined;
48
48
  }[] | undefined;
49
49
  }[];
@@ -51,7 +51,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
51
51
  description?: string | undefined;
52
52
  messages?: {
53
53
  text: string;
54
- type: "success" | "error" | "info" | "warning";
54
+ type: "error" | "success" | "info" | "warning";
55
55
  id?: number | undefined;
56
56
  }[] | undefined;
57
57
  links?: {
@@ -123,7 +123,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
123
123
  hint?: string | undefined;
124
124
  messages?: {
125
125
  text: string;
126
- type: "success" | "error" | "info" | "warning";
126
+ type: "error" | "success" | "info" | "warning";
127
127
  id?: number | undefined;
128
128
  }[] | undefined;
129
129
  }[];
@@ -131,7 +131,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
131
131
  description?: string | undefined;
132
132
  messages?: {
133
133
  text: string;
134
- type: "success" | "error" | "info" | "warning";
134
+ type: "error" | "success" | "info" | "warning";
135
135
  id?: number | undefined;
136
136
  }[] | undefined;
137
137
  links?: {
@@ -173,7 +173,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
173
173
  };
174
174
  output: {};
175
175
  outputFormat: string;
176
- status: 404;
176
+ status: 400;
177
177
  } | {
178
178
  input: {
179
179
  query: {
@@ -188,7 +188,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
188
188
  };
189
189
  output: {};
190
190
  outputFormat: string;
191
- status: 400;
191
+ status: 404;
192
192
  } | {
193
193
  input: {
194
194
  query: {
@@ -220,7 +220,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
220
220
  hint?: string | undefined;
221
221
  messages?: {
222
222
  text: string;
223
- type: "success" | "error" | "info" | "warning";
223
+ type: "error" | "success" | "info" | "warning";
224
224
  id?: number | undefined;
225
225
  }[] | undefined;
226
226
  }[];
@@ -228,7 +228,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
228
228
  description?: string | undefined;
229
229
  messages?: {
230
230
  text: string;
231
- type: "success" | "error" | "info" | "warning";
231
+ type: "error" | "success" | "info" | "warning";
232
232
  id?: number | undefined;
233
233
  }[] | undefined;
234
234
  links?: {
@@ -282,7 +282,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
282
282
  };
283
283
  output: {};
284
284
  outputFormat: string;
285
- status: 404;
285
+ status: 400;
286
286
  } | {
287
287
  input: {
288
288
  param: {
@@ -300,7 +300,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
300
300
  };
301
301
  output: {};
302
302
  outputFormat: string;
303
- status: 400;
303
+ status: 404;
304
304
  } | {
305
305
  input: {
306
306
  param: {
@@ -335,7 +335,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
335
335
  hint?: string | undefined;
336
336
  messages?: {
337
337
  text: string;
338
- type: "success" | "error" | "info" | "warning";
338
+ type: "error" | "success" | "info" | "warning";
339
339
  id?: number | undefined;
340
340
  }[] | undefined;
341
341
  }[];
@@ -343,7 +343,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
343
343
  description?: string | undefined;
344
344
  messages?: {
345
345
  text: string;
346
- type: "success" | "error" | "info" | "warning";
346
+ type: "error" | "success" | "info" | "warning";
347
347
  id?: number | undefined;
348
348
  }[] | undefined;
349
349
  links?: {
@@ -18,7 +18,7 @@ export declare const formNodeRoutes: OpenAPIHono<{
18
18
  };
19
19
  output: {};
20
20
  outputFormat: string;
21
- status: 404;
21
+ status: 200;
22
22
  } | {
23
23
  input: {
24
24
  param: {
@@ -32,7 +32,7 @@ export declare const formNodeRoutes: OpenAPIHono<{
32
32
  };
33
33
  output: {};
34
34
  outputFormat: string;
35
- status: 200;
35
+ status: 404;
36
36
  };
37
37
  };
38
38
  } & {
@@ -52,7 +52,7 @@ export declare const formNodeRoutes: OpenAPIHono<{
52
52
  };
53
53
  output: {};
54
54
  outputFormat: string;
55
- status: 404;
55
+ status: 200;
56
56
  } | {
57
57
  input: {
58
58
  param: {
@@ -68,7 +68,7 @@ export declare const formNodeRoutes: OpenAPIHono<{
68
68
  };
69
69
  output: {};
70
70
  outputFormat: string;
71
- status: 200;
71
+ status: 404;
72
72
  };
73
73
  };
74
74
  }, "/">;
@@ -1,8 +1,3 @@
1
- /**
2
- * Account MFA Phone Enrollment screen - enroll SMS MFA from account settings
3
- *
4
- * Corresponds to: /u2/account/security/phone-enrollment
5
- */
6
1
  import type { ScreenDefinition } from "./types";
7
2
  /**
8
3
  * Screen definition for account MFA phone enrollment
@@ -1,8 +1,3 @@
1
- /**
2
- * Account MFA TOTP Enrollment screen - enroll authenticator app from account settings
3
- *
4
- * Corresponds to: /u2/account/security/totp-enrollment
5
- */
6
1
  import type { ScreenDefinition } from "./types";
7
2
  /**
8
3
  * Screen definition for account MFA TOTP enrollment
@@ -1,8 +1,3 @@
1
- /**
2
- * Account Passkeys screen - manage passkey credentials
3
- *
4
- * Corresponds to: /u2/account/passkeys
5
- */
6
1
  import type { ScreenDefinition } from "./types";
7
2
  /**
8
3
  * Screen definition for the account-passkeys screen
@@ -1,13 +1,3 @@
1
- /**
2
- * Connect Tenant Select screen — control-plane-only step in the consent flow.
3
- *
4
- * When `/connect/start` is hit on the multi-tenancy control plane, the user
5
- * picks which child tenant the IAT should be minted on. Each child tenant is
6
- * represented by an organization on the control plane whose `name` matches
7
- * the child tenant id (see @authhero/multi-tenancy provisioning hooks).
8
- *
9
- * Corresponds to: /u2/connect/select-tenant
10
- */
11
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
12
2
  export declare function connectTenantSelectScreen(context: ScreenContext): Promise<ScreenResult>;
13
3
  export declare const connectTenantSelectScreenDefinition: ScreenDefinition;
@@ -1,8 +1,3 @@
1
- /**
2
- * Identifier screen - the first screen in the login flow
3
- *
4
- * Corresponds to: /u/login/identifier
5
- */
6
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
7
2
  /**
8
3
  * Create the identifier screen
@@ -1,11 +1,3 @@
1
- /**
2
- * Login screen - combined identifier + password screen (Identifier + Password flow)
3
- *
4
- * This screen shows email/username input, password input, and social login buttons
5
- * all on a single page. Used when identifier_first is set to false.
6
- *
7
- * Corresponds to: /u2/login
8
- */
9
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
10
2
  /**
11
3
  * Create the login screen (combined identifier + password)
@@ -1,8 +1,3 @@
1
- /**
2
- * MFA Login Options screen - factor selection when multiple MFA methods are available
3
- *
4
- * Corresponds to: /u2/mfa/login-options
5
- */
6
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
7
2
  interface MfaOption {
8
3
  id: string;
@@ -1,8 +1,3 @@
1
- /**
2
- * MFA Phone Challenge screen - for verifying SMS MFA code
3
- *
4
- * Corresponds to: /u2/mfa/phone-challenge
5
- */
6
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
7
2
  /**
8
3
  * Create the mfa-phone-challenge screen
@@ -1,8 +1,3 @@
1
- /**
2
- * MFA Phone Enrollment screen - for setting up SMS MFA
3
- *
4
- * Corresponds to: /u2/mfa/phone-enrollment
5
- */
6
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
7
2
  /**
8
3
  * Create the mfa-phone-enrollment screen
@@ -1,8 +1,3 @@
1
- /**
2
- * MFA TOTP Challenge screen - for verifying authenticator app MFA code
3
- *
4
- * Corresponds to: /u2/mfa/totp-challenge
5
- */
6
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
7
2
  /**
8
3
  * Create the mfa-totp-challenge screen
@@ -1,8 +1,3 @@
1
- /**
2
- * MFA TOTP Enrollment screen - for setting up authenticator app MFA
3
- *
4
- * Corresponds to: /u2/mfa/totp-enrollment
5
- */
6
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
7
2
  /**
8
3
  * Create the mfa-totp-enrollment screen
@@ -1,16 +1,2 @@
1
- /**
2
- * Passkey Challenge screen — WebAuthn authentication ceremony
3
- *
4
- * Allows users to sign in using a registered passkey (discoverable credential).
5
- * This triggers navigator.credentials.get() and verifies the assertion response.
6
- *
7
- * GET: Generates WebAuthn authentication options and renders the challenge screen.
8
- * POST: Verifies the assertion response, resolves the user, and completes login.
9
- *
10
- * Passkey authentication bypasses MFA since it already provides strong
11
- * multi-factor assurance (possession + biometric/PIN).
12
- *
13
- * Corresponds to: /u2/passkey/challenge
14
- */
15
1
  import type { ScreenDefinition } from "./types";
16
2
  export declare const passkeyChallengeScreenDefinition: ScreenDefinition;
@@ -1,17 +1,2 @@
1
- /**
2
- * Passkey Enrollment Nudge screen
3
- *
4
- * Shown after login when progressive enrollment is enabled and the user
5
- * has no passkeys registered. Offers three choices:
6
- * - "Set up passkey" → proceeds to the enrollment ceremony
7
- * - "Maybe later" → snoozes the prompt for 30 days
8
- * - "Don't show again" → permanently opts out
9
- *
10
- * Client-side: if the browser doesn't support WebAuthn
11
- * (window.PublicKeyCredential is undefined), the screen auto-submits
12
- * with action_no_webauthn so the login flow is never blocked.
13
- *
14
- * Corresponds to: /u2/passkey/enrollment-nudge
15
- */
16
1
  import type { ScreenDefinition } from "./types";
17
2
  export declare const passkeyEnrollmentNudgeScreenDefinition: ScreenDefinition;
@@ -1,11 +1,2 @@
1
- /**
2
- * Passkey Enrollment screen — WebAuthn registration ceremony
3
- *
4
- * GET: Generates WebAuthn registration options and renders a screen that
5
- * triggers `navigator.credentials.create()` via an inline script.
6
- * POST: Verifies the attestation response and stores the credential.
7
- *
8
- * Corresponds to: /u2/passkey/enrollment
9
- */
10
1
  import type { ScreenDefinition } from "./types";
11
2
  export declare const passkeyEnrollmentScreenDefinition: ScreenDefinition;
@@ -1,12 +1,3 @@
1
- /**
2
- * Reset Password Code screen - enter code + new password
3
- *
4
- * Used when the connection's verification_method is "code".
5
- * The user receives a 6-digit code via email and enters it
6
- * along with their new password on the same page.
7
- *
8
- * Corresponds to: /u2/reset-password/code
9
- */
10
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
11
2
  /**
12
3
  * Create the reset-password-code screen
@@ -1,8 +1,3 @@
1
- /**
2
- * Reset Password screen - set new password after reset
3
- *
4
- * Corresponds to: /u/reset-password
5
- */
6
1
  import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
7
2
  import type { Context } from "hono";
8
3
  import type { Bindings, Variables } from "../../../types";
@@ -19,7 +14,8 @@ export declare function executePasswordReset(params: {
19
14
  client: EnrichedClient;
20
15
  code: string;
21
16
  password: string;
22
- username: string;
17
+ loginSessionId: string;
18
+ method: "code" | "link";
23
19
  }): Promise<{
24
20
  success: true;
25
21
  } | {
@@ -165,7 +165,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
165
165
  $get: {
166
166
  input: {
167
167
  param: {
168
- screen: "account" | "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
168
+ screen: "account" | "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
169
169
  };
170
170
  } & {
171
171
  query: {
@@ -181,7 +181,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
181
181
  } | {
182
182
  input: {
183
183
  param: {
184
- screen: "account" | "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
184
+ screen: "account" | "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
185
185
  };
186
186
  } & {
187
187
  query: {
@@ -197,7 +197,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
197
197
  } | {
198
198
  input: {
199
199
  param: {
200
- screen: "account" | "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
200
+ screen: "account" | "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
201
201
  };
202
202
  } & {
203
203
  query: {
@@ -217,7 +217,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
217
217
  $post: {
218
218
  input: {
219
219
  param: {
220
- screen: "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
220
+ screen: "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
221
221
  };
222
222
  } & {
223
223
  query: {
@@ -235,7 +235,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
235
235
  } | {
236
236
  input: {
237
237
  param: {
238
- screen: "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
238
+ screen: "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
239
239
  };
240
240
  } & {
241
241
  query: {
@@ -170,7 +170,7 @@ export declare const u2Routes: OpenAPIHono<{
170
170
  $get: {
171
171
  input: {
172
172
  param: {
173
- screen: "account" | "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
173
+ screen: "account" | "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
174
174
  };
175
175
  } & {
176
176
  query: {
@@ -186,7 +186,7 @@ export declare const u2Routes: OpenAPIHono<{
186
186
  } | {
187
187
  input: {
188
188
  param: {
189
- screen: "account" | "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
189
+ screen: "account" | "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
190
190
  };
191
191
  } & {
192
192
  query: {
@@ -202,7 +202,7 @@ export declare const u2Routes: OpenAPIHono<{
202
202
  } | {
203
203
  input: {
204
204
  param: {
205
- screen: "account" | "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
205
+ screen: "account" | "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
206
206
  };
207
207
  } & {
208
208
  query: {
@@ -222,7 +222,7 @@ export declare const u2Routes: OpenAPIHono<{
222
222
  $post: {
223
223
  input: {
224
224
  param: {
225
- screen: "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
225
+ screen: "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
226
226
  };
227
227
  } & {
228
228
  query: {
@@ -240,7 +240,7 @@ export declare const u2Routes: OpenAPIHono<{
240
240
  } | {
241
241
  input: {
242
242
  param: {
243
- screen: "consent" | "login" | "reset-password" | "signup" | "impersonate" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
243
+ screen: "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "reset-password/request" | "reset-password/code" | "login/email-verification" | "login/email-verification-sent" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant";
244
244
  };
245
245
  } & {
246
246
  query: {
@@ -1 +1,3 @@
1
- export { loginSessionMachine, transitionLoginSession, transitionLoginSessionFromEntity, canTransition, getValidEvents, LoginSessionEventType, type LoginSessionContext, type LoginSessionEvent, } from "./login-session";
1
+ export { loginSessionMachine, transitionLoginSession, transitionLoginSessionFromEntity, canTransition, getValidEvents, LoginSessionEventType, type LoginSessionContext, type LoginSessionData, type LoginSessionEvent, } from "./login-session";
2
+ export { readLoginSessionData, updateLoginSessionData, createLoginSessionWithData, type LoginSessionDataEvent, } from "./login-session-data";
3
+ export { passwordResetMachine, transitionPasswordReset, canCompletePasswordReset, type PasswordResetFlow, } from "./password-reset";
@@ -0,0 +1,19 @@
1
+ import type { LoginSession, LoginSessionInsert, LoginSessionsAdapter } from "@authhero/adapter-interfaces";
2
+ import { LoginSessionEventType, type LoginSessionData, type LoginSessionEvent } from "./login-session";
3
+ export { readLoginSessionData } from "./login-session";
4
+ export type LoginSessionDataEvent = Extract<LoginSessionEvent, {
5
+ type: LoginSessionEventType.UPDATE_CONTEXT | LoginSessionEventType.PASSWORD_RESET_REQUESTED | LoginSessionEventType.PASSWORD_RESET_COMPLETED;
6
+ }>;
7
+ /** A terminal session cannot accept further context events. */
8
+ export declare class FinalizedLoginSessionError extends Error {
9
+ constructor(id: string);
10
+ }
11
+ /**
12
+ * Sole persistence boundary for session context updates. Always reduce against
13
+ * the latest stored context, never a caller's stale session snapshot. Optional
14
+ * session fields (e.g. MFA state) are persisted in the same adapter update.
15
+ * This is read/modify/write, not a cross-request atomic compare-and-swap.
16
+ */
17
+ export declare function updateLoginSessionData(sessions: LoginSessionsAdapter, tenantId: string, id: string, event: LoginSessionDataEvent, fields?: Omit<Partial<LoginSession>, "state_data">): Promise<boolean>;
18
+ /** Initialize context through the same machine reducer before inserting it. */
19
+ export declare function createLoginSessionWithData(sessions: LoginSessionsAdapter, tenantId: string, fields: Omit<LoginSessionInsert, "state_data">, data: Omit<LoginSessionData, "passwordReset">): Promise<LoginSession>;
@@ -1,4 +1,31 @@
1
+ import { type PasswordResetFlow } from "./password-reset";
1
2
  import { LoginSession, LoginSessionState } from "@authhero/adapter-interfaces";
3
+ /** Persisted context, grouped by responsibility in types, flat on disk. */
4
+ export interface LoginSessionData {
5
+ passwordReset?: PasswordResetFlow;
6
+ mfa_verified?: boolean;
7
+ authenticationMethodId?: string;
8
+ phoneNumber?: string;
9
+ totpSecret?: string;
10
+ guardian_enrollment?: boolean;
11
+ pending_email_verification?: unknown;
12
+ hookId?: string;
13
+ form_values?: Record<string, unknown>;
14
+ continuationScope?: string[];
15
+ continuationReturnUrl?: string;
16
+ webauthn_challenge?: string;
17
+ passkey_nudge_completed?: boolean;
18
+ notice?: "password_reset_success";
19
+ invitation_id?: string;
20
+ organization_id?: string;
21
+ organization_name?: string;
22
+ inviter_name?: string;
23
+ roles?: string[];
24
+ connect?: Record<string, unknown>;
25
+ try_connection_result?: unknown;
26
+ }
27
+ /** The on-disk JSON shape stays flat for compatibility with existing sessions. */
28
+ export declare function readLoginSessionData(raw?: string | null): LoginSessionData;
2
29
  /**
3
30
  * Context for the login session state machine
4
31
  */
@@ -12,12 +39,15 @@ export interface LoginSessionContext {
12
39
  /** Continuation scope - which pages are allowed during AWAITING_CONTINUATION */
13
40
  continuationScope?: string[];
14
41
  /** Additional state data */
15
- stateData?: Record<string, unknown>;
42
+ stateData?: LoginSessionData;
16
43
  }
17
44
  /**
18
45
  * Event types for the login session state machine
19
46
  */
20
47
  export declare enum LoginSessionEventType {
48
+ PASSWORD_RESET_REQUESTED = "PASSWORD_RESET_REQUESTED",
49
+ PASSWORD_RESET_COMPLETED = "PASSWORD_RESET_COMPLETED",
50
+ UPDATE_CONTEXT = "UPDATE_CONTEXT",
21
51
  AUTHENTICATE = "AUTHENTICATE",
22
52
  REQUIRE_EMAIL_VERIFICATION = "REQUIRE_EMAIL_VERIFICATION",
23
53
  REQUIRE_MFA = "REQUIRE_MFA",
@@ -36,6 +66,17 @@ export declare enum LoginSessionEventType {
36
66
  * Events that can trigger state transitions
37
67
  */
38
68
  export type LoginSessionEvent = {
69
+ type: LoginSessionEventType.PASSWORD_RESET_REQUESTED;
70
+ username: string;
71
+ requestId: string;
72
+ method: "code" | "link";
73
+ } | {
74
+ type: LoginSessionEventType.PASSWORD_RESET_COMPLETED;
75
+ requestId: string;
76
+ } | {
77
+ type: LoginSessionEventType.UPDATE_CONTEXT;
78
+ data: Partial<Omit<LoginSessionData, "passwordReset">>;
79
+ } | {
39
80
  type: LoginSessionEventType.AUTHENTICATE;
40
81
  userId: string;
41
82
  } | {
@@ -93,6 +134,17 @@ export type LoginSessionEvent = {
93
134
  * - expired: Session timed out (final)
94
135
  */
95
136
  export declare const loginSessionMachine: import("xstate").StateMachine<LoginSessionContext, {
137
+ type: LoginSessionEventType.PASSWORD_RESET_REQUESTED;
138
+ username: string;
139
+ requestId: string;
140
+ method: "code" | "link";
141
+ } | {
142
+ type: LoginSessionEventType.PASSWORD_RESET_COMPLETED;
143
+ requestId: string;
144
+ } | {
145
+ type: LoginSessionEventType.UPDATE_CONTEXT;
146
+ data: Partial<Omit<LoginSessionData, "passwordReset">>;
147
+ } | {
96
148
  type: LoginSessionEventType.AUTHENTICATE;
97
149
  userId: string;
98
150
  } | {
@@ -123,6 +175,15 @@ export declare const loginSessionMachine: import("xstate").StateMachine<LoginSes
123
175
  } | {
124
176
  type: LoginSessionEventType.EXPIRE;
125
177
  }, {}, never, {
178
+ type: "requestPasswordReset";
179
+ params: import("xstate").NonReducibleUnknown;
180
+ } | {
181
+ type: "completePasswordReset";
182
+ params: import("xstate").NonReducibleUnknown;
183
+ } | {
184
+ type: "updateContext";
185
+ params: import("xstate").NonReducibleUnknown;
186
+ } | {
126
187
  type: "setUserId";
127
188
  params: import("xstate").NonReducibleUnknown;
128
189
  } | {
@@ -140,7 +201,10 @@ export declare const loginSessionMachine: import("xstate").StateMachine<LoginSes
140
201
  } | {
141
202
  type: "setFailureReason";
142
203
  params: import("xstate").NonReducibleUnknown;
143
- }, never, never, "pending" | "failed" | "expired" | "authenticated" | "awaiting_email_verification" | "awaiting_mfa" | "awaiting_consent" | "awaiting_hook" | "awaiting_continuation" | "completed", string, import("xstate").NonReducibleUnknown, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
204
+ }, {
205
+ type: "passwordResetRequested";
206
+ params: unknown;
207
+ }, never, "completed" | "pending" | "authenticated" | "failed" | "expired" | "awaiting_email_verification" | "awaiting_mfa" | "awaiting_consent" | "awaiting_hook" | "awaiting_continuation", string, import("xstate").NonReducibleUnknown, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
144
208
  id: "loginSession";
145
209
  states: {
146
210
  readonly pending: {};
@@ -168,7 +232,7 @@ export declare function transitionLoginSession(currentState: LoginSessionState,
168
232
  /**
169
233
  * Check if a login session can transition with the given event
170
234
  *
171
- * Uses XState's transition - if the state changes, the transition is valid.
235
+ * Includes targetless context updates as well as authentication transitions.
172
236
  */
173
237
  export declare function canTransition(currentState: LoginSessionState, eventType: LoginSessionEvent["type"], context?: LoginSessionContext): boolean;
174
238
  /**