authhero 8.1.0 → 8.2.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 (34) hide show
  1. package/dist/authhero.cjs +215 -215
  2. package/dist/authhero.d.ts +96 -89
  3. package/dist/authhero.mjs +9007 -8979
  4. package/dist/{passkey-enrollment-Dw1ObR65.mjs → passkey-enrollment-Ba_8I87G.mjs} +1 -5
  5. package/dist/passkey-enrollment-CB7HjMH_.js +1 -0
  6. package/dist/stats.html +1 -1
  7. package/dist/tsconfig.types.tsbuildinfo +1 -1
  8. package/dist/types/authentication-flows/common.d.ts +18 -10
  9. package/dist/types/authentication-flows/connection.d.ts +2 -2
  10. package/dist/types/authentication-flows/passwordless.d.ts +1 -1
  11. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  12. package/dist/types/index.d.ts +85 -85
  13. package/dist/types/middlewares/tenant.d.ts +11 -4
  14. package/dist/types/routes/auth-api/account.d.ts +2 -2
  15. package/dist/types/routes/auth-api/index.d.ts +18 -18
  16. package/dist/types/routes/auth-api/passwordless.d.ts +14 -14
  17. package/dist/types/routes/management-api/action-triggers.d.ts +1 -1
  18. package/dist/types/routes/management-api/actions.d.ts +3 -3
  19. package/dist/types/routes/management-api/client-grants.d.ts +8 -8
  20. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  21. package/dist/types/routes/management-api/failed-events.d.ts +1 -1
  22. package/dist/types/routes/management-api/flows.d.ts +7 -7
  23. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  24. package/dist/types/routes/management-api/index.d.ts +61 -61
  25. package/dist/types/routes/management-api/logs.d.ts +3 -3
  26. package/dist/types/routes/management-api/organizations.d.ts +1 -1
  27. package/dist/types/routes/management-api/prompts.d.ts +4 -4
  28. package/dist/types/routes/management-api/users.d.ts +2 -2
  29. package/dist/types/routes/universal-login/common.d.ts +2 -2
  30. package/dist/types/routes/universal-login/u2-index.d.ts +6 -6
  31. package/dist/types/routes/universal-login/u2-routes.d.ts +6 -6
  32. package/dist/types/types/IdToken.d.ts +1 -1
  33. package/package.json +3 -3
  34. package/dist/passkey-enrollment-DKWsGt-K.js +0 -1
@@ -104,6 +104,11 @@ export interface AuthenticateLoginSessionParams {
104
104
  existingSessionId?: string;
105
105
  /** The connection name used for authentication (e.g., "email", "google-oauth2") */
106
106
  authConnection?: string;
107
+ /** Strategy metadata persisted so /authorize/resume can rehydrate it */
108
+ authStrategy?: {
109
+ strategy: string;
110
+ strategy_type: string;
111
+ };
107
112
  }
108
113
  /**
109
114
  * Authenticate a login session - transitions from PENDING to AUTHENTICATED
@@ -120,14 +125,8 @@ export interface AuthenticateLoginSessionParams {
120
125
  export declare function authenticateLoginSession(ctx: Context<{
121
126
  Bindings: Bindings;
122
127
  Variables: Variables;
123
- }>, { user, client, loginSession, existingSessionId, authConnection, }: AuthenticateLoginSessionParams): Promise<string>;
124
- export interface FinalizeAuthenticatedSessionParams extends AuthenticateLoginSessionParams {
125
- /** Strategy metadata persisted so /authorize/resume can rehydrate it */
126
- authStrategy?: {
127
- strategy: string;
128
- strategy_type: string;
129
- };
130
- }
128
+ }>, { user, client, loginSession, existingSessionId, authConnection, authStrategy, }: AuthenticateLoginSessionParams): Promise<string>;
129
+ export type FinalizeAuthenticatedSessionParams = AuthenticateLoginSessionParams;
131
130
  /**
132
131
  * Persist an authenticated identity onto the login session and 302 the browser
133
132
  * to `/authorize/resume?state=…`. This is the terminal step for sub-flows
@@ -185,12 +184,15 @@ export declare function completeLoginSessionHook(ctx: Context<{
185
184
  * Mark a login session as completed (tokens issued)
186
185
  * This should be called when tokens are successfully returned to the client
187
186
  *
188
- * Uses optimistic concurrency: re-fetches current state to prevent stale overwrites
187
+ * Uses optimistic concurrency: re-fetches current state to prevent stale
188
+ * overwrites. Callers that fetched the session in the same request and have
189
+ * been the only writer since (e.g. createFrontChannelAuthResponse) can pass
190
+ * it as `freshSession` to skip the round-trip.
189
191
  */
190
192
  export declare function completeLoginSession(ctx: Context<{
191
193
  Bindings: Bindings;
192
194
  Variables: Variables;
193
- }>, tenantId: string, loginSession: LoginSession, auth_connection?: string): Promise<void>;
195
+ }>, tenantId: string, loginSession: LoginSession, auth_connection?: string, freshSession?: LoginSession): Promise<void>;
194
196
  /**
195
197
  * Start a continuation - user is redirected to an account page (change-email, etc.)
196
198
  * This transitions to AWAITING_CONTINUATION and stores the allowed scope and return URL
@@ -253,6 +255,12 @@ export declare function completeLogin(ctx: Context<{
253
255
  }>, params: Omit<CreateAuthTokensParams, "client"> & {
254
256
  client: EnrichedClient;
255
257
  responseType?: AuthorizationResponseType;
258
+ /**
259
+ * Set when `loginSession` was fetched in this request and this call chain
260
+ * has been the only writer since — lets completeLoginSession skip its
261
+ * stale-overwrite re-fetch.
262
+ */
263
+ loginSessionIsCurrent?: boolean;
256
264
  }): Promise<TokenResponse | {
257
265
  code: string;
258
266
  state?: string;
@@ -1,11 +1,11 @@
1
1
  import { Context } from "hono";
2
- import { AuthParams } from "@authhero/adapter-interfaces";
2
+ import { AuthParams, LoginSession } from "@authhero/adapter-interfaces";
3
3
  import { EnrichedClient } from "../helpers/client";
4
4
  import { Bindings, Variables } from "../types";
5
5
  export declare function connectionAuth(ctx: Context<{
6
6
  Bindings: Bindings;
7
7
  Variables: Variables;
8
- }>, client: EnrichedClient, connectionName: string, authParams: AuthParams): Promise<Response>;
8
+ }>, client: EnrichedClient, connectionName: string, authParams: AuthParams, preloadedLoginSession?: LoginSession | null): Promise<Response>;
9
9
  interface SocialAuthCallbackParams {
10
10
  code: string;
11
11
  state: string;
@@ -457,7 +457,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
457
457
  custom_login_page_preview?: string | undefined;
458
458
  form_template?: string | undefined;
459
459
  addons?: Record<string, any> | undefined;
460
- token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
460
+ token_endpoint_auth_method?: "client_secret_post" | "client_secret_basic" | "none" | "client_secret_jwt" | "private_key_jwt" | undefined;
461
461
  client_metadata?: Record<string, string> | undefined;
462
462
  hide_sign_up_disabled_error?: boolean | undefined;
463
463
  mobile?: Record<string, any> | undefined;
@@ -24,10 +24,10 @@ export declare const dcrRequestSchema: z.ZodObject<{
24
24
  response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
25
  token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
26
26
  none: "none";
27
- private_key_jwt: "private_key_jwt";
28
27
  client_secret_post: "client_secret_post";
29
28
  client_secret_basic: "client_secret_basic";
30
29
  client_secret_jwt: "client_secret_jwt";
30
+ private_key_jwt: "private_key_jwt";
31
31
  }>>;
32
32
  jwks_uri: z.ZodOptional<z.ZodString>;
33
33
  jwks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;