@logto/schemas 1.41.0 → 1.43.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.42.0-1783916980-add-domain-verification-files.ts +20 -0
- package/alterations/1.42.0-1784619793-add-service-logs-created-at-index.ts +33 -0
- package/alterations/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.ts +38 -0
- package/alterations/1.43.0-1785393731-add-oidc-model-instances-account-id-partial-index.ts +33 -0
- package/alterations/1.43.0-1785481546-add-tenant-aware-scope-indexes.ts +33 -0
- package/alterations/1.43.0-1785488115-add-cimd-permission-ceiling-tables.ts +77 -0
- package/alterations/1.43.0-1785722831-add-oidc-session-extensions-account-id-index.ts +27 -0
- package/alterations/1.43.0-1785835991-add-cimd-client-identifier-columns.ts +31 -0
- package/alterations/1.43.0-1786325989-add-cimd-grant-organizations-table.ts +54 -0
- package/alterations/1.43.0-1786333495-add-trusted-devices.ts +57 -0
- package/alterations/1.43.0-1786373004-tighten-cimd-grant-organizations-pkey.ts +28 -0
- package/alterations/1.43.0-1786414712-add-service-logs-email-indexes.ts +34 -0
- package/alterations/1.43.0-1786431364-add-cimd-grant-client-snapshots-table.ts +43 -0
- package/alterations/utils/1704934999-tables.ts +22 -1
- package/alterations-js/1.42.0-1783916980-add-domain-verification-files.js +16 -0
- package/alterations-js/1.42.0-1784619793-add-service-logs-created-at-index.js +29 -0
- package/alterations-js/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.js +33 -0
- package/alterations-js/1.43.0-1785393731-add-oidc-model-instances-account-id-partial-index.js +28 -0
- package/alterations-js/1.43.0-1785481546-add-tenant-aware-scope-indexes.js +28 -0
- package/alterations-js/1.43.0-1785488115-add-cimd-permission-ceiling-tables.js +69 -0
- package/alterations-js/1.43.0-1785722831-add-oidc-session-extensions-account-id-index.js +23 -0
- package/alterations-js/1.43.0-1785835991-add-cimd-client-identifier-columns.js +27 -0
- package/alterations-js/1.43.0-1786325989-add-cimd-grant-organizations-table.js +49 -0
- package/alterations-js/1.43.0-1786333495-add-trusted-devices.js +50 -0
- package/alterations-js/1.43.0-1786373004-tighten-cimd-grant-organizations-pkey.js +24 -0
- package/alterations-js/1.43.0-1786414712-add-service-logs-email-indexes.js +30 -0
- package/alterations-js/1.43.0-1786431364-add-cimd-grant-client-snapshots-table.js +38 -0
- package/alterations-js/utils/1704934999-tables.js +19 -1
- package/lib/consts/experience.d.ts +1 -0
- package/lib/consts/experience.js +1 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/consts/product-event.d.ts +5 -1
- package/lib/consts/product-event.js +4 -0
- package/lib/consts/social-state.d.ts +12 -0
- package/lib/consts/social-state.js +12 -0
- package/lib/db-entries/cimd-grant-client-snapshot.d.ts +32 -0
- package/lib/db-entries/cimd-grant-client-snapshot.js +45 -0
- package/lib/db-entries/cimd-grant-organization.d.ts +30 -0
- package/lib/db-entries/cimd-grant-organization.js +37 -0
- package/lib/db-entries/cimd-organization-resource-scope.d.ts +20 -0
- package/lib/db-entries/cimd-organization-resource-scope.js +25 -0
- package/lib/db-entries/cimd-organization-scope.d.ts +20 -0
- package/lib/db-entries/cimd-organization-scope.js +25 -0
- package/lib/db-entries/cimd-resource-scope.d.ts +20 -0
- package/lib/db-entries/cimd-resource-scope.js +25 -0
- package/lib/db-entries/cimd-user-scope.d.ts +20 -0
- package/lib/db-entries/cimd-user-scope.js +25 -0
- package/lib/db-entries/domain.d.ts +4 -2
- package/lib/db-entries/domain.js +5 -1
- package/lib/db-entries/index.d.ts +8 -0
- package/lib/db-entries/index.js +8 -0
- package/lib/db-entries/oidc-session-extension.d.ts +3 -1
- package/lib/db-entries/oidc-session-extension.js +4 -0
- package/lib/db-entries/organization.d.ts +5 -1
- package/lib/db-entries/organization.js +4 -0
- package/lib/db-entries/saml-sso-connector-signing-key.d.ts +32 -0
- package/lib/db-entries/saml-sso-connector-signing-key.js +49 -0
- package/lib/db-entries/sign-in-experience.d.ts +4 -2
- package/lib/db-entries/sign-in-experience.js +5 -1
- package/lib/db-entries/trusted-device.d.ts +36 -0
- package/lib/db-entries/trusted-device.js +62 -0
- package/lib/db-entries/user.d.ts +3 -1
- package/lib/db-entries/user.js +4 -0
- package/lib/foundations/jsonb-types/account-centers.d.ts +3 -0
- package/lib/foundations/jsonb-types/account-centers.js +1 -0
- package/lib/foundations/jsonb-types/account-centers.test.d.ts +1 -0
- package/lib/foundations/jsonb-types/account-centers.test.js +13 -0
- package/lib/foundations/jsonb-types/custom-domain.d.ts +57 -0
- package/lib/foundations/jsonb-types/custom-domain.js +51 -0
- package/lib/foundations/jsonb-types/custom-domain.test.d.ts +1 -0
- package/lib/foundations/jsonb-types/custom-domain.test.js +38 -0
- package/lib/foundations/jsonb-types/hooks.d.ts +9 -5
- package/lib/foundations/jsonb-types/hooks.js +8 -0
- package/lib/foundations/jsonb-types/logs.d.ts +18 -0
- package/lib/foundations/jsonb-types/logs.js +6 -0
- package/lib/foundations/jsonb-types/one-time-tokens.d.ts +5 -0
- package/lib/foundations/jsonb-types/one-time-tokens.js +2 -0
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +39 -4
- package/lib/foundations/jsonb-types/sign-in-experience.js +10 -0
- package/lib/foundations/jsonb-types/sign-in-experience.test.js +17 -1
- package/lib/types/application.d.ts +131 -1
- package/lib/types/application.js +8 -0
- package/lib/types/connector.d.ts +8 -0
- package/lib/types/consent.d.ts +16 -190
- package/lib/types/consent.js +10 -1
- package/lib/types/custom-profile-fields.d.ts +2 -1
- package/lib/types/domain.d.ts +9 -0
- package/lib/types/hook.d.ts +37 -5
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/interaction-event.d.ts +11 -0
- package/lib/types/interaction-event.js +12 -0
- package/lib/types/interactions.d.ts +2 -11
- package/lib/types/interactions.js +2 -11
- package/lib/types/log/action.d.ts +7 -0
- package/lib/types/log/action.js +6 -0
- package/lib/types/log/index.d.ts +8 -2
- package/lib/types/log/index.js +2 -0
- package/lib/types/log/trusted-device.d.ts +7 -0
- package/lib/types/log/trusted-device.js +6 -0
- package/lib/types/logto-config/action.d.ts +963 -0
- package/lib/types/logto-config/action.js +77 -0
- package/lib/types/logto-config/index.d.ts +68 -26
- package/lib/types/logto-config/index.js +20 -7
- package/lib/types/logto-config/index.test.js +32 -9
- package/lib/types/logto-config/jwt-customizer.d.ts +60 -10
- package/lib/types/logto-config/jwt-customizer.js +1 -1
- package/lib/types/logto-config/oidc-provider.d.ts +2 -2
- package/lib/types/organization.d.ts +136 -1
- package/lib/types/organization.js +3 -2
- package/lib/types/service-log.d.ts +14 -1
- package/lib/types/service-log.js +13 -0
- package/lib/types/sign-in-experience.d.ts +18 -10
- package/lib/types/sign-in-experience.js +2 -1
- package/lib/types/sso-connector.d.ts +58 -0
- package/lib/types/sso-connector.js +12 -0
- package/lib/types/system.d.ts +2 -2
- package/lib/types/trusted-device.d.ts +67 -0
- package/lib/types/trusted-device.js +16 -0
- package/lib/types/user-sessions.d.ts +117 -238
- package/lib/types/user-sessions.js +9 -4
- package/lib/types/user.d.ts +10 -3
- package/lib/types/user.js +1 -0
- package/lib/types/verification-records/one-time-token-verification.d.ts +5 -0
- package/lib/utils/cimd.d.ts +14 -0
- package/lib/utils/cimd.js +14 -0
- package/lib/utils/cimd.test.d.ts +1 -0
- package/lib/utils/cimd.test.js +9 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/package.json +7 -7
- package/tables/cimd_grant_client_snapshots.sql +27 -0
- package/tables/cimd_grant_organizations.sql +38 -0
- package/tables/cimd_organization_resource_scopes.sql +16 -0
- package/tables/cimd_organization_scopes.sql +15 -0
- package/tables/cimd_resource_scopes.sql +15 -0
- package/tables/cimd_user_scopes.sql +13 -0
- package/tables/domains.sql +1 -0
- package/tables/oidc_model_instances.sql +5 -0
- package/tables/oidc_session_extensions.sql +5 -0
- package/tables/organization_scopes.sql +4 -0
- package/tables/organizations.sql +2 -0
- package/tables/saml_sso_connector_signing_keys.sql +21 -0
- package/tables/scopes.sql +4 -0
- package/tables/service_logs.sql +19 -0
- package/tables/sign_in_experiences.sql +1 -0
- package/tables/trusted_devices.sql +25 -0
- package/tables/users.sql +1 -0
- package/lib/types/logto-config/inline-hook.d.ts +0 -76
- package/lib/types/logto-config/inline-hook.js +0 -25
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsonGuard } from '@logto/connector-kit';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { InteractionEvent, interactionIdentifierGuard, } from '../interactions.js';
|
|
4
|
+
import { userInfoGuard } from '../user.js';
|
|
5
|
+
import { VerificationType } from '../verification-records/index.js';
|
|
6
|
+
/** Values map to config key names in `logto_configs`. */
|
|
7
|
+
export var LogtoActionKey;
|
|
8
|
+
(function (LogtoActionKey) {
|
|
9
|
+
LogtoActionKey["PostFirstFactorVerification"] = "action.postFirstFactorVerification";
|
|
10
|
+
LogtoActionKey["PostSignIn"] = "action.postSignIn";
|
|
11
|
+
})(LogtoActionKey || (LogtoActionKey = {}));
|
|
12
|
+
export const actionExecutionErrorPolicies = Object.freeze(['block', 'allow']);
|
|
13
|
+
export const logtoActionGuard = z
|
|
14
|
+
.object({
|
|
15
|
+
script: z.string(),
|
|
16
|
+
environmentVariables: z.record(z.string()).optional(),
|
|
17
|
+
contextSample: jsonGuard.optional(),
|
|
18
|
+
enabled: z.boolean().optional(),
|
|
19
|
+
onExecutionError: z.enum(actionExecutionErrorPolicies).optional(),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
22
|
+
/**
|
|
23
|
+
* Shared execution payload for production Actions and Management API dry runs.
|
|
24
|
+
* Cloud remote execution and the local runner both accept this shape.
|
|
25
|
+
*/
|
|
26
|
+
export const actionExecutionRequestBodyGuard = z
|
|
27
|
+
.object({
|
|
28
|
+
script: z.string(),
|
|
29
|
+
actionType: z.nativeEnum(LogtoActionKey),
|
|
30
|
+
event: jsonGuard,
|
|
31
|
+
environmentVariables: z.record(z.string()).optional(),
|
|
32
|
+
})
|
|
33
|
+
.strict();
|
|
34
|
+
export const actionUserPatchGuard = userInfoGuard
|
|
35
|
+
.pick({
|
|
36
|
+
username: true,
|
|
37
|
+
primaryEmail: true,
|
|
38
|
+
primaryPhone: true,
|
|
39
|
+
name: true,
|
|
40
|
+
avatar: true,
|
|
41
|
+
customData: true,
|
|
42
|
+
profile: true,
|
|
43
|
+
})
|
|
44
|
+
.partial();
|
|
45
|
+
// Nested `user` uses passthrough so password fields survive structural parsing.
|
|
46
|
+
export const postFirstFactorVerificationResultGuard = z.discriminatedUnion('action', [
|
|
47
|
+
z.object({
|
|
48
|
+
action: z.literal('createUser'),
|
|
49
|
+
user: actionUserPatchGuard.passthrough(),
|
|
50
|
+
passwordVerified: z.literal(true),
|
|
51
|
+
}),
|
|
52
|
+
z.object({
|
|
53
|
+
action: z.literal('updateUser'),
|
|
54
|
+
user: actionUserPatchGuard.passthrough(),
|
|
55
|
+
passwordVerified: z.literal(true),
|
|
56
|
+
}),
|
|
57
|
+
]);
|
|
58
|
+
// Nested `user` uses passthrough so password fields survive structural parsing.
|
|
59
|
+
export const postSignInResultGuard = z.discriminatedUnion('action', [
|
|
60
|
+
z.object({
|
|
61
|
+
action: z.literal('updateUser'),
|
|
62
|
+
user: actionUserPatchGuard.passthrough().optional(),
|
|
63
|
+
}),
|
|
64
|
+
]);
|
|
65
|
+
export const actionUserPatchFields = Object.freeze(actionUserPatchGuard.keyof().options);
|
|
66
|
+
export const loggablePostFirstFactorVerificationEventGuard = z.object({
|
|
67
|
+
key: z.literal(LogtoActionKey.PostFirstFactorVerification),
|
|
68
|
+
interactionEvent: z.literal(InteractionEvent.SignIn),
|
|
69
|
+
verificationType: z.literal(VerificationType.Password),
|
|
70
|
+
identifier: interactionIdentifierGuard,
|
|
71
|
+
user: z.object({ id: z.string() }).nullable(),
|
|
72
|
+
});
|
|
73
|
+
export const loggablePostSignInEventGuard = z.object({
|
|
74
|
+
key: z.literal(LogtoActionKey.PostSignIn),
|
|
75
|
+
interactionEvent: z.literal(InteractionEvent.SignIn),
|
|
76
|
+
user: z.object({ id: z.string() }),
|
|
77
|
+
});
|
|
@@ -3,11 +3,11 @@ import { type Nullable, type Optional } from '@silverhand/essentials';
|
|
|
3
3
|
import type { ZodType } from 'zod';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { type MessageRateLimitOverride } from '../../consts/message-rate-limit.js';
|
|
6
|
-
import { type
|
|
6
|
+
import { type LogtoAction, LogtoActionKey } from './action.js';
|
|
7
7
|
import { type AccessTokenJwtCustomizer, type ClientCredentialsJwtCustomizer } from './jwt-customizer.js';
|
|
8
8
|
export * from './oidc-provider.js';
|
|
9
9
|
export * from './jwt-customizer.js';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './action.js';
|
|
11
11
|
/**
|
|
12
12
|
* Logto OIDC signing key types, used mainly in REST API routes.
|
|
13
13
|
*/
|
|
@@ -94,12 +94,12 @@ export type JwtCustomizerType = {
|
|
|
94
94
|
export declare const jwtCustomizerConfigGuard: Readonly<{
|
|
95
95
|
[key in LogtoJwtTokenKey]: ZodType<JwtCustomizerType[key]>;
|
|
96
96
|
}>;
|
|
97
|
-
export type
|
|
98
|
-
[
|
|
99
|
-
[
|
|
97
|
+
export type ActionType = {
|
|
98
|
+
[LogtoActionKey.PostFirstFactorVerification]: LogtoAction;
|
|
99
|
+
[LogtoActionKey.PostSignIn]: LogtoAction;
|
|
100
100
|
};
|
|
101
|
-
export declare const
|
|
102
|
-
[key in
|
|
101
|
+
export declare const actionConfigGuard: Readonly<{
|
|
102
|
+
[key in LogtoActionKey]: ZodType<ActionType[key]>;
|
|
103
103
|
}>;
|
|
104
104
|
export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [z.ZodObject<{
|
|
105
105
|
key: z.ZodLiteral<LogtoJwtTokenKey.AccessToken>;
|
|
@@ -127,8 +127,8 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
127
127
|
kind?: "AccessToken" | undefined;
|
|
128
128
|
accountId?: string | undefined;
|
|
129
129
|
scope?: string | undefined;
|
|
130
|
-
sessionUid?: string | undefined;
|
|
131
130
|
clientId?: string | undefined;
|
|
131
|
+
sessionUid?: string | undefined;
|
|
132
132
|
expiresWithSession?: boolean | undefined;
|
|
133
133
|
gty?: string | undefined;
|
|
134
134
|
aud?: string | string[] | undefined;
|
|
@@ -139,8 +139,8 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
139
139
|
kind?: "AccessToken" | undefined;
|
|
140
140
|
accountId?: string | undefined;
|
|
141
141
|
scope?: string | undefined;
|
|
142
|
-
sessionUid?: string | undefined;
|
|
143
142
|
clientId?: string | undefined;
|
|
143
|
+
sessionUid?: string | undefined;
|
|
144
144
|
expiresWithSession?: boolean | undefined;
|
|
145
145
|
gty?: string | undefined;
|
|
146
146
|
aud?: string | string[] | undefined;
|
|
@@ -150,6 +150,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
150
150
|
name: z.ZodOptional<ZodType<string | null, z.ZodTypeDef, string | null>>;
|
|
151
151
|
id: z.ZodOptional<ZodType<string, z.ZodTypeDef, string>>;
|
|
152
152
|
applicationId: z.ZodOptional<ZodType<string | null, z.ZodTypeDef, string | null>>;
|
|
153
|
+
cimdClientId: z.ZodOptional<ZodType<string | null, z.ZodTypeDef, string | null>>;
|
|
153
154
|
username: z.ZodOptional<ZodType<string | null, z.ZodTypeDef, string | null>>;
|
|
154
155
|
createdAt: z.ZodOptional<ZodType<number, z.ZodTypeDef, number>>;
|
|
155
156
|
profile: z.ZodOptional<ZodType<Partial<{
|
|
@@ -288,6 +289,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
288
289
|
description: ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
289
290
|
customData: ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
|
|
290
291
|
isMfaRequired: ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
292
|
+
isTrustedDeviceAllowed: ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
291
293
|
color: ZodType<Partial<{
|
|
292
294
|
primaryColor: string;
|
|
293
295
|
isDarkModeEnabled: boolean;
|
|
@@ -336,6 +338,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
336
338
|
name?: string | null | undefined;
|
|
337
339
|
id?: string | undefined;
|
|
338
340
|
applicationId?: string | null | undefined;
|
|
341
|
+
cimdClientId?: string | null | undefined;
|
|
339
342
|
username?: string | null | undefined;
|
|
340
343
|
createdAt?: number | undefined;
|
|
341
344
|
profile?: Partial<{
|
|
@@ -403,6 +406,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
403
406
|
name?: string | null | undefined;
|
|
404
407
|
id?: string | undefined;
|
|
405
408
|
applicationId?: string | null | undefined;
|
|
409
|
+
cimdClientId?: string | null | undefined;
|
|
406
410
|
username?: string | null | undefined;
|
|
407
411
|
createdAt?: number | undefined;
|
|
408
412
|
profile?: Partial<{
|
|
@@ -478,7 +482,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
478
482
|
subjectTokenContext?: Record<string, import("@withtyped/server").Json> | undefined;
|
|
479
483
|
}>>;
|
|
480
484
|
interaction: z.ZodOptional<z.ZodObject<{
|
|
481
|
-
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof import("../
|
|
485
|
+
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof import("../interaction-event.js").InteractionEvent>>;
|
|
482
486
|
userId: z.ZodOptional<z.ZodString>;
|
|
483
487
|
verificationRecords: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
484
488
|
id: z.ZodString;
|
|
@@ -954,10 +958,13 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
954
958
|
}>;
|
|
955
959
|
oneTimeTokenContext: z.ZodOptional<z.ZodObject<{
|
|
956
960
|
jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
961
|
+
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof import("../interaction-event.js").InteractionEvent>>;
|
|
957
962
|
}, "strip", z.ZodTypeAny, {
|
|
958
963
|
jitOrganizationIds?: string[] | undefined;
|
|
964
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
959
965
|
}, {
|
|
960
966
|
jitOrganizationIds?: string[] | undefined;
|
|
967
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
961
968
|
}>>;
|
|
962
969
|
}, "strip", z.ZodTypeAny, {
|
|
963
970
|
type: import("../index.js").VerificationType.OneTimeToken;
|
|
@@ -969,6 +976,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
969
976
|
verified: boolean;
|
|
970
977
|
oneTimeTokenContext?: {
|
|
971
978
|
jitOrganizationIds?: string[] | undefined;
|
|
979
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
972
980
|
} | undefined;
|
|
973
981
|
}, {
|
|
974
982
|
type: import("../index.js").VerificationType.OneTimeToken;
|
|
@@ -980,6 +988,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
980
988
|
verified: boolean;
|
|
981
989
|
oneTimeTokenContext?: {
|
|
982
990
|
jitOrganizationIds?: string[] | undefined;
|
|
991
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
983
992
|
} | undefined;
|
|
984
993
|
}>, z.ZodObject<Omit<{
|
|
985
994
|
id: z.ZodString;
|
|
@@ -1014,7 +1023,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1014
1023
|
signInContext: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
1015
1024
|
}, "strip", z.ZodTypeAny, {
|
|
1016
1025
|
userId?: string | undefined;
|
|
1017
|
-
interactionEvent?: import("../
|
|
1026
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1018
1027
|
verificationRecords?: ({
|
|
1019
1028
|
type: import("../index.js").VerificationType.BackupCode;
|
|
1020
1029
|
id: string;
|
|
@@ -1073,6 +1082,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1073
1082
|
verified: boolean;
|
|
1074
1083
|
oneTimeTokenContext?: {
|
|
1075
1084
|
jitOrganizationIds?: string[] | undefined;
|
|
1085
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1076
1086
|
} | undefined;
|
|
1077
1087
|
} | {
|
|
1078
1088
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -1128,7 +1138,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1128
1138
|
signInContext?: Record<string, string> | undefined;
|
|
1129
1139
|
}, {
|
|
1130
1140
|
userId?: string | undefined;
|
|
1131
|
-
interactionEvent?: import("../
|
|
1141
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1132
1142
|
verificationRecords?: ({
|
|
1133
1143
|
type: import("../index.js").VerificationType.BackupCode;
|
|
1134
1144
|
id: string;
|
|
@@ -1187,6 +1197,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1187
1197
|
verified: boolean;
|
|
1188
1198
|
oneTimeTokenContext?: {
|
|
1189
1199
|
jitOrganizationIds?: string[] | undefined;
|
|
1200
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1190
1201
|
} | undefined;
|
|
1191
1202
|
} | {
|
|
1192
1203
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -1462,6 +1473,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1462
1473
|
name?: string | null | undefined;
|
|
1463
1474
|
id?: string | undefined;
|
|
1464
1475
|
applicationId?: string | null | undefined;
|
|
1476
|
+
cimdClientId?: string | null | undefined;
|
|
1465
1477
|
username?: string | null | undefined;
|
|
1466
1478
|
createdAt?: number | undefined;
|
|
1467
1479
|
profile?: Partial<{
|
|
@@ -1592,7 +1604,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1592
1604
|
} | undefined;
|
|
1593
1605
|
interaction?: {
|
|
1594
1606
|
userId?: string | undefined;
|
|
1595
|
-
interactionEvent?: import("../
|
|
1607
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1596
1608
|
verificationRecords?: ({
|
|
1597
1609
|
type: import("../index.js").VerificationType.BackupCode;
|
|
1598
1610
|
id: string;
|
|
@@ -1651,6 +1663,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1651
1663
|
verified: boolean;
|
|
1652
1664
|
oneTimeTokenContext?: {
|
|
1653
1665
|
jitOrganizationIds?: string[] | undefined;
|
|
1666
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1654
1667
|
} | undefined;
|
|
1655
1668
|
} | {
|
|
1656
1669
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -1710,6 +1723,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1710
1723
|
name?: string | null | undefined;
|
|
1711
1724
|
id?: string | undefined;
|
|
1712
1725
|
applicationId?: string | null | undefined;
|
|
1726
|
+
cimdClientId?: string | null | undefined;
|
|
1713
1727
|
username?: string | null | undefined;
|
|
1714
1728
|
createdAt?: number | undefined;
|
|
1715
1729
|
profile?: Partial<{
|
|
@@ -1840,7 +1854,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1840
1854
|
} | undefined;
|
|
1841
1855
|
interaction?: {
|
|
1842
1856
|
userId?: string | undefined;
|
|
1843
|
-
interactionEvent?: import("../
|
|
1857
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1844
1858
|
verificationRecords?: ({
|
|
1845
1859
|
type: import("../index.js").VerificationType.BackupCode;
|
|
1846
1860
|
id: string;
|
|
@@ -1899,6 +1913,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1899
1913
|
verified: boolean;
|
|
1900
1914
|
oneTimeTokenContext?: {
|
|
1901
1915
|
jitOrganizationIds?: string[] | undefined;
|
|
1916
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
1902
1917
|
} | undefined;
|
|
1903
1918
|
} | {
|
|
1904
1919
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -1962,6 +1977,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
1962
1977
|
name?: string | null | undefined;
|
|
1963
1978
|
id?: string | undefined;
|
|
1964
1979
|
applicationId?: string | null | undefined;
|
|
1980
|
+
cimdClientId?: string | null | undefined;
|
|
1965
1981
|
username?: string | null | undefined;
|
|
1966
1982
|
createdAt?: number | undefined;
|
|
1967
1983
|
profile?: Partial<{
|
|
@@ -2092,7 +2108,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2092
2108
|
} | undefined;
|
|
2093
2109
|
interaction?: {
|
|
2094
2110
|
userId?: string | undefined;
|
|
2095
|
-
interactionEvent?: import("../
|
|
2111
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2096
2112
|
verificationRecords?: ({
|
|
2097
2113
|
type: import("../index.js").VerificationType.BackupCode;
|
|
2098
2114
|
id: string;
|
|
@@ -2151,6 +2167,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2151
2167
|
verified: boolean;
|
|
2152
2168
|
oneTimeTokenContext?: {
|
|
2153
2169
|
jitOrganizationIds?: string[] | undefined;
|
|
2170
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2154
2171
|
} | undefined;
|
|
2155
2172
|
} | {
|
|
2156
2173
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -2214,8 +2231,8 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2214
2231
|
kind?: "AccessToken" | undefined;
|
|
2215
2232
|
accountId?: string | undefined;
|
|
2216
2233
|
scope?: string | undefined;
|
|
2217
|
-
sessionUid?: string | undefined;
|
|
2218
2234
|
clientId?: string | undefined;
|
|
2235
|
+
sessionUid?: string | undefined;
|
|
2219
2236
|
expiresWithSession?: boolean | undefined;
|
|
2220
2237
|
gty?: string | undefined;
|
|
2221
2238
|
aud?: string | string[] | undefined;
|
|
@@ -2228,6 +2245,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2228
2245
|
name?: string | null | undefined;
|
|
2229
2246
|
id?: string | undefined;
|
|
2230
2247
|
applicationId?: string | null | undefined;
|
|
2248
|
+
cimdClientId?: string | null | undefined;
|
|
2231
2249
|
username?: string | null | undefined;
|
|
2232
2250
|
createdAt?: number | undefined;
|
|
2233
2251
|
profile?: Partial<{
|
|
@@ -2358,7 +2376,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2358
2376
|
} | undefined;
|
|
2359
2377
|
interaction?: {
|
|
2360
2378
|
userId?: string | undefined;
|
|
2361
|
-
interactionEvent?: import("../
|
|
2379
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2362
2380
|
verificationRecords?: ({
|
|
2363
2381
|
type: import("../index.js").VerificationType.BackupCode;
|
|
2364
2382
|
id: string;
|
|
@@ -2417,6 +2435,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2417
2435
|
verified: boolean;
|
|
2418
2436
|
oneTimeTokenContext?: {
|
|
2419
2437
|
jitOrganizationIds?: string[] | undefined;
|
|
2438
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2420
2439
|
} | undefined;
|
|
2421
2440
|
} | {
|
|
2422
2441
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -2480,8 +2499,8 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2480
2499
|
kind?: "AccessToken" | undefined;
|
|
2481
2500
|
accountId?: string | undefined;
|
|
2482
2501
|
scope?: string | undefined;
|
|
2483
|
-
sessionUid?: string | undefined;
|
|
2484
2502
|
clientId?: string | undefined;
|
|
2503
|
+
sessionUid?: string | undefined;
|
|
2485
2504
|
expiresWithSession?: boolean | undefined;
|
|
2486
2505
|
gty?: string | undefined;
|
|
2487
2506
|
aud?: string | string[] | undefined;
|
|
@@ -2496,6 +2515,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2496
2515
|
name?: string | null | undefined;
|
|
2497
2516
|
id?: string | undefined;
|
|
2498
2517
|
applicationId?: string | null | undefined;
|
|
2518
|
+
cimdClientId?: string | null | undefined;
|
|
2499
2519
|
username?: string | null | undefined;
|
|
2500
2520
|
createdAt?: number | undefined;
|
|
2501
2521
|
profile?: Partial<{
|
|
@@ -2626,7 +2646,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2626
2646
|
} | undefined;
|
|
2627
2647
|
interaction?: {
|
|
2628
2648
|
userId?: string | undefined;
|
|
2629
|
-
interactionEvent?: import("../
|
|
2649
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2630
2650
|
verificationRecords?: ({
|
|
2631
2651
|
type: import("../index.js").VerificationType.BackupCode;
|
|
2632
2652
|
id: string;
|
|
@@ -2685,6 +2705,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2685
2705
|
verified: boolean;
|
|
2686
2706
|
oneTimeTokenContext?: {
|
|
2687
2707
|
jitOrganizationIds?: string[] | undefined;
|
|
2708
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2688
2709
|
} | undefined;
|
|
2689
2710
|
} | {
|
|
2690
2711
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -2748,8 +2769,8 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2748
2769
|
kind?: "AccessToken" | undefined;
|
|
2749
2770
|
accountId?: string | undefined;
|
|
2750
2771
|
scope?: string | undefined;
|
|
2751
|
-
sessionUid?: string | undefined;
|
|
2752
2772
|
clientId?: string | undefined;
|
|
2773
|
+
sessionUid?: string | undefined;
|
|
2753
2774
|
expiresWithSession?: boolean | undefined;
|
|
2754
2775
|
gty?: string | undefined;
|
|
2755
2776
|
aud?: string | string[] | undefined;
|
|
@@ -2765,6 +2786,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2765
2786
|
name?: string | null | undefined;
|
|
2766
2787
|
id?: string | undefined;
|
|
2767
2788
|
applicationId?: string | null | undefined;
|
|
2789
|
+
cimdClientId?: string | null | undefined;
|
|
2768
2790
|
username?: string | null | undefined;
|
|
2769
2791
|
createdAt?: number | undefined;
|
|
2770
2792
|
profile?: Partial<{
|
|
@@ -2895,7 +2917,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2895
2917
|
} | undefined;
|
|
2896
2918
|
interaction?: {
|
|
2897
2919
|
userId?: string | undefined;
|
|
2898
|
-
interactionEvent?: import("../
|
|
2920
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2899
2921
|
verificationRecords?: ({
|
|
2900
2922
|
type: import("../index.js").VerificationType.BackupCode;
|
|
2901
2923
|
id: string;
|
|
@@ -2954,6 +2976,7 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
2954
2976
|
verified: boolean;
|
|
2955
2977
|
oneTimeTokenContext?: {
|
|
2956
2978
|
jitOrganizationIds?: string[] | undefined;
|
|
2979
|
+
interactionEvent?: import("../interaction-event.js").InteractionEvent | undefined;
|
|
2957
2980
|
} | undefined;
|
|
2958
2981
|
} | {
|
|
2959
2982
|
type: import("../index.js").VerificationType.Password;
|
|
@@ -3017,8 +3040,8 @@ export declare const jwtCustomizerConfigsGuard: z.ZodDiscriminatedUnion<"key", [
|
|
|
3017
3040
|
kind?: "AccessToken" | undefined;
|
|
3018
3041
|
accountId?: string | undefined;
|
|
3019
3042
|
scope?: string | undefined;
|
|
3020
|
-
sessionUid?: string | undefined;
|
|
3021
3043
|
clientId?: string | undefined;
|
|
3044
|
+
sessionUid?: string | undefined;
|
|
3022
3045
|
expiresWithSession?: boolean | undefined;
|
|
3023
3046
|
gty?: string | undefined;
|
|
3024
3047
|
aud?: string | string[] | undefined;
|
|
@@ -3741,6 +3764,22 @@ export declare const signingKeyRotationStateGuard: z.ZodObject<{
|
|
|
3741
3764
|
signingKeyRotationAt?: number | undefined;
|
|
3742
3765
|
}>;
|
|
3743
3766
|
export type SigningKeyRotationState = z.infer<typeof signingKeyRotationStateGuard>;
|
|
3767
|
+
/**
|
|
3768
|
+
* Config for the OAuth Client ID Metadata Document (CIMD) feature. The row is only written once
|
|
3769
|
+
* the feature is toggled, so readers must fall back to {@link defaultCimdConfig}.
|
|
3770
|
+
*/
|
|
3771
|
+
export declare const cimdConfigGuard: z.ZodObject<{
|
|
3772
|
+
enabled: z.ZodBoolean;
|
|
3773
|
+
}, "strip", z.ZodTypeAny, {
|
|
3774
|
+
enabled: boolean;
|
|
3775
|
+
}, {
|
|
3776
|
+
enabled: boolean;
|
|
3777
|
+
}>;
|
|
3778
|
+
export type CimdConfig = z.infer<typeof cimdConfigGuard>;
|
|
3779
|
+
/** Applied when the `cimd` row is absent: the feature is opt-in per tenant. */
|
|
3780
|
+
export declare const defaultCimdConfig: Readonly<{
|
|
3781
|
+
enabled: false;
|
|
3782
|
+
}>;
|
|
3744
3783
|
export declare enum LogtoTenantConfigKey {
|
|
3745
3784
|
AdminConsole = "adminConsole",
|
|
3746
3785
|
CloudConnection = "cloudConnection",
|
|
@@ -3751,7 +3790,9 @@ export declare enum LogtoTenantConfigKey {
|
|
|
3751
3790
|
/** Tenant-scoped rotation state for staged private signing key activation. */
|
|
3752
3791
|
SigningKeyRotationState = "signingKeyRotationState",
|
|
3753
3792
|
/** Internal, ops-only override of the system message send-rate-limit policy. Not exposed by any API. */
|
|
3754
|
-
MessageRateLimitOverride = "messageRateLimitOverride"
|
|
3793
|
+
MessageRateLimitOverride = "messageRateLimitOverride",
|
|
3794
|
+
/** Tenant-level switch for the OAuth Client ID Metadata Document feature. */
|
|
3795
|
+
Cimd = "cimd"
|
|
3755
3796
|
}
|
|
3756
3797
|
export type LogtoTenantConfigType = {
|
|
3757
3798
|
[LogtoTenantConfigKey.AdminConsole]: AdminConsoleData;
|
|
@@ -3762,13 +3803,14 @@ export type LogtoTenantConfigType = {
|
|
|
3762
3803
|
[LogtoTenantConfigKey.IdToken]: IdTokenConfig;
|
|
3763
3804
|
[LogtoTenantConfigKey.SigningKeyRotationState]: SigningKeyRotationState;
|
|
3764
3805
|
[LogtoTenantConfigKey.MessageRateLimitOverride]: MessageRateLimitOverride;
|
|
3806
|
+
[LogtoTenantConfigKey.Cimd]: CimdConfig;
|
|
3765
3807
|
};
|
|
3766
3808
|
export declare const logtoTenantConfigGuard: Readonly<{
|
|
3767
3809
|
[key in LogtoTenantConfigKey]: ZodType<LogtoTenantConfigType[key]>;
|
|
3768
3810
|
}>;
|
|
3769
|
-
export type LogtoConfigKey = LogtoOidcConfigKey | LogtoJwtTokenKey |
|
|
3770
|
-
export type LogtoConfigType = LogtoOidcConfigType | JwtCustomizerType |
|
|
3771
|
-
export type LogtoConfigGuard = typeof logtoOidcConfigGuard & typeof jwtCustomizerConfigGuard & typeof
|
|
3811
|
+
export type LogtoConfigKey = LogtoOidcConfigKey | LogtoJwtTokenKey | LogtoActionKey | LogtoTenantConfigKey;
|
|
3812
|
+
export type LogtoConfigType = LogtoOidcConfigType | JwtCustomizerType | ActionType | LogtoTenantConfigType;
|
|
3813
|
+
export type LogtoConfigGuard = typeof logtoOidcConfigGuard & typeof jwtCustomizerConfigGuard & typeof actionConfigGuard & typeof logtoTenantConfigGuard;
|
|
3772
3814
|
export declare const logtoConfigKeys: readonly LogtoConfigKey[];
|
|
3773
3815
|
export declare const logtoConfigGuards: LogtoConfigGuard;
|
|
3774
3816
|
export declare const oidcConfigKeysResponseGuard: z.ZodObject<Omit<{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { extendedIdTokenClaims } from '@logto/core-kit';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { messageRateLimitOverrideGuard, } from '../../consts/message-rate-limit.js';
|
|
4
|
-
import {
|
|
4
|
+
import { LogtoActionKey, logtoActionGuard } from './action.js';
|
|
5
5
|
import { accessTokenJwtCustomizerGuard, clientCredentialsJwtCustomizerGuard, } from './jwt-customizer.js';
|
|
6
6
|
export * from './oidc-provider.js';
|
|
7
7
|
export * from './jwt-customizer.js';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './action.js';
|
|
9
9
|
/**
|
|
10
10
|
* Logto OIDC signing key types, used mainly in REST API routes.
|
|
11
11
|
*/
|
|
@@ -63,9 +63,9 @@ export const jwtCustomizerConfigGuard = Object.freeze({
|
|
|
63
63
|
[LogtoJwtTokenKey.AccessToken]: accessTokenJwtCustomizerGuard,
|
|
64
64
|
[LogtoJwtTokenKey.ClientCredentials]: clientCredentialsJwtCustomizerGuard,
|
|
65
65
|
});
|
|
66
|
-
export const
|
|
67
|
-
[
|
|
68
|
-
[
|
|
66
|
+
export const actionConfigGuard = Object.freeze({
|
|
67
|
+
[LogtoActionKey.PostFirstFactorVerification]: logtoActionGuard,
|
|
68
|
+
[LogtoActionKey.PostSignIn]: logtoActionGuard,
|
|
69
69
|
});
|
|
70
70
|
export const jwtCustomizerConfigsGuard = z.discriminatedUnion('key', [
|
|
71
71
|
z.object({
|
|
@@ -116,6 +116,16 @@ export const signingKeyRotationStateGuard = z.object({
|
|
|
116
116
|
tenantCacheExpiresAt: z.number().optional(),
|
|
117
117
|
signingKeyRotationAt: z.number().optional(),
|
|
118
118
|
});
|
|
119
|
+
/* --- CIMD Config --- */
|
|
120
|
+
/**
|
|
121
|
+
* Config for the OAuth Client ID Metadata Document (CIMD) feature. The row is only written once
|
|
122
|
+
* the feature is toggled, so readers must fall back to {@link defaultCimdConfig}.
|
|
123
|
+
*/
|
|
124
|
+
export const cimdConfigGuard = z.object({
|
|
125
|
+
enabled: z.boolean(),
|
|
126
|
+
});
|
|
127
|
+
/** Applied when the `cimd` row is absent: the feature is opt-in per tenant. */
|
|
128
|
+
export const defaultCimdConfig = Object.freeze({ enabled: false });
|
|
119
129
|
export var LogtoTenantConfigKey;
|
|
120
130
|
(function (LogtoTenantConfigKey) {
|
|
121
131
|
LogtoTenantConfigKey["AdminConsole"] = "adminConsole";
|
|
@@ -128,6 +138,8 @@ export var LogtoTenantConfigKey;
|
|
|
128
138
|
LogtoTenantConfigKey["SigningKeyRotationState"] = "signingKeyRotationState";
|
|
129
139
|
/** Internal, ops-only override of the system message send-rate-limit policy. Not exposed by any API. */
|
|
130
140
|
LogtoTenantConfigKey["MessageRateLimitOverride"] = "messageRateLimitOverride";
|
|
141
|
+
/** Tenant-level switch for the OAuth Client ID Metadata Document feature. */
|
|
142
|
+
LogtoTenantConfigKey["Cimd"] = "cimd";
|
|
131
143
|
})(LogtoTenantConfigKey || (LogtoTenantConfigKey = {}));
|
|
132
144
|
export const logtoTenantConfigGuard = Object.freeze({
|
|
133
145
|
[LogtoTenantConfigKey.AdminConsole]: adminConsoleDataGuard,
|
|
@@ -136,17 +148,18 @@ export const logtoTenantConfigGuard = Object.freeze({
|
|
|
136
148
|
[LogtoTenantConfigKey.IdToken]: idTokenConfigGuard,
|
|
137
149
|
[LogtoTenantConfigKey.SigningKeyRotationState]: signingKeyRotationStateGuard,
|
|
138
150
|
[LogtoTenantConfigKey.MessageRateLimitOverride]: messageRateLimitOverrideGuard,
|
|
151
|
+
[LogtoTenantConfigKey.Cimd]: cimdConfigGuard,
|
|
139
152
|
});
|
|
140
153
|
export const logtoConfigKeys = Object.freeze([
|
|
141
154
|
...Object.values(LogtoOidcConfigKey),
|
|
142
155
|
...Object.values(LogtoJwtTokenKey),
|
|
143
|
-
...Object.values(
|
|
156
|
+
...Object.values(LogtoActionKey),
|
|
144
157
|
...Object.values(LogtoTenantConfigKey),
|
|
145
158
|
]);
|
|
146
159
|
export const logtoConfigGuards = Object.freeze({
|
|
147
160
|
...logtoOidcConfigGuard,
|
|
148
161
|
...jwtCustomizerConfigGuard,
|
|
149
|
-
...
|
|
162
|
+
...actionConfigGuard,
|
|
150
163
|
...logtoTenantConfigGuard,
|
|
151
164
|
});
|
|
152
165
|
export const oidcConfigKeysResponseGuard = oidcConfigKeyGuard.omit({ value: true }).merge(z.object({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { LogtoActionKey, LogtoOidcConfigKey, LogtoTenantConfigKey, OidcSigningKeyStatus, actionConfigGuard, logtoOidcConfigGuard, logtoConfigGuards, logtoConfigKeys, logtoTenantConfigGuard, oidcConfigKeysResponseGuard, } from './index.js';
|
|
3
4
|
describe('logto config guards', () => {
|
|
4
5
|
it('accepts legacy private keys without status', () => {
|
|
5
6
|
const privateKeys = [
|
|
@@ -26,8 +27,8 @@ describe('logto config guards', () => {
|
|
|
26
27
|
});
|
|
27
28
|
expect(result.success).toBe(true);
|
|
28
29
|
});
|
|
29
|
-
it('accepts
|
|
30
|
-
const result =
|
|
30
|
+
it('accepts action configs', () => {
|
|
31
|
+
const result = actionConfigGuard[LogtoActionKey.PostFirstFactorVerification].safeParse({
|
|
31
32
|
script: 'export default async () => ({ action: "createUser" });',
|
|
32
33
|
environmentVariables: {
|
|
33
34
|
endpoint: 'https://example.com',
|
|
@@ -38,16 +39,38 @@ describe('logto config guards', () => {
|
|
|
38
39
|
});
|
|
39
40
|
expect(result.success).toBe(true);
|
|
40
41
|
});
|
|
41
|
-
it('rejects invalid
|
|
42
|
-
const result =
|
|
42
|
+
it('rejects invalid action execution error policy', () => {
|
|
43
|
+
const result = actionConfigGuard[LogtoActionKey.PostSignIn].safeParse({
|
|
43
44
|
script: 'export default async () => ({ action: "updateUser" });',
|
|
44
45
|
onExecutionError: 'ignore',
|
|
45
46
|
});
|
|
46
47
|
expect(result.success).toBe(false);
|
|
47
48
|
});
|
|
48
|
-
it('includes
|
|
49
|
-
expect(logtoConfigKeys).toContain(
|
|
50
|
-
expect(logtoConfigKeys).toContain(
|
|
51
|
-
expect(logtoConfigGuards[
|
|
49
|
+
it('includes action keys in the logto config summary guards', () => {
|
|
50
|
+
expect(logtoConfigKeys).toContain(LogtoActionKey.PostFirstFactorVerification);
|
|
51
|
+
expect(logtoConfigKeys).toContain(LogtoActionKey.PostSignIn);
|
|
52
|
+
expect(logtoConfigGuards[LogtoActionKey.PostSignIn]).toBe(actionConfigGuard[LogtoActionKey.PostSignIn]);
|
|
53
|
+
});
|
|
54
|
+
it('includes the CIMD key in the logto config summary guards', () => {
|
|
55
|
+
expect(logtoConfigKeys).toContain(LogtoTenantConfigKey.Cimd);
|
|
56
|
+
expect(logtoConfigGuards[LogtoTenantConfigKey.Cimd]).toBe(logtoTenantConfigGuard[LogtoTenantConfigKey.Cimd]);
|
|
57
|
+
});
|
|
58
|
+
it('keeps a stored CIMD config value', () => {
|
|
59
|
+
expect(logtoTenantConfigGuard[LogtoTenantConfigKey.Cimd].parse({ enabled: true })).toEqual({
|
|
60
|
+
enabled: true,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
it('rejects invalid CIMD config values', () => {
|
|
64
|
+
const result = logtoTenantConfigGuard[LogtoTenantConfigKey.Cimd].safeParse({ enabled: 'yes' });
|
|
65
|
+
expect(result.success).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
it('parses OIDC configs without the optional session row', () => {
|
|
68
|
+
const result = z.object(logtoOidcConfigGuard).parse({
|
|
69
|
+
[LogtoOidcConfigKey.PrivateKeys]: [
|
|
70
|
+
{ id: 'key_1', value: 'private-key-1', createdAt: 1_710_000_000_000 },
|
|
71
|
+
],
|
|
72
|
+
[LogtoOidcConfigKey.CookieKeys]: [],
|
|
73
|
+
});
|
|
74
|
+
expect(result[LogtoOidcConfigKey.Session]).toEqual({});
|
|
52
75
|
});
|
|
53
76
|
});
|