authhero 9.40.0 → 9.42.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-6774edd2.entry.js +1 -0
- package/dist/authhero.cjs +114 -111
- package/dist/authhero.d.ts +707 -431
- package/dist/authhero.mjs +16567 -12663
- package/dist/{mfa-BlaRHQgI.js → mfa-C8qBEQeH.js} +2 -2
- package/dist/{mfa-Ddp9JT1l.mjs → mfa-CVF4Wbdz.mjs} +106 -106
- package/dist/mfa-attempts-CzGjIGzD.js +395 -0
- package/dist/{mfa-attempts-YsmteBp0.mjs → mfa-attempts-sV0Xs59R.mjs} +5651 -5026
- package/dist/{passkey-enrollment-CLg7RteL.js → passkey-enrollment-CAb2zWEF.js} +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/mfa-attempts.d.ts +7 -0
- package/dist/types/authentication-flows/passwordless.d.ts +2 -2
- package/dist/types/generated/locale-types.d.ts +6 -0
- package/dist/types/helpers/client.d.ts +26 -0
- package/dist/types/helpers/login-migration.d.ts +56 -0
- package/dist/types/helpers/login-version.d.ts +18 -0
- package/dist/types/helpers/management-audience.d.ts +11 -0
- package/dist/types/helpers/reserved-claims.d.ts +2 -2
- package/dist/types/helpers/saml-connection-options.d.ts +24 -0
- package/dist/types/helpers/saml-request-signature.d.ts +36 -0
- package/dist/types/hooks/codehooks.d.ts +45 -0
- package/dist/types/hooks/lifecycle-codehooks.d.ts +1 -1
- package/dist/types/index.d.ts +426 -207
- package/dist/types/routes/auth-api/authorize.d.ts +13 -13
- package/dist/types/routes/auth-api/callback.d.ts +42 -6
- package/dist/types/routes/auth-api/device.d.ts +13 -13
- package/dist/types/routes/auth-api/index.d.ts +103 -67
- package/dist/types/routes/auth-api/logout.d.ts +2 -2
- package/dist/types/routes/auth-api/oidc-logout.d.ts +3 -3
- package/dist/types/routes/auth-api/passwordless.d.ts +16 -16
- package/dist/types/routes/auth-api/revoke.d.ts +6 -6
- package/dist/types/routes/auth-api/token.d.ts +12 -12
- package/dist/types/routes/management-api/action-executions.d.ts +1 -1
- package/dist/types/routes/management-api/action-triggers.d.ts +25 -25
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/branding.d.ts +3 -3
- package/dist/types/routes/management-api/clients.d.ts +30 -0
- package/dist/types/routes/management-api/connections.d.ts +91 -1
- 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/failed-events.d.ts +2 -2
- package/dist/types/routes/management-api/forms.d.ts +152 -152
- 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 -21
- package/dist/types/routes/management-api/index.d.ts +233 -113
- package/dist/types/routes/management-api/keys.d.ts +16 -16
- package/dist/types/routes/management-api/log-streams.d.ts +6 -6
- 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 +2 -2
- package/dist/types/routes/management-api/prompts.d.ts +6 -6
- package/dist/types/routes/management-api/roles.d.ts +1 -1
- package/dist/types/routes/management-api/rollouts.d.ts +6 -6
- package/dist/types/routes/management-api/self-service-profiles.d.ts +7 -7
- package/dist/types/routes/management-api/tenant-operations.d.ts +5 -5
- package/dist/types/routes/management-api/tenants.d.ts +13 -9
- package/dist/types/routes/management-api/users.d.ts +35 -35
- package/dist/types/routes/saml/index.d.ts +72 -9
- package/dist/types/routes/saml/samlp.d.ts +72 -9
- package/dist/types/routes/universal-login/common.d.ts +2 -0
- package/dist/types/routes/universal-login/continue.d.ts +4 -4
- 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/impersonate.d.ts +4 -4
- package/dist/types/routes/universal-login/index.d.ts +8 -8
- package/dist/types/routes/universal-login/screens/login-otp.d.ts +79 -5
- package/dist/types/routes/universal-login/screens/magic-link-sent.d.ts +8 -1
- package/dist/types/routes/universal-login/u2-index.d.ts +9 -9
- package/dist/types/routes/universal-login/u2-routes.d.ts +8 -7
- package/dist/types/state-machines/login-session-data.d.ts +36 -1
- package/dist/types/state-machines/login-session.d.ts +17 -1
- package/dist/types/strategies/index.d.ts +2 -0
- package/dist/types/strategies/samlp.d.ts +58 -0
- package/dist/types/types/AuthHeroConfig.d.ts +15 -1
- package/dist/types/types/Bindings.d.ts +2 -1
- package/dist/types/types/Variables.d.ts +2 -0
- package/dist/types/utils/ssrf-fetch.d.ts +2 -0
- package/dist/types/variables.d.ts +7 -6
- package/package.json +9 -6
- package/dist/assets/u/widget/p-d0eb5acc.entry.js +0 -1
- package/dist/mfa-attempts-bPJnyu2c.js +0 -385
|
@@ -27,7 +27,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
27
27
|
output: {
|
|
28
28
|
screen: {
|
|
29
29
|
action: string;
|
|
30
|
-
method: "
|
|
30
|
+
method: "GET" | "POST";
|
|
31
31
|
components: {
|
|
32
32
|
id: string;
|
|
33
33
|
type: string;
|
|
@@ -43,7 +43,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
43
43
|
hint?: string | undefined;
|
|
44
44
|
messages?: {
|
|
45
45
|
text: string;
|
|
46
|
-
type: "
|
|
46
|
+
type: "error" | "success" | "info" | "warning";
|
|
47
47
|
id?: number | undefined;
|
|
48
48
|
}[] | undefined;
|
|
49
49
|
}[];
|
|
@@ -51,7 +51,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
51
51
|
description?: string | undefined;
|
|
52
52
|
messages?: {
|
|
53
53
|
text: string;
|
|
54
|
-
type: "
|
|
54
|
+
type: "error" | "success" | "info" | "warning";
|
|
55
55
|
id?: number | undefined;
|
|
56
56
|
}[] | undefined;
|
|
57
57
|
links?: {
|
|
@@ -107,7 +107,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
107
107
|
output: {
|
|
108
108
|
screen: {
|
|
109
109
|
action: string;
|
|
110
|
-
method: "
|
|
110
|
+
method: "GET" | "POST";
|
|
111
111
|
components: {
|
|
112
112
|
id: string;
|
|
113
113
|
type: string;
|
|
@@ -123,7 +123,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
123
123
|
hint?: string | undefined;
|
|
124
124
|
messages?: {
|
|
125
125
|
text: string;
|
|
126
|
-
type: "
|
|
126
|
+
type: "error" | "success" | "info" | "warning";
|
|
127
127
|
id?: number | undefined;
|
|
128
128
|
}[] | undefined;
|
|
129
129
|
}[];
|
|
@@ -131,7 +131,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
131
131
|
description?: string | undefined;
|
|
132
132
|
messages?: {
|
|
133
133
|
text: string;
|
|
134
|
-
type: "
|
|
134
|
+
type: "error" | "success" | "info" | "warning";
|
|
135
135
|
id?: number | undefined;
|
|
136
136
|
}[] | undefined;
|
|
137
137
|
links?: {
|
|
@@ -204,7 +204,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
204
204
|
output: {
|
|
205
205
|
screen: {
|
|
206
206
|
action: string;
|
|
207
|
-
method: "
|
|
207
|
+
method: "GET" | "POST";
|
|
208
208
|
components: {
|
|
209
209
|
id: string;
|
|
210
210
|
type: string;
|
|
@@ -220,7 +220,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
220
220
|
hint?: string | undefined;
|
|
221
221
|
messages?: {
|
|
222
222
|
text: string;
|
|
223
|
-
type: "
|
|
223
|
+
type: "error" | "success" | "info" | "warning";
|
|
224
224
|
id?: number | undefined;
|
|
225
225
|
}[] | undefined;
|
|
226
226
|
}[];
|
|
@@ -228,7 +228,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
228
228
|
description?: string | undefined;
|
|
229
229
|
messages?: {
|
|
230
230
|
text: string;
|
|
231
|
-
type: "
|
|
231
|
+
type: "error" | "success" | "info" | "warning";
|
|
232
232
|
id?: number | undefined;
|
|
233
233
|
}[] | undefined;
|
|
234
234
|
links?: {
|
|
@@ -319,7 +319,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
319
319
|
output: {
|
|
320
320
|
screen: {
|
|
321
321
|
action: string;
|
|
322
|
-
method: "
|
|
322
|
+
method: "GET" | "POST";
|
|
323
323
|
components: {
|
|
324
324
|
id: string;
|
|
325
325
|
type: string;
|
|
@@ -335,7 +335,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
335
335
|
hint?: string | undefined;
|
|
336
336
|
messages?: {
|
|
337
337
|
text: string;
|
|
338
|
-
type: "
|
|
338
|
+
type: "error" | "success" | "info" | "warning";
|
|
339
339
|
id?: number | undefined;
|
|
340
340
|
}[] | undefined;
|
|
341
341
|
}[];
|
|
@@ -343,7 +343,7 @@ export declare const flowApiRoutes: OpenAPIHono<{
|
|
|
343
343
|
description?: string | undefined;
|
|
344
344
|
messages?: {
|
|
345
345
|
text: string;
|
|
346
|
-
type: "
|
|
346
|
+
type: "error" | "success" | "info" | "warning";
|
|
347
347
|
id?: number | undefined;
|
|
348
348
|
}[] | undefined;
|
|
349
349
|
links?: {
|
|
@@ -35,7 +35,7 @@ export declare const identifierRoutes: OpenAPIHono<{
|
|
|
35
35
|
};
|
|
36
36
|
output: {};
|
|
37
37
|
outputFormat: string;
|
|
38
|
-
status:
|
|
38
|
+
status: 400;
|
|
39
39
|
} | {
|
|
40
40
|
input: {
|
|
41
41
|
query: {
|
|
@@ -49,7 +49,7 @@ export declare const identifierRoutes: OpenAPIHono<{
|
|
|
49
49
|
};
|
|
50
50
|
output: {};
|
|
51
51
|
outputFormat: string;
|
|
52
|
-
status:
|
|
52
|
+
status: 302;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
}, "/">;
|
|
@@ -13,7 +13,7 @@ export declare const impersonateRoutes: OpenAPIHono<{
|
|
|
13
13
|
};
|
|
14
14
|
output: {};
|
|
15
15
|
outputFormat: string;
|
|
16
|
-
status:
|
|
16
|
+
status: 400;
|
|
17
17
|
} | {
|
|
18
18
|
input: {
|
|
19
19
|
query: {
|
|
@@ -22,7 +22,7 @@ export declare const impersonateRoutes: OpenAPIHono<{
|
|
|
22
22
|
};
|
|
23
23
|
output: {};
|
|
24
24
|
outputFormat: string;
|
|
25
|
-
status:
|
|
25
|
+
status: 200;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
} & {
|
|
@@ -52,7 +52,7 @@ export declare const impersonateRoutes: OpenAPIHono<{
|
|
|
52
52
|
};
|
|
53
53
|
output: {};
|
|
54
54
|
outputFormat: string;
|
|
55
|
-
status:
|
|
55
|
+
status: 400;
|
|
56
56
|
} | {
|
|
57
57
|
input: {
|
|
58
58
|
query: {
|
|
@@ -65,7 +65,7 @@ export declare const impersonateRoutes: OpenAPIHono<{
|
|
|
65
65
|
};
|
|
66
66
|
output: {};
|
|
67
67
|
outputFormat: string;
|
|
68
|
-
status:
|
|
68
|
+
status: 302;
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
}, "/">;
|
|
@@ -27,7 +27,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
27
27
|
};
|
|
28
28
|
output: {};
|
|
29
29
|
outputFormat: string;
|
|
30
|
-
status:
|
|
30
|
+
status: 400;
|
|
31
31
|
} | {
|
|
32
32
|
input: {
|
|
33
33
|
query: {
|
|
@@ -36,7 +36,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
36
36
|
};
|
|
37
37
|
output: {};
|
|
38
38
|
outputFormat: string;
|
|
39
|
-
status:
|
|
39
|
+
status: 302;
|
|
40
40
|
} | {
|
|
41
41
|
input: {
|
|
42
42
|
query: {
|
|
@@ -126,7 +126,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
126
126
|
};
|
|
127
127
|
output: {};
|
|
128
128
|
outputFormat: string;
|
|
129
|
-
status:
|
|
129
|
+
status: 400;
|
|
130
130
|
} | {
|
|
131
131
|
input: {
|
|
132
132
|
query: {
|
|
@@ -135,7 +135,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
135
135
|
};
|
|
136
136
|
output: {};
|
|
137
137
|
outputFormat: string;
|
|
138
|
-
status:
|
|
138
|
+
status: 200;
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
141
|
} & {
|
|
@@ -165,7 +165,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
165
165
|
};
|
|
166
166
|
output: {};
|
|
167
167
|
outputFormat: string;
|
|
168
|
-
status:
|
|
168
|
+
status: 400;
|
|
169
169
|
} | {
|
|
170
170
|
input: {
|
|
171
171
|
query: {
|
|
@@ -178,7 +178,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
178
178
|
};
|
|
179
179
|
output: {};
|
|
180
180
|
outputFormat: string;
|
|
181
|
-
status:
|
|
181
|
+
status: 302;
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
184
|
}, "/impersonate"> & import("hono/types").MergeSchemaPath<{
|
|
@@ -520,7 +520,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
520
520
|
};
|
|
521
521
|
output: {};
|
|
522
522
|
outputFormat: string;
|
|
523
|
-
status:
|
|
523
|
+
status: 400;
|
|
524
524
|
} | {
|
|
525
525
|
input: {
|
|
526
526
|
query: {
|
|
@@ -534,7 +534,7 @@ export default function create(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
534
534
|
};
|
|
535
535
|
output: {};
|
|
536
536
|
outputFormat: string;
|
|
537
|
-
status:
|
|
537
|
+
status: 302;
|
|
538
538
|
};
|
|
539
539
|
};
|
|
540
540
|
}, "/login/identifier"> & import("hono/types").MergeSchemaPath<{
|
|
@@ -2,16 +2,90 @@ import type { Context } from "hono";
|
|
|
2
2
|
import type { LoginSession } from "@authhero/adapter-interfaces";
|
|
3
3
|
import type { EnrichedClient } from "../../../helpers/client";
|
|
4
4
|
import type { Bindings, Variables } from "../../../types";
|
|
5
|
+
import type { ScreenContext, ScreenFactory, ScreenResult } from "./types";
|
|
6
|
+
type OtpContext = Context<{
|
|
7
|
+
Bindings: Bindings;
|
|
8
|
+
Variables: Variables;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Login OTP codes or magic links (identifier step plus resends) delivered per
|
|
12
|
+
* login session. Further requests are accepted but nothing is sent.
|
|
13
|
+
*
|
|
14
|
+
* Reserved atomically (see reserveLoginSessionCounter), so concurrent requests
|
|
15
|
+
* on one session cannot exceed it on adapters that implement
|
|
16
|
+
* `updateIfStateDataUnchanged`; other adapters fall back to a best-effort
|
|
17
|
+
* read/modify/write. The optional per-recipient rate limit adds a bound
|
|
18
|
+
* across sessions, but it is not configured by default and fails open on
|
|
19
|
+
* adapter errors, so it is not a hard guarantee.
|
|
20
|
+
*/
|
|
21
|
+
export declare const LOGIN_OTP_MAX_SENDS = 5;
|
|
22
|
+
/**
|
|
23
|
+
* Count a login OTP delivery on the login session and consume the optional
|
|
24
|
+
* per-recipient rate limit. Returns false when either limit is reached, or
|
|
25
|
+
* when the session is already finalized; callers then skip delivery but
|
|
26
|
+
* respond as usual, so the response does not reveal the limit or whether
|
|
27
|
+
* the address exists. Counted before sending, so failed sends count too.
|
|
28
|
+
*
|
|
29
|
+
* Order: check the session cap without writing, then the recipient rate
|
|
30
|
+
* limit, then reserve the slot atomically. A request the rate limit rejects
|
|
31
|
+
* does not use up the session's allowance, and a session already at its cap
|
|
32
|
+
* does not consume the recipient's rate limit. Concurrent requests may all
|
|
33
|
+
* pass the first check, but only LOGIN_OTP_MAX_SENDS of them can reserve.
|
|
34
|
+
*/
|
|
35
|
+
export declare function allowLoginOtpSend(ctx: OtpContext, { tenantId, loginSessionId, to, }: {
|
|
36
|
+
tenantId: string;
|
|
37
|
+
loginSessionId: string;
|
|
38
|
+
to: string;
|
|
39
|
+
}): Promise<boolean>;
|
|
5
40
|
/**
|
|
6
41
|
* Create a one-time code bound to the login session and to `to`, and deliver
|
|
7
42
|
* it to the user, either as a code or (for magic-link email connections) as a link.
|
|
43
|
+
*
|
|
44
|
+
* Subject to the per-session send cap and per-recipient rate limit in
|
|
45
|
+
* allowLoginOtpSend; returns false, without sending, when a limit is hit.
|
|
8
46
|
*/
|
|
9
|
-
export declare function sendLoginOtp(ctx:
|
|
10
|
-
Bindings: Bindings;
|
|
11
|
-
Variables: Variables;
|
|
12
|
-
}>, { client, loginSession, to, magicLink, }: {
|
|
47
|
+
export declare function sendLoginOtp(ctx: OtpContext, { client, loginSession, to, magicLink, }: {
|
|
13
48
|
client: EnrichedClient;
|
|
14
49
|
loginSession: LoginSession;
|
|
15
50
|
to: string;
|
|
16
51
|
magicLink: boolean;
|
|
17
|
-
}): Promise<
|
|
52
|
+
}): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Re-send the login OTP (code or magic link) for the login session behind
|
|
55
|
+
* `state`, to the username the identifier step stored on it.
|
|
56
|
+
*
|
|
57
|
+
* Only re-sends when a login OTP was issued for this session to the same
|
|
58
|
+
* recipient before. The enumeration-safe stub path in the identifier screens
|
|
59
|
+
* shows the challenge without issuing a code, and a resend must not start
|
|
60
|
+
* delivering to an unknown address either, nor to a new address the session
|
|
61
|
+
* switched to after a code went to an earlier one. Repeated resends are capped by allowLoginOtpSend;
|
|
62
|
+
* past the cap the caller still shows the usual "code sent" message.
|
|
63
|
+
*
|
|
64
|
+
* Returns false when the login session is gone or has no username.
|
|
65
|
+
*/
|
|
66
|
+
export declare function resendLoginOtp(ctx: OtpContext, { client, state, magicLink, }: {
|
|
67
|
+
client: EnrichedClient;
|
|
68
|
+
state: string;
|
|
69
|
+
magicLink: boolean;
|
|
70
|
+
}): Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* POST handler body for the RESEND_BUTTON on the login OTP screens
|
|
73
|
+
* (email-otp-challenge, sms-otp-challenge, magic-link-sent): re-send and
|
|
74
|
+
* re-render the screen with a success or error message. A delivery error is
|
|
75
|
+
* shown as such, except in enumeration-safe mode
|
|
76
|
+
* (client.hide_sign_up_disabled_error), where it gets the usual success
|
|
77
|
+
* message like every other resend.
|
|
78
|
+
*/
|
|
79
|
+
export declare function loginOtpResendResult(context: ScreenContext, { render, magicLink, successText, failedText, expiredText, }: {
|
|
80
|
+
render: ScreenFactory;
|
|
81
|
+
magicLink: boolean;
|
|
82
|
+
successText: string;
|
|
83
|
+
failedText: string;
|
|
84
|
+
expiredText: string;
|
|
85
|
+
}): Promise<{
|
|
86
|
+
screen: ScreenResult;
|
|
87
|
+
} | {
|
|
88
|
+
error: string;
|
|
89
|
+
screen: ScreenResult;
|
|
90
|
+
}>;
|
|
91
|
+
export {};
|
|
@@ -3,9 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Shown after a magic link has been sent to the user's email.
|
|
5
5
|
* Tells the user to check their email and click the link to log in.
|
|
6
|
+
*
|
|
7
|
+
* Corresponds to: /u2/login/magic-link-sent
|
|
6
8
|
*/
|
|
7
|
-
import type { ScreenContext, ScreenResult } from "./types";
|
|
9
|
+
import type { ScreenContext, ScreenResult, ScreenDefinition } from "./types";
|
|
8
10
|
/**
|
|
9
11
|
* Create the magic-link-sent screen
|
|
10
12
|
*/
|
|
11
13
|
export declare function magicLinkSentScreen(context: ScreenContext): Promise<ScreenResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Screen definition for the magic-link-sent screen. The only action is the
|
|
16
|
+
* resend button; any other POST re-renders the screen.
|
|
17
|
+
*/
|
|
18
|
+
export declare const magicLinkSentScreenDefinition: ScreenDefinition;
|
|
@@ -195,7 +195,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
195
195
|
$get: {
|
|
196
196
|
input: {
|
|
197
197
|
param: {
|
|
198
|
-
screen: "
|
|
198
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "account" | "enter-password" | "try-connection-result" | "invalid-session" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
|
|
199
199
|
};
|
|
200
200
|
} & {
|
|
201
201
|
query: {
|
|
@@ -211,7 +211,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
211
211
|
} | {
|
|
212
212
|
input: {
|
|
213
213
|
param: {
|
|
214
|
-
screen: "
|
|
214
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "account" | "enter-password" | "try-connection-result" | "invalid-session" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
|
|
215
215
|
};
|
|
216
216
|
} & {
|
|
217
217
|
query: {
|
|
@@ -223,11 +223,11 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
223
223
|
};
|
|
224
224
|
output: {};
|
|
225
225
|
outputFormat: string;
|
|
226
|
-
status:
|
|
226
|
+
status: 400;
|
|
227
227
|
} | {
|
|
228
228
|
input: {
|
|
229
229
|
param: {
|
|
230
|
-
screen: "
|
|
230
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "account" | "enter-password" | "try-connection-result" | "invalid-session" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
|
|
231
231
|
};
|
|
232
232
|
} & {
|
|
233
233
|
query: {
|
|
@@ -239,7 +239,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
239
239
|
};
|
|
240
240
|
output: {};
|
|
241
241
|
outputFormat: string;
|
|
242
|
-
status:
|
|
242
|
+
status: 302;
|
|
243
243
|
};
|
|
244
244
|
};
|
|
245
245
|
} & {
|
|
@@ -247,7 +247,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
247
247
|
$post: {
|
|
248
248
|
input: {
|
|
249
249
|
param: {
|
|
250
|
-
screen: "
|
|
250
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
|
|
251
251
|
};
|
|
252
252
|
} & {
|
|
253
253
|
query: {
|
|
@@ -265,7 +265,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
265
265
|
} | {
|
|
266
266
|
input: {
|
|
267
267
|
param: {
|
|
268
|
-
screen: "
|
|
268
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
|
|
269
269
|
};
|
|
270
270
|
} & {
|
|
271
271
|
query: {
|
|
@@ -306,7 +306,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
306
306
|
};
|
|
307
307
|
output: {};
|
|
308
308
|
outputFormat: string;
|
|
309
|
-
status:
|
|
309
|
+
status: 400;
|
|
310
310
|
} | {
|
|
311
311
|
input: {
|
|
312
312
|
query: {
|
|
@@ -315,7 +315,7 @@ export default function createU2App(config: AuthHeroConfig): OpenAPIHono<{
|
|
|
315
315
|
};
|
|
316
316
|
output: {};
|
|
317
317
|
outputFormat: string;
|
|
318
|
-
status:
|
|
318
|
+
status: 302;
|
|
319
319
|
} | {
|
|
320
320
|
input: {
|
|
321
321
|
query: {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* - GET /u2/login/identifier - Identifier screen (first screen of login flow)
|
|
9
9
|
* - GET /u2/login/email-otp-challenge - Email OTP code verification
|
|
10
10
|
* - GET /u2/login/sms-otp-challenge - SMS OTP code verification
|
|
11
|
+
* - GET /u2/login/magic-link-sent - Check your email for the magic link
|
|
11
12
|
* - GET /u2/enter-password - Password authentication
|
|
12
13
|
* - GET /u2/signup - New user registration
|
|
13
14
|
* - GET /u2/reset-password/request - Password reset request
|
|
@@ -200,7 +201,7 @@ export declare const u2Routes: OpenAPIHono<{
|
|
|
200
201
|
$get: {
|
|
201
202
|
input: {
|
|
202
203
|
param: {
|
|
203
|
-
screen: "
|
|
204
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "account" | "enter-password" | "try-connection-result" | "invalid-session" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
|
|
204
205
|
};
|
|
205
206
|
} & {
|
|
206
207
|
query: {
|
|
@@ -216,7 +217,7 @@ export declare const u2Routes: OpenAPIHono<{
|
|
|
216
217
|
} | {
|
|
217
218
|
input: {
|
|
218
219
|
param: {
|
|
219
|
-
screen: "
|
|
220
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "account" | "enter-password" | "try-connection-result" | "invalid-session" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
|
|
220
221
|
};
|
|
221
222
|
} & {
|
|
222
223
|
query: {
|
|
@@ -228,11 +229,11 @@ export declare const u2Routes: OpenAPIHono<{
|
|
|
228
229
|
};
|
|
229
230
|
output: {};
|
|
230
231
|
outputFormat: string;
|
|
231
|
-
status:
|
|
232
|
+
status: 400;
|
|
232
233
|
} | {
|
|
233
234
|
input: {
|
|
234
235
|
param: {
|
|
235
|
-
screen: "
|
|
236
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "account" | "enter-password" | "try-connection-result" | "invalid-session" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation" | "device/complete";
|
|
236
237
|
};
|
|
237
238
|
} & {
|
|
238
239
|
query: {
|
|
@@ -244,7 +245,7 @@ export declare const u2Routes: OpenAPIHono<{
|
|
|
244
245
|
};
|
|
245
246
|
output: {};
|
|
246
247
|
outputFormat: string;
|
|
247
|
-
status:
|
|
248
|
+
status: 302;
|
|
248
249
|
};
|
|
249
250
|
};
|
|
250
251
|
} & {
|
|
@@ -252,7 +253,7 @@ export declare const u2Routes: OpenAPIHono<{
|
|
|
252
253
|
$post: {
|
|
253
254
|
input: {
|
|
254
255
|
param: {
|
|
255
|
-
screen: "
|
|
256
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
|
|
256
257
|
};
|
|
257
258
|
} & {
|
|
258
259
|
query: {
|
|
@@ -270,7 +271,7 @@ export declare const u2Routes: OpenAPIHono<{
|
|
|
270
271
|
} | {
|
|
271
272
|
input: {
|
|
272
273
|
param: {
|
|
273
|
-
screen: "
|
|
274
|
+
screen: "impersonate" | "signup" | "login" | "consent" | "reset-password" | "enter-password" | "login/identifier" | "login/email-otp-challenge" | "login/sms-otp-challenge" | "login/magic-link-sent" | "login/login-passwordless-identifier" | "login/email-verification" | "login/email-verification-sent" | "reset-password/code" | "reset-password/request" | "mfa/login-options" | "mfa/totp-challenge" | "mfa/totp-enrollment" | "mfa/phone-challenge" | "mfa/phone-enrollment" | "passkey/challenge" | "passkey/enrollment" | "passkey/enrollment-nudge" | "account/profile" | "account/change-email" | "account/change-email/verify" | "account/security" | "account/security/totp-enrollment" | "account/security/phone-enrollment" | "account/linked" | "account/delete" | "account/passkeys" | "connect/start" | "connect/select-tenant" | "self-service/app" | "device/code" | "device/confirmation";
|
|
274
275
|
};
|
|
275
276
|
} & {
|
|
276
277
|
query: {
|
|
@@ -8,12 +8,47 @@ export type LoginSessionDataEvent = Extract<LoginSessionEvent, {
|
|
|
8
8
|
export declare class FinalizedLoginSessionError extends Error {
|
|
9
9
|
constructor(id: string);
|
|
10
10
|
}
|
|
11
|
+
/** Completed, failed and expired sessions accept no further context updates. */
|
|
12
|
+
export declare function isFinalizedLoginSession(session: Pick<LoginSession, "state">): boolean;
|
|
13
|
+
/** Thrown when every compare-and-swap round lost to a concurrent write. */
|
|
14
|
+
export declare class LoginSessionContentionError extends Error {
|
|
15
|
+
constructor(id: string);
|
|
16
|
+
}
|
|
11
17
|
/**
|
|
12
18
|
* Sole persistence boundary for session context updates. Always reduce against
|
|
13
19
|
* the latest stored context, never a caller's stale session snapshot. Optional
|
|
14
20
|
* session fields (e.g. MFA state) are persisted in the same adapter update.
|
|
15
|
-
*
|
|
21
|
+
*
|
|
22
|
+
* Written with the adapter's `updateIfStateDataUnchanged` when available: if
|
|
23
|
+
* another write landed since the read, the event is re-applied to the newer
|
|
24
|
+
* context. So an update never writes back a stale snapshot, e.g. an older
|
|
25
|
+
* counter value reserved by reserveLoginSessionCounter in the meantime.
|
|
26
|
+
* Adapters without that method fall back to a plain read/modify/write.
|
|
16
27
|
*/
|
|
17
28
|
export declare function updateLoginSessionData(sessions: LoginSessionsAdapter, tenantId: string, id: string, event: LoginSessionDataEvent, fields?: Omit<Partial<LoginSession>, "state_data">): Promise<boolean>;
|
|
29
|
+
/** Per-session send counters that reserveLoginSessionCounter can cap. */
|
|
30
|
+
export type LoginSessionCounter = "login_otp_sent" | "mfa_sms_sent";
|
|
31
|
+
export type LoginSessionCounterStatus =
|
|
32
|
+
/** The counter was incremented; the caller owns one slot. */
|
|
33
|
+
"reserved"
|
|
34
|
+
/** The counter is already at `max`; nothing was written. */
|
|
35
|
+
| "limit_reached" | "not_found" | "finalized"
|
|
36
|
+
/** Every compare-and-swap attempt lost to a concurrent write. */
|
|
37
|
+
| "contended";
|
|
38
|
+
export interface LoginSessionCounterReservation {
|
|
39
|
+
status: LoginSessionCounterStatus;
|
|
40
|
+
/** The session as last read (before the increment), when it exists. */
|
|
41
|
+
session?: LoginSession;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Atomically reserve one slot of a per-session counter capped at `max`.
|
|
45
|
+
*
|
|
46
|
+
* The increment is written with the adapter's `updateIfStateDataUnchanged`,
|
|
47
|
+
* which only applies while `state_data` still equals what was read; a lost
|
|
48
|
+
* race re-reads and retries. Because the counter only grows, concurrent
|
|
49
|
+
* requests can never reserve more than `max` slots in total. Adapters without
|
|
50
|
+
* that method fall back to a plain update (best effort, not atomic).
|
|
51
|
+
*/
|
|
52
|
+
export declare function reserveLoginSessionCounter(sessions: LoginSessionsAdapter, tenantId: string, id: string, counter: LoginSessionCounter, max: number): Promise<LoginSessionCounterReservation>;
|
|
18
53
|
/** Initialize context through the same machine reducer before inserting it. */
|
|
19
54
|
export declare function createLoginSessionWithData(sessions: LoginSessionsAdapter, tenantId: string, fields: Omit<LoginSessionInsert, "state_data">, data: Omit<LoginSessionData, "passwordReset">): Promise<LoginSession>;
|
|
@@ -11,6 +11,18 @@ export interface MfaRequiredByAction {
|
|
|
11
11
|
*/
|
|
12
12
|
allow_remember_browser: boolean;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Custom claims a post-login action set with `api.accessToken.setCustomClaim`
|
|
16
|
+
* / `api.idToken.setCustomClaim` (issue #1816). Applied to the tokens issued
|
|
17
|
+
* for this login, including the authorization-code exchange, and only for the
|
|
18
|
+
* user the hooks settled on. Refresh-token exchanges don't apply them: they
|
|
19
|
+
* don't re-run post-login actions.
|
|
20
|
+
*/
|
|
21
|
+
export interface PostLoginActionClaims {
|
|
22
|
+
user_id: string;
|
|
23
|
+
access_token?: Record<string, unknown>;
|
|
24
|
+
id_token?: Record<string, unknown>;
|
|
25
|
+
}
|
|
14
26
|
/** Persisted context, grouped by responsibility in types, flat on disk. */
|
|
15
27
|
export interface LoginSessionData {
|
|
16
28
|
passwordReset?: PasswordResetFlow;
|
|
@@ -21,6 +33,8 @@ export interface LoginSessionData {
|
|
|
21
33
|
* already run for this login so the resume after MFA does not run them again.
|
|
22
34
|
*/
|
|
23
35
|
mfa_required_by_action?: MfaRequiredByAction;
|
|
36
|
+
/** Token claims set by post-login actions, see {@link PostLoginActionClaims}. */
|
|
37
|
+
action_claims?: PostLoginActionClaims;
|
|
24
38
|
/** Authentication method type that satisfied MFA (e.g. "totp", "phone") */
|
|
25
39
|
mfa_method?: string;
|
|
26
40
|
/** When MFA was verified (ISO 8601); copied onto the browser session */
|
|
@@ -31,6 +45,8 @@ export interface LoginSessionData {
|
|
|
31
45
|
guardian_enrollment?: boolean;
|
|
32
46
|
mfa_failed_attempts?: number;
|
|
33
47
|
mfa_sms_sent?: number;
|
|
48
|
+
/** Login OTP codes/links sent (identifier step plus resends), see screens/login-otp.ts */
|
|
49
|
+
login_otp_sent?: number;
|
|
34
50
|
pending_email_verification?: unknown;
|
|
35
51
|
/** u2 change-email: the address a code was sent to, shown on the verify step */
|
|
36
52
|
pending_email_change?: {
|
|
@@ -264,7 +280,7 @@ export declare const loginSessionMachine: import("xstate").StateMachine<LoginSes
|
|
|
264
280
|
}, {
|
|
265
281
|
type: "passwordResetRequested";
|
|
266
282
|
params: unknown;
|
|
267
|
-
}, never, "pending" | "failed" | "expired" | "authenticated" | "awaiting_email_verification" | "awaiting_mfa" | "awaiting_consent" | "awaiting_hook" | "awaiting_continuation"
|
|
283
|
+
}, never, "pending" | "failed" | "expired" | "completed" | "authenticated" | "awaiting_email_verification" | "awaiting_mfa" | "awaiting_consent" | "awaiting_hook" | "awaiting_continuation", string, import("xstate").NonReducibleUnknown, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
|
|
268
284
|
id: "loginSession";
|
|
269
285
|
states: {
|
|
270
286
|
readonly pending: {};
|