authhero 9.3.0 → 9.4.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-b5f14fa6.entry.js +1 -0
- package/dist/assets/u/widget/p-f94037cd.entry.js +1 -0
- package/dist/authhero.cjs +138 -137
- package/dist/authhero.d.ts +315 -268
- package/dist/authhero.mjs +13365 -13194
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/passwordless.d.ts +11 -7
- package/dist/types/helpers/client.d.ts +4 -0
- package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
- package/dist/types/helpers/session-usage.d.ts +48 -0
- package/dist/types/hooks/formhooks.d.ts +24 -0
- package/dist/types/index.d.ts +311 -268
- package/dist/types/routes/auth-api/index.d.ts +36 -36
- package/dist/types/routes/auth-api/oidc-logout.d.ts +2 -2
- package/dist/types/routes/auth-api/passwordless.d.ts +16 -16
- package/dist/types/routes/auth-api/register/index.d.ts +2 -2
- package/dist/types/routes/auth-api/revoke.d.ts +6 -6
- package/dist/types/routes/auth-api/token.d.ts +10 -10
- package/dist/types/routes/management-api/branding.d.ts +15 -15
- package/dist/types/routes/management-api/clients.d.ts +24 -16
- package/dist/types/routes/management-api/connections.d.ts +41 -21
- package/dist/types/routes/management-api/email-templates.d.ts +18 -18
- package/dist/types/routes/management-api/failed-events.d.ts +1 -1
- 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/hooks.d.ts +21 -6
- package/dist/types/routes/management-api/index.d.ts +262 -219
- package/dist/types/routes/management-api/logs.d.ts +4 -4
- 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 +28 -28
- package/dist/types/routes/management-api/themes.d.ts +6 -6
- package/dist/types/routes/management-api/users.d.ts +2 -2
- package/dist/types/routes/universal-login/common.d.ts +24 -16
- package/dist/types/routes/universal-login/continue.d.ts +2 -2
- package/dist/types/routes/universal-login/flow-api.d.ts +8 -8
- package/dist/types/routes/universal-login/identifier.d.ts +2 -2
- package/dist/types/routes/universal-login/impersonate.d.ts +2 -2
- package/dist/types/routes/universal-login/index.d.ts +6 -6
- package/dist/types/routes/universal-login/u2-index.d.ts +7 -7
- package/dist/types/routes/universal-login/u2-routes.d.ts +7 -7
- package/dist/types/routes/universal-login/u2-widget-page.d.ts +12 -0
- package/dist/types/utils/locale.d.ts +26 -0
- package/package.json +6 -6
- package/dist/assets/u/widget/p-cdfc4555.entry.js +0 -1
- package/dist/assets/u/widget/p-e95c436f.entry.js +0 -1
|
@@ -323,6 +323,9 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
323
323
|
client_secret?: string | undefined;
|
|
324
324
|
app_secret?: string | undefined;
|
|
325
325
|
scope?: string | undefined;
|
|
326
|
+
client_secret_hint?: string | undefined;
|
|
327
|
+
app_secret_hint?: string | undefined;
|
|
328
|
+
twilio_token_hint?: string | undefined;
|
|
326
329
|
authorization_endpoint?: string | undefined;
|
|
327
330
|
token_endpoint?: string | undefined;
|
|
328
331
|
userinfo_endpoint?: string | undefined;
|
|
@@ -360,6 +363,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
360
363
|
userinfo_endpoint?: string | undefined;
|
|
361
364
|
client_id?: string | undefined;
|
|
362
365
|
client_secret?: string | undefined;
|
|
366
|
+
client_secret_hint?: string | undefined;
|
|
363
367
|
realm?: string | undefined;
|
|
364
368
|
} | undefined;
|
|
365
369
|
attributes?: {
|
|
@@ -368,7 +372,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
368
372
|
active?: boolean | undefined;
|
|
369
373
|
} | undefined;
|
|
370
374
|
signup?: {
|
|
371
|
-
status?: "
|
|
375
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
372
376
|
verification?: {
|
|
373
377
|
active?: boolean | undefined;
|
|
374
378
|
} | undefined;
|
|
@@ -385,7 +389,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
385
389
|
active?: boolean | undefined;
|
|
386
390
|
} | undefined;
|
|
387
391
|
signup?: {
|
|
388
|
-
status?: "
|
|
392
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
389
393
|
} | undefined;
|
|
390
394
|
validation?: {
|
|
391
395
|
max_length?: number | undefined;
|
|
@@ -402,7 +406,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
402
406
|
active?: boolean | undefined;
|
|
403
407
|
} | undefined;
|
|
404
408
|
signup?: {
|
|
405
|
-
status?: "
|
|
409
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
406
410
|
} | undefined;
|
|
407
411
|
} | undefined;
|
|
408
412
|
} | undefined;
|
|
@@ -415,7 +419,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
415
419
|
} | undefined;
|
|
416
420
|
} | undefined;
|
|
417
421
|
passkey_options?: {
|
|
418
|
-
challenge_ui?: "
|
|
422
|
+
challenge_ui?: "button" | "both" | "autofill" | undefined;
|
|
419
423
|
local_enrollment_enabled?: boolean | undefined;
|
|
420
424
|
progressive_enrollment_enabled?: boolean | undefined;
|
|
421
425
|
} | undefined;
|
|
@@ -467,7 +471,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
467
471
|
custom_login_page_preview?: string | undefined;
|
|
468
472
|
form_template?: string | undefined;
|
|
469
473
|
addons?: Record<string, any> | undefined;
|
|
470
|
-
token_endpoint_auth_method?: "none" | "
|
|
474
|
+
token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
|
|
471
475
|
client_metadata?: Record<string, string> | undefined;
|
|
472
476
|
hide_sign_up_disabled_error?: boolean | undefined;
|
|
473
477
|
mobile?: Record<string, any> | undefined;
|
|
@@ -550,8 +554,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
550
554
|
} | undefined;
|
|
551
555
|
authenticated_at?: string | undefined;
|
|
552
556
|
};
|
|
553
|
-
connectionType: "username" | "
|
|
554
|
-
authConnection: "username" | "
|
|
557
|
+
connectionType: "username" | "email" | "sms";
|
|
558
|
+
authConnection: "username" | "email" | "sms";
|
|
555
559
|
session_id: string | undefined;
|
|
556
560
|
authParams: {
|
|
557
561
|
client_id: string;
|
|
@@ -362,6 +362,9 @@ export declare const enrichedClientSchema: z.ZodObject<{
|
|
|
362
362
|
client_secret: z.ZodOptional<z.ZodString>;
|
|
363
363
|
app_secret: z.ZodOptional<z.ZodString>;
|
|
364
364
|
scope: z.ZodOptional<z.ZodString>;
|
|
365
|
+
client_secret_hint: z.ZodOptional<z.ZodString>;
|
|
366
|
+
app_secret_hint: z.ZodOptional<z.ZodString>;
|
|
367
|
+
twilio_token_hint: z.ZodOptional<z.ZodString>;
|
|
365
368
|
authorization_endpoint: z.ZodOptional<z.ZodString>;
|
|
366
369
|
token_endpoint: z.ZodOptional<z.ZodString>;
|
|
367
370
|
userinfo_endpoint: z.ZodOptional<z.ZodString>;
|
|
@@ -408,6 +411,7 @@ export declare const enrichedClientSchema: z.ZodObject<{
|
|
|
408
411
|
userinfo_endpoint: z.ZodOptional<z.ZodString>;
|
|
409
412
|
client_id: z.ZodOptional<z.ZodString>;
|
|
410
413
|
client_secret: z.ZodOptional<z.ZodString>;
|
|
414
|
+
client_secret_hint: z.ZodOptional<z.ZodString>;
|
|
411
415
|
realm: z.ZodOptional<z.ZodString>;
|
|
412
416
|
}, z.core.$strip>>;
|
|
413
417
|
attributes: z.ZodOptional<z.ZodObject<{
|
|
@@ -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,48 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { Session } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* How stale `sessions.used_at` may get before a session touch re-stamps it.
|
|
6
|
+
*
|
|
7
|
+
* Session retention analytics bucket by week, so even a daily stamp would be
|
|
8
|
+
* ample precision there; an hour keeps the value fresh enough to be useful as
|
|
9
|
+
* "last used" in the management API without turning every refresh-token
|
|
10
|
+
* exchange into a `sessions` write. Chatty clients that refresh hourly or more
|
|
11
|
+
* cost roughly one write per hour per session instead of one per exchange.
|
|
12
|
+
*
|
|
13
|
+
* The throttle is advisory, not a lock: the check is a read followed by a
|
|
14
|
+
* write, so concurrent uses of the same session can both decide to stamp and
|
|
15
|
+
* double-write. That is harmless — both writes set `used_at` to ~now, so the
|
|
16
|
+
* stored value is correct either way — and the write volume stays bounded by
|
|
17
|
+
* request concurrency rather than by exchange count, which is the point.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SESSION_USED_AT_THROTTLE_MS: number;
|
|
20
|
+
/** The subset of a session needed to decide whether to re-stamp `used_at`. */
|
|
21
|
+
export type SessionUsage = Pick<Session, "used_at" | "created_at">;
|
|
22
|
+
/**
|
|
23
|
+
* Whether a session that is being used right now should have `used_at`
|
|
24
|
+
* re-stamped, or whether the existing value is recent enough to leave alone.
|
|
25
|
+
*
|
|
26
|
+
* A session with no `used_at` falls back to `created_at`: a session created
|
|
27
|
+
* ten minutes ago has already been counted in the current week, so there is
|
|
28
|
+
* nothing to record yet.
|
|
29
|
+
*/
|
|
30
|
+
export declare function shouldStampUsedAt(session: SessionUsage, now?: number): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Record that a session was used, off the request's critical path.
|
|
33
|
+
*
|
|
34
|
+
* Sessions are kept alive by refresh-token exchanges, but those write only to
|
|
35
|
+
* `refresh_tokens`; without this the `sessions` row keeps the `used_at` it was
|
|
36
|
+
* born with and session-retention cohorts collapse to 100% in week 0 and zero
|
|
37
|
+
* everywhere after (every session looks like it was last seen the week it was
|
|
38
|
+
* created).
|
|
39
|
+
*
|
|
40
|
+
* Both the read and the write run under `waitUntil`, so a caller on a latency-
|
|
41
|
+
* sensitive path (the token endpoint) pays nothing for them. Pass `session`
|
|
42
|
+
* when the caller already holds the row to skip the read entirely. Failures
|
|
43
|
+
* are swallowed: a missing usage stamp must never fail a grant.
|
|
44
|
+
*/
|
|
45
|
+
export declare function touchSessionUsedAt(ctx: Context<{
|
|
46
|
+
Bindings: Bindings;
|
|
47
|
+
Variables: Variables;
|
|
48
|
+
}>, tenantId: string, sessionId: string, session?: SessionUsage): void;
|
|
@@ -3,6 +3,30 @@ import { Bindings, Variables } from "../types";
|
|
|
3
3
|
import { FORM_FIELD_TYPES, LoginSession, Node, User } from "@authhero/adapter-interfaces";
|
|
4
4
|
import { EnrichedClient } from "../helpers/client";
|
|
5
5
|
export { FORM_FIELD_TYPES };
|
|
6
|
+
/**
|
|
7
|
+
* Merges this step's submitted values into the ones already collected in this
|
|
8
|
+
* login session and returns the full set for `{{$form.*}}` resolution.
|
|
9
|
+
*
|
|
10
|
+
* Each submission only carries the components of the step being submitted, so
|
|
11
|
+
* without this an `UPDATE_USER` placed after a later step resolves an earlier
|
|
12
|
+
* step's field to `undefined` and [resolveTemplateValues] drops the key —
|
|
13
|
+
* silently, since the form path emits no logs. Accumulating on the login
|
|
14
|
+
* session's `state_data` keeps every answered field resolvable for the rest of
|
|
15
|
+
* the form.
|
|
16
|
+
*
|
|
17
|
+
* The stored values are cleared along with the rest of `state_data` when the
|
|
18
|
+
* hook completes (`completeLoginSessionHook`), so they never outlive the form.
|
|
19
|
+
* Sensitive and password/code fields resolve for the current step but are
|
|
20
|
+
* never written to the session row.
|
|
21
|
+
*/
|
|
22
|
+
export declare function accumulateFormValues(ctx: Context<{
|
|
23
|
+
Bindings: Bindings;
|
|
24
|
+
Variables: Variables;
|
|
25
|
+
}>, tenantId: string, loginSessionId: string, submittedFields: Record<string, string>, components: ReadonlyArray<{
|
|
26
|
+
id: string;
|
|
27
|
+
type: string;
|
|
28
|
+
sensitive?: boolean;
|
|
29
|
+
}>): Promise<Record<string, string>>;
|
|
6
30
|
export declare function isFormHook(hook: any): hook is {
|
|
7
31
|
form_id: string;
|
|
8
32
|
enabled: boolean;
|