authhero 5.13.0 → 5.14.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.
- package/dist/assets/u/widget/index.esm.js +1 -1
- package/dist/authhero.cjs +126 -126
- package/dist/authhero.d.ts +149 -114
- package/dist/authhero.mjs +9962 -9822
- package/dist/stats.html +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/passwordless.d.ts +7 -6
- 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/helpers/service-token.d.ts +11 -1
- package/dist/types/index.d.ts +148 -114
- package/dist/types/routes/auth-api/index.d.ts +48 -14
- package/dist/types/routes/auth-api/passwordless.d.ts +2 -2
- package/dist/types/routes/auth-api/register/index.d.ts +2 -2
- package/dist/types/routes/auth-api/token.d.ts +10 -10
- 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 +15 -15
- package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
- 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/guardian.d.ts +5 -5
- package/dist/types/routes/management-api/hooks.d.ts +24 -24
- package/dist/types/routes/management-api/index.d.ts +92 -92
- package/dist/types/routes/management-api/logs.d.ts +3 -3
- package/dist/types/routes/management-api/organizations.d.ts +1 -1
- 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 +12 -8
- package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
- package/dist/types/routes/universal-login/identifier.d.ts +2 -2
- package/dist/types/routes/universal-login/index.d.ts +2 -2
- package/dist/types/routes/universal-login/u2-index.d.ts +6 -6
- package/dist/types/routes/universal-login/u2-routes.d.ts +6 -6
- package/dist/types/utils/ssrf-fetch.d.ts +8 -0
- package/package.json +6 -6
|
@@ -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;
|
|
@@ -355,7 +356,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
355
356
|
active?: boolean | undefined;
|
|
356
357
|
} | undefined;
|
|
357
358
|
signup?: {
|
|
358
|
-
status?: "optional" | "
|
|
359
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
359
360
|
verification?: {
|
|
360
361
|
active?: boolean | undefined;
|
|
361
362
|
} | undefined;
|
|
@@ -372,7 +373,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
372
373
|
active?: boolean | undefined;
|
|
373
374
|
} | undefined;
|
|
374
375
|
signup?: {
|
|
375
|
-
status?: "optional" | "
|
|
376
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
376
377
|
} | undefined;
|
|
377
378
|
validation?: {
|
|
378
379
|
max_length?: number | undefined;
|
|
@@ -389,7 +390,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
389
390
|
active?: boolean | undefined;
|
|
390
391
|
} | undefined;
|
|
391
392
|
signup?: {
|
|
392
|
-
status?: "optional" | "
|
|
393
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
393
394
|
} | undefined;
|
|
394
395
|
} | undefined;
|
|
395
396
|
} | undefined;
|
|
@@ -446,7 +447,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
446
447
|
custom_login_page_preview?: string | undefined;
|
|
447
448
|
form_template?: string | undefined;
|
|
448
449
|
addons?: Record<string, any> | undefined;
|
|
449
|
-
token_endpoint_auth_method?: "
|
|
450
|
+
token_endpoint_auth_method?: "none" | "private_key_jwt" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | undefined;
|
|
450
451
|
client_metadata?: Record<string, string> | undefined;
|
|
451
452
|
hide_sign_up_disabled_error?: boolean | undefined;
|
|
452
453
|
mobile?: Record<string, any> | undefined;
|
|
@@ -529,8 +530,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
529
530
|
} | undefined;
|
|
530
531
|
authenticated_at?: string | undefined;
|
|
531
532
|
};
|
|
532
|
-
connectionType: "
|
|
533
|
-
authConnection: "
|
|
533
|
+
connectionType: "sms" | "email" | "username";
|
|
534
|
+
authConnection: "sms" | "email" | "username";
|
|
534
535
|
session_id: string | undefined;
|
|
535
536
|
authParams: {
|
|
536
537
|
client_id: string;
|
|
@@ -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>>;
|
|
@@ -58,6 +58,16 @@ export interface CreateClientServiceTokenParams {
|
|
|
58
58
|
expiresInSeconds?: number;
|
|
59
59
|
customClaims?: Record<string, unknown>;
|
|
60
60
|
}
|
|
61
|
+
export interface CreateClientServiceTokenOptions {
|
|
62
|
+
/**
|
|
63
|
+
* When the client isn't found in the request tenant, resolve it against the
|
|
64
|
+
* configured control-plane tenant and mint there instead. Off by default so
|
|
65
|
+
* that the hook-facing token API (`createTokenAPI`) cannot reach across the
|
|
66
|
+
* tenant boundary into control-plane clients — only trusted internal callers
|
|
67
|
+
* (e.g. the auth service's own email/SMS senders) opt in.
|
|
68
|
+
*/
|
|
69
|
+
allowControlPlaneFallback?: boolean;
|
|
70
|
+
}
|
|
61
71
|
/**
|
|
62
72
|
* In-process mint of a grant-bounded access token for a DB-registered M2M
|
|
63
73
|
* client. The caller is trusted (running inside the Worker) so no client
|
|
@@ -71,5 +81,5 @@ export interface CreateClientServiceTokenParams {
|
|
|
71
81
|
export declare function createClientServiceToken(ctx: Context<{
|
|
72
82
|
Bindings: Bindings;
|
|
73
83
|
Variables: Variables;
|
|
74
|
-
}>, tenantId: string, params: CreateClientServiceTokenParams): Promise<ServiceTokenResponse>;
|
|
84
|
+
}>, tenantId: string, params: CreateClientServiceTokenParams, options?: CreateClientServiceTokenOptions): Promise<ServiceTokenResponse>;
|
|
75
85
|
export { AUTH_SERVICE_CLIENT_ID };
|