authhero 9.7.0 → 9.9.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/authhero.cjs +132 -132
- package/dist/authhero.d.ts +361 -249
- package/dist/authhero.mjs +11713 -11450
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/passwordless.d.ts +31 -8
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/helpers/revoke-session-refresh-tokens.d.ts +33 -0
- package/dist/types/helpers/signing-keys.d.ts +11 -0
- package/dist/types/index.d.ts +351 -249
- package/dist/types/routes/auth-api/index.d.ts +32 -12
- package/dist/types/routes/auth-api/passwordless.d.ts +12 -12
- package/dist/types/routes/auth-api/token.d.ts +20 -0
- package/dist/types/routes/management-api/clients.d.ts +6 -6
- package/dist/types/routes/management-api/connections.d.ts +16 -16
- package/dist/types/routes/management-api/custom-domains.d.ts +6 -6
- package/dist/types/routes/management-api/email-templates.d.ts +18 -18
- package/dist/types/routes/management-api/forms.d.ts +126 -126
- 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/index.d.ts +312 -230
- package/dist/types/routes/management-api/keys.d.ts +92 -10
- package/dist/types/routes/management-api/logs.d.ts +4 -4
- package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
- package/dist/types/routes/management-api/organizations.d.ts +5 -5
- 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/tenant-export-import.d.ts +5 -5
- package/dist/types/routes/management-api/tenants.d.ts +4 -4
- package/dist/types/routes/management-api/users.d.ts +18 -18
- package/dist/types/routes/universal-login/common.d.ts +6 -6
- package/dist/types/routes/universal-login/flow-api.d.ts +12 -12
- 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 +5 -5
- 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/encryption.d.ts +51 -0
- package/package.json +6 -6
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Context } from "hono";
|
|
2
2
|
import { z } from "@hono/zod-openapi";
|
|
3
3
|
import { Bindings, Variables } from "../types";
|
|
4
|
+
import { GrantFlowUserResult } from "../types/GrantFlowResult";
|
|
4
5
|
export declare const passwordlessGrantParamsSchema: z.ZodObject<{
|
|
5
6
|
client_id: z.ZodString;
|
|
6
7
|
username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
7
8
|
otp: z.ZodString;
|
|
9
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
10
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
8
11
|
authParams: z.ZodOptional<z.ZodObject<{
|
|
9
12
|
client_id: z.ZodString;
|
|
10
13
|
act_as: z.ZodOptional<z.ZodString>;
|
|
@@ -42,7 +45,7 @@ export declare const passwordlessGrantParamsSchema: z.ZodObject<{
|
|
|
42
45
|
export declare function passwordlessGrantUser(ctx: Context<{
|
|
43
46
|
Bindings: Bindings;
|
|
44
47
|
Variables: Variables;
|
|
45
|
-
}>, { client_id, username, otp, authParams, enforceIpCheck, }: z.input<typeof passwordlessGrantParamsSchema>): Promise<{
|
|
48
|
+
}>, { client_id, username, otp, scope, audience, authParams, enforceIpCheck, }: z.input<typeof passwordlessGrantParamsSchema>): Promise<{
|
|
46
49
|
user: {
|
|
47
50
|
connection: string;
|
|
48
51
|
email_verified: boolean;
|
|
@@ -372,7 +375,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
372
375
|
active?: boolean | undefined;
|
|
373
376
|
} | undefined;
|
|
374
377
|
signup?: {
|
|
375
|
-
status?: "
|
|
378
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
376
379
|
verification?: {
|
|
377
380
|
active?: boolean | undefined;
|
|
378
381
|
} | undefined;
|
|
@@ -389,7 +392,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
389
392
|
active?: boolean | undefined;
|
|
390
393
|
} | undefined;
|
|
391
394
|
signup?: {
|
|
392
|
-
status?: "
|
|
395
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
393
396
|
} | undefined;
|
|
394
397
|
validation?: {
|
|
395
398
|
max_length?: number | undefined;
|
|
@@ -406,7 +409,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
406
409
|
active?: boolean | undefined;
|
|
407
410
|
} | undefined;
|
|
408
411
|
signup?: {
|
|
409
|
-
status?: "
|
|
412
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
410
413
|
} | undefined;
|
|
411
414
|
} | undefined;
|
|
412
415
|
} | undefined;
|
|
@@ -554,20 +557,20 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
554
557
|
} | undefined;
|
|
555
558
|
authenticated_at?: string | undefined;
|
|
556
559
|
};
|
|
557
|
-
connectionType: "
|
|
558
|
-
authConnection: "
|
|
560
|
+
connectionType: "username" | "email" | "sms";
|
|
561
|
+
authConnection: "username" | "email" | "sms";
|
|
559
562
|
session_id: string | undefined;
|
|
560
563
|
authParams: {
|
|
564
|
+
audience?: string | undefined;
|
|
565
|
+
scope?: string | undefined;
|
|
561
566
|
client_id: string;
|
|
562
567
|
act_as?: string | undefined;
|
|
563
568
|
response_type?: import("@authhero/adapter-interfaces").AuthorizationResponseType | undefined;
|
|
564
569
|
response_mode?: import("@authhero/adapter-interfaces").AuthorizationResponseMode | undefined;
|
|
565
570
|
redirect_uri?: string | undefined;
|
|
566
|
-
audience?: string | undefined;
|
|
567
571
|
organization?: string | undefined;
|
|
568
572
|
state?: string | undefined;
|
|
569
573
|
nonce?: string | undefined;
|
|
570
|
-
scope?: string | undefined;
|
|
571
574
|
prompt?: string | undefined;
|
|
572
575
|
code_challenge_method?: import("@authhero/adapter-interfaces").CodeChallengeMethod | undefined;
|
|
573
576
|
code_challenge?: string | undefined;
|
|
@@ -590,6 +593,26 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
590
593
|
vendor_id?: string | undefined;
|
|
591
594
|
};
|
|
592
595
|
}>;
|
|
596
|
+
/**
|
|
597
|
+
* The `http://auth0.com/oauth/grant-type/passwordless/otp` grant at
|
|
598
|
+
* /oauth/token.
|
|
599
|
+
*
|
|
600
|
+
* Unlike the authorization-code exchange — where /authorize has already
|
|
601
|
+
* authenticated the login session and created a session — nothing has run for
|
|
602
|
+
* this login yet: /passwordless/start only stores a PENDING login session and
|
|
603
|
+
* an OTP. So authenticate it here, which creates the session the auth cookie
|
|
604
|
+
* and the refresh token below both hang off, then mint a refresh token when
|
|
605
|
+
* `offline_access` was requested (issue #1273).
|
|
606
|
+
*
|
|
607
|
+
* The sibling front-channel path (`passwordlessGrant`, used by
|
|
608
|
+
* /co/authenticate) does not go through here: createFrontChannelAuthResponse
|
|
609
|
+
* does both steps itself, and skips the refresh token for code flows so the
|
|
610
|
+
* exchange issues it instead.
|
|
611
|
+
*/
|
|
612
|
+
export declare function passwordlessOtpGrant(ctx: Context<{
|
|
613
|
+
Bindings: Bindings;
|
|
614
|
+
Variables: Variables;
|
|
615
|
+
}>, params: z.input<typeof passwordlessGrantParamsSchema>): Promise<GrantFlowUserResult>;
|
|
593
616
|
export declare function passwordlessGrant(ctx: Context<{
|
|
594
617
|
Bindings: Bindings;
|
|
595
618
|
Variables: Variables;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const USERNAME_PASSWORD_PROVIDER = "auth0";
|
|
2
|
+
export declare const JWT_CERT_VALIDITY_DAYS = 365;
|
|
3
|
+
export declare const SAML_CERT_VALIDITY_DAYS: number;
|
|
2
4
|
export declare const JWKS_CACHE_TIMEOUT_IN_SECONDS: number;
|
|
3
5
|
export declare const SILENT_AUTH_MAX_AGE_IN_SECONDS: number;
|
|
4
6
|
export declare const UNIVERSAL_AUTH_SESSION_EXPIRES_IN_SECONDS: number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DataAdapters } from "@authhero/adapter-interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* The parts of a session this cascade needs: its own id, which refresh tokens
|
|
4
|
+
* point at through `session_id`, and the login session it originated from,
|
|
5
|
+
* which is the only link rows minted before that column existed carry.
|
|
6
|
+
*/
|
|
7
|
+
export interface RevocableSession {
|
|
8
|
+
id: string;
|
|
9
|
+
login_session_id?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Revoke every refresh token issued under a session.
|
|
13
|
+
*
|
|
14
|
+
* Call this only where a session is *deliberately* ended — an admin revoking
|
|
15
|
+
* or deleting it, or a user being blocked. Natural expiry and cleanup must not
|
|
16
|
+
* cascade: a refresh token is designed to outlive its session, and killing
|
|
17
|
+
* tokens on an SSO timeout would log out every long-lived native client on
|
|
18
|
+
* each timeout. Revocation couples; lifetime does not.
|
|
19
|
+
*
|
|
20
|
+
* Two sweeps, run in sequence:
|
|
21
|
+
*
|
|
22
|
+
* 1. `session_id` — the ownership edge, and the one that is actually complete.
|
|
23
|
+
* 2. `login_id` — legacy fallback for rows minted before `session_id` existed.
|
|
24
|
+
* `sessions.login_session_id` records only the session's *originating*
|
|
25
|
+
* authorization transaction and is never repointed on SSO reuse, so on its
|
|
26
|
+
* own it misses every token minted during a later re-authorization. It is
|
|
27
|
+
* retained until pre-Stage-2 rows have aged out (#1259) and then dropped.
|
|
28
|
+
*
|
|
29
|
+
* Sequential rather than parallel because a row can match both predicates, and
|
|
30
|
+
* both adapters guard on `revoked_at IS NULL` — so the second sweep skips what
|
|
31
|
+
* the first already revoked instead of double-counting it.
|
|
32
|
+
*/
|
|
33
|
+
export declare function revokeSessionRefreshTokens(data: DataAdapters, tenant_id: string, session: RevocableSession, revoked_at: string): Promise<number>;
|
|
@@ -17,6 +17,17 @@ export interface ResolveSigningKeysOptions {
|
|
|
17
17
|
export declare function resolveSigningKeys(keys: KeysAdapter, tenantId: string, modeOption: SigningKeyModeOption | undefined, opts: ResolveSigningKeysOptions): Promise<SigningKey[]>;
|
|
18
18
|
/** A key is signable only if it carries private material, not just a cert. */
|
|
19
19
|
export declare function isSignable(key: SigningKey): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* A key with `current_since` in the future is *staged*: published so relying
|
|
22
|
+
* parties can pre-trust it, but not yet signing anything.
|
|
23
|
+
*
|
|
24
|
+
* This is what makes a zero-downtime rotation possible for a SAML service
|
|
25
|
+
* provider that pins the certificate out-of-band. The new certificate appears
|
|
26
|
+
* in the IdP metadata immediately, the operator gets it to the service
|
|
27
|
+
* provider, and only then does it start signing — the reverse order breaks
|
|
28
|
+
* every login in between.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isStaged(key: SigningKey, now?: Date): boolean;
|
|
20
31
|
export interface EnsureSigningKeyOptions {
|
|
21
32
|
/**
|
|
22
33
|
* When set, the key is created tenant-scoped (`tenant_id` stamped) and the
|