@logto/schemas 1.42.0 → 1.44.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.
Files changed (189) hide show
  1. package/alterations/1.43.0-1785393731-add-oidc-model-instances-account-id-partial-index.ts +33 -0
  2. package/alterations/1.43.0-1785481546-add-tenant-aware-scope-indexes.ts +33 -0
  3. package/alterations/1.43.0-1785488115-add-cimd-permission-ceiling-tables.ts +77 -0
  4. package/alterations/1.43.0-1785722831-add-oidc-session-extensions-account-id-index.ts +27 -0
  5. package/alterations/1.43.0-1785835991-add-cimd-client-identifier-columns.ts +31 -0
  6. package/alterations/1.43.0-1786325989-add-cimd-grant-organizations-table.ts +54 -0
  7. package/alterations/1.43.0-1786333495-add-trusted-devices.ts +57 -0
  8. package/alterations/1.43.0-1786373004-tighten-cimd-grant-organizations-pkey.ts +28 -0
  9. package/alterations/1.43.0-1786414712-add-service-logs-email-indexes.ts +34 -0
  10. package/alterations/1.43.0-1786431364-add-cimd-grant-client-snapshots-table.ts +43 -0
  11. package/alterations/1.44.0-1788946735-add-saml-authn-request-config.ts +18 -0
  12. package/alterations/1.44.0-1789000000-extend-user-id-length.ts +61 -0
  13. package/alterations-js/1.43.0-1785393731-add-oidc-model-instances-account-id-partial-index.js +28 -0
  14. package/alterations-js/1.43.0-1785481546-add-tenant-aware-scope-indexes.js +28 -0
  15. package/alterations-js/1.43.0-1785488115-add-cimd-permission-ceiling-tables.js +69 -0
  16. package/alterations-js/1.43.0-1785722831-add-oidc-session-extensions-account-id-index.js +23 -0
  17. package/alterations-js/1.43.0-1785835991-add-cimd-client-identifier-columns.js +27 -0
  18. package/alterations-js/1.43.0-1786325989-add-cimd-grant-organizations-table.js +49 -0
  19. package/alterations-js/1.43.0-1786333495-add-trusted-devices.js +50 -0
  20. package/alterations-js/1.43.0-1786373004-tighten-cimd-grant-organizations-pkey.js +24 -0
  21. package/alterations-js/1.43.0-1786414712-add-service-logs-email-indexes.js +30 -0
  22. package/alterations-js/1.43.0-1786431364-add-cimd-grant-client-snapshots-table.js +38 -0
  23. package/alterations-js/1.44.0-1788946735-add-saml-authn-request-config.js +14 -0
  24. package/alterations-js/1.44.0-1789000000-extend-user-id-length.js +47 -0
  25. package/lib/consts/experience.d.ts +3 -0
  26. package/lib/consts/experience.js +3 -0
  27. package/lib/consts/index.d.ts +2 -0
  28. package/lib/consts/index.js +2 -0
  29. package/lib/consts/license.d.ts +222 -0
  30. package/lib/consts/license.js +81 -0
  31. package/lib/consts/license.test.d.ts +1 -0
  32. package/lib/consts/license.test.js +96 -0
  33. package/lib/consts/oidc.d.ts +15 -1
  34. package/lib/consts/oidc.js +11 -0
  35. package/lib/consts/oidc.test.d.ts +1 -0
  36. package/lib/consts/oidc.test.js +15 -0
  37. package/lib/consts/product-event.d.ts +5 -1
  38. package/lib/consts/product-event.js +4 -0
  39. package/lib/consts/social-state.d.ts +12 -0
  40. package/lib/consts/social-state.js +12 -0
  41. package/lib/consts/subscriptions.d.ts +13 -1
  42. package/lib/consts/subscriptions.js +12 -0
  43. package/lib/db-entries/aggregated-daily-active-user.js +2 -2
  44. package/lib/db-entries/application-access-control-user-relation.js +2 -2
  45. package/lib/db-entries/application-user-consent-organization.js +2 -2
  46. package/lib/db-entries/cimd-grant-client-snapshot.d.ts +32 -0
  47. package/lib/db-entries/cimd-grant-client-snapshot.js +45 -0
  48. package/lib/db-entries/cimd-grant-organization.d.ts +30 -0
  49. package/lib/db-entries/cimd-grant-organization.js +37 -0
  50. package/lib/db-entries/cimd-organization-resource-scope.d.ts +20 -0
  51. package/lib/db-entries/cimd-organization-resource-scope.js +25 -0
  52. package/lib/db-entries/cimd-organization-scope.d.ts +20 -0
  53. package/lib/db-entries/cimd-organization-scope.js +25 -0
  54. package/lib/db-entries/cimd-resource-scope.d.ts +20 -0
  55. package/lib/db-entries/cimd-resource-scope.js +25 -0
  56. package/lib/db-entries/cimd-user-scope.d.ts +20 -0
  57. package/lib/db-entries/cimd-user-scope.js +25 -0
  58. package/lib/db-entries/daily-active-user.js +2 -2
  59. package/lib/db-entries/index.d.ts +7 -0
  60. package/lib/db-entries/index.js +7 -0
  61. package/lib/db-entries/oidc-session-extension.d.ts +3 -1
  62. package/lib/db-entries/oidc-session-extension.js +6 -2
  63. package/lib/db-entries/organization-invitation.js +4 -4
  64. package/lib/db-entries/organization-role-user-relation.js +2 -2
  65. package/lib/db-entries/organization-user-relation.js +2 -2
  66. package/lib/db-entries/organization.d.ts +5 -1
  67. package/lib/db-entries/organization.js +4 -0
  68. package/lib/db-entries/personal-access-token.js +2 -2
  69. package/lib/db-entries/saml-application-config.d.ts +4 -2
  70. package/lib/db-entries/saml-application-config.js +5 -1
  71. package/lib/db-entries/secret.js +2 -2
  72. package/lib/db-entries/sign-in-experience.d.ts +4 -2
  73. package/lib/db-entries/sign-in-experience.js +5 -1
  74. package/lib/db-entries/subject-token.js +2 -2
  75. package/lib/db-entries/trusted-device.d.ts +36 -0
  76. package/lib/db-entries/trusted-device.js +62 -0
  77. package/lib/db-entries/user-geo-location.js +2 -2
  78. package/lib/db-entries/user-sign-in-country.js +2 -2
  79. package/lib/db-entries/user-sso-identity.js +2 -2
  80. package/lib/db-entries/user.d.ts +3 -1
  81. package/lib/db-entries/user.js +6 -2
  82. package/lib/db-entries/users-role.js +2 -2
  83. package/lib/db-entries/verification-record.js +2 -2
  84. package/lib/db-entries/verification-status.js +2 -2
  85. package/lib/foundations/jsonb-types/account-centers.d.ts +3 -0
  86. package/lib/foundations/jsonb-types/account-centers.js +1 -0
  87. package/lib/foundations/jsonb-types/account-centers.test.d.ts +1 -0
  88. package/lib/foundations/jsonb-types/account-centers.test.js +13 -0
  89. package/lib/foundations/jsonb-types/captcha.d.ts +47 -1
  90. package/lib/foundations/jsonb-types/captcha.js +20 -0
  91. package/lib/foundations/jsonb-types/hooks.d.ts +5 -4
  92. package/lib/foundations/jsonb-types/hooks.js +3 -0
  93. package/lib/foundations/jsonb-types/logs.d.ts +18 -0
  94. package/lib/foundations/jsonb-types/logs.js +6 -0
  95. package/lib/foundations/jsonb-types/saml-application-configs.d.ts +23 -0
  96. package/lib/foundations/jsonb-types/saml-application-configs.js +16 -0
  97. package/lib/foundations/jsonb-types/saml-application-configs.test.js +24 -1
  98. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +23 -3
  99. package/lib/foundations/jsonb-types/sign-in-experience.js +9 -0
  100. package/lib/foundations/jsonb-types/sign-in-experience.test.js +17 -1
  101. package/lib/types/authentication-context.d.ts +224 -0
  102. package/lib/types/authentication-context.js +238 -0
  103. package/lib/types/authentication-context.test.d.ts +1 -0
  104. package/lib/types/authentication-context.test.js +186 -0
  105. package/lib/types/connector.d.ts +8 -0
  106. package/lib/types/consent.d.ts +16 -190
  107. package/lib/types/consent.js +10 -1
  108. package/lib/types/cookie.d.ts +4 -0
  109. package/lib/types/cookie.js +6 -1
  110. package/lib/types/custom-profile-fields.d.ts +1 -0
  111. package/lib/types/hook.d.ts +31 -6
  112. package/lib/types/index.d.ts +2 -0
  113. package/lib/types/index.js +2 -0
  114. package/lib/types/interactions.d.ts +161 -0
  115. package/lib/types/interactions.js +23 -0
  116. package/lib/types/log/index.d.ts +5 -2
  117. package/lib/types/log/index.js +1 -0
  118. package/lib/types/log/interaction.d.ts +15 -2
  119. package/lib/types/log/interaction.js +5 -0
  120. package/lib/types/log/trusted-device.d.ts +7 -0
  121. package/lib/types/log/trusted-device.js +6 -0
  122. package/lib/types/logto-config/action.d.ts +1 -1
  123. package/lib/types/logto-config/action.js +1 -1
  124. package/lib/types/logto-config/index.d.ts +83 -7
  125. package/lib/types/logto-config/index.js +14 -0
  126. package/lib/types/logto-config/index.test.js +23 -0
  127. package/lib/types/logto-config/jwt-customizer.d.ts +123 -10
  128. package/lib/types/logto-config/jwt-customizer.js +1 -1
  129. package/lib/types/logto-config/oidc-provider.d.ts +2 -2
  130. package/lib/types/saml-application.d.ts +55 -1
  131. package/lib/types/saml-application.js +7 -1
  132. package/lib/types/service-log.d.ts +14 -1
  133. package/lib/types/service-log.js +13 -0
  134. package/lib/types/sign-in-experience.d.ts +20 -6
  135. package/lib/types/sign-in-experience.js +1 -0
  136. package/lib/types/ssr.d.ts +2 -0
  137. package/lib/types/system.d.ts +59 -7
  138. package/lib/types/system.js +36 -0
  139. package/lib/types/system.test.d.ts +1 -0
  140. package/lib/types/system.test.js +26 -0
  141. package/lib/types/trusted-device.d.ts +67 -0
  142. package/lib/types/trusted-device.js +16 -0
  143. package/lib/types/user-sessions.d.ts +195 -209
  144. package/lib/types/user-sessions.js +9 -4
  145. package/lib/types/user.d.ts +10 -3
  146. package/lib/types/user.js +1 -0
  147. package/lib/types/verification-records/code-verification.d.ts +17 -0
  148. package/lib/types/verification-records/code-verification.js +1 -0
  149. package/lib/utils/cimd.d.ts +14 -0
  150. package/lib/utils/cimd.js +14 -0
  151. package/lib/utils/cimd.test.d.ts +1 -0
  152. package/lib/utils/cimd.test.js +9 -0
  153. package/lib/utils/index.d.ts +1 -0
  154. package/lib/utils/index.js +1 -0
  155. package/lib/utils/oidc-private-key.test.js +44 -0
  156. package/package.json +9 -9
  157. package/tables/aggregated_daily_active_users.sql +1 -1
  158. package/tables/application_access_control_user_relations.sql +1 -1
  159. package/tables/application_user_consent_organizations.sql +1 -1
  160. package/tables/cimd_grant_client_snapshots.sql +27 -0
  161. package/tables/cimd_grant_organizations.sql +38 -0
  162. package/tables/cimd_organization_resource_scopes.sql +16 -0
  163. package/tables/cimd_organization_scopes.sql +15 -0
  164. package/tables/cimd_resource_scopes.sql +15 -0
  165. package/tables/cimd_user_scopes.sql +13 -0
  166. package/tables/daily_active_users.sql +1 -1
  167. package/tables/oidc_model_instances.sql +5 -0
  168. package/tables/oidc_session_extensions.sql +6 -1
  169. package/tables/organization_invitations.sql +2 -2
  170. package/tables/organization_role_user_relations.sql +1 -1
  171. package/tables/organization_scopes.sql +4 -0
  172. package/tables/organization_user_relations.sql +1 -1
  173. package/tables/organizations.sql +2 -0
  174. package/tables/personal_access_tokens.sql +1 -1
  175. package/tables/saml_application_configs.sql +1 -0
  176. package/tables/scopes.sql +4 -0
  177. package/tables/secrets.sql +1 -1
  178. package/tables/service_logs.sql +14 -0
  179. package/tables/sign_in_experiences.sql +1 -0
  180. package/tables/subject_tokens.sql +1 -1
  181. package/tables/trusted_devices.sql +25 -0
  182. package/tables/user_geo_locations.sql +1 -1
  183. package/tables/user_sign_in_countries.sql +1 -1
  184. package/tables/user_sso_identities.sql +1 -1
  185. package/tables/users.sql +2 -1
  186. package/tables/users_roles.sql +1 -1
  187. package/tables/verification_records.sql +1 -1
  188. package/tables/verification_statuses.sql +1 -1
  189. package/LICENSE +0 -373
@@ -4,7 +4,7 @@ import { userProfileGuard, identitiesGuard, jsonObjectGuard, mfaVerificationsGua
4
4
  import { UsersPasswordEncryptionMethod } from './custom-types.js';
5
5
  const createGuard = z.object({
6
6
  tenantId: z.string().max(21).optional(),
7
- id: z.string().min(1).max(12),
7
+ id: z.string().min(1).max(128),
8
8
  username: z.string().max(128).nullable().optional(),
9
9
  primaryEmail: z.string().max(128).nullable().optional(),
10
10
  primaryPhone: z.string().max(128).nullable().optional(),
@@ -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(),
@@ -27,7 +28,7 @@ const createGuard = z.object({
27
28
  });
28
29
  const guard = z.object({
29
30
  tenantId: z.string().max(21),
30
- id: z.string().min(1).max(12),
31
+ id: z.string().min(1).max(128),
31
32
  username: z.string().max(128).nullable(),
32
33
  primaryEmail: z.string().max(128).nullable(),
33
34
  primaryPhone: z.string().max(128).nullable(),
@@ -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',
@@ -3,13 +3,13 @@ import { z } from 'zod';
3
3
  const createGuard = z.object({
4
4
  tenantId: z.string().max(21).optional(),
5
5
  id: z.string().min(1).max(21),
6
- userId: z.string().min(1).max(21),
6
+ userId: z.string().min(1).max(128),
7
7
  roleId: z.string().min(1).max(21),
8
8
  });
9
9
  const guard = z.object({
10
10
  tenantId: z.string().max(21),
11
11
  id: z.string().min(1).max(21),
12
- userId: z.string().min(1).max(21),
12
+ userId: z.string().min(1).max(128),
13
13
  roleId: z.string().min(1).max(21),
14
14
  });
15
15
  export const UsersRoles = Object.freeze({
@@ -4,7 +4,7 @@ import { jsonObjectGuard } from './../foundations/index.js';
4
4
  const createGuard = z.object({
5
5
  tenantId: z.string().max(21).optional(),
6
6
  id: z.string().min(1).max(21),
7
- userId: z.string().max(21).nullable().optional(),
7
+ userId: z.string().max(128).nullable().optional(),
8
8
  createdAt: z.number().optional(),
9
9
  expiresAt: z.number(),
10
10
  data: jsonObjectGuard.optional(),
@@ -12,7 +12,7 @@ const createGuard = z.object({
12
12
  const guard = z.object({
13
13
  tenantId: z.string().max(21),
14
14
  id: z.string().min(1).max(21),
15
- userId: z.string().max(21).nullable(),
15
+ userId: z.string().max(128).nullable(),
16
16
  createdAt: z.number(),
17
17
  expiresAt: z.number(),
18
18
  data: jsonObjectGuard,
@@ -3,14 +3,14 @@ import { z } from 'zod';
3
3
  const createGuard = z.object({
4
4
  tenantId: z.string().max(21).optional(),
5
5
  id: z.string().min(1).max(21),
6
- userId: z.string().min(1).max(21),
6
+ userId: z.string().min(1).max(128),
7
7
  createdAt: z.number().optional(),
8
8
  verifiedIdentifier: z.string().max(255).nullable().optional(),
9
9
  });
10
10
  const guard = z.object({
11
11
  tenantId: z.string().max(21),
12
12
  id: z.string().min(1).max(21),
13
- userId: z.string().min(1).max(21),
13
+ userId: z.string().min(1).max(128),
14
14
  createdAt: z.number(),
15
15
  verifiedIdentifier: z.string().max(255).nullable(),
16
16
  });
@@ -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,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
+ });
@@ -1,7 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  export declare enum CaptchaType {
3
3
  RecaptchaEnterprise = "RecaptchaEnterprise",
4
- Turnstile = "Turnstile"
4
+ Turnstile = "Turnstile",
5
+ Cap = "Cap"
5
6
  }
6
7
  export declare enum RecaptchaEnterpriseMode {
7
8
  Invisible = "invisible",
@@ -28,6 +29,7 @@ export declare const recaptchaEnterpriseConfigGuard: z.ZodObject<{
28
29
  projectId: z.ZodString;
29
30
  domain: z.ZodOptional<z.ZodString>;
30
31
  mode: z.ZodOptional<z.ZodNativeEnum<typeof RecaptchaEnterpriseMode>>;
32
+ scoreThreshold: z.ZodOptional<z.ZodNumber>;
31
33
  }, "strip", z.ZodTypeAny, {
32
34
  type: CaptchaType.RecaptchaEnterprise;
33
35
  siteKey: string;
@@ -35,6 +37,7 @@ export declare const recaptchaEnterpriseConfigGuard: z.ZodObject<{
35
37
  projectId: string;
36
38
  domain?: string | undefined;
37
39
  mode?: RecaptchaEnterpriseMode | undefined;
40
+ scoreThreshold?: number | undefined;
38
41
  }, {
39
42
  type: CaptchaType.RecaptchaEnterprise;
40
43
  siteKey: string;
@@ -42,8 +45,32 @@ export declare const recaptchaEnterpriseConfigGuard: z.ZodObject<{
42
45
  projectId: string;
43
46
  domain?: string | undefined;
44
47
  mode?: RecaptchaEnterpriseMode | undefined;
48
+ scoreThreshold?: number | undefined;
45
49
  }>;
46
50
  export type RecaptchaEnterpriseConfig = z.infer<typeof recaptchaEnterpriseConfigGuard>;
51
+ /**
52
+ * Config of a self-hosted Cap Standalone instance.
53
+ *
54
+ * @see https://capjs.js.org/guide/standalone/
55
+ */
56
+ export declare const capConfigGuard: z.ZodObject<{
57
+ type: z.ZodLiteral<CaptchaType.Cap>;
58
+ /** The public base URL of the Cap Standalone instance, e.g. `https://cap.example.com`. */
59
+ endpoint: z.ZodEffects<z.ZodString, string, string>;
60
+ siteKey: z.ZodString;
61
+ secretKey: z.ZodString;
62
+ }, "strip", z.ZodTypeAny, {
63
+ type: CaptchaType.Cap;
64
+ siteKey: string;
65
+ secretKey: string;
66
+ endpoint: string;
67
+ }, {
68
+ type: CaptchaType.Cap;
69
+ siteKey: string;
70
+ secretKey: string;
71
+ endpoint: string;
72
+ }>;
73
+ export type CapConfig = z.infer<typeof capConfigGuard>;
47
74
  export declare const captchaConfigGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
48
75
  type: z.ZodLiteral<CaptchaType.Turnstile>;
49
76
  siteKey: z.ZodString;
@@ -63,6 +90,7 @@ export declare const captchaConfigGuard: z.ZodDiscriminatedUnion<"type", [z.ZodO
63
90
  projectId: z.ZodString;
64
91
  domain: z.ZodOptional<z.ZodString>;
65
92
  mode: z.ZodOptional<z.ZodNativeEnum<typeof RecaptchaEnterpriseMode>>;
93
+ scoreThreshold: z.ZodOptional<z.ZodNumber>;
66
94
  }, "strip", z.ZodTypeAny, {
67
95
  type: CaptchaType.RecaptchaEnterprise;
68
96
  siteKey: string;
@@ -70,6 +98,7 @@ export declare const captchaConfigGuard: z.ZodDiscriminatedUnion<"type", [z.ZodO
70
98
  projectId: string;
71
99
  domain?: string | undefined;
72
100
  mode?: RecaptchaEnterpriseMode | undefined;
101
+ scoreThreshold?: number | undefined;
73
102
  }, {
74
103
  type: CaptchaType.RecaptchaEnterprise;
75
104
  siteKey: string;
@@ -77,5 +106,22 @@ export declare const captchaConfigGuard: z.ZodDiscriminatedUnion<"type", [z.ZodO
77
106
  projectId: string;
78
107
  domain?: string | undefined;
79
108
  mode?: RecaptchaEnterpriseMode | undefined;
109
+ scoreThreshold?: number | undefined;
110
+ }>, z.ZodObject<{
111
+ type: z.ZodLiteral<CaptchaType.Cap>;
112
+ /** The public base URL of the Cap Standalone instance, e.g. `https://cap.example.com`. */
113
+ endpoint: z.ZodEffects<z.ZodString, string, string>;
114
+ siteKey: z.ZodString;
115
+ secretKey: z.ZodString;
116
+ }, "strip", z.ZodTypeAny, {
117
+ type: CaptchaType.Cap;
118
+ siteKey: string;
119
+ secretKey: string;
120
+ endpoint: string;
121
+ }, {
122
+ type: CaptchaType.Cap;
123
+ siteKey: string;
124
+ secretKey: string;
125
+ endpoint: string;
80
126
  }>]>;
81
127
  export type CaptchaConfig = z.infer<typeof captchaConfigGuard>;
@@ -3,6 +3,7 @@ export var CaptchaType;
3
3
  (function (CaptchaType) {
4
4
  CaptchaType["RecaptchaEnterprise"] = "RecaptchaEnterprise";
5
5
  CaptchaType["Turnstile"] = "Turnstile";
6
+ CaptchaType["Cap"] = "Cap";
6
7
  })(CaptchaType || (CaptchaType = {}));
7
8
  export var RecaptchaEnterpriseMode;
8
9
  (function (RecaptchaEnterpriseMode) {
@@ -21,8 +22,27 @@ export const recaptchaEnterpriseConfigGuard = z.object({
21
22
  projectId: z.string(),
22
23
  domain: z.string().optional(),
23
24
  mode: z.nativeEnum(RecaptchaEnterpriseMode).optional(),
25
+ scoreThreshold: z.number().min(0).max(1).optional(),
26
+ });
27
+ /**
28
+ * Config of a self-hosted Cap Standalone instance.
29
+ *
30
+ * @see https://capjs.js.org/guide/standalone/
31
+ */
32
+ export const capConfigGuard = z.object({
33
+ type: z.literal(CaptchaType.Cap),
34
+ /** The public base URL of the Cap Standalone instance, e.g. `https://cap.example.com`. */
35
+ endpoint: z
36
+ .string()
37
+ .url()
38
+ .refine((value) => ['http:', 'https:'].includes(new URL(value).protocol), {
39
+ message: 'The endpoint must be an HTTP(S) URL.',
40
+ }),
41
+ siteKey: z.string(),
42
+ secretKey: z.string(),
24
43
  });
25
44
  export const captchaConfigGuard = z.discriminatedUnion('type', [
26
45
  turnstileConfigGuard,
27
46
  recaptchaEnterpriseConfigGuard,
47
+ capConfigGuard,
28
48
  ]);
@@ -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,16 @@ 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;
35
36
  /** 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"];
37
+ 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
38
  /** The type of hook event values that can be registered. */
38
39
  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">;
40
+ 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"]>;
41
+ 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
42
  export type HookEvents = z.infer<typeof hookEventsGuard>;
42
43
  export declare const interactionHookEventGuard: z.ZodNativeEnum<typeof InteractionHookEvent>;
43
44
  /**
@@ -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";
@@ -43,6 +44,8 @@ export const hookEvents = Object.freeze([
43
44
  'User.Deleted',
44
45
  'User.Data.Updated',
45
46
  'User.SuspensionStatus.Updated',
47
+ 'TrustedDevice.Created',
48
+ 'TrustedDevice.Deleted',
46
49
  'Role.Created',
47
50
  'Role.Deleted',
48
51
  '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
  })
@@ -49,6 +49,29 @@ export declare const samlEncryptionGuard: z.ZodEffects<z.ZodObject<{
49
49
  certificate?: string | undefined;
50
50
  }>;
51
51
  export type SamlEncryption = z.input<typeof samlEncryptionGuard>;
52
+ /** Authentication and request-signature policy for a SAML application. */
53
+ export declare const samlAuthnRequestConfigGuard: z.ZodEffects<z.ZodObject<{
54
+ forceAuthn: z.ZodOptional<z.ZodBoolean>;
55
+ requireSignedAuthnRequests: z.ZodOptional<z.ZodBoolean>;
56
+ signingCertificate: z.ZodOptional<z.ZodString>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ forceAuthn?: boolean | undefined;
59
+ requireSignedAuthnRequests?: boolean | undefined;
60
+ signingCertificate?: string | undefined;
61
+ }, {
62
+ forceAuthn?: boolean | undefined;
63
+ requireSignedAuthnRequests?: boolean | undefined;
64
+ signingCertificate?: string | undefined;
65
+ }>, {
66
+ forceAuthn?: boolean | undefined;
67
+ requireSignedAuthnRequests?: boolean | undefined;
68
+ signingCertificate?: string | undefined;
69
+ }, {
70
+ forceAuthn?: boolean | undefined;
71
+ requireSignedAuthnRequests?: boolean | undefined;
72
+ signingCertificate?: string | undefined;
73
+ }>;
74
+ export type SamlAuthnRequestConfig = z.infer<typeof samlAuthnRequestConfigGuard>;
52
75
  export declare enum NameIdFormat {
53
76
  /** Uses unique and persistent identifiers for the user. */
54
77
  Persistent = "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent",
@@ -28,6 +28,22 @@ export const samlEncryptionGuard = z
28
28
  return z.NEVER;
29
29
  }
30
30
  });
31
+ /** Authentication and request-signature policy for a SAML application. */
32
+ export const samlAuthnRequestConfigGuard = z
33
+ .object({
34
+ forceAuthn: z.boolean().optional(),
35
+ requireSignedAuthnRequests: z.boolean().optional(),
36
+ signingCertificate: z.string().trim().min(1).optional(),
37
+ })
38
+ .superRefine(({ requireSignedAuthnRequests, signingCertificate }, ctx) => {
39
+ if (requireSignedAuthnRequests && !signingCertificate) {
40
+ ctx.addIssue({
41
+ code: z.ZodIssueCode.custom,
42
+ path: ['signingCertificate'],
43
+ message: '`signingCertificate` is required when `requireSignedAuthnRequests` is `true`',
44
+ });
45
+ }
46
+ });
31
47
  export var NameIdFormat;
32
48
  (function (NameIdFormat) {
33
49
  /** Uses unique and persistent identifiers for the user. */
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { samlEncryptionGuard } from './saml-application-configs.js';
2
+ import { samlEncryptionGuard, samlAuthnRequestConfigGuard } from './saml-application-configs.js';
3
3
  describe('samlEncryptionGuard', () => {
4
4
  // Test valid configurations
5
5
  it('should pass when encryption is disabled', () => {
@@ -47,3 +47,26 @@ describe('samlEncryptionGuard', () => {
47
47
  }
48
48
  });
49
49
  });
50
+ describe('samlAuthnRequestConfigGuard', () => {
51
+ it('keeps the per-application force-login setting', () => {
52
+ expect(samlAuthnRequestConfigGuard.parse({ forceAuthn: true })).toEqual({ forceAuthn: true });
53
+ });
54
+ it('allows default session reuse', () => {
55
+ expect(samlAuthnRequestConfigGuard.parse({})).toEqual({});
56
+ });
57
+ it('rejects a non-boolean force-login setting', () => {
58
+ expect(samlAuthnRequestConfigGuard.safeParse({ forceAuthn: 'true' }).success).toBe(false);
59
+ });
60
+ });
61
+ describe('signed AuthnRequest policy', () => {
62
+ it('requires a signing certificate when signatures are required', () => {
63
+ expect(samlAuthnRequestConfigGuard.safeParse({ requireSignedAuthnRequests: true }).success).toBe(false);
64
+ });
65
+ it('keeps the configured trust certificate', () => {
66
+ const config = { requireSignedAuthnRequests: true, signingCertificate: 'certificate' };
67
+ expect(samlAuthnRequestConfigGuard.parse(config)).toEqual(config);
68
+ });
69
+ it.each(['', ' '])('rejects an empty certificate: %j', (signingCertificate) => {
70
+ expect(samlAuthnRequestConfigGuard.safeParse({ signingCertificate }).success).toBe(false);
71
+ });
72
+ });
@@ -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
+ });