@logto/schemas 1.42.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.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-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/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/index.d.ts +7 -0
- package/lib/db-entries/index.js +7 -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/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/hooks.d.ts +8 -4
- package/lib/foundations/jsonb-types/hooks.js +7 -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/sign-in-experience.d.ts +23 -3
- package/lib/foundations/jsonb-types/sign-in-experience.js +9 -0
- package/lib/foundations/jsonb-types/sign-in-experience.test.js +17 -1
- 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 +1 -0
- package/lib/types/hook.d.ts +31 -6
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/log/index.d.ts +5 -2
- package/lib/types/log/index.js +1 -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 +1 -1
- package/lib/types/logto-config/action.js +1 -1
- package/lib/types/logto-config/index.d.ts +36 -7
- package/lib/types/logto-config/index.js +13 -0
- package/lib/types/logto-config/index.test.js +23 -0
- package/lib/types/logto-config/jwt-customizer.d.ts +31 -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/service-log.d.ts +14 -1
- package/lib/types/service-log.js +13 -0
- package/lib/types/sign-in-experience.d.ts +18 -8
- package/lib/types/sign-in-experience.js +2 -1
- 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 +39 -209
- 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/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/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/scopes.sql +4 -0
- package/tables/service_logs.sql +14 -0
- package/tables/sign_in_experiences.sql +1 -0
- package/tables/trusted_devices.sql +25 -0
- package/tables/users.sql +1 -0
|
@@ -17,6 +17,8 @@ export type CreateOrganization = {
|
|
|
17
17
|
customData?: JsonObject;
|
|
18
18
|
/** Whether multi-factor authentication configuration is required for the members of the organization. */
|
|
19
19
|
isMfaRequired?: boolean;
|
|
20
|
+
/** Whether trusted devices are allowed for members of the organization. */
|
|
21
|
+
isTrustedDeviceAllowed?: boolean;
|
|
20
22
|
/** The organization's branding color configuration. */
|
|
21
23
|
color?: PartialColor;
|
|
22
24
|
/** The organization's branding configuration. */
|
|
@@ -39,6 +41,8 @@ export type Organization = {
|
|
|
39
41
|
customData: JsonObject;
|
|
40
42
|
/** Whether multi-factor authentication configuration is required for the members of the organization. */
|
|
41
43
|
isMfaRequired: boolean;
|
|
44
|
+
/** Whether trusted devices are allowed for members of the organization. */
|
|
45
|
+
isTrustedDeviceAllowed: boolean;
|
|
42
46
|
/** The organization's branding color configuration. */
|
|
43
47
|
color: PartialColor;
|
|
44
48
|
/** The organization's branding configuration. */
|
|
@@ -48,5 +52,5 @@ export type Organization = {
|
|
|
48
52
|
/** When the organization was created. */
|
|
49
53
|
createdAt: number;
|
|
50
54
|
};
|
|
51
|
-
export type OrganizationKeys = 'tenantId' | 'id' | 'name' | 'description' | 'customData' | 'isMfaRequired' | 'color' | 'branding' | 'customCss' | 'createdAt';
|
|
55
|
+
export type OrganizationKeys = 'tenantId' | 'id' | 'name' | 'description' | 'customData' | 'isMfaRequired' | 'isTrustedDeviceAllowed' | 'color' | 'branding' | 'customCss' | 'createdAt';
|
|
52
56
|
export declare const Organizations: GeneratedSchema<OrganizationKeys, CreateOrganization, Organization, 'organizations', 'organization'>;
|
|
@@ -8,6 +8,7 @@ const createGuard = z.object({
|
|
|
8
8
|
description: z.string().max(256).nullable().optional(),
|
|
9
9
|
customData: jsonObjectGuard.optional(),
|
|
10
10
|
isMfaRequired: z.boolean().optional(),
|
|
11
|
+
isTrustedDeviceAllowed: z.boolean().optional(),
|
|
11
12
|
color: partialColorGuard.optional(),
|
|
12
13
|
branding: brandingGuard.optional(),
|
|
13
14
|
customCss: z.string().nullable().optional(),
|
|
@@ -20,6 +21,7 @@ const guard = z.object({
|
|
|
20
21
|
description: z.string().max(256).nullable(),
|
|
21
22
|
customData: jsonObjectGuard,
|
|
22
23
|
isMfaRequired: z.boolean(),
|
|
24
|
+
isTrustedDeviceAllowed: z.boolean(),
|
|
23
25
|
color: partialColorGuard,
|
|
24
26
|
branding: brandingGuard,
|
|
25
27
|
customCss: z.string().nullable(),
|
|
@@ -35,6 +37,7 @@ export const Organizations = Object.freeze({
|
|
|
35
37
|
description: 'description',
|
|
36
38
|
customData: 'custom_data',
|
|
37
39
|
isMfaRequired: 'is_mfa_required',
|
|
40
|
+
isTrustedDeviceAllowed: 'is_trusted_device_allowed',
|
|
38
41
|
color: 'color',
|
|
39
42
|
branding: 'branding',
|
|
40
43
|
customCss: 'custom_css',
|
|
@@ -47,6 +50,7 @@ export const Organizations = Object.freeze({
|
|
|
47
50
|
'description',
|
|
48
51
|
'customData',
|
|
49
52
|
'isMfaRequired',
|
|
53
|
+
'isTrustedDeviceAllowed',
|
|
50
54
|
'color',
|
|
51
55
|
'branding',
|
|
52
56
|
'customCss',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color, Branding, LanguageInfo, SignIn, SignUp, SocialSignIn, ConnectorTargets, CustomContent, CustomUiAssets, CustomUiCsp, PartialPasswordPolicy, Mfa, AdaptiveMfa, CaptchaPolicy, SentinelPolicy, EmailBlocklistPolicy, VerificationCodePolicy, ForgotPasswordMethods, PasskeySignIn, SignUpProfileFields, PasswordExpirationPolicy, UsernamePolicy, GeneratedSchema } from './../foundations/index.js';
|
|
1
|
+
import { Color, Branding, LanguageInfo, SignIn, SignUp, SocialSignIn, ConnectorTargets, CustomContent, CustomUiAssets, CustomUiCsp, PartialPasswordPolicy, Mfa, AdaptiveMfa, TrustedDevicePolicy, CaptchaPolicy, SentinelPolicy, EmailBlocklistPolicy, VerificationCodePolicy, ForgotPasswordMethods, PasskeySignIn, SignUpProfileFields, PasswordExpirationPolicy, UsernamePolicy, GeneratedSchema } from './../foundations/index.js';
|
|
2
2
|
import { AgreeToTermsPolicy, SignInMode } from './custom-types.js';
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
@@ -28,6 +28,7 @@ export type CreateSignInExperience = {
|
|
|
28
28
|
passwordPolicy?: PartialPasswordPolicy;
|
|
29
29
|
mfa?: Mfa;
|
|
30
30
|
adaptiveMfa?: AdaptiveMfa;
|
|
31
|
+
trustedDevice?: TrustedDevicePolicy;
|
|
31
32
|
singleSignOnEnabled?: boolean;
|
|
32
33
|
supportEmail?: string | null;
|
|
33
34
|
supportWebsiteUrl?: string | null;
|
|
@@ -66,6 +67,7 @@ export type SignInExperience = {
|
|
|
66
67
|
passwordPolicy: PartialPasswordPolicy;
|
|
67
68
|
mfa: Mfa;
|
|
68
69
|
adaptiveMfa: AdaptiveMfa;
|
|
70
|
+
trustedDevice: TrustedDevicePolicy;
|
|
69
71
|
singleSignOnEnabled: boolean;
|
|
70
72
|
supportEmail: string | null;
|
|
71
73
|
supportWebsiteUrl: string | null;
|
|
@@ -81,5 +83,5 @@ export type SignInExperience = {
|
|
|
81
83
|
passwordExpiration: PasswordExpirationPolicy;
|
|
82
84
|
usernamePolicy: UsernamePolicy;
|
|
83
85
|
};
|
|
84
|
-
export type SignInExperienceKeys = 'tenantId' | 'id' | 'color' | 'branding' | 'hideLogtoBranding' | 'languageInfo' | 'termsOfUseUrl' | 'privacyPolicyUrl' | 'agreeToTermsPolicy' | 'signIn' | 'signUp' | 'socialSignIn' | 'socialSignInConnectorTargets' | 'signInMode' | 'customCss' | 'customContent' | 'customUiAssets' | 'customUiCsp' | 'passwordPolicy' | 'mfa' | 'adaptiveMfa' | 'singleSignOnEnabled' | 'supportEmail' | 'supportWebsiteUrl' | 'unknownSessionRedirectUrl' | 'captchaPolicy' | 'sentinelPolicy' | 'emailBlocklistPolicy' | 'verificationCodePolicy' | 'forgotPasswordMethods' | 'passkeySignIn' | 'signUpProfileFields' | 'passwordExpiration' | 'usernamePolicy';
|
|
86
|
+
export type SignInExperienceKeys = 'tenantId' | 'id' | 'color' | 'branding' | 'hideLogtoBranding' | 'languageInfo' | 'termsOfUseUrl' | 'privacyPolicyUrl' | 'agreeToTermsPolicy' | 'signIn' | 'signUp' | 'socialSignIn' | 'socialSignInConnectorTargets' | 'signInMode' | 'customCss' | 'customContent' | 'customUiAssets' | 'customUiCsp' | 'passwordPolicy' | 'mfa' | 'adaptiveMfa' | 'trustedDevice' | 'singleSignOnEnabled' | 'supportEmail' | 'supportWebsiteUrl' | 'unknownSessionRedirectUrl' | 'captchaPolicy' | 'sentinelPolicy' | 'emailBlocklistPolicy' | 'verificationCodePolicy' | 'forgotPasswordMethods' | 'passkeySignIn' | 'signUpProfileFields' | 'passwordExpiration' | 'usernamePolicy';
|
|
85
87
|
export declare const SignInExperiences: GeneratedSchema<SignInExperienceKeys, CreateSignInExperience, SignInExperience, 'sign_in_experiences', 'sign_in_experience'>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { colorGuard, brandingGuard, languageInfoGuard, signInGuard, signUpGuard, socialSignInGuard, connectorTargetsGuard, customContentGuard, customUiAssetsGuard, customUiCspGuard, partialPasswordPolicyGuard, mfaGuard, adaptiveMfaGuard, captchaPolicyGuard, sentinelPolicyGuard, emailBlocklistPolicyGuard, verificationCodePolicyGuard, forgotPasswordMethodsGuard, passkeySignInGuard, signUpProfileFieldsGuard, passwordExpirationPolicyGuard, usernamePolicyGuard } from './../foundations/index.js';
|
|
3
|
+
import { colorGuard, brandingGuard, languageInfoGuard, signInGuard, signUpGuard, socialSignInGuard, connectorTargetsGuard, customContentGuard, customUiAssetsGuard, customUiCspGuard, partialPasswordPolicyGuard, mfaGuard, adaptiveMfaGuard, trustedDevicePolicyGuard, captchaPolicyGuard, sentinelPolicyGuard, emailBlocklistPolicyGuard, verificationCodePolicyGuard, forgotPasswordMethodsGuard, passkeySignInGuard, signUpProfileFieldsGuard, passwordExpirationPolicyGuard, usernamePolicyGuard } from './../foundations/index.js';
|
|
4
4
|
import { AgreeToTermsPolicy, SignInMode } from './custom-types.js';
|
|
5
5
|
const createGuard = z.object({
|
|
6
6
|
tenantId: z.string().max(21).optional(),
|
|
@@ -24,6 +24,7 @@ const createGuard = z.object({
|
|
|
24
24
|
passwordPolicy: partialPasswordPolicyGuard.optional(),
|
|
25
25
|
mfa: mfaGuard.optional(),
|
|
26
26
|
adaptiveMfa: adaptiveMfaGuard.optional(),
|
|
27
|
+
trustedDevice: trustedDevicePolicyGuard.optional(),
|
|
27
28
|
singleSignOnEnabled: z.boolean().optional(),
|
|
28
29
|
supportEmail: z.string().nullable().optional(),
|
|
29
30
|
supportWebsiteUrl: z.string().nullable().optional(),
|
|
@@ -60,6 +61,7 @@ const guard = z.object({
|
|
|
60
61
|
passwordPolicy: partialPasswordPolicyGuard,
|
|
61
62
|
mfa: mfaGuard,
|
|
62
63
|
adaptiveMfa: adaptiveMfaGuard,
|
|
64
|
+
trustedDevice: trustedDevicePolicyGuard,
|
|
63
65
|
singleSignOnEnabled: z.boolean(),
|
|
64
66
|
supportEmail: z.string().nullable(),
|
|
65
67
|
supportWebsiteUrl: z.string().nullable(),
|
|
@@ -99,6 +101,7 @@ export const SignInExperiences = Object.freeze({
|
|
|
99
101
|
passwordPolicy: 'password_policy',
|
|
100
102
|
mfa: 'mfa',
|
|
101
103
|
adaptiveMfa: 'adaptive_mfa',
|
|
104
|
+
trustedDevice: 'trusted_device',
|
|
102
105
|
singleSignOnEnabled: 'single_sign_on_enabled',
|
|
103
106
|
supportEmail: 'support_email',
|
|
104
107
|
supportWebsiteUrl: 'support_website_url',
|
|
@@ -135,6 +138,7 @@ export const SignInExperiences = Object.freeze({
|
|
|
135
138
|
'passwordPolicy',
|
|
136
139
|
'mfa',
|
|
137
140
|
'adaptiveMfa',
|
|
141
|
+
'trustedDevice',
|
|
138
142
|
'singleSignOnEnabled',
|
|
139
143
|
'supportEmail',
|
|
140
144
|
'supportWebsiteUrl',
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BufferLike, GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* A revocable server-side credential that can fulfill sign-in MFA for a user.
|
|
4
|
+
*
|
|
5
|
+
* @remarks This is a type for database creation.
|
|
6
|
+
* @see {@link TrustedDevice} for the original type.
|
|
7
|
+
*/
|
|
8
|
+
export type CreateTrustedDevice = {
|
|
9
|
+
tenantId?: string;
|
|
10
|
+
id: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
secretHash: BufferLike;
|
|
13
|
+
userAgent?: string | null;
|
|
14
|
+
ip?: string | null;
|
|
15
|
+
country?: string | null;
|
|
16
|
+
city?: string | null;
|
|
17
|
+
createdAt?: number;
|
|
18
|
+
lastUsedAt?: number;
|
|
19
|
+
expiresAt: number;
|
|
20
|
+
};
|
|
21
|
+
/** A revocable server-side credential that can fulfill sign-in MFA for a user. */
|
|
22
|
+
export type TrustedDevice = {
|
|
23
|
+
tenantId: string;
|
|
24
|
+
id: string;
|
|
25
|
+
userId: string;
|
|
26
|
+
secretHash: BufferLike;
|
|
27
|
+
userAgent: string | null;
|
|
28
|
+
ip: string | null;
|
|
29
|
+
country: string | null;
|
|
30
|
+
city: string | null;
|
|
31
|
+
createdAt: number;
|
|
32
|
+
lastUsedAt: number;
|
|
33
|
+
expiresAt: number;
|
|
34
|
+
};
|
|
35
|
+
export type TrustedDeviceKeys = 'tenantId' | 'id' | 'userId' | 'secretHash' | 'userAgent' | 'ip' | 'country' | 'city' | 'createdAt' | 'lastUsedAt' | 'expiresAt';
|
|
36
|
+
export declare const TrustedDevices: GeneratedSchema<TrustedDeviceKeys, CreateTrustedDevice, TrustedDevice, 'trusted_devices', 'trusted_device'>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { bufferLikeGuard } from './../foundations/index.js';
|
|
4
|
+
const createGuard = z.object({
|
|
5
|
+
tenantId: z.string().max(21).optional(),
|
|
6
|
+
id: z.string().min(1).max(21),
|
|
7
|
+
userId: z.string().min(1).max(12),
|
|
8
|
+
secretHash: bufferLikeGuard,
|
|
9
|
+
userAgent: z.string().nullable().optional(),
|
|
10
|
+
ip: z.string().nullable().optional(),
|
|
11
|
+
country: z.string().max(16).nullable().optional(),
|
|
12
|
+
city: z.string().nullable().optional(),
|
|
13
|
+
createdAt: z.number().optional(),
|
|
14
|
+
lastUsedAt: z.number().optional(),
|
|
15
|
+
expiresAt: z.number(),
|
|
16
|
+
});
|
|
17
|
+
const guard = z.object({
|
|
18
|
+
tenantId: z.string().max(21),
|
|
19
|
+
id: z.string().min(1).max(21),
|
|
20
|
+
userId: z.string().min(1).max(12),
|
|
21
|
+
secretHash: bufferLikeGuard,
|
|
22
|
+
userAgent: z.string().nullable(),
|
|
23
|
+
ip: z.string().nullable(),
|
|
24
|
+
country: z.string().max(16).nullable(),
|
|
25
|
+
city: z.string().nullable(),
|
|
26
|
+
createdAt: z.number(),
|
|
27
|
+
lastUsedAt: z.number(),
|
|
28
|
+
expiresAt: z.number(),
|
|
29
|
+
});
|
|
30
|
+
export const TrustedDevices = Object.freeze({
|
|
31
|
+
table: 'trusted_devices',
|
|
32
|
+
tableSingular: 'trusted_device',
|
|
33
|
+
fields: {
|
|
34
|
+
tenantId: 'tenant_id',
|
|
35
|
+
id: 'id',
|
|
36
|
+
userId: 'user_id',
|
|
37
|
+
secretHash: 'secret_hash',
|
|
38
|
+
userAgent: 'user_agent',
|
|
39
|
+
ip: 'ip',
|
|
40
|
+
country: 'country',
|
|
41
|
+
city: 'city',
|
|
42
|
+
createdAt: 'created_at',
|
|
43
|
+
lastUsedAt: 'last_used_at',
|
|
44
|
+
expiresAt: 'expires_at',
|
|
45
|
+
},
|
|
46
|
+
fieldKeys: [
|
|
47
|
+
'tenantId',
|
|
48
|
+
'id',
|
|
49
|
+
'userId',
|
|
50
|
+
'secretHash',
|
|
51
|
+
'userAgent',
|
|
52
|
+
'ip',
|
|
53
|
+
'country',
|
|
54
|
+
'city',
|
|
55
|
+
'createdAt',
|
|
56
|
+
'lastUsedAt',
|
|
57
|
+
'expiresAt',
|
|
58
|
+
],
|
|
59
|
+
createGuard,
|
|
60
|
+
guard,
|
|
61
|
+
updateGuard: guard.partial(),
|
|
62
|
+
});
|
package/lib/db-entries/user.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export type CreateUser = {
|
|
|
19
19
|
/** Additional OpenID Connect standard claims that are not included in user's properties. */
|
|
20
20
|
profile?: UserProfile;
|
|
21
21
|
applicationId?: string | null;
|
|
22
|
+
cimdClientId?: string | null;
|
|
22
23
|
identities?: Identities;
|
|
23
24
|
customData?: JsonObject;
|
|
24
25
|
logtoConfig?: JsonObject;
|
|
@@ -44,6 +45,7 @@ export type User = {
|
|
|
44
45
|
/** Additional OpenID Connect standard claims that are not included in user's properties. */
|
|
45
46
|
profile: UserProfile;
|
|
46
47
|
applicationId: string | null;
|
|
48
|
+
cimdClientId: string | null;
|
|
47
49
|
identities: Identities;
|
|
48
50
|
customData: JsonObject;
|
|
49
51
|
logtoConfig: JsonObject;
|
|
@@ -55,5 +57,5 @@ export type User = {
|
|
|
55
57
|
createdAt: number;
|
|
56
58
|
updatedAt: number;
|
|
57
59
|
};
|
|
58
|
-
export type UserKeys = 'tenantId' | 'id' | 'username' | 'primaryEmail' | 'primaryPhone' | 'passwordEncrypted' | 'passwordEncryptionMethod' | 'name' | 'avatar' | 'profile' | 'applicationId' | 'identities' | 'customData' | 'logtoConfig' | 'mfaVerifications' | 'isSuspended' | 'isPasswordExpired' | 'lastSignInAt' | 'passwordUpdatedAt' | 'createdAt' | 'updatedAt';
|
|
60
|
+
export type UserKeys = 'tenantId' | 'id' | 'username' | 'primaryEmail' | 'primaryPhone' | 'passwordEncrypted' | 'passwordEncryptionMethod' | 'name' | 'avatar' | 'profile' | 'applicationId' | 'cimdClientId' | 'identities' | 'customData' | 'logtoConfig' | 'mfaVerifications' | 'isSuspended' | 'isPasswordExpired' | 'lastSignInAt' | 'passwordUpdatedAt' | 'createdAt' | 'updatedAt';
|
|
59
61
|
export declare const Users: GeneratedSchema<UserKeys, CreateUser, User, 'users', 'user'>;
|
package/lib/db-entries/user.js
CHANGED
|
@@ -14,6 +14,7 @@ const createGuard = z.object({
|
|
|
14
14
|
avatar: z.string().max(2048).nullable().optional(),
|
|
15
15
|
profile: userProfileGuard.optional(),
|
|
16
16
|
applicationId: z.string().max(21).nullable().optional(),
|
|
17
|
+
cimdClientId: z.string().max(2048).nullable().optional(),
|
|
17
18
|
identities: identitiesGuard.optional(),
|
|
18
19
|
customData: jsonObjectGuard.optional(),
|
|
19
20
|
logtoConfig: jsonObjectGuard.optional(),
|
|
@@ -37,6 +38,7 @@ const guard = z.object({
|
|
|
37
38
|
avatar: z.string().max(2048).nullable(),
|
|
38
39
|
profile: userProfileGuard,
|
|
39
40
|
applicationId: z.string().max(21).nullable(),
|
|
41
|
+
cimdClientId: z.string().max(2048).nullable(),
|
|
40
42
|
identities: identitiesGuard,
|
|
41
43
|
customData: jsonObjectGuard,
|
|
42
44
|
logtoConfig: jsonObjectGuard,
|
|
@@ -63,6 +65,7 @@ export const Users = Object.freeze({
|
|
|
63
65
|
avatar: 'avatar',
|
|
64
66
|
profile: 'profile',
|
|
65
67
|
applicationId: 'application_id',
|
|
68
|
+
cimdClientId: 'cimd_client_id',
|
|
66
69
|
identities: 'identities',
|
|
67
70
|
customData: 'custom_data',
|
|
68
71
|
logtoConfig: 'logto_config',
|
|
@@ -86,6 +89,7 @@ export const Users = Object.freeze({
|
|
|
86
89
|
'avatar',
|
|
87
90
|
'profile',
|
|
88
91
|
'applicationId',
|
|
92
|
+
'cimdClientId',
|
|
89
93
|
'identities',
|
|
90
94
|
'customData',
|
|
91
95
|
'logtoConfig',
|
|
@@ -22,6 +22,7 @@ export declare const accountCenterFieldControlGuard: z.ZodObject<{
|
|
|
22
22
|
mfa: z.ZodOptional<z.ZodNativeEnum<typeof AccountCenterControlValue>>;
|
|
23
23
|
passkey: z.ZodOptional<z.ZodNativeEnum<typeof AccountCenterControlValue>>;
|
|
24
24
|
session: z.ZodOptional<z.ZodNativeEnum<typeof AccountCenterControlValue>>;
|
|
25
|
+
trustedDevice: z.ZodOptional<z.ZodNativeEnum<typeof AccountCenterControlValue>>;
|
|
25
26
|
}, "strip", z.ZodTypeAny, {
|
|
26
27
|
name?: AccountCenterControlValue | undefined;
|
|
27
28
|
username?: AccountCenterControlValue | undefined;
|
|
@@ -35,6 +36,7 @@ export declare const accountCenterFieldControlGuard: z.ZodObject<{
|
|
|
35
36
|
mfa?: AccountCenterControlValue | undefined;
|
|
36
37
|
passkey?: AccountCenterControlValue | undefined;
|
|
37
38
|
session?: AccountCenterControlValue | undefined;
|
|
39
|
+
trustedDevice?: AccountCenterControlValue | undefined;
|
|
38
40
|
}, {
|
|
39
41
|
name?: AccountCenterControlValue | undefined;
|
|
40
42
|
username?: AccountCenterControlValue | undefined;
|
|
@@ -48,6 +50,7 @@ export declare const accountCenterFieldControlGuard: z.ZodObject<{
|
|
|
48
50
|
mfa?: AccountCenterControlValue | undefined;
|
|
49
51
|
passkey?: AccountCenterControlValue | undefined;
|
|
50
52
|
session?: AccountCenterControlValue | undefined;
|
|
53
|
+
trustedDevice?: AccountCenterControlValue | undefined;
|
|
51
54
|
}>;
|
|
52
55
|
export type AccountCenterFieldControl = z.infer<typeof accountCenterFieldControlGuard>;
|
|
53
56
|
export declare const webauthnRelatedOriginsGuard: z.ZodArray<z.ZodString, "many">;
|
|
@@ -24,6 +24,7 @@ export const accountCenterFieldControlGuard = z
|
|
|
24
24
|
mfa: z.nativeEnum(AccountCenterControlValue),
|
|
25
25
|
passkey: z.nativeEnum(AccountCenterControlValue),
|
|
26
26
|
session: z.nativeEnum(AccountCenterControlValue),
|
|
27
|
+
trustedDevice: z.nativeEnum(AccountCenterControlValue),
|
|
27
28
|
})
|
|
28
29
|
.partial();
|
|
29
30
|
export const webauthnRelatedOriginsGuard = z.array(z.string());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { AccountCenterControlValue, accountCenterFieldControlGuard } from './account-centers.js';
|
|
3
|
+
describe('accountCenterFieldControlGuard', () => {
|
|
4
|
+
it('allows trusted device control to be omitted', () => {
|
|
5
|
+
expect(accountCenterFieldControlGuard.parse({})).toEqual({});
|
|
6
|
+
});
|
|
7
|
+
it.each(Object.values(AccountCenterControlValue))('accepts trusted device control value %s', (trustedDevice) => {
|
|
8
|
+
expect(accountCenterFieldControlGuard.parse({ trustedDevice })).toEqual({ trustedDevice });
|
|
9
|
+
});
|
|
10
|
+
it('rejects an invalid trusted device control value', () => {
|
|
11
|
+
expect(accountCenterFieldControlGuard.safeParse({ trustedDevice: 'Invalid' }).success).toBe(false);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -14,6 +14,7 @@ export declare enum InteractionHookEvent {
|
|
|
14
14
|
}
|
|
15
15
|
export declare enum DataHookSchema {
|
|
16
16
|
User = "User",
|
|
17
|
+
TrustedDevice = "TrustedDevice",
|
|
17
18
|
Role = "Role",
|
|
18
19
|
Scope = "Scope",
|
|
19
20
|
Organization = "Organization",
|
|
@@ -28,16 +29,19 @@ declare enum DataHookDetailMutationType {
|
|
|
28
29
|
Updated = "Updated"
|
|
29
30
|
}
|
|
30
31
|
type BasicDataHookEvent = `${DataHookSchema}.${DataHookBasicMutationType}`;
|
|
31
|
-
type CustomDataHookMutableSchema = `${DataHookSchema}.Data` | `${DataHookSchema.User}.SuspensionStatus` | `${DataHookSchema.Role}.Scopes` | `${DataHookSchema.Organization}.Membership` | `${DataHookSchema.OrganizationRole}.Scopes`;
|
|
32
|
+
type CustomDataHookMutableSchema = `${Exclude<DataHookSchema, DataHookSchema.TrustedDevice>}.Data` | `${DataHookSchema.User}.SuspensionStatus` | `${DataHookSchema.Role}.Scopes` | `${DataHookSchema.Organization}.Membership` | `${DataHookSchema.OrganizationRole}.Scopes`;
|
|
32
33
|
type DataHookPropertyUpdateEvent = `${CustomDataHookMutableSchema}.${DataHookDetailMutationType.Updated}`;
|
|
33
34
|
export type ExceptionHookEvent = 'Identifier.Lockout' | 'Message.RateLimited' | 'Grant.LimitExceeded';
|
|
34
35
|
export type DataHookEvent = BasicDataHookEvent | DataHookPropertyUpdateEvent;
|
|
36
|
+
/** Data hook events that are available only while their feature is under development. */
|
|
37
|
+
export declare const devFeatureHookEvents: readonly ["TrustedDevice.Created", "TrustedDevice.Deleted"];
|
|
38
|
+
export type DevFeatureHookEvent = (typeof devFeatureHookEvents)[number];
|
|
35
39
|
/** The hook event values that can be registered. */
|
|
36
|
-
export declare const hookEvents: readonly [InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited", "Grant.LimitExceeded"];
|
|
40
|
+
export declare const hookEvents: readonly [InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "TrustedDevice.Created", "TrustedDevice.Deleted", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited", "Grant.LimitExceeded"];
|
|
37
41
|
/** The type of hook event values that can be registered. */
|
|
38
42
|
export type HookEvent = (typeof hookEvents)[number];
|
|
39
|
-
export declare const hookEventGuard: z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited", "Grant.LimitExceeded"]>;
|
|
40
|
-
export declare const hookEventsGuard: z.ZodArray<z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited", "Grant.LimitExceeded"]>, "many">;
|
|
43
|
+
export declare const hookEventGuard: z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "TrustedDevice.Created", "TrustedDevice.Deleted", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited", "Grant.LimitExceeded"]>;
|
|
44
|
+
export declare const hookEventsGuard: z.ZodArray<z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "TrustedDevice.Created", "TrustedDevice.Deleted", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited", "Grant.LimitExceeded"]>, "many">;
|
|
41
45
|
export type HookEvents = z.infer<typeof hookEventsGuard>;
|
|
42
46
|
export declare const interactionHookEventGuard: z.ZodNativeEnum<typeof InteractionHookEvent>;
|
|
43
47
|
/**
|
|
@@ -18,6 +18,7 @@ export var InteractionHookEvent;
|
|
|
18
18
|
export var DataHookSchema;
|
|
19
19
|
(function (DataHookSchema) {
|
|
20
20
|
DataHookSchema["User"] = "User";
|
|
21
|
+
DataHookSchema["TrustedDevice"] = "TrustedDevice";
|
|
21
22
|
DataHookSchema["Role"] = "Role";
|
|
22
23
|
DataHookSchema["Scope"] = "Scope";
|
|
23
24
|
DataHookSchema["Organization"] = "Organization";
|
|
@@ -33,6 +34,11 @@ var DataHookDetailMutationType;
|
|
|
33
34
|
(function (DataHookDetailMutationType) {
|
|
34
35
|
DataHookDetailMutationType["Updated"] = "Updated";
|
|
35
36
|
})(DataHookDetailMutationType || (DataHookDetailMutationType = {}));
|
|
37
|
+
/** Data hook events that are available only while their feature is under development. */
|
|
38
|
+
export const devFeatureHookEvents = Object.freeze([
|
|
39
|
+
'TrustedDevice.Created',
|
|
40
|
+
'TrustedDevice.Deleted',
|
|
41
|
+
]);
|
|
36
42
|
/** The hook event values that can be registered. */
|
|
37
43
|
export const hookEvents = Object.freeze([
|
|
38
44
|
InteractionHookEvent.PostRegister,
|
|
@@ -43,6 +49,7 @@ export const hookEvents = Object.freeze([
|
|
|
43
49
|
'User.Deleted',
|
|
44
50
|
'User.Data.Updated',
|
|
45
51
|
'User.SuspensionStatus.Updated',
|
|
52
|
+
...devFeatureHookEvents,
|
|
46
53
|
'Role.Created',
|
|
47
54
|
'Role.Deleted',
|
|
48
55
|
'Role.Data.Updated',
|
|
@@ -362,7 +362,13 @@ export declare const logContextPayloadGuard: z.ZodObject<{
|
|
|
362
362
|
}, z.ZodUnknown, "strip">>>;
|
|
363
363
|
}, z.ZodUnknown, "strip">>>;
|
|
364
364
|
userId: z.ZodOptional<z.ZodString>;
|
|
365
|
+
/** Registered application ids only; a CIMD client identifier goes under {@link cimdClientId}. */
|
|
365
366
|
applicationId: z.ZodOptional<z.ZodString>;
|
|
367
|
+
/**
|
|
368
|
+
* The CIMD client identifier URL, kept apart from `applicationId` so payload consumers
|
|
369
|
+
* branch on key presence instead of URL shape.
|
|
370
|
+
*/
|
|
371
|
+
cimdClientId: z.ZodOptional<z.ZodString>;
|
|
366
372
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
367
373
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
368
374
|
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
@@ -547,7 +553,13 @@ export declare const logContextPayloadGuard: z.ZodObject<{
|
|
|
547
553
|
}, z.ZodUnknown, "strip">>>;
|
|
548
554
|
}, z.ZodUnknown, "strip">>>;
|
|
549
555
|
userId: z.ZodOptional<z.ZodString>;
|
|
556
|
+
/** Registered application ids only; a CIMD client identifier goes under {@link cimdClientId}. */
|
|
550
557
|
applicationId: z.ZodOptional<z.ZodString>;
|
|
558
|
+
/**
|
|
559
|
+
* The CIMD client identifier URL, kept apart from `applicationId` so payload consumers
|
|
560
|
+
* branch on key presence instead of URL shape.
|
|
561
|
+
*/
|
|
562
|
+
cimdClientId: z.ZodOptional<z.ZodString>;
|
|
551
563
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
552
564
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
553
565
|
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
@@ -732,7 +744,13 @@ export declare const logContextPayloadGuard: z.ZodObject<{
|
|
|
732
744
|
}, z.ZodUnknown, "strip">>>;
|
|
733
745
|
}, z.ZodUnknown, "strip">>>;
|
|
734
746
|
userId: z.ZodOptional<z.ZodString>;
|
|
747
|
+
/** Registered application ids only; a CIMD client identifier goes under {@link cimdClientId}. */
|
|
735
748
|
applicationId: z.ZodOptional<z.ZodString>;
|
|
749
|
+
/**
|
|
750
|
+
* The CIMD client identifier URL, kept apart from `applicationId` so payload consumers
|
|
751
|
+
* branch on key presence instead of URL shape.
|
|
752
|
+
*/
|
|
753
|
+
cimdClientId: z.ZodOptional<z.ZodString>;
|
|
736
754
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
737
755
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
738
756
|
}, z.ZodUnknown, "strip">>;
|
|
@@ -64,7 +64,13 @@ export const logContextPayloadGuard = z
|
|
|
64
64
|
userAgent: z.string().optional(),
|
|
65
65
|
userAgentParsed: userAgentParsedGuard.optional(),
|
|
66
66
|
userId: z.string().optional(),
|
|
67
|
+
/** Registered application ids only; a CIMD client identifier goes under {@link cimdClientId}. */
|
|
67
68
|
applicationId: z.string().optional(),
|
|
69
|
+
/**
|
|
70
|
+
* The CIMD client identifier URL, kept apart from `applicationId` so payload consumers
|
|
71
|
+
* branch on key presence instead of URL shape.
|
|
72
|
+
*/
|
|
73
|
+
cimdClientId: z.string().optional(),
|
|
68
74
|
sessionId: z.string().optional(),
|
|
69
75
|
params: z.record(z.string(), z.unknown()).optional(),
|
|
70
76
|
})
|
|
@@ -51,13 +51,13 @@ export declare const brandingGuard: z.ZodObject<{
|
|
|
51
51
|
export type Branding = z.infer<typeof brandingGuard>;
|
|
52
52
|
export declare const languageInfoGuard: z.ZodObject<{
|
|
53
53
|
autoDetect: z.ZodBoolean;
|
|
54
|
-
fallbackLanguage: z.ZodType<"af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR", z.ZodTypeDef, "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR">;
|
|
54
|
+
fallbackLanguage: z.ZodType<"af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR", z.ZodTypeDef, "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR">;
|
|
55
55
|
}, "strip", z.ZodTypeAny, {
|
|
56
56
|
autoDetect: boolean;
|
|
57
|
-
fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
|
|
57
|
+
fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
|
|
58
58
|
}, {
|
|
59
59
|
autoDetect: boolean;
|
|
60
|
-
fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
|
|
60
|
+
fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
|
|
61
61
|
}>;
|
|
62
62
|
export type LanguageInfo = z.infer<typeof languageInfoGuard>;
|
|
63
63
|
export declare enum SignInIdentifier {
|
|
@@ -320,6 +320,26 @@ export declare const adaptiveMfaGuard: z.ZodObject<{
|
|
|
320
320
|
}, {
|
|
321
321
|
enabled?: boolean | undefined;
|
|
322
322
|
}>;
|
|
323
|
+
/** Stored tenant-level overrides for MFA trusted-device credentials. */
|
|
324
|
+
export type TrustedDevicePolicy = {
|
|
325
|
+
enabled?: boolean;
|
|
326
|
+
durationDays?: number;
|
|
327
|
+
};
|
|
328
|
+
/** Default trusted-device policy for newly created sign-in experiences. */
|
|
329
|
+
export declare const defaultTrustedDevicePolicy: Readonly<{
|
|
330
|
+
enabled: false;
|
|
331
|
+
durationDays: 30;
|
|
332
|
+
}>;
|
|
333
|
+
export declare const trustedDevicePolicyGuard: z.ZodObject<{
|
|
334
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
335
|
+
durationDays: z.ZodOptional<z.ZodNumber>;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
enabled?: boolean | undefined;
|
|
338
|
+
durationDays?: number | undefined;
|
|
339
|
+
}, {
|
|
340
|
+
enabled?: boolean | undefined;
|
|
341
|
+
durationDays?: number | undefined;
|
|
342
|
+
}>;
|
|
323
343
|
export declare const customUiAssetsGuard: z.ZodObject<{
|
|
324
344
|
id: z.ZodString;
|
|
325
345
|
createdAt: z.ZodNumber;
|
|
@@ -112,6 +112,15 @@ export const mfaGuard = z.object({
|
|
|
112
112
|
export const adaptiveMfaGuard = z.object({
|
|
113
113
|
enabled: z.boolean().optional(),
|
|
114
114
|
});
|
|
115
|
+
/** Default trusted-device policy for newly created sign-in experiences. */
|
|
116
|
+
export const defaultTrustedDevicePolicy = Object.freeze({
|
|
117
|
+
enabled: false,
|
|
118
|
+
durationDays: 30,
|
|
119
|
+
});
|
|
120
|
+
export const trustedDevicePolicyGuard = z.object({
|
|
121
|
+
enabled: z.boolean().optional(),
|
|
122
|
+
durationDays: z.number().int().min(1).max(365).optional(),
|
|
123
|
+
});
|
|
115
124
|
export const customUiAssetsGuard = z.object({
|
|
116
125
|
id: z.string(),
|
|
117
126
|
createdAt: z.number(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { customUiCspGuard, passwordExpirationPolicyGuard } from './sign-in-experience.js';
|
|
2
|
+
import { customUiCspGuard, defaultTrustedDevicePolicy, passwordExpirationPolicyGuard, trustedDevicePolicyGuard, } from './sign-in-experience.js';
|
|
3
3
|
describe('customUiCspGuard', () => {
|
|
4
4
|
it.each([
|
|
5
5
|
{},
|
|
@@ -64,3 +64,19 @@ describe('passwordExpirationPolicyGuard', () => {
|
|
|
64
64
|
expect(passwordExpirationPolicyGuard.safeParse(value).success).toBe(false);
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
|
+
describe('trustedDevicePolicyGuard', () => {
|
|
68
|
+
it.each([{}, { enabled: false }, { durationDays: 1 }, { enabled: true, durationDays: 365 }])('accepts valid policy %p', (value) => {
|
|
69
|
+
expect(trustedDevicePolicyGuard.parse(value)).toEqual(value);
|
|
70
|
+
});
|
|
71
|
+
it.each([{ durationDays: 0 }, { durationDays: 366 }, { durationDays: 1.5 }])('rejects invalid policy %p', (value) => {
|
|
72
|
+
expect(trustedDevicePolicyGuard.safeParse(value).success).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
it('provides the complete effective default', () => {
|
|
75
|
+
expect(defaultTrustedDevicePolicy).toEqual({ enabled: false, durationDays: 30 });
|
|
76
|
+
expect(trustedDevicePolicyGuard.safeParse(defaultTrustedDevicePolicy).success).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
it('rejects invalid enabled values', () => {
|
|
79
|
+
const value = { enabled: 'true' };
|
|
80
|
+
expect(trustedDevicePolicyGuard.safeParse(value).success).toBe(false);
|
|
81
|
+
});
|
|
82
|
+
});
|