authhero 9.24.0 → 9.25.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 (77) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +116 -116
  3. package/dist/authhero.d.ts +470 -178
  4. package/dist/authhero.mjs +36356 -35927
  5. package/dist/tsconfig.types.tsbuildinfo +1 -1
  6. package/dist/types/authentication-flows/password.d.ts +6 -0
  7. package/dist/types/authentication-flows/passwordless.d.ts +7 -3
  8. package/dist/types/generated/locale-types.d.ts +1 -0
  9. package/dist/types/helpers/audit-target-types.d.ts +26 -0
  10. package/dist/types/helpers/client.d.ts +12 -0
  11. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  12. package/dist/types/helpers/session-notice.d.ts +17 -0
  13. package/dist/types/index.d.ts +455 -178
  14. package/dist/types/routes/auth-api/account.d.ts +2 -2
  15. package/dist/types/routes/auth-api/index.d.ts +26 -26
  16. package/dist/types/routes/auth-api/logout.d.ts +2 -2
  17. package/dist/types/routes/auth-api/oidc-logout.d.ts +3 -3
  18. package/dist/types/routes/auth-api/passwordless.d.ts +8 -8
  19. package/dist/types/routes/auth-api/token.d.ts +10 -10
  20. package/dist/types/routes/auth-api/well-known.d.ts +1 -1
  21. package/dist/types/routes/management-api/action-executions.d.ts +2 -2
  22. package/dist/types/routes/management-api/action-triggers.d.ts +8 -2
  23. package/dist/types/routes/management-api/actions.d.ts +45 -12
  24. package/dist/types/routes/management-api/branding.d.ts +14 -2
  25. package/dist/types/routes/management-api/clients.d.ts +8 -2
  26. package/dist/types/routes/management-api/connections.d.ts +30 -6
  27. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  28. package/dist/types/routes/management-api/emails.d.ts +18 -0
  29. package/dist/types/routes/management-api/failed-events.d.ts +27 -2
  30. package/dist/types/routes/management-api/flows.d.ts +8 -8
  31. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  32. package/dist/types/routes/management-api/helpers.d.ts +25 -3
  33. package/dist/types/routes/management-api/hooks.d.ts +105 -0
  34. package/dist/types/routes/management-api/index.d.ts +406 -129
  35. package/dist/types/routes/management-api/keys.d.ts +12 -12
  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/organizations.d.ts +4 -4
  39. package/dist/types/routes/management-api/prompts.d.ts +12 -6
  40. package/dist/types/routes/management-api/resource-servers.d.ts +44 -20
  41. package/dist/types/routes/management-api/tenants.d.ts +4 -0
  42. package/dist/types/routes/management-api/token-exchange-profiles.d.ts +6 -6
  43. package/dist/types/routes/management-api/users.d.ts +18 -18
  44. package/dist/types/routes/saml/index.d.ts +6 -6
  45. package/dist/types/routes/saml/samlp.d.ts +6 -6
  46. package/dist/types/routes/universal-login/common.d.ts +18 -2
  47. package/dist/types/routes/universal-login/continue.d.ts +2 -2
  48. package/dist/types/routes/universal-login/identifier.d.ts +4 -4
  49. package/dist/types/routes/universal-login/impersonate.d.ts +4 -4
  50. package/dist/types/routes/universal-login/index.d.ts +10 -10
  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-partials.d.ts +8 -0
  57. package/dist/types/routes/universal-login/screens/login.d.ts +0 -8
  58. package/dist/types/routes/universal-login/screens/mfa-login-options.d.ts +0 -5
  59. package/dist/types/routes/universal-login/screens/mfa-phone-challenge.d.ts +0 -5
  60. package/dist/types/routes/universal-login/screens/mfa-phone-enrollment.d.ts +0 -5
  61. package/dist/types/routes/universal-login/screens/mfa-totp-challenge.d.ts +0 -5
  62. package/dist/types/routes/universal-login/screens/mfa-totp-enrollment.d.ts +0 -5
  63. package/dist/types/routes/universal-login/screens/passkey-challenge.d.ts +0 -14
  64. package/dist/types/routes/universal-login/screens/passkey-enrollment-nudge.d.ts +0 -15
  65. package/dist/types/routes/universal-login/screens/passkey-enrollment.d.ts +0 -9
  66. package/dist/types/routes/universal-login/screens/reset-password-code.d.ts +0 -9
  67. package/dist/types/routes/universal-login/screens/reset-password.d.ts +2 -6
  68. package/dist/types/routes/universal-login/u2-index.d.ts +7 -7
  69. package/dist/types/routes/universal-login/u2-routes.d.ts +7 -7
  70. package/dist/types/state-machines/index.d.ts +3 -1
  71. package/dist/types/state-machines/login-session-data.d.ts +19 -0
  72. package/dist/types/state-machines/login-session.d.ts +67 -3
  73. package/dist/types/state-machines/password-reset.d.ts +46 -0
  74. package/dist/types/types/Variables.d.ts +3 -0
  75. package/dist/types/utils/jwks.d.ts +2 -2
  76. package/dist/types/utils/jwt.d.ts +2 -0
  77. package/package.json +6 -6
@@ -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: "signup" | "impersonate" | "login" | "account" | "reset-password" | "consent" | "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: "signup" | "impersonate" | "account" | "consent" | "login" | "reset-password" | "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";
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: "signup" | "impersonate" | "login" | "account" | "reset-password" | "consent" | "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: "signup" | "impersonate" | "account" | "consent" | "login" | "reset-password" | "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";
185
185
  };
186
186
  } & {
187
187
  query: {
@@ -193,11 +193,11 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
193
193
  };
194
194
  output: {};
195
195
  outputFormat: string;
196
- status: 400;
196
+ status: 302;
197
197
  } | {
198
198
  input: {
199
199
  param: {
200
- screen: "signup" | "impersonate" | "login" | "account" | "reset-password" | "consent" | "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: "signup" | "impersonate" | "account" | "consent" | "login" | "reset-password" | "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";
201
201
  };
202
202
  } & {
203
203
  query: {
@@ -209,7 +209,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
209
209
  };
210
210
  output: {};
211
211
  outputFormat: string;
212
- status: 302;
212
+ status: 400;
213
213
  };
214
214
  };
215
215
  } & {
@@ -217,7 +217,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
217
217
  $post: {
218
218
  input: {
219
219
  param: {
220
- screen: "signup" | "impersonate" | "login" | "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";
220
+ screen: "signup" | "impersonate" | "consent" | "login" | "reset-password" | "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: "signup" | "impersonate" | "login" | "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";
238
+ screen: "signup" | "impersonate" | "consent" | "login" | "reset-password" | "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: "signup" | "impersonate" | "login" | "account" | "reset-password" | "consent" | "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: "signup" | "impersonate" | "account" | "consent" | "login" | "reset-password" | "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";
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: "signup" | "impersonate" | "login" | "account" | "reset-password" | "consent" | "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: "signup" | "impersonate" | "account" | "consent" | "login" | "reset-password" | "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";
190
190
  };
191
191
  } & {
192
192
  query: {
@@ -198,11 +198,11 @@ export declare const u2Routes: OpenAPIHono<{
198
198
  };
199
199
  output: {};
200
200
  outputFormat: string;
201
- status: 400;
201
+ status: 302;
202
202
  } | {
203
203
  input: {
204
204
  param: {
205
- screen: "signup" | "impersonate" | "login" | "account" | "reset-password" | "consent" | "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: "signup" | "impersonate" | "account" | "consent" | "login" | "reset-password" | "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";
206
206
  };
207
207
  } & {
208
208
  query: {
@@ -214,7 +214,7 @@ export declare const u2Routes: OpenAPIHono<{
214
214
  };
215
215
  output: {};
216
216
  outputFormat: string;
217
- status: 302;
217
+ status: 400;
218
218
  };
219
219
  };
220
220
  } & {
@@ -222,7 +222,7 @@ export declare const u2Routes: OpenAPIHono<{
222
222
  $post: {
223
223
  input: {
224
224
  param: {
225
- screen: "signup" | "impersonate" | "login" | "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";
225
+ screen: "signup" | "impersonate" | "consent" | "login" | "reset-password" | "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: "signup" | "impersonate" | "login" | "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";
243
+ screen: "signup" | "impersonate" | "consent" | "login" | "reset-password" | "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, "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, {
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
  /**
@@ -0,0 +1,46 @@
1
+ export interface PasswordResetFlow {
2
+ state: "awaiting_code" | "awaiting_link" | "completed";
3
+ username: string;
4
+ requestId: string;
5
+ }
6
+ export type PasswordResetEvent = {
7
+ type: "REQUEST_CODE";
8
+ username: string;
9
+ requestId: string;
10
+ } | {
11
+ type: "REQUEST_LINK";
12
+ username: string;
13
+ requestId: string;
14
+ } | {
15
+ type: "COMPLETE";
16
+ };
17
+ /** A reset request belongs to the login session, independently of login progress. */
18
+ export declare const passwordResetMachine: import("xstate").StateMachine<{
19
+ username?: string;
20
+ requestId?: string;
21
+ }, {
22
+ type: "REQUEST_CODE";
23
+ username: string;
24
+ requestId: string;
25
+ } | {
26
+ type: "REQUEST_LINK";
27
+ username: string;
28
+ requestId: string;
29
+ } | {
30
+ type: "COMPLETE";
31
+ }, {}, never, {
32
+ type: "setUsername";
33
+ params: import("xstate").NonReducibleUnknown;
34
+ }, never, never, "idle" | "awaiting_code" | "completed" | "awaiting_link", string, import("xstate").NonReducibleUnknown, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
35
+ id: "passwordReset";
36
+ states: {
37
+ readonly idle: {};
38
+ readonly awaiting_code: {};
39
+ readonly awaiting_link: {};
40
+ readonly completed: {};
41
+ };
42
+ }>;
43
+ /** Rehydrate the persisted child flow and reduce one domain event. */
44
+ export declare function transitionPasswordReset(flow: PasswordResetFlow | undefined, event: PasswordResetEvent): PasswordResetFlow | undefined;
45
+ /** Code and link submission endpoints accept only their own requested flow. */
46
+ export declare function canCompletePasswordReset(flow: PasswordResetFlow | undefined, method?: "code" | "link"): flow is PasswordResetFlow;
@@ -52,6 +52,9 @@ export type Variables = {
52
52
  org_id?: string;
53
53
  scope?: string;
54
54
  aud?: string | string[];
55
+ azp?: string;
56
+ gty?: string;
57
+ jti?: string;
55
58
  };
56
59
  organization_id?: string;
57
60
  org_name?: string;
@@ -9,7 +9,7 @@ import { CertificateIssuer } from "../helpers/signing-certificate-authority";
9
9
  */
10
10
  export declare function getJwksForPublication(data: DataAdapters, tenantId: string, modeOption: SigningKeyModeOption | undefined, certificateIssuer?: CertificateIssuer): Promise<{
11
11
  kty: "EC" | "RSA" | "oct";
12
- alg?: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "HS256" | "HS384" | "HS512" | undefined;
12
+ alg?: "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | undefined;
13
13
  kid?: string | undefined;
14
14
  use?: "sig" | "enc" | undefined;
15
15
  n?: string | undefined;
@@ -29,7 +29,7 @@ export declare function getJwksForPublication(data: DataAdapters, tenantId: stri
29
29
  */
30
30
  export declare function getJwksForVerification(data: DataAdapters, tenantId: string | undefined, modeOption: SigningKeyModeOption | undefined): Promise<{
31
31
  kty: "EC" | "RSA" | "oct";
32
- alg?: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "HS256" | "HS384" | "HS512" | undefined;
32
+ alg?: "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | undefined;
33
33
  kid?: string | undefined;
34
34
  use?: "sig" | "enc" | undefined;
35
35
  n?: string | undefined;
@@ -38,6 +38,8 @@ export interface JwtPayload {
38
38
  scope: string;
39
39
  permissions?: string[];
40
40
  azp?: string;
41
+ gty?: string;
42
+ jti?: string;
41
43
  tenant_id?: string;
42
44
  org_id?: string;
43
45
  org_name?: string;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/sesamyab/authhero"
13
13
  },
14
- "version": "9.24.0",
14
+ "version": "9.25.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -63,8 +63,8 @@
63
63
  "vite": "^8.0.14",
64
64
  "vite-plugin-dts": "^4.5.4",
65
65
  "vitest": "^4.1.7",
66
- "@authhero/kysely-adapter": "12.15.0",
67
- "@authhero/widget": "0.41.3"
66
+ "@authhero/kysely-adapter": "12.16.0",
67
+ "@authhero/widget": "0.41.4"
68
68
  },
69
69
  "dependencies": {
70
70
  "@peculiar/x509": "^1.14.3",
@@ -80,9 +80,9 @@
80
80
  "qrcode": "^1.5.4",
81
81
  "sanitize-html": "^2.17.4",
82
82
  "xstate": "^5.31.1",
83
- "@authhero/adapter-interfaces": "4.21.0",
84
- "@authhero/proxy": "0.11.7",
85
- "@authhero/saml": "0.6.0"
83
+ "@authhero/adapter-interfaces": "4.22.0",
84
+ "@authhero/proxy": "0.11.8",
85
+ "@authhero/saml": "0.6.1"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@authhero/widget": "^0.1.0",