authhero 5.18.0 → 5.19.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 (48) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +136 -129
  3. package/dist/authhero.d.ts +309 -104
  4. package/dist/authhero.mjs +10431 -9866
  5. package/dist/stats.html +1 -1
  6. package/dist/tsconfig.types.tsbuildinfo +1 -1
  7. package/dist/types/authentication-flows/passwordless.d.ts +4 -4
  8. package/dist/types/helpers/consent.d.ts +31 -0
  9. package/dist/types/helpers/control-plane-sync-events.d.ts +67 -0
  10. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  11. package/dist/types/helpers/default-destinations.d.ts +11 -0
  12. package/dist/types/helpers/outbox-destinations/control-plane-sync.d.ts +35 -0
  13. package/dist/types/helpers/outbox-destinations/logs.d.ts +2 -0
  14. package/dist/types/index.d.ts +178 -101
  15. package/dist/types/routes/auth-api/index.d.ts +24 -24
  16. package/dist/types/routes/auth-api/passwordless.d.ts +6 -6
  17. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  18. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  19. package/dist/types/routes/auth-api/token.d.ts +10 -10
  20. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  21. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  22. package/dist/types/routes/management-api/branding.d.ts +9 -9
  23. package/dist/types/routes/management-api/clients.d.ts +9 -9
  24. package/dist/types/routes/management-api/connections.d.ts +5 -5
  25. package/dist/types/routes/management-api/custom-domains.d.ts +8 -8
  26. package/dist/types/routes/management-api/email-templates.d.ts +15 -15
  27. package/dist/types/routes/management-api/grants.d.ts +80 -0
  28. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  29. package/dist/types/routes/management-api/index.d.ts +143 -69
  30. package/dist/types/routes/management-api/logs.d.ts +3 -3
  31. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  32. package/dist/types/routes/management-api/organizations.d.ts +1 -1
  33. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  34. package/dist/types/routes/management-api/proxy-routes.d.ts +1 -0
  35. package/dist/types/routes/management-api/themes.d.ts +6 -6
  36. package/dist/types/routes/management-api/users.d.ts +2 -2
  37. package/dist/types/routes/proxy-control-plane/index.d.ts +34 -1
  38. package/dist/types/routes/universal-login/common.d.ts +10 -10
  39. package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
  40. package/dist/types/routes/universal-login/identifier.d.ts +2 -2
  41. package/dist/types/routes/universal-login/index.d.ts +2 -2
  42. package/dist/types/routes/universal-login/screens/consent.d.ts +9 -0
  43. package/dist/types/routes/universal-login/u2-index.d.ts +6 -6
  44. package/dist/types/routes/universal-login/u2-routes.d.ts +6 -6
  45. package/dist/types/state-machines/login-session.d.ts +12 -1
  46. package/dist/types/types/AuthHeroConfig.d.ts +26 -0
  47. package/dist/types/types/IdToken.d.ts +1 -1
  48. package/package.json +5 -5
@@ -170,7 +170,7 @@ export declare const u2Routes: OpenAPIHono<{
170
170
  $get: {
171
171
  input: {
172
172
  param: {
173
- screen: "signup" | "login" | "reset-password" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "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" | "consent" | "login" | "reset-password" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "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" | "login" | "reset-password" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "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" | "consent" | "login" | "reset-password" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "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: "signup" | "login" | "reset-password" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "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" | "consent" | "login" | "reset-password" | "account" | "enter-password" | "impersonate" | "try-connection-result" | "reset-password/request" | "reset-password/code" | "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: "signup" | "login" | "reset-password" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "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" | "consent" | "login" | "reset-password" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "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" | "login" | "reset-password" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "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" | "consent" | "login" | "reset-password" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "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: {
@@ -258,7 +258,7 @@ export declare const u2Routes: OpenAPIHono<{
258
258
  } | {
259
259
  input: {
260
260
  param: {
261
- screen: "signup" | "login" | "reset-password" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "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";
261
+ screen: "signup" | "consent" | "login" | "reset-password" | "enter-password" | "impersonate" | "reset-password/request" | "reset-password/code" | "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";
262
262
  };
263
263
  } & {
264
264
  query: {
@@ -22,6 +22,8 @@ export declare enum LoginSessionEventType {
22
22
  REQUIRE_EMAIL_VERIFICATION = "REQUIRE_EMAIL_VERIFICATION",
23
23
  REQUIRE_MFA = "REQUIRE_MFA",
24
24
  COMPLETE_MFA = "COMPLETE_MFA",
25
+ REQUIRE_CONSENT = "REQUIRE_CONSENT",
26
+ COMPLETE_CONSENT = "COMPLETE_CONSENT",
25
27
  START_HOOK = "START_HOOK",
26
28
  COMPLETE_HOOK = "COMPLETE_HOOK",
27
29
  START_CONTINUATION = "START_CONTINUATION",
@@ -42,6 +44,10 @@ export type LoginSessionEvent = {
42
44
  type: LoginSessionEventType.REQUIRE_MFA;
43
45
  } | {
44
46
  type: LoginSessionEventType.COMPLETE_MFA;
47
+ } | {
48
+ type: LoginSessionEventType.REQUIRE_CONSENT;
49
+ } | {
50
+ type: LoginSessionEventType.COMPLETE_CONSENT;
45
51
  } | {
46
52
  type: LoginSessionEventType.START_HOOK;
47
53
  hookId?: string;
@@ -95,6 +101,10 @@ export declare const loginSessionMachine: import("xstate").StateMachine<LoginSes
95
101
  type: LoginSessionEventType.REQUIRE_MFA;
96
102
  } | {
97
103
  type: LoginSessionEventType.COMPLETE_MFA;
104
+ } | {
105
+ type: LoginSessionEventType.REQUIRE_CONSENT;
106
+ } | {
107
+ type: LoginSessionEventType.COMPLETE_CONSENT;
98
108
  } | {
99
109
  type: LoginSessionEventType.START_HOOK;
100
110
  hookId?: string;
@@ -130,13 +140,14 @@ export declare const loginSessionMachine: import("xstate").StateMachine<LoginSes
130
140
  } | {
131
141
  type: "setFailureReason";
132
142
  params: import("xstate").NonReducibleUnknown;
133
- }, never, never, "pending" | "failed" | "authenticated" | "expired" | "awaiting_email_verification" | "awaiting_mfa" | "awaiting_hook" | "awaiting_continuation" | "completed", string, import("xstate").NonReducibleUnknown, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
143
+ }, never, never, "pending" | "failed" | "authenticated" | "expired" | "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, {
134
144
  id: "loginSession";
135
145
  states: {
136
146
  readonly pending: {};
137
147
  readonly authenticated: {};
138
148
  readonly awaiting_email_verification: {};
139
149
  readonly awaiting_mfa: {};
150
+ readonly awaiting_consent: {};
140
151
  readonly awaiting_hook: {};
141
152
  readonly awaiting_continuation: {};
142
153
  readonly completed: {};
@@ -290,6 +290,32 @@ export interface AuthHeroConfig {
290
290
  proxyControlPlane?: {
291
291
  resolveHost: (host: string) => Promise<import("@authhero/proxy").ResolvedHost | null>;
292
292
  authenticate: (request: Request) => Promise<boolean> | boolean;
293
+ /**
294
+ * Optional receiver for `POST /sync` events emitted by tenant shards via
295
+ * the `ControlPlaneSyncDestination`. Mount on the control-plane authhero
296
+ * instance only. Implementations MUST be idempotent — the outbox retries
297
+ * on transient failures. Use `createApplySyncEvents({ customDomains,
298
+ * proxyRoutes })` (exported from `authhero`) for the default
299
+ * adapter-backed implementation.
300
+ */
301
+ applySyncEvents?: (events: import("../helpers/control-plane-sync-events").SyncEvent[]) => Promise<void>;
302
+ };
303
+ /**
304
+ * Optional outbox-driven replication of `custom_domains` and `proxy_routes`
305
+ * mutations to a global proxy control plane. When set, every successful
306
+ * write on this tenant shard enqueues a `controlplane.sync.*` outbox event;
307
+ * the `ControlPlaneSyncDestination` POSTs each event to
308
+ * `${baseUrl}/api/v2/proxy/control-plane/sync`. Requires the outbox to be
309
+ * enabled (`outbox: { enabled: true }`).
310
+ *
311
+ * Leave unset for single-DB deployments — the proxy reads the same database
312
+ * the management API writes to, so replication is unnecessary.
313
+ */
314
+ controlPlaneSync?: {
315
+ /** Base URL of the control-plane authhero instance. */
316
+ baseUrl: string;
317
+ /** Per-request timeout for the sync POST (default: 10_000ms). */
318
+ timeoutMs?: number;
293
319
  };
294
320
  /**
295
321
  * Optional powered-by logo to display at the bottom left of the login widget.
@@ -18,12 +18,12 @@ export declare const idTokenSchema: z.ZodObject<{
18
18
  c_hash: z.ZodOptional<z.ZodString>;
19
19
  }, z.core.$loose>;
20
20
  export declare const userInfoSchema: z.ZodObject<{
21
- sub: z.ZodString;
22
21
  name: z.ZodOptional<z.ZodString>;
23
22
  email: z.ZodOptional<z.ZodString>;
24
23
  given_name: z.ZodOptional<z.ZodString>;
25
24
  family_name: z.ZodOptional<z.ZodString>;
26
25
  iss: z.ZodString;
26
+ sub: z.ZodString;
27
27
  aud: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
28
28
  exp: z.ZodNumber;
29
29
  }, z.core.$loose>;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "5.18.0",
14
+ "version": "5.19.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -62,8 +62,8 @@
62
62
  "vite": "^8.0.14",
63
63
  "vite-plugin-dts": "^4.5.4",
64
64
  "vitest": "^4.1.7",
65
- "@authhero/kysely-adapter": "11.5.4",
66
- "@authhero/widget": "0.32.34"
65
+ "@authhero/kysely-adapter": "11.6.0",
66
+ "@authhero/widget": "0.32.35"
67
67
  },
68
68
  "dependencies": {
69
69
  "@peculiar/x509": "^1.14.0",
@@ -81,8 +81,8 @@
81
81
  "qrcode": "^1.5.4",
82
82
  "sanitize-html": "^2.17.4",
83
83
  "xstate": "^5.31.1",
84
- "@authhero/adapter-interfaces": "2.10.0",
85
- "@authhero/proxy": "0.4.0",
84
+ "@authhero/adapter-interfaces": "2.11.0",
85
+ "@authhero/proxy": "0.4.1",
86
86
  "@authhero/saml": "0.4.1"
87
87
  },
88
88
  "peerDependencies": {