authhero 9.15.0 → 9.17.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 (61) 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-36898e2d.entry.js +1 -0
  4. package/dist/assets/u/widget/p-Che3Wd7J.js +1 -0
  5. package/dist/assets/u/widget/p-c6ec4c36.entry.js +1 -0
  6. package/dist/authhero.cjs +144 -144
  7. package/dist/authhero.d.ts +381 -249
  8. package/dist/authhero.mjs +13183 -13003
  9. package/dist/tsconfig.types.tsbuildinfo +1 -1
  10. package/dist/types/authentication-flows/passwordless.d.ts +2 -2
  11. package/dist/types/generated/locale-types.d.ts +1 -0
  12. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  13. package/dist/types/helpers/reserved-claims.d.ts +2 -2
  14. package/dist/types/helpers/scopes-permissions.d.ts +51 -12
  15. package/dist/types/helpers/signing-certificate-authority.d.ts +99 -0
  16. package/dist/types/helpers/signing-keys.d.ts +7 -0
  17. package/dist/types/index.d.ts +257 -247
  18. package/dist/types/middlewares/authentication.d.ts +1 -0
  19. package/dist/types/middlewares/reject-unknown-hosts.d.ts +13 -0
  20. package/dist/types/routes/auth-api/index.d.ts +25 -24
  21. package/dist/types/routes/auth-api/passwordless.d.ts +8 -8
  22. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  23. package/dist/types/routes/auth-api/token.d.ts +10 -10
  24. package/dist/types/routes/auth-api/well-known.d.ts +1 -0
  25. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  26. package/dist/types/routes/management-api/actions.d.ts +3 -3
  27. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  28. package/dist/types/routes/management-api/branding.d.ts +1 -1
  29. package/dist/types/routes/management-api/client-grants.d.ts +9 -9
  30. package/dist/types/routes/management-api/connections.d.ts +1 -1
  31. package/dist/types/routes/management-api/email-templates.d.ts +2 -2
  32. package/dist/types/routes/management-api/emails.d.ts +2 -2
  33. package/dist/types/routes/management-api/failed-events.d.ts +1 -1
  34. package/dist/types/routes/management-api/forms.d.ts +133 -126
  35. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  36. package/dist/types/routes/management-api/helpers.d.ts +1 -1
  37. package/dist/types/routes/management-api/hooks.d.ts +4 -4
  38. package/dist/types/routes/management-api/index.d.ts +219 -212
  39. package/dist/types/routes/management-api/keys.d.ts +8 -8
  40. package/dist/types/routes/management-api/logs.d.ts +4 -4
  41. package/dist/types/routes/management-api/organizations.d.ts +7 -7
  42. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  43. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  44. package/dist/types/routes/management-api/tenant-operations.d.ts +4 -4
  45. package/dist/types/routes/management-api/token-exchange-profiles.d.ts +6 -0
  46. package/dist/types/routes/management-api/users.d.ts +26 -26
  47. package/dist/types/routes/universal-login/flow-api.d.ts +12 -12
  48. package/dist/types/routes/universal-login/form-node.d.ts +4 -4
  49. package/dist/types/routes/universal-login/index.d.ts +4 -4
  50. package/dist/types/routes/universal-login/screens/connect-authz.d.ts +16 -0
  51. package/dist/types/routes/universal-login/u2-form-node.d.ts +2 -2
  52. package/dist/types/routes/universal-login/u2-index.d.ts +7 -7
  53. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  54. package/dist/types/state-machines/login-session.d.ts +1 -1
  55. package/dist/types/types/AuthHeroConfig.d.ts +38 -0
  56. package/dist/types/types/Bindings.d.ts +3 -0
  57. package/dist/types/utils/encryption.d.ts +20 -0
  58. package/dist/types/utils/jwks.d.ts +4 -1
  59. package/package.json +6 -6
  60. package/dist/assets/u/widget/p-1eb7f287.entry.js +0 -1
  61. package/dist/assets/u/widget/p-398d72df.entry.js +0 -1
@@ -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
  }, "/">;
@@ -63,7 +63,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
63
63
  };
64
64
  output: {};
65
65
  outputFormat: string;
66
- status: 404;
66
+ status: 200;
67
67
  } | {
68
68
  input: {
69
69
  param: {
@@ -77,7 +77,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
77
77
  };
78
78
  output: {};
79
79
  outputFormat: string;
80
- status: 200;
80
+ status: 404;
81
81
  };
82
82
  };
83
83
  } & {
@@ -97,7 +97,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
97
97
  };
98
98
  output: {};
99
99
  outputFormat: string;
100
- status: 404;
100
+ status: 200;
101
101
  } | {
102
102
  input: {
103
103
  param: {
@@ -113,7 +113,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
113
113
  };
114
114
  output: {};
115
115
  outputFormat: string;
116
- status: 200;
116
+ status: 404;
117
117
  };
118
118
  };
119
119
  }, "/forms"> & import("hono/types").MergeSchemaPath<{
@@ -21,6 +21,20 @@ export declare const DCR_REGISTER_PERMISSION = "create:clients";
21
21
  * Management API audience so unrelated API permissions can't satisfy it.
22
22
  */
23
23
  export declare function userHasGlobalOrgAdmin(context: ScreenContext, userId: string): Promise<boolean>;
24
+ /**
25
+ * True when the user holds the global `access:all_organizations` permission
26
+ * (directly or through a role, Management API audience). Such a user may open
27
+ * any control-plane org without being a member, but is NOT a tenant admin:
28
+ * registering a DCR client still needs `create:clients`, which for these
29
+ * users can come from their global roles (#1437).
30
+ */
31
+ export declare function userHasAccessAllOrganizations(context: ScreenContext, userId: string): Promise<boolean>;
32
+ /**
33
+ * True when the user holds `create:clients` at global scope (Management API
34
+ * audience). For a user with `access:all_organizations` this lets them
35
+ * register on any child tenant without an org-scoped role.
36
+ */
37
+ export declare function userCanRegisterGlobally(context: ScreenContext, userId: string): Promise<boolean>;
24
38
  /**
25
39
  * True when the user holds the DCR register permission on the given
26
40
  * control-plane organization (scoped to the Management API audience).
@@ -33,6 +47,8 @@ export declare function userCanRegisterOnOrg(context: ScreenContext, userId: str
33
47
  *
34
48
  * Access is granted when either:
35
49
  * - the user holds the global `admin:organizations` escape hatch, or
50
+ * - the user holds global `access:all_organizations` AND `create:clients`
51
+ * (globally or on that org), with no membership needed, or
36
52
  * - the user is a member of the control-plane org whose `name` equals the
37
53
  * target tenant id AND holds `create:clients` on their role for that org.
38
54
  *
@@ -28,7 +28,7 @@ export declare const u2FormNodeRoutes: OpenAPIHono<{
28
28
  };
29
29
  output: {};
30
30
  outputFormat: string;
31
- status: 404;
31
+ status: 200;
32
32
  } | {
33
33
  input: {
34
34
  param: {
@@ -42,7 +42,7 @@ export declare const u2FormNodeRoutes: OpenAPIHono<{
42
42
  };
43
43
  output: {};
44
44
  outputFormat: string;
45
- status: 200;
45
+ status: 404;
46
46
  };
47
47
  };
48
48
  } & {
@@ -165,7 +165,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
165
165
  $get: {
166
166
  input: {
167
167
  param: {
168
- screen: "signup" | "enter-password" | "login" | "reset-password" | "consent" | "impersonate" | "reset-password/request" | "reset-password/code" | "account" | "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";
168
+ screen: "login" | "impersonate" | "signup" | "account" | "reset-password" | "consent" | "enter-password" | "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";
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" | "enter-password" | "login" | "reset-password" | "consent" | "impersonate" | "reset-password/request" | "reset-password/code" | "account" | "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";
184
+ screen: "login" | "impersonate" | "signup" | "account" | "reset-password" | "consent" | "enter-password" | "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";
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: "signup" | "enter-password" | "login" | "reset-password" | "consent" | "impersonate" | "reset-password/request" | "reset-password/code" | "account" | "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";
200
+ screen: "login" | "impersonate" | "signup" | "account" | "reset-password" | "consent" | "enter-password" | "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";
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: "signup" | "enter-password" | "login" | "reset-password" | "consent" | "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";
220
+ screen: "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "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";
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" | "enter-password" | "login" | "reset-password" | "consent" | "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";
238
+ screen: "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "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";
239
239
  };
240
240
  } & {
241
241
  query: {
@@ -267,7 +267,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
267
267
  };
268
268
  output: {};
269
269
  outputFormat: string;
270
- status: 404;
270
+ status: 200;
271
271
  } | {
272
272
  input: {
273
273
  param: {
@@ -281,7 +281,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
281
281
  };
282
282
  output: {};
283
283
  outputFormat: string;
284
- status: 200;
284
+ status: 404;
285
285
  };
286
286
  };
287
287
  } & {
@@ -170,7 +170,7 @@ export declare const u2Routes: OpenAPIHono<{
170
170
  $get: {
171
171
  input: {
172
172
  param: {
173
- screen: "signup" | "enter-password" | "login" | "reset-password" | "consent" | "impersonate" | "reset-password/request" | "reset-password/code" | "account" | "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";
173
+ screen: "login" | "impersonate" | "signup" | "account" | "reset-password" | "consent" | "enter-password" | "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" | "enter-password" | "login" | "reset-password" | "consent" | "impersonate" | "reset-password/request" | "reset-password/code" | "account" | "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";
189
+ screen: "login" | "impersonate" | "signup" | "account" | "reset-password" | "consent" | "enter-password" | "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" | "enter-password" | "login" | "reset-password" | "consent" | "impersonate" | "reset-password/request" | "reset-password/code" | "account" | "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";
205
+ screen: "login" | "impersonate" | "signup" | "account" | "reset-password" | "consent" | "enter-password" | "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" | "enter-password" | "login" | "reset-password" | "consent" | "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: "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "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" | "enter-password" | "login" | "reset-password" | "consent" | "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: "login" | "impersonate" | "signup" | "reset-password" | "consent" | "enter-password" | "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: {
@@ -140,7 +140,7 @@ export declare const loginSessionMachine: import("xstate").StateMachine<LoginSes
140
140
  } | {
141
141
  type: "setFailureReason";
142
142
  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, {
143
+ }, never, never, "pending" | "failed" | "expired" | "completed" | "authenticated" | "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
144
  id: "loginSession";
145
145
  states: {
146
146
  readonly pending: {};
@@ -2,6 +2,7 @@ import { CodeExecutor, Connection, ConnectionInsert, CreateTenantParams, DataAda
2
2
  import type { RolePermissionHooks, Hooks } from "./Hooks";
3
3
  import type { OutboxMetricsSink } from "./OutboxMetrics";
4
4
  import type { SamlSigner } from "@authhero/saml/core";
5
+ import type { SigningCertificateAuthority } from "../helpers/signing-certificate-authority";
5
6
  import type { OpenAPIHono } from "@hono/zod-openapi";
6
7
  import type { Handler, MiddlewareHandler } from "hono";
7
8
  import type { ManagementAudienceResolver, IssuerResolver } from "../middlewares/authentication";
@@ -690,6 +691,43 @@ export interface AuthHeroConfig {
690
691
  * @default "control-plane"
691
692
  */
692
693
  signingKeyMode?: SigningKeyModeOption;
694
+ /**
695
+ * Issue `jwt_signing` certificates from an intermediate CA instead of
696
+ * self-signing them, and publish the chain (`x5c`, `x5t#S256`) in the JWKS.
697
+ *
698
+ * Each certificate carries its owner in a SubjectAlternativeName URI
699
+ * (`urn:authhero:tenant:<id>`, or `urn:authhero:control-plane`), so a
700
+ * relying party can pin one root and trust a key for a tenant without
701
+ * knowing which hosts that tenant is served on.
702
+ *
703
+ * Applies to keys created or renewed after it is set. Existing
704
+ * self-signed keys keep working and are published without a chain until
705
+ * they are rotated out. SAML keys are never CA-issued.
706
+ *
707
+ * @example
708
+ * ```ts
709
+ * signingCertificateAuthority: {
710
+ * issuer: createLocalCertificateIssuer({
711
+ * certificate: env.SIGNING_CA_CERT,
712
+ * privateKey: env.SIGNING_CA_KEY,
713
+ * }),
714
+ * }
715
+ * ```
716
+ */
717
+ signingCertificateAuthority?: SigningCertificateAuthority;
718
+ /**
719
+ * Answer 404 on `/.well-known/*` when the request host doesn't belong to
720
+ * this deployment: not the ISSUER host, not a `{tenant}.{issuer}`
721
+ * subdomain of an existing tenant, and not a registered custom domain.
722
+ *
723
+ * Without it, discovery and JWKS are served for any host that reaches the
724
+ * worker, falling back to the control-plane keys and apex metadata. Turn it
725
+ * on once every host the deployment is reached on is one of the above
726
+ * (watch for `*.workers.dev` URLs and unregistered domain aliases).
727
+ *
728
+ * @default false
729
+ */
730
+ rejectUnknownHosts?: boolean;
693
731
  /**
694
732
  * Relax the management API audience check from a hard 403 to a
695
733
  * `console.warn`. Tokens issued for any other audience will still be
@@ -1,3 +1,4 @@
1
+ import type { SigningCertificateAuthority } from "../helpers/signing-certificate-authority";
1
2
  import { CodeExecutor, DataAdapters } from "@authhero/adapter-interfaces";
2
3
  import type { SamlSigner } from "@authhero/saml/core";
3
4
  import { Hooks } from "./Hooks";
@@ -42,6 +43,8 @@ export type Bindings = {
42
43
  userLinkingMode?: UserLinkingModeOption;
43
44
  usernamePasswordProvider?: UsernamePasswordProviderResolver;
44
45
  signingKeyMode?: SigningKeyModeOption;
46
+ signingCertificateAuthority?: SigningCertificateAuthority;
47
+ rejectUnknownHosts?: boolean;
45
48
  mcp?: McpConfig;
46
49
  /**
47
50
  * Allow outbound fetches (jwks_uri, request_uri) to localhost / private IP
@@ -1,5 +1,6 @@
1
1
  import * as x509 from "@peculiar/x509";
2
2
  import { SigningKey } from "@authhero/adapter-interfaces";
3
+ import type { CertificateAuthorityIssuance } from "../helpers/signing-certificate-authority";
3
4
  /**
4
5
  * Supported signing-key shapes. Note: `EC-P-521` is not supported on
5
6
  * Cloudflare Workers (`workerd`) — `crypto.subtle.generateKey` will reject
@@ -24,7 +25,13 @@ export interface CreateX509CertificateParams {
24
25
  * emails it over — so SAML keys want years, not months.
25
26
  */
26
27
  validityDays?: number;
28
+ /**
29
+ * Issue the certificate from a CA instead of self-signing it. The key pair
30
+ * is still generated here; only the public key is sent to the issuer.
31
+ */
32
+ certificateAuthority?: CertificateAuthorityIssuance;
27
33
  }
34
+ export declare function signingAlgForKeyType(keyType: SigningKeyType): RsaHashedKeyGenParams | EcdsaParams;
28
35
  /** Default certificate lifetime when a caller doesn't ask for one. */
29
36
  export declare const DEFAULT_CERT_VALIDITY_DAYS = 365;
30
37
  /**
@@ -45,6 +52,8 @@ export interface RenewX509CertificateParams {
45
52
  /** Subject/issuer CN for the new certificate. Defaults to the current CN. */
46
53
  name?: string;
47
54
  validityDays?: number;
55
+ /** Re-issue from a CA instead of self-signing. The key pair is unchanged. */
56
+ certificateAuthority?: CertificateAuthorityIssuance;
48
57
  }
49
58
  export interface RenewX509CertificateResult {
50
59
  /** The re-issued certificate, PEM-encoded. */
@@ -54,6 +63,17 @@ export interface RenewX509CertificateResult {
54
63
  /** RFC 7638 thumbprint of the public key — unchanged by definition. */
55
64
  fingerprint: string;
56
65
  }
66
+ /**
67
+ * Import a PEM private key by trying each supported algorithm in turn.
68
+ *
69
+ * A PKCS#8 blob doesn't tell WebCrypto which algorithm to import it as, and
70
+ * the stored row doesn't record the key type, so we probe. The list is short
71
+ * and an import either succeeds or throws immediately.
72
+ */
73
+ export declare function importPrivateKey(pkcs7: string): Promise<{
74
+ key: CryptoKey;
75
+ keyType: SigningKeyType;
76
+ }>;
57
77
  /**
58
78
  * Re-issue a certificate over an existing key pair.
59
79
  *
@@ -1,12 +1,13 @@
1
1
  import { DataAdapters } from "@authhero/adapter-interfaces";
2
2
  import { SigningKeyModeOption } from "../types/AuthHeroConfig";
3
+ import { CertificateIssuer } from "../helpers/signing-certificate-authority";
3
4
  /**
4
5
  * JWKS for publication on a tenant's `/.well-known/jwks.json`. Honors the
5
6
  * configured `signingKeyMode` and, in `"tenant"` mode, returns the union of
6
7
  * the tenant's keys and the control-plane fallback so tokens signed by either
7
8
  * still verify during the per-tenant key rollout.
8
9
  */
9
- export declare function getJwksForPublication(data: DataAdapters, tenantId: string, modeOption: SigningKeyModeOption | undefined): Promise<{
10
+ export declare function getJwksForPublication(data: DataAdapters, tenantId: string, modeOption: SigningKeyModeOption | undefined, certificateIssuer?: CertificateIssuer): Promise<{
10
11
  kty: "EC" | "RSA" | "oct";
11
12
  alg?: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "HS256" | "HS384" | "HS512" | undefined;
12
13
  kid?: string | undefined;
@@ -17,6 +18,7 @@ export declare function getJwksForPublication(data: DataAdapters, tenantId: stri
17
18
  x?: string | undefined;
18
19
  y?: string | undefined;
19
20
  x5t?: string | undefined;
21
+ "x5t#S256"?: string | undefined;
20
22
  x5c?: string[] | undefined;
21
23
  }[]>;
22
24
  /**
@@ -36,5 +38,6 @@ export declare function getJwksForVerification(data: DataAdapters, tenantId: str
36
38
  x?: string | undefined;
37
39
  y?: string | undefined;
38
40
  x5t?: string | undefined;
41
+ "x5t#S256"?: string | undefined;
39
42
  x5c?: string[] | undefined;
40
43
  }[]>;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "https://github.com/markusahlstrand/authhero"
13
13
  },
14
- "version": "9.15.0",
14
+ "version": "9.17.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.9.0",
67
- "@authhero/widget": "0.39.1"
66
+ "@authhero/kysely-adapter": "12.10.0",
67
+ "@authhero/widget": "0.40.0"
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.15.0",
84
- "@authhero/proxy": "0.11.1",
85
- "@authhero/saml": "0.5.13"
83
+ "@authhero/adapter-interfaces": "4.16.0",
84
+ "@authhero/saml": "0.5.14",
85
+ "@authhero/proxy": "0.11.2"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@authhero/widget": "^0.1.0",