authhero 5.13.1 → 5.14.1
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.
- package/dist/assets/u/widget/index.esm.js +1 -1
- package/dist/authhero.cjs +133 -133
- package/dist/authhero.d.ts +246 -195
- package/dist/authhero.mjs +10592 -10388
- package/dist/stats.html +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/password.d.ts +1 -1
- package/dist/types/authentication-flows/passwordless.d.ts +1 -0
- package/dist/types/emails/index.d.ts +1 -1
- package/dist/types/helpers/cimd.d.ts +32 -0
- package/dist/types/helpers/client.d.ts +3 -18
- package/dist/types/helpers/connection.d.ts +40 -0
- package/dist/types/helpers/dcr/metadata-mapping.d.ts +2 -2
- package/dist/types/index.d.ts +245 -195
- package/dist/types/routes/auth-api/account.d.ts +2 -2
- package/dist/types/routes/auth-api/index.d.ts +50 -16
- package/dist/types/routes/auth-api/oidc-logout.d.ts +2 -2
- package/dist/types/routes/auth-api/passwordless.d.ts +12 -12
- package/dist/types/routes/auth-api/register/index.d.ts +2 -2
- package/dist/types/routes/auth-api/well-known.d.ts +34 -0
- package/dist/types/routes/management-api/action-executions.d.ts +2 -2
- package/dist/types/routes/management-api/actions.d.ts +1 -1
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/clients.d.ts +13 -13
- package/dist/types/routes/management-api/connections.d.ts +1 -1
- package/dist/types/routes/management-api/custom-domains.d.ts +13 -13
- package/dist/types/routes/management-api/email-templates.d.ts +14 -14
- package/dist/types/routes/management-api/failed-events.d.ts +1 -1
- package/dist/types/routes/management-api/flows.d.ts +7 -7
- package/dist/types/routes/management-api/index.d.ts +173 -173
- package/dist/types/routes/management-api/logs.d.ts +3 -3
- package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
- package/dist/types/routes/management-api/organizations.d.ts +2 -2
- package/dist/types/routes/management-api/prompts.d.ts +4 -4
- package/dist/types/routes/management-api/tenants.d.ts +3 -0
- package/dist/types/routes/management-api/users.d.ts +2 -2
- package/dist/types/routes/universal-login/common.d.ts +4 -0
- package/dist/types/routes/universal-login/error-page.d.ts +2 -1
- package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
- package/dist/types/routes/universal-login/u2-index.d.ts +22 -6
- package/dist/types/routes/universal-login/u2-routes.d.ts +22 -6
- package/dist/types/utils/ssrf-fetch.d.ts +8 -0
- package/dist/types/variables.d.ts +1 -1
- package/package.json +6 -6
|
@@ -21,4 +21,4 @@ export declare function changePassword(ctx: Context<{
|
|
|
21
21
|
export declare function requestPasswordReset(ctx: Context<{
|
|
22
22
|
Bindings: Bindings;
|
|
23
23
|
Variables: Variables;
|
|
24
|
-
}>, client: EnrichedClient, email: string, state: string, verification_method?: "link" | "code"): Promise<void>;
|
|
24
|
+
}>, client: EnrichedClient, email: string, state: string, verification_method?: "link" | "code", routePrefix?: string): Promise<void>;
|
|
@@ -160,6 +160,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
160
160
|
allow_legacy_ro_grant_types?: boolean | undefined;
|
|
161
161
|
allow_legacy_tokeninfo_endpoint?: boolean | undefined;
|
|
162
162
|
change_pwd_flow_v1?: boolean | undefined;
|
|
163
|
+
client_id_metadata_document_registration?: boolean | undefined;
|
|
163
164
|
custom_domains_provisioning?: boolean | undefined;
|
|
164
165
|
dashboard_insights_view?: boolean | undefined;
|
|
165
166
|
dashboard_log_streams_next?: boolean | undefined;
|
|
@@ -27,7 +27,7 @@ export declare function sendSms(ctx: Context<{
|
|
|
27
27
|
export declare function sendResetPassword(ctx: Context<{
|
|
28
28
|
Bindings: Bindings;
|
|
29
29
|
Variables: Variables;
|
|
30
|
-
}>, to: string, code: string, state?: string, language?: string): Promise<void>;
|
|
30
|
+
}>, to: string, code: string, state?: string, language?: string, routePrefix?: string): Promise<void>;
|
|
31
31
|
export declare function sendResetPasswordCode(ctx: Context<{
|
|
32
32
|
Bindings: Bindings;
|
|
33
33
|
Variables: Variables;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { Client } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { SsrfFetchOptions } from "../utils/ssrf-fetch";
|
|
4
|
+
/**
|
|
5
|
+
* Cheap guard: a CIMD client_id is an absolute https/http URL. Full validation
|
|
6
|
+
* (length, path, fetch, document shape) happens in {@link resolveCimdClient}.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isCimdClientId(clientId: string): boolean;
|
|
9
|
+
export declare const cimdDocumentSchema: z.ZodObject<{
|
|
10
|
+
client_id: z.ZodString;
|
|
11
|
+
client_name: z.ZodString;
|
|
12
|
+
grant_types: z.ZodArray<z.ZodString>;
|
|
13
|
+
redirect_uris: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
|
+
application_type: z.ZodOptional<z.ZodEnum<{
|
|
15
|
+
native: "native";
|
|
16
|
+
web: "web";
|
|
17
|
+
}>>;
|
|
18
|
+
token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
none: "none";
|
|
20
|
+
private_key_jwt: "private_key_jwt";
|
|
21
|
+
}>>;
|
|
22
|
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type CimdDocument = z.infer<typeof cimdDocumentSchema>;
|
|
25
|
+
/**
|
|
26
|
+
* Fetch, validate, and map a CIMD document into a synthesized (un-persisted)
|
|
27
|
+
* Client. The caller is responsible for the per-tenant flag check and for
|
|
28
|
+
* composing tenant + connections into an EnrichedClient.
|
|
29
|
+
*
|
|
30
|
+
* @throws JSONHTTPException(400) on any URL, fetch, or document validation error.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveCimdClient(rawUrl: string, fetchOpts?: SsrfFetchOptions): Promise<Client>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import { Bindings } from "../types";
|
|
3
|
+
import { SsrfFetchOptions } from "../utils/ssrf-fetch";
|
|
3
4
|
/**
|
|
4
5
|
* EnrichedClient combines a Client with its associated Tenant and Connections.
|
|
5
6
|
*
|
|
@@ -165,6 +166,7 @@ export declare const enrichedClientSchema: z.ZodObject<{
|
|
|
165
166
|
allow_legacy_ro_grant_types: z.ZodOptional<z.ZodBoolean>;
|
|
166
167
|
allow_legacy_tokeninfo_endpoint: z.ZodOptional<z.ZodBoolean>;
|
|
167
168
|
change_pwd_flow_v1: z.ZodOptional<z.ZodBoolean>;
|
|
169
|
+
client_id_metadata_document_registration: z.ZodOptional<z.ZodBoolean>;
|
|
168
170
|
custom_domains_provisioning: z.ZodOptional<z.ZodBoolean>;
|
|
169
171
|
dashboard_insights_view: z.ZodOptional<z.ZodBoolean>;
|
|
170
172
|
dashboard_log_streams_next: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -476,21 +478,4 @@ export declare const enrichedClientSchema: z.ZodObject<{
|
|
|
476
478
|
}, z.core.$strip>>;
|
|
477
479
|
}, z.core.$strip>;
|
|
478
480
|
export type EnrichedClient = z.infer<typeof enrichedClientSchema>;
|
|
479
|
-
|
|
480
|
-
* Fetches a client along with its tenant and connections by making separate
|
|
481
|
-
* adapter calls. This composites the data into an EnrichedClient.
|
|
482
|
-
*
|
|
483
|
-
* When tenantId is provided, all fetches happen in parallel for better performance.
|
|
484
|
-
* When tenantId is not provided, we first fetch the client to get the tenant_id,
|
|
485
|
-
* then fetch tenant and connections in parallel.
|
|
486
|
-
*
|
|
487
|
-
* If no connections are explicitly enabled for the client, falls back to all
|
|
488
|
-
* connections available in the tenant.
|
|
489
|
-
*
|
|
490
|
-
* @param env - The environment bindings containing data adapters
|
|
491
|
-
* @param clientId - The client ID to fetch
|
|
492
|
-
* @param tenantId - Optional tenant ID (if known, enables parallel fetching)
|
|
493
|
-
* @returns EnrichedClient with client, tenant, and connections data
|
|
494
|
-
* @throws JSONHTTPException if client or tenant is not found
|
|
495
|
-
*/
|
|
496
|
-
export declare function getEnrichedClient(env: Bindings, clientId: string, tenantId?: string): Promise<EnrichedClient>;
|
|
481
|
+
export declare function getEnrichedClient(env: Bindings, clientId: string, tenantId?: string, fetchOpts?: SsrfFetchOptions): Promise<EnrichedClient>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { LoginSession, User } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
import { HookEvent } from "../types/Hooks";
|
|
5
|
+
export type ConnectionInfo = NonNullable<HookEvent["connection"]>;
|
|
6
|
+
export interface ConnectionNameSources {
|
|
7
|
+
/** The login session's stored auth_connection — the exact connection captured
|
|
8
|
+
* at authentication time. Correct even for linked users. */
|
|
9
|
+
loginSession?: Pick<LoginSession, "auth_connection"> | null;
|
|
10
|
+
/** An explicitly resolved connection name passed down a flow. */
|
|
11
|
+
authConnection?: string | null;
|
|
12
|
+
/** The request-scoped ctx.var.connection (set during interactive flows). */
|
|
13
|
+
ctxConnection?: string | null;
|
|
14
|
+
/** The authenticated user. Pass ONLY where guessing from the user record is
|
|
15
|
+
* acceptable (read-time hook events) — omit when persisting the authoritative
|
|
16
|
+
* auth_connection, so a linked user's primary connection is never stored. */
|
|
17
|
+
user?: Pick<User, "connection"> | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the connection name used for authentication, in priority order:
|
|
21
|
+
* 1. the login session's stored `auth_connection`
|
|
22
|
+
* 2. an explicitly passed connection name
|
|
23
|
+
* 3. the request-scoped `ctx.var.connection`
|
|
24
|
+
* 4. the user's own `connection` (last resort — only when `user` is supplied)
|
|
25
|
+
*
|
|
26
|
+
* Supplying `user` is what populates `event.connection` on token-exchange and
|
|
27
|
+
* refresh requests that carry no session connection, matching Auth0's contract
|
|
28
|
+
* that the connection is available whenever it can be derived.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveConnectionName(sources: ConnectionNameSources): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Look up a connection by name and build the Auth0-compatible object exposed to
|
|
33
|
+
* hooks (`event.connection`). Matches by exact name first, then case-insensitively.
|
|
34
|
+
* Returns `undefined` when the name is empty or doesn't resolve to a known
|
|
35
|
+
* connection — callers decide whether to synthesize a fallback.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getConnectionInfo(ctx: Context<{
|
|
38
|
+
Bindings: Bindings;
|
|
39
|
+
Variables: Variables;
|
|
40
|
+
}>, tenantId: string, connectionName: string | undefined, user?: Pick<User, "provider"> | null): Promise<ConnectionInfo | undefined>;
|
|
@@ -23,11 +23,11 @@ export declare const dcrRequestSchema: z.ZodObject<{
|
|
|
23
23
|
grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
24
|
response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
25
|
token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
none: "none";
|
|
27
|
+
private_key_jwt: "private_key_jwt";
|
|
26
28
|
client_secret_post: "client_secret_post";
|
|
27
29
|
client_secret_basic: "client_secret_basic";
|
|
28
|
-
none: "none";
|
|
29
30
|
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>>;
|