authhero 9.14.0 → 9.15.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/authhero-widget.esm.js +1 -1
- package/dist/assets/u/widget/index.esm.js +1 -1
- package/dist/assets/u/widget/{p-1471c0f2.entry.js → p-1eb7f287.entry.js} +1 -1
- package/dist/assets/u/widget/p-398d72df.entry.js +1 -0
- package/dist/authhero.cjs +144 -144
- package/dist/authhero.d.ts +280 -129
- package/dist/authhero.mjs +13812 -12841
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/custom-token-exchange.d.ts +21 -0
- package/dist/types/authentication-flows/passwordless.d.ts +6 -3
- package/dist/types/authentication-flows/token-exchange.d.ts +19 -0
- package/dist/types/generated/locale-types.d.ts +2 -0
- package/dist/types/helpers/client-assertion-replay.d.ts +17 -0
- package/dist/types/helpers/client-keys.d.ts +9 -0
- package/dist/types/helpers/client.d.ts +3 -0
- package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
- package/dist/types/helpers/organization-branding.d.ts +18 -0
- package/dist/types/helpers/reserved-claims.d.ts +2 -2
- package/dist/types/index.d.ts +277 -129
- package/dist/types/routes/auth-api/index.d.ts +156 -46
- 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/revoke.d.ts +8 -8
- package/dist/types/routes/auth-api/token.d.ts +132 -22
- package/dist/types/routes/auth-api/well-known.d.ts +2 -2
- package/dist/types/routes/management-api/action-executions.d.ts +1 -1
- package/dist/types/routes/management-api/actions.d.ts +3 -3
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/client-grants.d.ts +9 -9
- package/dist/types/routes/management-api/clients.d.ts +32 -8
- package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
- package/dist/types/routes/management-api/email-templates.d.ts +20 -20
- package/dist/types/routes/management-api/emails.d.ts +2 -2
- package/dist/types/routes/management-api/failed-events.d.ts +1 -1
- package/dist/types/routes/management-api/forms.d.ts +14 -0
- package/dist/types/routes/management-api/guardian.d.ts +5 -5
- package/dist/types/routes/management-api/helpers.d.ts +1 -1
- package/dist/types/routes/management-api/hooks.d.ts +4 -4
- package/dist/types/routes/management-api/index.d.ts +135 -97
- package/dist/types/routes/management-api/keys.d.ts +8 -8
- package/dist/types/routes/management-api/logs.d.ts +4 -4
- package/dist/types/routes/management-api/organizations.d.ts +7 -7
- package/dist/types/routes/management-api/prompts.d.ts +4 -4
- package/dist/types/routes/management-api/roles.d.ts +1 -1
- package/dist/types/routes/management-api/tenants.d.ts +6 -6
- package/dist/types/routes/management-api/token-exchange-profiles.d.ts +321 -0
- package/dist/types/routes/management-api/users.d.ts +11 -11
- package/dist/types/routes/universal-login/common.d.ts +6 -0
- package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
- package/dist/types/routes/universal-login/form-node.d.ts +4 -4
- package/dist/types/routes/universal-login/index.d.ts +4 -4
- package/dist/types/routes/universal-login/screens/login-otp.d.ts +17 -0
- package/dist/types/routes/universal-login/screens/types.d.ts +6 -0
- package/dist/types/routes/universal-login/u2-form-node.d.ts +2 -2
- package/dist/types/routes/universal-login/u2-index.d.ts +7 -7
- package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
- package/dist/types/state-machines/login-session.d.ts +1 -1
- package/dist/types/utils/jwks.d.ts +4 -4
- package/dist/types/utils/jws-verify.d.ts +46 -0
- package/package.json +6 -6
- package/dist/assets/u/widget/p-c2744f87.entry.js +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { z } from "@hono/zod-openapi";
|
|
3
|
+
import { Bindings, Variables, GrantFlowUserResult } from "../types";
|
|
4
|
+
import { EnrichedClient } from "../helpers/client";
|
|
5
|
+
export declare const customTokenExchangeParamsSchema: z.ZodObject<{
|
|
6
|
+
grant_type: z.ZodLiteral<"urn:ietf:params:oauth:grant-type:token-exchange">;
|
|
7
|
+
client_id: z.ZodString;
|
|
8
|
+
client_secret: z.ZodOptional<z.ZodString>;
|
|
9
|
+
subject_token: z.ZodString;
|
|
10
|
+
subject_token_type: z.ZodString;
|
|
11
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
12
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
13
|
+
organization: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type CustomTokenExchangeParams = z.infer<typeof customTokenExchangeParamsSchema>;
|
|
16
|
+
type Ctx = Context<{
|
|
17
|
+
Bindings: Bindings;
|
|
18
|
+
Variables: Variables;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function customTokenExchangeGrant(ctx: Ctx, params: CustomTokenExchangeParams, client: EnrichedClient): Promise<GrantFlowUserResult>;
|
|
21
|
+
export {};
|
|
@@ -475,7 +475,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
475
475
|
custom_login_page_preview?: string | undefined;
|
|
476
476
|
form_template?: string | undefined;
|
|
477
477
|
addons?: Record<string, any> | undefined;
|
|
478
|
-
token_endpoint_auth_method?: "
|
|
478
|
+
token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
|
|
479
479
|
client_metadata?: Record<string, string> | undefined;
|
|
480
480
|
hide_sign_up_disabled_error?: boolean | undefined;
|
|
481
481
|
mobile?: Record<string, any> | undefined;
|
|
@@ -501,6 +501,9 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
501
501
|
owner_user_id?: string | undefined;
|
|
502
502
|
registration_type?: "manual" | "open_dcr" | "iat_dcr" | undefined;
|
|
503
503
|
registration_metadata?: Record<string, any> | undefined;
|
|
504
|
+
token_exchange?: {
|
|
505
|
+
allow_any_profile_of_type?: "custom_authentication"[] | undefined;
|
|
506
|
+
} | undefined;
|
|
504
507
|
user_linking_mode?: "builtin" | "off" | undefined;
|
|
505
508
|
};
|
|
506
509
|
loginSession: {
|
|
@@ -558,8 +561,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
558
561
|
} | undefined;
|
|
559
562
|
authenticated_at?: string | undefined;
|
|
560
563
|
};
|
|
561
|
-
connectionType: "
|
|
562
|
-
authConnection: "
|
|
564
|
+
connectionType: "sms" | "email" | "username";
|
|
565
|
+
authConnection: "sms" | "email" | "username";
|
|
563
566
|
session_id: string | undefined;
|
|
564
567
|
authParams: {
|
|
565
568
|
audience?: string | undefined;
|
|
@@ -2,6 +2,7 @@ import { Context } from "hono";
|
|
|
2
2
|
import { z } from "@hono/zod-openapi";
|
|
3
3
|
import { Bindings, Variables, GrantFlowUserResult } from "../types";
|
|
4
4
|
import { EnrichedClient } from "../helpers/client";
|
|
5
|
+
export declare const SUBJECT_TOKEN_TYPE_ACCESS_TOKEN = "urn:ietf:params:oauth:token-type:access_token";
|
|
5
6
|
export declare const TOKEN_EXCHANGE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:token-exchange";
|
|
6
7
|
export declare const tokenExchangeParamsSchema: z.ZodObject<{
|
|
7
8
|
grant_type: z.ZodLiteral<"urn:ietf:params:oauth:grant-type:token-exchange">;
|
|
@@ -18,3 +19,21 @@ export declare function tokenExchangeGrant(ctx: Context<{
|
|
|
18
19
|
Bindings: Bindings;
|
|
19
20
|
Variables: Variables;
|
|
20
21
|
}>, params: TokenExchangeParams, preloadedClient?: EnrichedClient): Promise<GrantFlowUserResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the organization a token-exchange request asks for and check the
|
|
24
|
+
* user may act in it: a member, or a holder of the global
|
|
25
|
+
* `admin:organizations` permission when the tenant opts into inheriting it.
|
|
26
|
+
* Shared by the org-switch exchange and Custom Token Exchange.
|
|
27
|
+
*/
|
|
28
|
+
export declare function authorizeOrganizationAccess(ctx: Context<{
|
|
29
|
+
Bindings: Bindings;
|
|
30
|
+
Variables: Variables;
|
|
31
|
+
}>, params: {
|
|
32
|
+
tenantId: string;
|
|
33
|
+
userId: string;
|
|
34
|
+
organizationId: string;
|
|
35
|
+
failLog: (description: string) => void;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
}>;
|
|
@@ -64,6 +64,7 @@ export interface EmailOtpChallengeScreen {
|
|
|
64
64
|
sessionExpired: () => string;
|
|
65
65
|
title: () => string;
|
|
66
66
|
unexpectedError: () => string;
|
|
67
|
+
usePasswordText: () => string;
|
|
67
68
|
}
|
|
68
69
|
export interface EmailVerificationScreen {
|
|
69
70
|
description: (vars: {
|
|
@@ -269,6 +270,7 @@ export interface LoginPasswordScreen {
|
|
|
269
270
|
unverifiedEmail: () => string;
|
|
270
271
|
"user-blocked": () => string;
|
|
271
272
|
"wrong-credentials": () => string;
|
|
273
|
+
sendCodeText: () => string;
|
|
272
274
|
}
|
|
273
275
|
export interface LoginPasswordlessScreen {
|
|
274
276
|
authMethodEmail: () => string;
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { Context } from "hono";
|
|
2
|
+
import { CodeType } from "@authhero/adapter-interfaces";
|
|
2
3
|
import { Bindings, Variables } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Record a presented token's `jti` as spent.
|
|
6
|
+
*
|
|
7
|
+
* @returns false when the same `(namespace, jti)` was already spent, true
|
|
8
|
+
* otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export declare function consumeSingleUseJti(ctx: Context<{
|
|
11
|
+
Bindings: Bindings;
|
|
12
|
+
Variables: Variables;
|
|
13
|
+
}>, tenantId: string, params: {
|
|
14
|
+
codeType: Extract<CodeType, "client_assertion_jti" | "subject_token_jti">;
|
|
15
|
+
namespace: string;
|
|
16
|
+
jti: string;
|
|
17
|
+
/** The token's `exp`, in seconds — when the marker becomes collectable. */
|
|
18
|
+
exp: number;
|
|
19
|
+
}): Promise<boolean>;
|
|
3
20
|
export interface ConsumeClientAssertionJtiParams {
|
|
4
21
|
clientId: string;
|
|
5
22
|
/** The assertion's `jti`. When absent there is nothing to spend. */
|
|
@@ -25,3 +25,12 @@ export interface ClientWithKeys {
|
|
|
25
25
|
* asymmetric algs do).
|
|
26
26
|
*/
|
|
27
27
|
export declare function loadClientJwks(client: ClientWithKeys, opts?: LoadClientKeysOptions): Promise<Jwk[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve verification keys published inline (`jwks`) or by reference
|
|
30
|
+
* (`jwks_uri`). Inline takes precedence. The remote fetch goes through the
|
|
31
|
+
* SSRF guard. Returns an empty array when neither is set.
|
|
32
|
+
*/
|
|
33
|
+
export declare function loadJwks(source: {
|
|
34
|
+
jwks?: unknown;
|
|
35
|
+
jwks_uri?: unknown;
|
|
36
|
+
}, opts?: LoadClientKeysOptions): Promise<Jwk[]>;
|
|
@@ -134,6 +134,9 @@ export declare const enrichedClientSchema: z.ZodObject<{
|
|
|
134
134
|
iat_dcr: "iat_dcr";
|
|
135
135
|
}>>;
|
|
136
136
|
registration_metadata: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
137
|
+
token_exchange: z.ZodOptional<z.ZodObject<{
|
|
138
|
+
allow_any_profile_of_type: z.ZodOptional<z.ZodArray<z.ZodLiteral<"custom_authentication">>>;
|
|
139
|
+
}, z.core.$strip>>;
|
|
137
140
|
user_linking_mode: z.ZodOptional<z.ZodEnum<{
|
|
138
141
|
builtin: "builtin";
|
|
139
142
|
off: "off";
|
|
@@ -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>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Branding, Organization, Theme } from "@authhero/adapter-interfaces";
|
|
2
|
+
type OrganizationBranding = NonNullable<Organization["branding"]>;
|
|
3
|
+
/**
|
|
4
|
+
* Layer an organization's branding over the tenant's branding and theme, the
|
|
5
|
+
* way Auth0 does when a login runs in the context of an organization.
|
|
6
|
+
*
|
|
7
|
+
* The login pages let the theme win over branding (`theme.widget.logo_url`
|
|
8
|
+
* before `branding.logo_url`, `theme.colors.primary_button` before
|
|
9
|
+
* `branding.colors.primary`, `theme.page_background` before
|
|
10
|
+
* `branding.colors.page_background`), and a theme always exists because of
|
|
11
|
+
* the DEFAULT_THEME fallback. So each org value is written into both, or it
|
|
12
|
+
* would never be visible.
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyOrganizationBranding(branding: Branding | null, theme: Theme, orgBranding: OrganizationBranding | undefined): {
|
|
15
|
+
branding: Branding | null;
|
|
16
|
+
theme: Theme;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -14,9 +14,9 @@ export declare const USERINFO_RESERVED_CLAIMS: readonly ["iss", "sub", "aud", "e
|
|
|
14
14
|
* vendor/tenant for downstream APIs while `sub` stays `auth-service`.
|
|
15
15
|
* Client-bound mints keep `azp` locked (see below).
|
|
16
16
|
*/
|
|
17
|
-
export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("
|
|
17
|
+
export declare const SERVICE_TOKEN_RESERVED_CLAIMS: ("sid" | "client_id" | "scope" | "tenant_id" | "org_name" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "permissions" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
|
|
18
18
|
/** Client-bound mints: `azp` must stay the registered client id. */
|
|
19
|
-
export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("
|
|
19
|
+
export declare const CLIENT_SERVICE_TOKEN_RESERVED_CLAIMS: ("sid" | "client_id" | "scope" | "tenant_id" | "org_name" | "sub" | "exp" | "iat" | "org_id" | "iss" | "aud" | "auth_time" | "acr" | "amr" | "azp" | "permissions" | "nbf" | "jti" | "act" | "requested_userinfo_claims" | "gty")[];
|
|
20
20
|
export type AccessTokenReservedClaim = (typeof ACCESS_TOKEN_RESERVED_CLAIMS)[number];
|
|
21
21
|
export type IdTokenReservedClaim = (typeof ID_TOKEN_RESERVED_CLAIMS)[number];
|
|
22
22
|
/**
|