authhero 9.9.0 → 9.10.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 (59) hide show
  1. package/dist/assets/u/widget/index.esm.js +1 -1
  2. package/dist/authhero.cjs +537 -338
  3. package/dist/authhero.d.ts +297 -124
  4. package/dist/authhero.mjs +14879 -14098
  5. package/dist/tsconfig.types.tsbuildinfo +1 -1
  6. package/dist/types/authentication-flows/authorization-code.d.ts +2 -1
  7. package/dist/types/authentication-flows/client-credentials.d.ts +2 -1
  8. package/dist/types/authentication-flows/grant-tokens.d.ts +16 -0
  9. package/dist/types/authentication-flows/passwordless.d.ts +6 -5
  10. package/dist/types/authentication-flows/refresh-token.d.ts +2 -1
  11. package/dist/types/authentication-flows/token-exchange.d.ts +2 -1
  12. package/dist/types/helpers/client-assertion-replay.d.ts +21 -0
  13. package/dist/types/helpers/client-assertion.d.ts +24 -2
  14. package/dist/types/helpers/default-destinations.d.ts +7 -1
  15. package/dist/types/helpers/outbox-destinations/index.d.ts +1 -0
  16. package/dist/types/helpers/outbox-destinations/pipeline.d.ts +63 -0
  17. package/dist/types/helpers/outbox-relay.d.ts +3 -0
  18. package/dist/types/helpers/refresh-token-lifetime.d.ts +103 -0
  19. package/dist/types/helpers/reserved-claims.d.ts +64 -0
  20. package/dist/types/helpers/run-outbox-relay.d.ts +8 -0
  21. package/dist/types/hooks/addDataHooks.d.ts +4 -3
  22. package/dist/types/index.d.ts +134 -121
  23. package/dist/types/routes/auth-api/index.d.ts +16 -16
  24. package/dist/types/routes/auth-api/passwordless.d.ts +14 -14
  25. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  26. package/dist/types/routes/management-api/action-triggers.d.ts +0 -2
  27. package/dist/types/routes/management-api/actions.d.ts +0 -7
  28. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  29. package/dist/types/routes/management-api/branding.d.ts +9 -9
  30. package/dist/types/routes/management-api/clients.d.ts +8 -8
  31. package/dist/types/routes/management-api/connections.d.ts +1 -1
  32. package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
  33. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  34. package/dist/types/routes/management-api/failed-events.d.ts +21 -1
  35. package/dist/types/routes/management-api/forms.d.ts +126 -126
  36. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  37. package/dist/types/routes/management-api/helpers.d.ts +1 -1
  38. package/dist/types/routes/management-api/index.d.ts +107 -96
  39. package/dist/types/routes/management-api/keys.d.ts +12 -12
  40. package/dist/types/routes/management-api/logs.d.ts +4 -4
  41. package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
  42. package/dist/types/routes/management-api/organizations.d.ts +5 -5
  43. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  44. package/dist/types/routes/management-api/roles.d.ts +1 -1
  45. package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
  46. package/dist/types/routes/management-api/tenants.d.ts +11 -11
  47. package/dist/types/routes/management-api/users.d.ts +15 -15
  48. package/dist/types/routes/universal-login/common.d.ts +2 -2
  49. package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
  50. package/dist/types/routes/universal-login/info-code-exchange.d.ts +27 -0
  51. package/dist/types/routes/universal-login/token-info-page.d.ts +26 -0
  52. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  53. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  54. package/dist/types/types/AuthHeroConfig.d.ts +27 -0
  55. package/dist/types/types/Bindings.d.ts +12 -0
  56. package/dist/types/types/OutboxMetrics.d.ts +47 -0
  57. package/dist/types/types/index.d.ts +1 -0
  58. package/dist/types/utils/email.d.ts +21 -9
  59. package/package.json +8 -8
@@ -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?: {
@@ -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?: {
@@ -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?: {
@@ -0,0 +1,27 @@
1
+ import { Context } from "hono";
2
+ import { TokenResponse, User } from "@authhero/adapter-interfaces";
3
+ import { Bindings, Variables } from "../../types";
4
+ import { EnrichedClient } from "../../helpers/client";
5
+ export type InfoCodeExchangeResult = {
6
+ ok: true;
7
+ tokens: TokenResponse;
8
+ user: User;
9
+ client: EnrichedClient;
10
+ } | {
11
+ ok: false;
12
+ error: string;
13
+ error_description: string;
14
+ };
15
+ /**
16
+ * Redeem an authorization code that was issued with the info page itself as
17
+ * `redirect_uri`, using the client's own credentials on the server side.
18
+ *
19
+ * The page lives on the auth server, so it can complete the exchange without
20
+ * the browser ever seeing a client secret. The redirect_uri guard is
21
+ * load-bearing: without it a code intercepted from any other redirect target
22
+ * could be pasted into this page and redeemed with the client's secret.
23
+ */
24
+ export declare function exchangeInfoPageCode(ctx: Context<{
25
+ Bindings: Bindings;
26
+ Variables: Variables;
27
+ }>, tenantId: string, code: string): Promise<InfoCodeExchangeResult>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Signed-in landing page for the /u2/info test redirect target.
3
+ *
4
+ * Shows the outcome of a server-side authorization code exchange: buttons
5
+ * that copy the issued tokens to the clipboard, and a grid with the claims
6
+ * from the ID token (or the user's profile when no ID token was issued).
7
+ */
8
+ import type { Theme, TokenResponse, User } from "@authhero/adapter-interfaces";
9
+ import type { DarkModePreference } from "./u2-widget-page";
10
+ import type { ErrorPageProps } from "./error-page";
11
+ export type TokenInfoPageProps = {
12
+ tokens: TokenResponse;
13
+ user: User;
14
+ branding?: ErrorPageProps["branding"];
15
+ theme?: Theme | null;
16
+ darkMode?: DarkModePreference;
17
+ };
18
+ type ClaimRow = {
19
+ key: string;
20
+ value: string;
21
+ };
22
+ /** Decode a JWT payload without verifying it — the server just minted it. */
23
+ export declare function decodeJwtPayload(token: string): Record<string, unknown> | null;
24
+ export declare function buildClaimRows(tokens: TokenResponse, user: User): ClaimRow[];
25
+ export declare function TokenInfoPage({ tokens, user, branding, theme, darkMode, }: TokenInfoPageProps): import("hono/jsx/jsx-dev-runtime").JSX.Element;
26
+ export {};
@@ -165,7 +165,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
165
165
  $get: {
166
166
  input: {
167
167
  param: {
168
- screen: "signup" | "impersonate" | "consent" | "login" | "reset-password" | "account" | "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";
168
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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" | "consent" | "login" | "reset-password" | "account" | "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";
184
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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" | "impersonate" | "consent" | "login" | "reset-password" | "account" | "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";
200
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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" | "impersonate" | "consent" | "login" | "reset-password" | "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";
220
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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" | "consent" | "login" | "reset-password" | "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";
238
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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" | "consent" | "login" | "reset-password" | "account" | "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";
173
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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" | "consent" | "login" | "reset-password" | "account" | "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";
189
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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" | "impersonate" | "consent" | "login" | "reset-password" | "account" | "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";
205
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "account" | "enter-password" | "try-connection-result" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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" | "impersonate" | "consent" | "login" | "reset-password" | "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";
225
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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" | "consent" | "login" | "reset-password" | "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";
243
+ screen: "impersonate" | "signup" | "login" | "reset-password" | "consent" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/login-passwordless-identifier" | "reset-password/code" | "reset-password/request" | "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,5 +1,6 @@
1
1
  import { CodeExecutor, Connection, ConnectionInsert, CreateTenantParams, DataAdapters, Hook, ResourceServer, ResourceServerInsert, Role, RoleInsert, Tenant, TenantOperation, TenantOperationKind } from "@authhero/adapter-interfaces";
2
2
  import type { RolePermissionHooks, Hooks } from "./Hooks";
3
+ import type { OutboxMetricsSink } from "./OutboxMetrics";
3
4
  import type { SamlSigner } from "@authhero/saml/core";
4
5
  import type { OpenAPIHono } from "@hono/zod-openapi";
5
6
  import type { Handler, MiddlewareHandler } from "hono";
@@ -127,6 +128,32 @@ export interface OutboxConfig {
127
128
  retentionDays?: number;
128
129
  /** Max delivery retries before giving up on an event (default: 5) */
129
130
  maxRetries?: number;
131
+ /**
132
+ * Optional sink for relay metrics (`outbox_events_processed_total`,
133
+ * `outbox_events_dead_lettered_total`, `outbox_retry_delay_seconds`).
134
+ * Left unset, the relay emits nothing beyond its existing console logging.
135
+ */
136
+ metrics?: OutboxMetricsSink;
137
+ /**
138
+ * When set, audit events are additionally archived to a Cloudflare Pipelines
139
+ * stream, which lands them in R2 as an Iceberg table. Left unset, no archive
140
+ * destination is registered and delivery is unchanged.
141
+ *
142
+ * See `apps/docs/architecture/audit-archive.md`.
143
+ */
144
+ pipeline?: OutboxPipelineConfig;
145
+ }
146
+ export interface OutboxPipelineConfig {
147
+ /**
148
+ * Stream HTTP ingest endpoint, e.g. `https://<stream-id>.ingest.cloudflare.com`.
149
+ * Must be https — the destination rejects any other scheme at startup, since
150
+ * every request carries the ingest token and a full audit event.
151
+ */
152
+ endpoint: string;
153
+ /** Stream ingest token, sent as `Authorization: Bearer`. */
154
+ token: string;
155
+ /** Per-request timeout in ms (default: 10_000). */
156
+ timeoutMs?: number;
130
157
  }
131
158
  /**
132
159
  * Mode for the built-in email-based user linking path.
@@ -45,6 +45,18 @@ export type Bindings = {
45
45
  * leave unset (or false) in production so SSRF protection stays on.
46
46
  */
47
47
  ALLOW_PRIVATE_OUTBOUND_FETCH?: boolean;
48
+ /**
49
+ * Clock-skew leeway in seconds applied to a client assertion's `exp`/`nbf`
50
+ * at `POST /oauth/token`. Defaults to 30 when unset.
51
+ */
52
+ CLIENT_ASSERTION_LEEWAY_SECONDS?: number;
53
+ /**
54
+ * Upper bound, in seconds, on a client assertion's lifetime (`exp - iat`,
55
+ * and the absolute `exp` measured from now). RFC 7523 sets no limit, so
56
+ * without one a client can mint an assertion valid for a year. Defaults to
57
+ * 300 when unset.
58
+ */
59
+ CLIENT_ASSERTION_MAX_LIFETIME_SECONDS?: number;
48
60
  /**
49
61
  * Controls where Server-Timing instrumentation goes. The data/cache adapters
50
62
  * and the webhook hook always measure per-operation latency; this decides the
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Metric names emitted by the outbox relay.
3
+ *
4
+ * - `outbox_events_processed_total` — counter, one per event that every
5
+ * accepting destination delivered successfully.
6
+ * - `outbox_events_dead_lettered_total` — counter, one per event successfully
7
+ * moved to the dead-letter state (retries exhausted, or no destination
8
+ * accepted it). Not emitted when the dead-letter write itself fails, since
9
+ * the event has not transitioned.
10
+ * - `outbox_retry_delay_seconds` — observation, emitted once per delivery
11
+ * failure with the backoff delay before the next attempt. Its count doubles
12
+ * as a retry counter.
13
+ */
14
+ export type OutboxMetricName = "outbox_events_processed_total" | "outbox_events_dead_lettered_total" | "outbox_retry_delay_seconds";
15
+ /** A single metric emission from the outbox relay. */
16
+ export interface OutboxMetric {
17
+ name: OutboxMetricName;
18
+ /** Counter increment, or the observed value for `outbox_retry_delay_seconds`. */
19
+ value: number;
20
+ /** Tenant the event belongs to. */
21
+ tenantId: string;
22
+ /** Audit event type, e.g. `hook.post-user-registration`. */
23
+ eventType: string;
24
+ /** Which relay path emitted this: inline per-request, or the cron drain. */
25
+ source: "request" | "cron";
26
+ /** Destination that failed, when the metric was caused by a delivery failure. */
27
+ destination?: string;
28
+ /** Failure reason, for retry and dead-letter metrics. */
29
+ error?: string;
30
+ /** Retry count of the event at the time of emission. */
31
+ retryCount?: number;
32
+ }
33
+ /**
34
+ * Optional sink for outbox relay metrics.
35
+ *
36
+ * Kept deliberately sink-agnostic: `packages/authhero` never knows where the
37
+ * numbers end up. Consumers pass a callback that forwards to whatever they
38
+ * use (Cloudflare Analytics Engine, StatsD, OpenTelemetry, a log line).
39
+ * `@authhero/cloudflare-adapter` ships an Analytics Engine implementation via
40
+ * `createAnalyticsEngineOutboxMetricsSink`.
41
+ *
42
+ * Implementations should be synchronous and must not throw. The relay calls
43
+ * the sink without awaiting it and swallows both synchronous throws and
44
+ * rejections from a promise-returning sink, so a broken sink can never fail
45
+ * event delivery.
46
+ */
47
+ export type OutboxMetricsSink = (metric: OutboxMetric) => void;
@@ -2,5 +2,6 @@ export * from "./Variables";
2
2
  export * from "./Bindings";
3
3
  export * from "./auth0";
4
4
  export * from "./AuthHeroConfig";
5
+ export * from "./OutboxMetrics";
5
6
  export * from "./GrantFlowResult";
6
7
  export * from "./Hooks";
@@ -1,16 +1,28 @@
1
1
  export declare const EMAIL_REGEX: RegExp;
2
2
  export declare function isValidEmail(value: string): boolean;
3
3
  /**
4
- * Return `payload` with `email` lowercased, or unchanged when there is nothing
5
- * to normalize.
4
+ * Canonical form of an email identifier: surrounding whitespace stripped, then
5
+ * lowercased.
6
6
  *
7
- * Emails are case-insensitive identifiers: every lookup (identifier-first
8
- * login, `getPrimaryUserByEmail`, email-based auto-linking) lowercases its
9
- * input, so a mixed-case stored email is unreachable and spawns duplicate
10
- * accounts. The zod request-schema transform only covers validated bodies
11
- * emails sourced upstream (SCIM provisioning, Auth0 lazy migration, IdP
12
- * profiles) and emails assigned by lifecycle hooks never pass through it.
7
+ * Both halves matter. Emails are case-insensitive identifiers, so a mixed-case
8
+ * stored address is unreachable from a lowercasing lookup. Whitespace is worse:
9
+ * `"user@example.com "` is stored verbatim, passes every uniqueness check
10
+ * against its trimmed twin, and produces a second account for the same person
11
+ * on the same connection (issue #1279). Every read and write path must agree on
12
+ * this single definition or the two halves diverge again.
13
13
  */
14
- export declare function withLowercasedEmail<T extends {
14
+ export declare function normalizeEmail(email: string): string;
15
+ /**
16
+ * Return `payload` with `email` normalized via {@link normalizeEmail}, or
17
+ * unchanged when there is nothing to normalize.
18
+ *
19
+ * This is the write-path chokepoint: every lookup (identifier-first login,
20
+ * `getPrimaryUserByEmail`, email-based auto-linking) normalizes its input, so
21
+ * an un-normalized stored email is unreachable and spawns duplicate accounts.
22
+ * The zod request-schema transform only covers validated bodies — emails
23
+ * sourced upstream (SCIM provisioning, Auth0 lazy migration, IdP profiles) and
24
+ * emails assigned by lifecycle hooks never pass through it.
25
+ */
26
+ export declare function withNormalizedEmail<T extends {
15
27
  email?: string;
16
28
  }>(payload: T): T;
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.9.0",
14
+ "version": "9.10.0",
15
15
  "files": [
16
16
  "dist"
17
17
  ],
@@ -33,8 +33,7 @@
33
33
  "@ape-egg/tailwind-rows-columns": "^1.0.2",
34
34
  "@hono/node-server": "^1.19.14",
35
35
  "@hono/zod-openapi": "^1.4.0",
36
- "@react-email/components": "^1.0.12",
37
- "@react-email/render": "^2.0.6",
36
+ "@react-email/render": "^2.1.0",
38
37
  "@storybook/react": "^10.4.1",
39
38
  "@storybook/react-vite": "^10.4.1",
40
39
  "@types/node": "^24.12.4",
@@ -53,6 +52,7 @@
53
52
  "postcss": "8.5.15",
54
53
  "react": "^19.2.6",
55
54
  "react-dom": "^19.2.6",
55
+ "react-email": "^6.9.3",
56
56
  "rollup": "^4.54.0",
57
57
  "rollup-plugin-dts": "^6.4.1",
58
58
  "rollup-plugin-visualizer": "^6.0.5",
@@ -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.6.0",
67
- "@authhero/widget": "0.38.5"
66
+ "@authhero/kysely-adapter": "12.6.2",
67
+ "@authhero/widget": "0.38.7"
68
68
  },
69
69
  "dependencies": {
70
70
  "@peculiar/x509": "^1.14.0",
@@ -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.10.0",
84
- "@authhero/proxy": "0.10.9",
85
- "@authhero/saml": "0.5.8"
83
+ "@authhero/adapter-interfaces": "4.12.0",
84
+ "@authhero/proxy": "0.10.11",
85
+ "@authhero/saml": "0.5.10"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@authhero/widget": "^0.1.0",