@logto/schemas 1.34.0 → 1.36.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/alterations/1.35.0-1764580455-remove-daily-active-users-foreign-key.ts +69 -0
- package/alterations/1.35.0-1764580589-create-aggregated-daily-active-users-table.ts +51 -0
- package/alterations/1.35.0-1764653048-update-daily-token-usage-mau-support.ts +37 -0
- package/alterations/1.35.0-1765183934-add-logs-created-at-id-index.ts +39 -0
- package/alterations/1.35.0-1765255453-update-saml-session-relay-state-to-varchar-512.ts +31 -0
- package/alterations/1.35.0-1765631949-drop-redundant-logs-id-index.ts +47 -0
- package/alterations/1.35.0-1766028646-grant-tenants-table-tag-column-read-permission.ts +39 -0
- package/alterations/1.36.0-1767193412-allow-token-exchange.ts +34 -0
- package/alterations/1.36.0-1767859553-passkey-sign-in.ts +21 -0
- package/alterations/1.36.0-1768192304-enable-account-center-for-admin-tenant.ts +32 -0
- package/alterations/1.36.0-1768464306-enable-mfa-for-admin-tenant.ts +30 -0
- package/alterations/1.36.0-1768758295-add-user-geo-location.ts +32 -0
- package/alterations/1.36.0-1768891516-add-user-sign-in-countries-table.ts +33 -0
- package/alterations/1.36.0-1769067642-add-adaptive-mfa-configuration.ts +19 -0
- package/alterations/1.36.0-1769172677-enable-organization-mfa-policy-for-admin-tenant.ts +31 -0
- package/alterations-js/1.35.0-1764580455-remove-daily-active-users-foreign-key.js +57 -0
- package/alterations-js/1.35.0-1764580589-create-aggregated-daily-active-users-table.js +40 -0
- package/alterations-js/1.35.0-1764653048-update-daily-token-usage-mau-support.js +31 -0
- package/alterations-js/1.35.0-1765183934-add-logs-created-at-id-index.js +35 -0
- package/alterations-js/1.35.0-1765255453-update-saml-session-relay-state-to-varchar-512.js +25 -0
- package/alterations-js/1.35.0-1765631949-drop-redundant-logs-id-index.js +43 -0
- package/alterations-js/1.35.0-1766028646-grant-tenants-table-tag-column-read-permission.js +31 -0
- package/alterations-js/1.36.0-1767193412-allow-token-exchange.js +30 -0
- package/alterations-js/1.36.0-1767859553-passkey-sign-in.js +17 -0
- package/alterations-js/1.36.0-1768192304-enable-account-center-for-admin-tenant.js +27 -0
- package/alterations-js/1.36.0-1768464306-enable-mfa-for-admin-tenant.js +25 -0
- package/alterations-js/1.36.0-1768758295-add-user-geo-location.js +27 -0
- package/alterations-js/1.36.0-1768891516-add-user-sign-in-countries-table.js +28 -0
- package/alterations-js/1.36.0-1769067642-add-adaptive-mfa-configuration.js +15 -0
- package/alterations-js/1.36.0-1769172677-enable-organization-mfa-policy-for-admin-tenant.js +26 -0
- package/lib/consts/product-event.d.ts +0 -12
- package/lib/consts/product-event.js +0 -13
- package/lib/db-entries/aggregated-daily-active-user.d.ts +22 -0
- package/lib/db-entries/aggregated-daily-active-user.js +33 -0
- package/lib/db-entries/daily-token-usage.d.ts +5 -1
- package/lib/db-entries/daily-token-usage.js +8 -0
- package/lib/db-entries/index.d.ts +3 -0
- package/lib/db-entries/index.js +3 -0
- package/lib/db-entries/saml-application-session.js +2 -2
- package/lib/db-entries/sign-in-experience.d.ts +6 -2
- package/lib/db-entries/sign-in-experience.js +9 -1
- package/lib/db-entries/user-geo-location.d.ts +24 -0
- package/lib/db-entries/user-geo-location.js +37 -0
- package/lib/db-entries/user-sign-in-country.d.ts +24 -0
- package/lib/db-entries/user-sign-in-country.js +33 -0
- package/lib/foundations/jsonb-types/account-centers.d.ts +2 -2
- package/lib/foundations/jsonb-types/captcha.d.ts +16 -0
- package/lib/foundations/jsonb-types/captcha.js +7 -0
- package/lib/foundations/jsonb-types/logs.d.ts +703 -0
- package/lib/foundations/jsonb-types/logs.js +52 -0
- package/lib/foundations/jsonb-types/oidc-module.d.ts +15 -3
- package/lib/foundations/jsonb-types/oidc-module.js +15 -3
- package/lib/foundations/jsonb-types/saml-application-configs.d.ts +1 -1
- package/lib/foundations/jsonb-types/sentinel.d.ts +13 -1
- package/lib/foundations/jsonb-types/sentinel.js +12 -0
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +59 -0
- package/lib/foundations/jsonb-types/sign-in-experience.js +11 -0
- package/lib/seeds/account-center.d.ts +6 -0
- package/lib/seeds/account-center.js +24 -0
- package/lib/seeds/cloud-api.d.ts +3 -1
- package/lib/seeds/cloud-api.js +2 -0
- package/lib/seeds/sign-in-experience.js +6 -1
- package/lib/types/alteration.d.ts +11 -1
- package/lib/types/application.d.ts +6 -0
- package/lib/types/consent.d.ts +4 -0
- package/lib/types/custom-profile-fields.d.ts +3 -3
- package/lib/types/hook.d.ts +2 -2
- package/lib/types/interactions.d.ts +16 -7
- package/lib/types/interactions.js +10 -4
- package/lib/types/log/index.d.ts +12 -6
- package/lib/types/log/interaction.d.ts +5 -1
- package/lib/types/logto-config/index.d.ts +9 -9
- package/lib/types/logto-config/jwt-customizer.d.ts +17 -17
- package/lib/types/saml-application.d.ts +7 -7
- package/lib/types/sign-in-experience.d.ts +19 -1
- package/lib/types/sign-in-experience.js +3 -1
- package/lib/types/user.d.ts +10 -7
- package/lib/types/user.js +1 -0
- package/package.json +6 -6
- package/tables/_after_all.sql +1 -1
- package/tables/aggregated_daily_active_users.sql +16 -0
- package/tables/daily_active_users.sql +9 -4
- package/tables/daily_token_usage.sql +3 -2
- package/tables/logs.sql +3 -3
- package/tables/saml_application_sessions.sql +1 -1
- package/tables/sign_in_experiences.sql +2 -0
- package/tables/user_geo_locations.sql +14 -0
- package/tables/user_sign_in_countries.sql +16 -0
- package/tables/users.sql +3 -0
|
@@ -5,6 +5,56 @@ export var LogResult;
|
|
|
5
5
|
LogResult["Success"] = "Success";
|
|
6
6
|
LogResult["Error"] = "Error";
|
|
7
7
|
})(LogResult || (LogResult = {}));
|
|
8
|
+
// UAParser.js returns partial results, so all fields are optional
|
|
9
|
+
// Ref: https://docs.uaparser.dev/api/main/overview.html#methods
|
|
10
|
+
const uaParserBrowserGuard = z
|
|
11
|
+
.object({
|
|
12
|
+
name: z.string(),
|
|
13
|
+
version: z.string(),
|
|
14
|
+
major: z.string(),
|
|
15
|
+
type: z.string(),
|
|
16
|
+
})
|
|
17
|
+
.partial()
|
|
18
|
+
.catchall(z.unknown());
|
|
19
|
+
const uaParserDeviceGuard = z
|
|
20
|
+
.object({
|
|
21
|
+
model: z.string(),
|
|
22
|
+
type: z.string(),
|
|
23
|
+
vendor: z.string(),
|
|
24
|
+
})
|
|
25
|
+
.partial()
|
|
26
|
+
.catchall(z.unknown());
|
|
27
|
+
const uaParserEngineGuard = z
|
|
28
|
+
.object({
|
|
29
|
+
name: z.string(),
|
|
30
|
+
version: z.string(),
|
|
31
|
+
})
|
|
32
|
+
.partial()
|
|
33
|
+
.catchall(z.unknown());
|
|
34
|
+
const uaParserOsGuard = z
|
|
35
|
+
.object({
|
|
36
|
+
name: z.string(),
|
|
37
|
+
version: z.string(),
|
|
38
|
+
})
|
|
39
|
+
.partial()
|
|
40
|
+
.catchall(z.unknown());
|
|
41
|
+
const uaParserCpuGuard = z
|
|
42
|
+
.object({
|
|
43
|
+
architecture: z.string(),
|
|
44
|
+
})
|
|
45
|
+
.partial()
|
|
46
|
+
.catchall(z.unknown());
|
|
47
|
+
export const userAgentParsedGuard = z
|
|
48
|
+
.object({
|
|
49
|
+
ua: z.string(),
|
|
50
|
+
browser: uaParserBrowserGuard,
|
|
51
|
+
device: uaParserDeviceGuard,
|
|
52
|
+
engine: uaParserEngineGuard,
|
|
53
|
+
os: uaParserOsGuard,
|
|
54
|
+
cpu: uaParserCpuGuard,
|
|
55
|
+
})
|
|
56
|
+
.partial()
|
|
57
|
+
.catchall(z.unknown());
|
|
8
58
|
export const logContextPayloadGuard = z
|
|
9
59
|
.object({
|
|
10
60
|
key: z.string(),
|
|
@@ -12,6 +62,8 @@ export const logContextPayloadGuard = z
|
|
|
12
62
|
error: z.record(z.string(), z.unknown()).or(z.string()).optional(),
|
|
13
63
|
ip: z.string().optional(),
|
|
14
64
|
userAgent: z.string().optional(),
|
|
65
|
+
userAgentParsed: userAgentParsedGuard.optional(),
|
|
66
|
+
injectedHeaders: z.record(z.string(), z.string()).optional(),
|
|
15
67
|
userId: z.string().optional(),
|
|
16
68
|
applicationId: z.string().optional(),
|
|
17
69
|
sessionId: z.string().optional(),
|
|
@@ -41,8 +41,8 @@ export type OidcClientMetadata = {
|
|
|
41
41
|
logoUri?: string;
|
|
42
42
|
};
|
|
43
43
|
export declare const oidcClientMetadataGuard: z.ZodObject<{
|
|
44
|
-
redirectUris: z.ZodArray<z.
|
|
45
|
-
postLogoutRedirectUris: z.ZodArray<z.ZodString, "many">;
|
|
44
|
+
redirectUris: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
45
|
+
postLogoutRedirectUris: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
46
46
|
backchannelLogoutUri: z.ZodOptional<z.ZodString>;
|
|
47
47
|
backchannelLogoutSessionRequired: z.ZodOptional<z.ZodBoolean>;
|
|
48
48
|
logoUri: z.ZodOptional<z.ZodString>;
|
|
@@ -79,7 +79,16 @@ export declare enum CustomClientMetadataKey {
|
|
|
79
79
|
*
|
|
80
80
|
* It can be turned off for only traditional web apps for enhanced security.
|
|
81
81
|
*/
|
|
82
|
-
RotateRefreshToken = "rotateRefreshToken"
|
|
82
|
+
RotateRefreshToken = "rotateRefreshToken",
|
|
83
|
+
/**
|
|
84
|
+
* Whether the application is allowed to initiate token exchange requests.
|
|
85
|
+
*
|
|
86
|
+
* Only first-party applications can use token exchange. Third-party applications are always
|
|
87
|
+
* forbidden.
|
|
88
|
+
*
|
|
89
|
+
* Defaults to `false` for all new applications. Users must explicitly enable it.
|
|
90
|
+
*/
|
|
91
|
+
AllowTokenExchange = "allowTokenExchange"
|
|
83
92
|
}
|
|
84
93
|
export declare const customClientMetadataGuard: z.ZodObject<{
|
|
85
94
|
corsAllowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -89,6 +98,7 @@ export declare const customClientMetadataGuard: z.ZodObject<{
|
|
|
89
98
|
tenantId: z.ZodOptional<z.ZodString>;
|
|
90
99
|
alwaysIssueRefreshToken: z.ZodOptional<z.ZodBoolean>;
|
|
91
100
|
rotateRefreshToken: z.ZodOptional<z.ZodBoolean>;
|
|
101
|
+
allowTokenExchange: z.ZodOptional<z.ZodBoolean>;
|
|
92
102
|
}, "strip", z.ZodTypeAny, {
|
|
93
103
|
corsAllowedOrigins?: string[] | undefined;
|
|
94
104
|
idTokenTtl?: number | undefined;
|
|
@@ -97,6 +107,7 @@ export declare const customClientMetadataGuard: z.ZodObject<{
|
|
|
97
107
|
tenantId?: string | undefined;
|
|
98
108
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
99
109
|
rotateRefreshToken?: boolean | undefined;
|
|
110
|
+
allowTokenExchange?: boolean | undefined;
|
|
100
111
|
}, {
|
|
101
112
|
corsAllowedOrigins?: string[] | undefined;
|
|
102
113
|
idTokenTtl?: number | undefined;
|
|
@@ -105,6 +116,7 @@ export declare const customClientMetadataGuard: z.ZodObject<{
|
|
|
105
116
|
tenantId?: string | undefined;
|
|
106
117
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
107
118
|
rotateRefreshToken?: boolean | undefined;
|
|
119
|
+
allowTokenExchange?: boolean | undefined;
|
|
108
120
|
}>;
|
|
109
121
|
/**
|
|
110
122
|
* @see {@link CustomClientMetadataKey} for key descriptions.
|
|
@@ -14,10 +14,12 @@ export const oidcModelInstancePayloadGuard = z
|
|
|
14
14
|
export const oidcClientMetadataGuard = z.object({
|
|
15
15
|
redirectUris: z
|
|
16
16
|
.string()
|
|
17
|
-
.refine((url) => validateRedirectUrl(url, 'web'))
|
|
18
|
-
.
|
|
17
|
+
.refine((url) => validateRedirectUrl(url, 'web') || validateRedirectUrl(url, 'mobile'))
|
|
18
|
+
.array(),
|
|
19
|
+
postLogoutRedirectUris: z
|
|
20
|
+
.string()
|
|
21
|
+
.refine((url) => validateRedirectUrl(url, 'web') || validateRedirectUrl(url, 'mobile'))
|
|
19
22
|
.array(),
|
|
20
|
-
postLogoutRedirectUris: z.string().url().array(),
|
|
21
23
|
backchannelLogoutUri: z.string().url().optional(),
|
|
22
24
|
backchannelLogoutSessionRequired: z.boolean().optional(),
|
|
23
25
|
logoUri: z.string().optional(),
|
|
@@ -44,6 +46,15 @@ export var CustomClientMetadataKey;
|
|
|
44
46
|
* It can be turned off for only traditional web apps for enhanced security.
|
|
45
47
|
*/
|
|
46
48
|
CustomClientMetadataKey["RotateRefreshToken"] = "rotateRefreshToken";
|
|
49
|
+
/**
|
|
50
|
+
* Whether the application is allowed to initiate token exchange requests.
|
|
51
|
+
*
|
|
52
|
+
* Only first-party applications can use token exchange. Third-party applications are always
|
|
53
|
+
* forbidden.
|
|
54
|
+
*
|
|
55
|
+
* Defaults to `false` for all new applications. Users must explicitly enable it.
|
|
56
|
+
*/
|
|
57
|
+
CustomClientMetadataKey["AllowTokenExchange"] = "allowTokenExchange";
|
|
47
58
|
})(CustomClientMetadataKey || (CustomClientMetadataKey = {}));
|
|
48
59
|
export const customClientMetadataGuard = z.object({
|
|
49
60
|
[CustomClientMetadataKey.CorsAllowedOrigins]: z.string().min(1).array().optional(),
|
|
@@ -53,4 +64,5 @@ export const customClientMetadataGuard = z.object({
|
|
|
53
64
|
[CustomClientMetadataKey.TenantId]: z.string().optional(),
|
|
54
65
|
[CustomClientMetadataKey.AlwaysIssueRefreshToken]: z.boolean().optional(),
|
|
55
66
|
[CustomClientMetadataKey.RotateRefreshToken]: z.boolean().optional(),
|
|
67
|
+
[CustomClientMetadataKey.AllowTokenExchange]: z.boolean().optional(),
|
|
56
68
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UserClaim } from '@logto/core-kit';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export type SamlAttributeMapping = Partial<Record<UserClaim | 'sub', string>>;
|
|
4
|
-
export declare const samlAttributeMappingKeys: readonly ("name" | "
|
|
4
|
+
export declare const samlAttributeMappingKeys: readonly ("name" | "email" | "username" | "sub" | "nickname" | "profile" | "website" | "gender" | "birthdate" | "zoneinfo" | "locale" | "address" | "given_name" | "family_name" | "middle_name" | "preferred_username" | "picture" | "email_verified" | "phone_number" | "phone_number_verified" | "updated_at" | "roles" | "organizations" | "organization_data" | "organization_roles" | "custom_data" | "identities" | "sso_identities" | "created_at")[];
|
|
5
5
|
export declare const samlAttributeMappingGuard: z.ZodObject<{
|
|
6
6
|
[x: string]: z.ZodOptional<z.ZodString>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -27,7 +27,19 @@ export declare enum SentinelActivityAction {
|
|
|
27
27
|
* For example, a user (subject) who inputted a one-time token (action) to authenticate
|
|
28
28
|
* themselves (target), e.g. Magic Link.
|
|
29
29
|
*/
|
|
30
|
-
OneTimeToken = "OneTimeToken"
|
|
30
|
+
OneTimeToken = "OneTimeToken",
|
|
31
|
+
/**
|
|
32
|
+
* The subject tries to pass a TOTP MFA verification.
|
|
33
|
+
*/
|
|
34
|
+
MfaTotp = "MfaTotp",
|
|
35
|
+
/**
|
|
36
|
+
* The subject tries to pass a WebAuthn MFA verification.
|
|
37
|
+
*/
|
|
38
|
+
MfaWebAuthn = "MfaWebAuthn",
|
|
39
|
+
/**
|
|
40
|
+
* The subject tries to pass a backup code MFA verification.
|
|
41
|
+
*/
|
|
42
|
+
MfaBackupCode = "MfaBackupCode"
|
|
31
43
|
}
|
|
32
44
|
export declare const sentinelActivityActionGuard: z.ZodNativeEnum<typeof SentinelActivityAction>;
|
|
33
45
|
export type SentinelActivityPayload = Record<string, unknown>;
|
|
@@ -30,6 +30,18 @@ export var SentinelActivityAction;
|
|
|
30
30
|
* themselves (target), e.g. Magic Link.
|
|
31
31
|
*/
|
|
32
32
|
SentinelActivityAction["OneTimeToken"] = "OneTimeToken";
|
|
33
|
+
/**
|
|
34
|
+
* The subject tries to pass a TOTP MFA verification.
|
|
35
|
+
*/
|
|
36
|
+
SentinelActivityAction["MfaTotp"] = "MfaTotp";
|
|
37
|
+
/**
|
|
38
|
+
* The subject tries to pass a WebAuthn MFA verification.
|
|
39
|
+
*/
|
|
40
|
+
SentinelActivityAction["MfaWebAuthn"] = "MfaWebAuthn";
|
|
41
|
+
/**
|
|
42
|
+
* The subject tries to pass a backup code MFA verification.
|
|
43
|
+
*/
|
|
44
|
+
SentinelActivityAction["MfaBackupCode"] = "MfaBackupCode";
|
|
33
45
|
})(SentinelActivityAction || (SentinelActivityAction = {}));
|
|
34
46
|
export const sentinelActivityActionGuard = z.nativeEnum(SentinelActivityAction);
|
|
35
47
|
export const sentinelActivityPayloadGuard = z.record(z.unknown());
|
|
@@ -199,13 +199,25 @@ export type SocialSignIn = {
|
|
|
199
199
|
* to the system and exactly one existing account is found with the same identifier (e.g., email).
|
|
200
200
|
*/
|
|
201
201
|
automaticAccountLinking?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* If required identifiers (e.g., email, phone) should be skipped during social sign-in.
|
|
204
|
+
* @remarks
|
|
205
|
+
* By default, if a social identity does not provide all required identifiers,
|
|
206
|
+
* the user will be prompted to provide them before completing sign-in.
|
|
207
|
+
*
|
|
208
|
+
* Setting this to `true` will bypass that requirement.
|
|
209
|
+
*/
|
|
210
|
+
skipRequiredIdentifiers?: boolean;
|
|
202
211
|
};
|
|
203
212
|
export declare const socialSignInGuard: z.ZodObject<{
|
|
204
213
|
automaticAccountLinking: z.ZodOptional<z.ZodBoolean>;
|
|
214
|
+
skipRequiredIdentifiers: z.ZodOptional<z.ZodBoolean>;
|
|
205
215
|
}, "strip", z.ZodTypeAny, {
|
|
206
216
|
automaticAccountLinking?: boolean | undefined;
|
|
217
|
+
skipRequiredIdentifiers?: boolean | undefined;
|
|
207
218
|
}, {
|
|
208
219
|
automaticAccountLinking?: boolean | undefined;
|
|
220
|
+
skipRequiredIdentifiers?: boolean | undefined;
|
|
209
221
|
}>;
|
|
210
222
|
export declare const connectorTargetsGuard: z.ZodArray<z.ZodString, "many">;
|
|
211
223
|
export type ConnectorTargets = z.infer<typeof connectorTargetsGuard>;
|
|
@@ -274,6 +286,35 @@ export declare const mfaGuard: z.ZodObject<{
|
|
|
274
286
|
policy: MfaPolicy;
|
|
275
287
|
organizationRequiredMfaPolicy?: OrganizationRequiredMfaPolicy | undefined;
|
|
276
288
|
}>;
|
|
289
|
+
/**
|
|
290
|
+
* Adaptive MFA configuration for the sign-in experience.
|
|
291
|
+
*
|
|
292
|
+
* @remarks
|
|
293
|
+
* This is a single enable switch for the rule-based Adaptive MFA flow.
|
|
294
|
+
* Use it in Management API sign-in experience updates (`PATCH /api/sign-in-exp`).
|
|
295
|
+
* When enabled, the server evaluates fixed risk rules from request signals
|
|
296
|
+
* (IP, User-Agent, edge-injected headers) and may require MFA verification.
|
|
297
|
+
* If omitted, Adaptive MFA is disabled.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```ts
|
|
301
|
+
* {
|
|
302
|
+
* adaptiveMfa: {
|
|
303
|
+
* enabled: true,
|
|
304
|
+
* },
|
|
305
|
+
* }
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
export type AdaptiveMfa = {
|
|
309
|
+
enabled?: boolean;
|
|
310
|
+
};
|
|
311
|
+
export declare const adaptiveMfaGuard: z.ZodObject<{
|
|
312
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
313
|
+
}, "strip", z.ZodTypeAny, {
|
|
314
|
+
enabled?: boolean | undefined;
|
|
315
|
+
}, {
|
|
316
|
+
enabled?: boolean | undefined;
|
|
317
|
+
}>;
|
|
277
318
|
export declare const customUiAssetsGuard: z.ZodObject<{
|
|
278
319
|
id: z.ZodString;
|
|
279
320
|
createdAt: z.ZodNumber;
|
|
@@ -352,4 +393,22 @@ export declare enum ForgotPasswordMethod {
|
|
|
352
393
|
}
|
|
353
394
|
export declare const forgotPasswordMethodsGuard: z.ZodArray<z.ZodNativeEnum<typeof ForgotPasswordMethod>, "many">;
|
|
354
395
|
export type ForgotPasswordMethods = z.infer<typeof forgotPasswordMethodsGuard>;
|
|
396
|
+
export type PasskeySignIn = {
|
|
397
|
+
enabled?: boolean;
|
|
398
|
+
showPasskeyButton?: boolean;
|
|
399
|
+
allowAutofill?: boolean;
|
|
400
|
+
};
|
|
401
|
+
export declare const passkeySignInGuard: z.ZodObject<{
|
|
402
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
403
|
+
showPasskeyButton: z.ZodOptional<z.ZodBoolean>;
|
|
404
|
+
allowAutofill: z.ZodOptional<z.ZodBoolean>;
|
|
405
|
+
}, "strip", z.ZodTypeAny, {
|
|
406
|
+
enabled?: boolean | undefined;
|
|
407
|
+
showPasskeyButton?: boolean | undefined;
|
|
408
|
+
allowAutofill?: boolean | undefined;
|
|
409
|
+
}, {
|
|
410
|
+
enabled?: boolean | undefined;
|
|
411
|
+
showPasskeyButton?: boolean | undefined;
|
|
412
|
+
allowAutofill?: boolean | undefined;
|
|
413
|
+
}>;
|
|
355
414
|
export {};
|
|
@@ -64,6 +64,7 @@ export const signInGuard = z.object({
|
|
|
64
64
|
});
|
|
65
65
|
export const socialSignInGuard = z.object({
|
|
66
66
|
automaticAccountLinking: z.boolean().optional(),
|
|
67
|
+
skipRequiredIdentifiers: z.boolean().optional(),
|
|
67
68
|
});
|
|
68
69
|
export const connectorTargetsGuard = z.string().array();
|
|
69
70
|
export const customContentGuard = z.record(z.string());
|
|
@@ -101,6 +102,9 @@ export const mfaGuard = z.object({
|
|
|
101
102
|
policy: z.nativeEnum(MfaPolicy),
|
|
102
103
|
organizationRequiredMfaPolicy: z.nativeEnum(OrganizationRequiredMfaPolicy).optional(),
|
|
103
104
|
});
|
|
105
|
+
export const adaptiveMfaGuard = z.object({
|
|
106
|
+
enabled: z.boolean().optional(),
|
|
107
|
+
});
|
|
104
108
|
export const customUiAssetsGuard = z.object({
|
|
105
109
|
id: z.string(),
|
|
106
110
|
createdAt: z.number(),
|
|
@@ -123,3 +127,10 @@ export var ForgotPasswordMethod;
|
|
|
123
127
|
ForgotPasswordMethod["PhoneVerificationCode"] = "PhoneVerificationCode";
|
|
124
128
|
})(ForgotPasswordMethod || (ForgotPasswordMethod = {}));
|
|
125
129
|
export const forgotPasswordMethodsGuard = z.nativeEnum(ForgotPasswordMethod).array();
|
|
130
|
+
export const passkeySignInGuard = z
|
|
131
|
+
.object({
|
|
132
|
+
enabled: z.boolean(),
|
|
133
|
+
showPasskeyButton: z.boolean(),
|
|
134
|
+
allowAutofill: z.boolean(),
|
|
135
|
+
})
|
|
136
|
+
.partial();
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { CreateAccountCenter } from '../db-entries/index.js';
|
|
2
2
|
export declare const createDefaultAccountCenter: (forTenantId: string) => Readonly<CreateAccountCenter>;
|
|
3
|
+
/**
|
|
4
|
+
* Create the account center for the admin tenant.
|
|
5
|
+
* The account center is enabled by default and allows editing all fields,
|
|
6
|
+
* so that the console profile page can use the Account API.
|
|
7
|
+
*/
|
|
8
|
+
export declare const createAdminTenantAccountCenter: () => Readonly<CreateAccountCenter>;
|
|
@@ -1,6 +1,30 @@
|
|
|
1
|
+
import { AccountCenterControlValue } from '../foundations/index.js';
|
|
2
|
+
import { adminTenantId } from './tenant.js';
|
|
1
3
|
export const createDefaultAccountCenter = (forTenantId) => Object.freeze({
|
|
2
4
|
tenantId: forTenantId,
|
|
3
5
|
id: 'default',
|
|
4
6
|
enabled: false,
|
|
5
7
|
fields: {},
|
|
6
8
|
});
|
|
9
|
+
/**
|
|
10
|
+
* Create the account center for the admin tenant.
|
|
11
|
+
* The account center is enabled by default and allows editing all fields,
|
|
12
|
+
* so that the console profile page can use the Account API.
|
|
13
|
+
*/
|
|
14
|
+
export const createAdminTenantAccountCenter = () => Object.freeze({
|
|
15
|
+
tenantId: adminTenantId,
|
|
16
|
+
id: 'default',
|
|
17
|
+
enabled: true,
|
|
18
|
+
fields: {
|
|
19
|
+
name: AccountCenterControlValue.Edit,
|
|
20
|
+
avatar: AccountCenterControlValue.Edit,
|
|
21
|
+
profile: AccountCenterControlValue.Edit,
|
|
22
|
+
email: AccountCenterControlValue.Edit,
|
|
23
|
+
phone: AccountCenterControlValue.Edit,
|
|
24
|
+
password: AccountCenterControlValue.Edit,
|
|
25
|
+
username: AccountCenterControlValue.Edit,
|
|
26
|
+
social: AccountCenterControlValue.Edit,
|
|
27
|
+
customData: AccountCenterControlValue.Edit,
|
|
28
|
+
mfa: AccountCenterControlValue.Edit,
|
|
29
|
+
},
|
|
30
|
+
});
|
package/lib/seeds/cloud-api.d.ts
CHANGED
|
@@ -21,7 +21,9 @@ export declare enum CloudScope {
|
|
|
21
21
|
/** The user can see and manage affiliates, including create, update, and delete. */
|
|
22
22
|
ManageAffiliate = "manage:affiliate",
|
|
23
23
|
/** The user can create new affiliates and logs. */
|
|
24
|
-
CreateAffiliate = "create:affiliate"
|
|
24
|
+
CreateAffiliate = "create:affiliate",
|
|
25
|
+
/** Allow accessing Logto MCP API (part of Logto Cloud API). This scope is only available to M2M MCP server. */
|
|
26
|
+
AccessMcpApi = "access:mcp:api"
|
|
25
27
|
}
|
|
26
28
|
export declare const createCloudApi: () => Readonly<[UpdateAdminData, ...CreateScope[]]>;
|
|
27
29
|
export declare const createTenantApplicationRole: () => Readonly<Role>;
|
package/lib/seeds/cloud-api.js
CHANGED
|
@@ -25,6 +25,8 @@ export var CloudScope;
|
|
|
25
25
|
CloudScope["ManageAffiliate"] = "manage:affiliate";
|
|
26
26
|
/** The user can create new affiliates and logs. */
|
|
27
27
|
CloudScope["CreateAffiliate"] = "create:affiliate";
|
|
28
|
+
/** Allow accessing Logto MCP API (part of Logto Cloud API). This scope is only available to M2M MCP server. */
|
|
29
|
+
CloudScope["AccessMcpApi"] = "access:mcp:api";
|
|
28
30
|
})(CloudScope || (CloudScope = {}));
|
|
29
31
|
export const createCloudApi = () => {
|
|
30
32
|
const resourceId = generateStandardId();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { generateDarkColor } from '@logto/core-kit';
|
|
2
2
|
import { SignInMode } from '../db-entries/index.js';
|
|
3
|
-
import { MfaPolicy, SignInIdentifier } from '../foundations/index.js';
|
|
3
|
+
import { MfaFactor, MfaPolicy, OrganizationRequiredMfaPolicy, SignInIdentifier, } from '../foundations/index.js';
|
|
4
4
|
import { adminTenantId, defaultTenantId } from './tenant.js';
|
|
5
5
|
export const defaultPrimaryColor = '#6139F6';
|
|
6
6
|
export const createDefaultSignInExperience = (forTenantId, isCloud) => Object.freeze({
|
|
@@ -62,4 +62,9 @@ export const createAdminTenantSignInExperience = () => Object.freeze({
|
|
|
62
62
|
logoUrl: 'https://logto.io/logo.svg',
|
|
63
63
|
darkLogoUrl: 'https://logto.io/logo-dark.svg',
|
|
64
64
|
},
|
|
65
|
+
mfa: {
|
|
66
|
+
factors: [MfaFactor.TOTP, MfaFactor.WebAuthn, MfaFactor.BackupCode],
|
|
67
|
+
policy: MfaPolicy.NoPrompt,
|
|
68
|
+
organizationRequiredMfaPolicy: OrganizationRequiredMfaPolicy.Mandatory,
|
|
69
|
+
},
|
|
65
70
|
});
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import type { DatabaseTransactionConnection } from '@silverhand/slonik';
|
|
1
|
+
import type { CommonQueryMethods, DatabaseTransactionConnection } from '@silverhand/slonik';
|
|
2
2
|
export type AlterationScript = {
|
|
3
|
+
/**
|
|
4
|
+
* Optional hook that runs before `up` outside of a transaction.
|
|
5
|
+
* Use for operations that cannot be wrapped in a transaction (e.g., CREATE INDEX CONCURRENTLY).
|
|
6
|
+
*/
|
|
7
|
+
beforeUp?: (connection: CommonQueryMethods) => Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Optional hook that runs before `down` outside of a transaction.
|
|
10
|
+
* Use for operations that cannot be wrapped in a transaction (e.g., DROP INDEX CONCURRENTLY).
|
|
11
|
+
*/
|
|
12
|
+
beforeDown?: (connection: CommonQueryMethods) => Promise<void>;
|
|
3
13
|
up: (connection: DatabaseTransactionConnection) => Promise<void>;
|
|
4
14
|
down: (connection: DatabaseTransactionConnection) => Promise<void>;
|
|
5
15
|
};
|
|
@@ -26,6 +26,7 @@ export declare const featuredApplicationGuard: z.ZodObject<Pick<{
|
|
|
26
26
|
tenantId?: string | undefined;
|
|
27
27
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
28
28
|
rotateRefreshToken?: boolean | undefined;
|
|
29
|
+
allowTokenExchange?: boolean | undefined;
|
|
29
30
|
}, z.ZodTypeDef, {
|
|
30
31
|
corsAllowedOrigins?: string[] | undefined;
|
|
31
32
|
idTokenTtl?: number | undefined;
|
|
@@ -34,6 +35,7 @@ export declare const featuredApplicationGuard: z.ZodObject<Pick<{
|
|
|
34
35
|
tenantId?: string | undefined;
|
|
35
36
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
36
37
|
rotateRefreshToken?: boolean | undefined;
|
|
38
|
+
allowTokenExchange?: boolean | undefined;
|
|
37
39
|
}>;
|
|
38
40
|
protectedAppMetadata: z.ZodType<{
|
|
39
41
|
host: string;
|
|
@@ -116,6 +118,7 @@ export declare const applicationCreateGuard: z.ZodObject<{
|
|
|
116
118
|
tenantId?: string | undefined;
|
|
117
119
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
118
120
|
rotateRefreshToken?: boolean | undefined;
|
|
121
|
+
allowTokenExchange?: boolean | undefined;
|
|
119
122
|
}, z.ZodTypeDef, {
|
|
120
123
|
corsAllowedOrigins?: string[] | undefined;
|
|
121
124
|
idTokenTtl?: number | undefined;
|
|
@@ -124,6 +127,7 @@ export declare const applicationCreateGuard: z.ZodObject<{
|
|
|
124
127
|
tenantId?: string | undefined;
|
|
125
128
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
126
129
|
rotateRefreshToken?: boolean | undefined;
|
|
130
|
+
allowTokenExchange?: boolean | undefined;
|
|
127
131
|
}>>>;
|
|
128
132
|
protectedAppMetadata: z.ZodOptional<z.ZodOptional<z.ZodType<{
|
|
129
133
|
host: string;
|
|
@@ -217,6 +221,7 @@ export declare const applicationPatchGuard: z.ZodObject<Omit<{
|
|
|
217
221
|
tenantId?: string | undefined;
|
|
218
222
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
219
223
|
rotateRefreshToken?: boolean | undefined;
|
|
224
|
+
allowTokenExchange?: boolean | undefined;
|
|
220
225
|
}, z.ZodTypeDef, {
|
|
221
226
|
corsAllowedOrigins?: string[] | undefined;
|
|
222
227
|
idTokenTtl?: number | undefined;
|
|
@@ -225,6 +230,7 @@ export declare const applicationPatchGuard: z.ZodObject<Omit<{
|
|
|
225
230
|
tenantId?: string | undefined;
|
|
226
231
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
227
232
|
rotateRefreshToken?: boolean | undefined;
|
|
233
|
+
allowTokenExchange?: boolean | undefined;
|
|
228
234
|
}>>>>;
|
|
229
235
|
protectedAppMetadata: z.ZodOptional<z.ZodOptional<z.ZodOptional<z.ZodType<{
|
|
230
236
|
host: string;
|
package/lib/types/consent.d.ts
CHANGED
|
@@ -157,6 +157,7 @@ export declare const publicApplicationGuard: z.ZodObject<Pick<{
|
|
|
157
157
|
tenantId?: string | undefined;
|
|
158
158
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
159
159
|
rotateRefreshToken?: boolean | undefined;
|
|
160
|
+
allowTokenExchange?: boolean | undefined;
|
|
160
161
|
}, z.ZodTypeDef, {
|
|
161
162
|
corsAllowedOrigins?: string[] | undefined;
|
|
162
163
|
idTokenTtl?: number | undefined;
|
|
@@ -165,6 +166,7 @@ export declare const publicApplicationGuard: z.ZodObject<Pick<{
|
|
|
165
166
|
tenantId?: string | undefined;
|
|
166
167
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
167
168
|
rotateRefreshToken?: boolean | undefined;
|
|
169
|
+
allowTokenExchange?: boolean | undefined;
|
|
168
170
|
}>;
|
|
169
171
|
protectedAppMetadata: z.ZodType<{
|
|
170
172
|
host: string;
|
|
@@ -474,6 +476,7 @@ export declare const consentInfoResponseGuard: z.ZodObject<{
|
|
|
474
476
|
tenantId?: string | undefined;
|
|
475
477
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
476
478
|
rotateRefreshToken?: boolean | undefined;
|
|
479
|
+
allowTokenExchange?: boolean | undefined;
|
|
477
480
|
}, z.ZodTypeDef, {
|
|
478
481
|
corsAllowedOrigins?: string[] | undefined;
|
|
479
482
|
idTokenTtl?: number | undefined;
|
|
@@ -482,6 +485,7 @@ export declare const consentInfoResponseGuard: z.ZodObject<{
|
|
|
482
485
|
tenantId?: string | undefined;
|
|
483
486
|
alwaysIssueRefreshToken?: boolean | undefined;
|
|
484
487
|
rotateRefreshToken?: boolean | undefined;
|
|
488
|
+
allowTokenExchange?: boolean | undefined;
|
|
485
489
|
}>;
|
|
486
490
|
protectedAppMetadata: z.ZodType<{
|
|
487
491
|
host: string;
|
|
@@ -2531,19 +2531,19 @@ export declare const signInIdentifierKeyGuard: z.ZodObject<Pick<{
|
|
|
2531
2531
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2532
2532
|
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2533
2533
|
}, "strip", z.ZodTypeAny, {
|
|
2534
|
-
username?: string | null;
|
|
2535
2534
|
email?: string | null | undefined;
|
|
2535
|
+
username?: string | null;
|
|
2536
2536
|
phone?: string | null | undefined;
|
|
2537
2537
|
primaryEmail?: string | null;
|
|
2538
2538
|
primaryPhone?: string | null;
|
|
2539
2539
|
}, {
|
|
2540
|
-
username?: string | null;
|
|
2541
2540
|
email?: string | null | undefined;
|
|
2541
|
+
username?: string | null;
|
|
2542
2542
|
phone?: string | null | undefined;
|
|
2543
2543
|
primaryEmail?: string | null;
|
|
2544
2544
|
primaryPhone?: string | null;
|
|
2545
2545
|
}>;
|
|
2546
|
-
export declare const reservedSignInIdentifierKeys: readonly ["
|
|
2546
|
+
export declare const reservedSignInIdentifierKeys: readonly ["email", "username", "phone", "primaryEmail", "primaryPhone"];
|
|
2547
2547
|
/**
|
|
2548
2548
|
* Reserved user profile keys.
|
|
2549
2549
|
* Currently only `preferredUsername` is reserved since it is the standard username property used
|
package/lib/types/hook.d.ts
CHANGED
|
@@ -47,8 +47,8 @@ export declare const hookResponseGuard: z.ZodObject<{
|
|
|
47
47
|
name: string;
|
|
48
48
|
id: string;
|
|
49
49
|
tenantId: string;
|
|
50
|
-
createdAt: number;
|
|
51
50
|
enabled: boolean;
|
|
51
|
+
createdAt: number;
|
|
52
52
|
config: import("../foundations/index.js").HookConfig;
|
|
53
53
|
event: import("../foundations/index.js").HookEvent | null;
|
|
54
54
|
events: import("../foundations/index.js").HookEvents;
|
|
@@ -61,8 +61,8 @@ export declare const hookResponseGuard: z.ZodObject<{
|
|
|
61
61
|
name: string;
|
|
62
62
|
id: string;
|
|
63
63
|
tenantId: string;
|
|
64
|
-
createdAt: number;
|
|
65
64
|
enabled: boolean;
|
|
65
|
+
createdAt: number;
|
|
66
66
|
config: import("../foundations/index.js").HookConfig;
|
|
67
67
|
event: import("../foundations/index.js").HookEvent | null;
|
|
68
68
|
events: import("../foundations/index.js").HookEvents;
|
|
@@ -45,16 +45,25 @@ export type VerificationCodeIdentifier<T extends VerificationCodeSignInIdentifie
|
|
|
45
45
|
type: T;
|
|
46
46
|
value: string;
|
|
47
47
|
};
|
|
48
|
-
export declare const verificationCodeIdentifierGuard: z.ZodObject<{
|
|
49
|
-
type: z.
|
|
48
|
+
export declare const verificationCodeIdentifierGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<SignInIdentifier.Email>;
|
|
50
50
|
value: z.ZodString;
|
|
51
51
|
}, "strip", z.ZodTypeAny, {
|
|
52
52
|
value: string;
|
|
53
|
-
type: SignInIdentifier.Email
|
|
53
|
+
type: SignInIdentifier.Email;
|
|
54
54
|
}, {
|
|
55
55
|
value: string;
|
|
56
|
-
type: SignInIdentifier.Email
|
|
57
|
-
}
|
|
56
|
+
type: SignInIdentifier.Email;
|
|
57
|
+
}>, z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<SignInIdentifier.Phone>;
|
|
59
|
+
value: z.ZodString;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
value: string;
|
|
62
|
+
type: SignInIdentifier.Phone;
|
|
63
|
+
}, {
|
|
64
|
+
value: string;
|
|
65
|
+
type: SignInIdentifier.Phone;
|
|
66
|
+
}>]>;
|
|
58
67
|
/** Payload type for `POST /api/experience/verification/{social|sso}/:connectorId/authorization-uri`. */
|
|
59
68
|
export type SocialAuthorizationUrlPayload = {
|
|
60
69
|
state: string;
|
|
@@ -450,14 +459,14 @@ export declare const profileGuard: z.ZodObject<{
|
|
|
450
459
|
connectorId: z.ZodOptional<z.ZodString>;
|
|
451
460
|
password: z.ZodOptional<z.ZodString>;
|
|
452
461
|
}, "strip", z.ZodTypeAny, {
|
|
453
|
-
username?: string | undefined;
|
|
454
462
|
email?: string | undefined;
|
|
463
|
+
username?: string | undefined;
|
|
455
464
|
phone?: string | undefined;
|
|
456
465
|
password?: string | undefined;
|
|
457
466
|
connectorId?: string | undefined;
|
|
458
467
|
}, {
|
|
459
|
-
username?: string | undefined;
|
|
460
468
|
email?: string | undefined;
|
|
469
|
+
username?: string | undefined;
|
|
461
470
|
phone?: string | undefined;
|
|
462
471
|
password?: string | undefined;
|
|
463
472
|
connectorId?: string | undefined;
|
|
@@ -21,10 +21,16 @@ export const interactionIdentifierGuard = z.object({
|
|
|
21
21
|
type: z.nativeEnum(SignInIdentifier),
|
|
22
22
|
value: z.string(),
|
|
23
23
|
});
|
|
24
|
-
export const verificationCodeIdentifierGuard = z.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
export const verificationCodeIdentifierGuard = z.discriminatedUnion('type', [
|
|
25
|
+
z.object({
|
|
26
|
+
type: z.literal(SignInIdentifier.Email),
|
|
27
|
+
value: z.string().regex(emailRegEx),
|
|
28
|
+
}),
|
|
29
|
+
z.object({
|
|
30
|
+
type: z.literal(SignInIdentifier.Phone),
|
|
31
|
+
value: z.string().regex(phoneRegEx),
|
|
32
|
+
}),
|
|
33
|
+
]);
|
|
28
34
|
export const socialAuthorizationUrlPayloadGuard = z.object({
|
|
29
35
|
state: z.string(),
|
|
30
36
|
redirectUri: z.string(),
|
package/lib/types/log/index.d.ts
CHANGED
|
@@ -10,16 +10,22 @@ export * as jwtCustomizer from './jwt-customizer.js';
|
|
|
10
10
|
export * as saml from './saml.js';
|
|
11
11
|
/** Fallback for empty or unrecognized log keys. */
|
|
12
12
|
export declare const LogKeyUnknown = "Unknown";
|
|
13
|
-
export type
|
|
13
|
+
export type InteractionLogKey = interaction.LogKey;
|
|
14
|
+
export type TokenLogKey = token.LogKey;
|
|
14
15
|
export type WebhookLogKey = hook.LogKey;
|
|
15
16
|
export type JwtCustomizerLogKey = jwtCustomizer.LogKey;
|
|
16
17
|
export type SamlLogKey = saml.LogKey;
|
|
18
|
+
/**
|
|
19
|
+
* The union type of all available audit log keys.
|
|
20
|
+
*
|
|
21
|
+
* - All user-facing audit log keys should be included here.
|
|
22
|
+
* - Webhook log keys are excluded.
|
|
23
|
+
*/
|
|
24
|
+
export type AuditLogKey = typeof LogKeyUnknown | InteractionLogKey | TokenLogKey | SamlLogKey | JwtCustomizerLogKey;
|
|
17
25
|
/**
|
|
18
26
|
* The union type of all available log keys.
|
|
19
27
|
* Note duplicate keys are allowed but should be avoided.
|
|
20
|
-
*
|
|
21
|
-
* @see {@link interaction.LogKey} for interaction log keys.
|
|
22
|
-
* @see {@link token.LogKey} for token log keys.
|
|
23
|
-
* @see {@link saml.LogKey} for SAML application log keys.
|
|
24
28
|
**/
|
|
25
|
-
export type LogKey = AuditLogKey | WebhookLogKey
|
|
29
|
+
export type LogKey = AuditLogKey | WebhookLogKey;
|
|
30
|
+
export type AuditLogPrefix = interaction.Prefix | token.Type | saml.Prefix | jwtCustomizer.Prefix | typeof LogKeyUnknown;
|
|
31
|
+
export type WebhookLogPrefix = hook.Type;
|