@logto/schemas 1.27.0 → 1.29.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 (105) hide show
  1. package/alterations/1.28.0-1745735646-add-email-blocklist-policy-column-to-sie-table.ts +20 -0
  2. package/alterations/1.29.0-1748832174-add-webauthn-related-origins.ts +20 -0
  3. package/alterations/1.29.0-1749005587-user-sso-identities-table-add-updated-at-column.ts +31 -0
  4. package/alterations/1.29.0-1749026308-add-oidc-session-extension-table.ts +41 -0
  5. package/alterations/1.29.0-1749523818-add-custom-profile-fields.ts +58 -0
  6. package/alterations/1.29.0-1749724664-drop-sie-order-constraint-from-custom-profile-fields.ts +20 -0
  7. package/alterations/1.29.0-1750663091-change-user-password-encrypted-length.ts +18 -0
  8. package/alterations/1.29.0-1750744518-add-secrets-table.ts +50 -0
  9. package/alterations/1.29.0-1750744539-add-secret-connector-relations-table.ts +109 -0
  10. package/alterations-js/1.28.0-1745735646-add-email-blocklist-policy-column-to-sie-table.js +16 -0
  11. package/alterations-js/1.29.0-1748832174-add-webauthn-related-origins.js +16 -0
  12. package/alterations-js/1.29.0-1749005587-user-sso-identities-table-add-updated-at-column.js +25 -0
  13. package/alterations-js/1.29.0-1749026308-add-oidc-session-extension-table.js +33 -0
  14. package/alterations-js/1.29.0-1749523818-add-custom-profile-fields.js +52 -0
  15. package/alterations-js/1.29.0-1749724664-drop-sie-order-constraint-from-custom-profile-fields.js +16 -0
  16. package/alterations-js/1.29.0-1750663091-change-user-password-encrypted-length.js +14 -0
  17. package/alterations-js/1.29.0-1750744518-add-secrets-table.js +42 -0
  18. package/alterations-js/1.29.0-1750744539-add-secret-connector-relations-table.js +99 -0
  19. package/lib/db-entries/account-center.d.ts +4 -2
  20. package/lib/db-entries/account-center.js +5 -1
  21. package/lib/db-entries/custom-profile-field.d.ts +32 -0
  22. package/lib/db-entries/custom-profile-field.js +58 -0
  23. package/lib/db-entries/index.d.ts +4 -0
  24. package/lib/db-entries/index.js +4 -0
  25. package/lib/db-entries/oidc-session-extension.d.ts +24 -0
  26. package/lib/db-entries/oidc-session-extension.js +42 -0
  27. package/lib/db-entries/secret-connector-relation.d.ts +40 -0
  28. package/lib/db-entries/secret-connector-relation.js +49 -0
  29. package/lib/db-entries/secret.d.ts +44 -0
  30. package/lib/db-entries/secret.js +62 -0
  31. package/lib/db-entries/sign-in-experience.d.ts +4 -2
  32. package/lib/db-entries/sign-in-experience.js +5 -1
  33. package/lib/db-entries/user-sso-identity.d.ts +5 -1
  34. package/lib/db-entries/user-sso-identity.js +4 -0
  35. package/lib/db-entries/user.js +2 -2
  36. package/lib/foundations/jsonb-types/account-centers.d.ts +5 -0
  37. package/lib/foundations/jsonb-types/account-centers.js +2 -0
  38. package/lib/foundations/jsonb-types/custom-profile-fields.d.ts +116 -0
  39. package/lib/foundations/jsonb-types/custom-profile-fields.js +36 -0
  40. package/lib/foundations/jsonb-types/index.d.ts +2 -1
  41. package/lib/foundations/jsonb-types/index.js +2 -1
  42. package/lib/foundations/jsonb-types/secrets.d.ts +9 -0
  43. package/lib/foundations/jsonb-types/secrets.js +10 -0
  44. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +33 -0
  45. package/lib/foundations/jsonb-types/sign-in-experience.js +5 -0
  46. package/lib/foundations/jsonb-types/users.d.ts +32 -0
  47. package/lib/foundations/jsonb-types/users.js +11 -10
  48. package/lib/types/application.d.ts +7 -91
  49. package/lib/types/connector.d.ts +9 -13
  50. package/lib/types/consent.d.ts +25 -21
  51. package/lib/types/custom-profile-fields.d.ts +1310 -0
  52. package/lib/types/custom-profile-fields.js +123 -0
  53. package/lib/types/hook.d.ts +3 -3
  54. package/lib/types/index.d.ts +2 -0
  55. package/lib/types/index.js +2 -0
  56. package/lib/types/interactions.d.ts +12 -6
  57. package/lib/types/interactions.js +1 -0
  58. package/lib/types/log/interaction.d.ts +2 -1
  59. package/lib/types/logto-config/index.d.ts +1119 -34
  60. package/lib/types/logto-config/jwt-customizer.d.ts +2431 -60
  61. package/lib/types/logto-config/jwt-customizer.js +50 -1
  62. package/lib/types/logto-config/oidc-provider.d.ts +6 -6
  63. package/lib/types/mfa.d.ts +10 -10
  64. package/lib/types/saml-application.d.ts +19 -342
  65. package/lib/types/scope.d.ts +3 -3
  66. package/lib/types/sign-in-experience.d.ts +14 -11
  67. package/lib/types/sso-connector.d.ts +27 -5
  68. package/lib/types/sso-connector.js +3 -0
  69. package/lib/types/tenant.d.ts +1 -0
  70. package/lib/types/tenant.js +1 -0
  71. package/lib/types/user.d.ts +14 -3
  72. package/lib/types/user.js +3 -0
  73. package/lib/types/verification-records/backup-code-verification.d.ts +29 -0
  74. package/lib/types/verification-records/backup-code-verification.js +9 -0
  75. package/lib/types/verification-records/code-verification.d.ts +89 -0
  76. package/lib/types/verification-records/code-verification.js +22 -0
  77. package/lib/types/verification-records/enterprise-sso-verification.d.ts +68 -0
  78. package/lib/types/verification-records/enterprise-sso-verification.js +10 -0
  79. package/lib/types/verification-records/index.d.ts +16 -0
  80. package/lib/types/verification-records/index.js +16 -0
  81. package/lib/types/verification-records/new-password-identity-verification.d.ts +54 -0
  82. package/lib/types/verification-records/new-password-identity-verification.js +16 -0
  83. package/lib/types/verification-records/one-time-token-verification.d.ts +55 -0
  84. package/lib/types/verification-records/one-time-token-verification.js +13 -0
  85. package/lib/types/verification-records/password-verification.d.ts +40 -0
  86. package/lib/types/verification-records/password-verification.js +9 -0
  87. package/lib/types/verification-records/social-verification.d.ts +106 -0
  88. package/lib/types/verification-records/social-verification.js +10 -0
  89. package/lib/types/verification-records/totp-verification.d.ts +29 -0
  90. package/lib/types/verification-records/totp-verification.js +9 -0
  91. package/lib/types/verification-records/web-authn-verification.d.ts +80 -0
  92. package/lib/types/verification-records/web-authn-verification.js +12 -0
  93. package/package.json +3 -3
  94. package/tables/account_centers.sql +1 -0
  95. package/tables/connectors.sql +2 -0
  96. package/tables/custom_profile_fields.sql +31 -0
  97. package/tables/oidc_model_instances.sql +2 -0
  98. package/tables/oidc_session_extensions.sql +18 -0
  99. package/tables/secret_connector_relations.sql +78 -0
  100. package/tables/secrets.sql +26 -0
  101. package/tables/sign_in_experiences.sql +1 -0
  102. package/tables/user_sso_identities.sql +8 -0
  103. package/tables/users.sql +1 -1
  104. /package/lib/{foundations/jsonb-types/verification-records.d.ts → types/verification-records/verification-type.d.ts} +0 -0
  105. /package/lib/{foundations/jsonb-types/verification-records.js → types/verification-records/verification-type.js} +0 -0
@@ -34,7 +34,7 @@ export type FullSignInExperience = SignInExperience & {
34
34
  siteKey: string;
35
35
  };
36
36
  };
37
- export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendShape<{
37
+ export declare const fullSignInExperienceGuard: z.ZodObject<{
38
38
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
39
39
  id: z.ZodType<string, z.ZodTypeDef, string>;
40
40
  color: z.ZodType<{
@@ -135,8 +135,9 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
135
135
  enabled?: boolean | undefined;
136
136
  }>;
137
137
  sentinelPolicy: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy>;
138
- }, {
139
- socialConnectors: z.ZodArray<z.ZodObject<Omit<z.objectUtil.extendShape<{
138
+ emailBlocklistPolicy: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy>;
139
+ } & {
140
+ socialConnectors: z.ZodArray<z.ZodObject<Omit<{
140
141
  id: z.ZodString;
141
142
  target: z.ZodString;
142
143
  name: z.ZodType<import("@logto/connector-kit").I18nPhrases, z.ZodTypeDef, import("@logto/connector-kit").I18nPhrases>;
@@ -323,10 +324,10 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
323
324
  }>]>, "many">>;
324
325
  customData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
325
326
  fromEmail: z.ZodOptional<z.ZodString>;
326
- }, {
327
+ } & {
327
328
  platform: z.ZodNullable<z.ZodNativeEnum<typeof import("@logto/connector-kit").ConnectorPlatform>>;
328
329
  isStandard: z.ZodOptional<z.ZodBoolean>;
329
- }>, "customData" | "description" | "readme" | "configTemplate" | "formItems">, "strip", z.ZodTypeAny, {
330
+ }, "customData" | "description" | "readme" | "configTemplate" | "formItems">, "strip", z.ZodTypeAny, {
330
331
  name: {
331
332
  en: string;
332
333
  } & {
@@ -632,15 +633,15 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
632
633
  phone: boolean;
633
634
  }>;
634
635
  isDevelopmentTenant: z.ZodBoolean;
635
- googleOneTap: z.ZodOptional<z.ZodObject<z.objectUtil.extendShape<{
636
+ googleOneTap: z.ZodOptional<z.ZodObject<{
636
637
  isEnabled: z.ZodOptional<z.ZodBoolean>;
637
638
  autoSelect: z.ZodOptional<z.ZodBoolean>;
638
639
  closeOnTapOutside: z.ZodOptional<z.ZodBoolean>;
639
640
  itpSupport: z.ZodOptional<z.ZodBoolean>;
640
- }, {
641
+ } & {
641
642
  clientId: z.ZodString;
642
643
  connectorId: z.ZodString;
643
- }>, "strip", z.ZodTypeAny, {
644
+ }, "strip", z.ZodTypeAny, {
644
645
  connectorId: string;
645
646
  clientId: string;
646
647
  isEnabled?: boolean | undefined;
@@ -665,9 +666,10 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
665
666
  type: CaptchaType;
666
667
  siteKey: string;
667
668
  }>>;
668
- }>, "strip", z.ZodTypeAny, {
669
+ }, "strip", z.ZodTypeAny, {
669
670
  id: string;
670
671
  tenantId: string;
672
+ mfa: import("../foundations/jsonb-types/sign-in-experience.js").Mfa;
671
673
  color: import("../foundations/jsonb-types/sign-in-experience.js").Color;
672
674
  branding: import("../foundations/jsonb-types/sign-in-experience.js").Branding;
673
675
  termsOfUseUrl: string | null;
@@ -683,13 +685,13 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
683
685
  customContent: import("../foundations/jsonb-types/sign-in-experience.js").CustomContent;
684
686
  customUiAssets: import("../foundations/jsonb-types/sign-in-experience.js").CustomUiAssets | null;
685
687
  passwordPolicy: import("../foundations/jsonb-types/logs.js").PartialPasswordPolicy;
686
- mfa: import("../foundations/jsonb-types/sign-in-experience.js").Mfa;
687
688
  singleSignOnEnabled: boolean;
688
689
  supportEmail: string | null;
689
690
  supportWebsiteUrl: string | null;
690
691
  unknownSessionRedirectUrl: string | null;
691
692
  captchaPolicy: import("../foundations/jsonb-types/sign-in-experience.js").CaptchaPolicy;
692
693
  sentinelPolicy: import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy;
694
+ emailBlocklistPolicy: import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy;
693
695
  socialConnectors: {
694
696
  name: {
695
697
  en: string;
@@ -856,6 +858,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
856
858
  }, {
857
859
  id: string;
858
860
  tenantId: string;
861
+ mfa: import("../foundations/jsonb-types/sign-in-experience.js").Mfa;
859
862
  color: import("../foundations/jsonb-types/sign-in-experience.js").Color;
860
863
  branding: import("../foundations/jsonb-types/sign-in-experience.js").Branding;
861
864
  termsOfUseUrl: string | null;
@@ -871,13 +874,13 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
871
874
  customContent: import("../foundations/jsonb-types/sign-in-experience.js").CustomContent;
872
875
  customUiAssets: import("../foundations/jsonb-types/sign-in-experience.js").CustomUiAssets | null;
873
876
  passwordPolicy: import("../foundations/jsonb-types/logs.js").PartialPasswordPolicy;
874
- mfa: import("../foundations/jsonb-types/sign-in-experience.js").Mfa;
875
877
  singleSignOnEnabled: boolean;
876
878
  supportEmail: string | null;
877
879
  supportWebsiteUrl: string | null;
878
880
  unknownSessionRedirectUrl: string | null;
879
881
  captchaPolicy: import("../foundations/jsonb-types/sign-in-experience.js").CaptchaPolicy;
880
882
  sentinelPolicy: import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy;
883
+ emailBlocklistPolicy: import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy;
881
884
  socialConnectors: {
882
885
  name: {
883
886
  en: string;
@@ -82,10 +82,9 @@ export declare const ssoConnectorProvidersResponseGuard: z.ZodArray<z.ZodObject<
82
82
  providerType: SsoProviderType;
83
83
  }>, "many">;
84
84
  export type SsoConnectorProvidersResponse = z.infer<typeof ssoConnectorProvidersResponseGuard>;
85
- export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
85
+ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<{
86
86
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
87
87
  id: z.ZodType<string, z.ZodTypeDef, string>;
88
- providerName: z.ZodType<string, z.ZodTypeDef, string>;
89
88
  connectorName: z.ZodType<string, z.ZodTypeDef, string>;
90
89
  config: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
91
90
  domains: z.ZodType<string[], z.ZodTypeDef, string[]>;
@@ -100,15 +99,15 @@ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<z.objectUt
100
99
  }>;
101
100
  syncProfile: z.ZodType<boolean, z.ZodTypeDef, boolean>;
102
101
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
103
- }, {
102
+ } & {
104
103
  providerName: z.ZodNativeEnum<typeof SsoProviderName>;
105
- }>, {
104
+ } & {
106
105
  name: z.ZodString;
107
106
  providerType: z.ZodNativeEnum<typeof SsoProviderType>;
108
107
  providerLogo: z.ZodString;
109
108
  providerLogoDark: z.ZodString;
110
109
  providerConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
111
- }>, "strip", z.ZodTypeAny, {
110
+ }, "strip", z.ZodTypeAny, {
112
111
  name: string;
113
112
  id: string;
114
113
  tenantId: string;
@@ -143,4 +142,27 @@ export type SsoConnectorWithProviderConfig = z.infer<typeof ssoConnectorWithProv
143
142
  export declare enum SsoAuthenticationQueryKey {
144
143
  SsoConnectorId = "ssoConnectorId"
145
144
  }
145
+ export declare const extendedSocialUserInfoGuard: z.ZodObject<{
146
+ id: z.ZodString;
147
+ email: z.ZodOptional<z.ZodString>;
148
+ phone: z.ZodOptional<z.ZodString>;
149
+ name: z.ZodOptional<z.ZodString>;
150
+ avatar: z.ZodOptional<z.ZodString>;
151
+ rawData: z.ZodOptional<z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
152
+ }, "strip", z.ZodUnknown, z.objectOutputType<{
153
+ id: z.ZodString;
154
+ email: z.ZodOptional<z.ZodString>;
155
+ phone: z.ZodOptional<z.ZodString>;
156
+ name: z.ZodOptional<z.ZodString>;
157
+ avatar: z.ZodOptional<z.ZodString>;
158
+ rawData: z.ZodOptional<z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
159
+ }, z.ZodUnknown, "strip">, z.objectInputType<{
160
+ id: z.ZodString;
161
+ email: z.ZodOptional<z.ZodString>;
162
+ phone: z.ZodOptional<z.ZodString>;
163
+ name: z.ZodOptional<z.ZodString>;
164
+ avatar: z.ZodOptional<z.ZodString>;
165
+ rawData: z.ZodOptional<z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
166
+ }, z.ZodUnknown, "strip">>;
167
+ export type ExtendedSocialUserInfo = z.infer<typeof extendedSocialUserInfoGuard>;
146
168
  export {};
@@ -1,3 +1,4 @@
1
+ import { socialUserInfoGuard } from '@logto/connector-kit';
1
2
  import { z } from 'zod';
2
3
  import { SsoConnectors } from '../db-entries/sso-connector.js';
3
4
  /**
@@ -73,3 +74,5 @@ export var SsoAuthenticationQueryKey;
73
74
  (function (SsoAuthenticationQueryKey) {
74
75
  SsoAuthenticationQueryKey["SsoConnectorId"] = "ssoConnectorId";
75
76
  })(SsoAuthenticationQueryKey || (SsoAuthenticationQueryKey = {}));
77
+ // Saml assertion returned user attribute value
78
+ export const extendedSocialUserInfoGuard = socialUserInfoGuard.catchall(z.unknown());
@@ -2,3 +2,4 @@ export declare enum TenantTag {
2
2
  Development = "development",
3
3
  Production = "production"
4
4
  }
5
+ export declare const defaultTenantIdKey = "defaultTenantId";
@@ -5,3 +5,4 @@ export var TenantTag;
5
5
  /* A production tenant must have an associated subscription plan, even if it's a free plan. */
6
6
  TenantTag["Production"] = "production";
7
7
  })(TenantTag || (TenantTag = {}));
8
+ export const defaultTenantIdKey = 'defaultTenantId';
@@ -77,6 +77,7 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
77
77
  publicKey: string;
78
78
  counter: number;
79
79
  agent: string;
80
+ name?: string | undefined;
80
81
  lastUsedAt?: string | undefined;
81
82
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
82
83
  } | {
@@ -102,6 +103,7 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
102
103
  publicKey: string;
103
104
  counter: number;
104
105
  agent: string;
106
+ name?: string | undefined;
105
107
  lastUsedAt?: string | undefined;
106
108
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
107
109
  } | {
@@ -150,7 +152,7 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
150
152
  lastSignInAt: number | null;
151
153
  }>;
152
154
  export type UserInfo = z.infer<typeof userInfoGuard>;
153
- export declare const userProfileResponseGuard: z.ZodObject<z.objectUtil.extendShape<Pick<{
155
+ export declare const userProfileResponseGuard: z.ZodObject<Pick<{
154
156
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
155
157
  id: z.ZodType<string, z.ZodTypeDef, string>;
156
158
  username: z.ZodType<string | null, z.ZodTypeDef, string | null>;
@@ -225,6 +227,7 @@ export declare const userProfileResponseGuard: z.ZodObject<z.objectUtil.extendSh
225
227
  publicKey: string;
226
228
  counter: number;
227
229
  agent: string;
230
+ name?: string | undefined;
228
231
  lastUsedAt?: string | undefined;
229
232
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
230
233
  } | {
@@ -250,6 +253,7 @@ export declare const userProfileResponseGuard: z.ZodObject<z.objectUtil.extendSh
250
253
  publicKey: string;
251
254
  counter: number;
252
255
  agent: string;
256
+ name?: string | undefined;
253
257
  lastUsedAt?: string | undefined;
254
258
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
255
259
  } | {
@@ -266,10 +270,10 @@ export declare const userProfileResponseGuard: z.ZodObject<z.objectUtil.extendSh
266
270
  lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
267
271
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
268
272
  updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
269
- }, "name" | "id" | "applicationId" | "username" | "createdAt" | "profile" | "avatar" | "customData" | "identities" | "updatedAt" | "primaryEmail" | "primaryPhone" | "isSuspended" | "lastSignInAt">, {
273
+ }, "name" | "id" | "applicationId" | "username" | "createdAt" | "profile" | "avatar" | "customData" | "identities" | "updatedAt" | "primaryEmail" | "primaryPhone" | "isSuspended" | "lastSignInAt"> & {
270
274
  hasPassword: z.ZodOptional<z.ZodBoolean>;
271
275
  ssoIdentities: z.ZodOptional<z.ZodArray<import("../foundations/schemas.js").Guard<import("../db-entries/user-sso-identity.js").UserSsoIdentity>, "many">>;
272
- }>, "strip", z.ZodTypeAny, {
276
+ }, "strip", z.ZodTypeAny, {
273
277
  name: string | null;
274
278
  id: string;
275
279
  applicationId: string | null;
@@ -310,17 +314,20 @@ export declare const userMfaVerificationResponseGuard: z.ZodArray<z.ZodObject<{
310
314
  createdAt: z.ZodString;
311
315
  type: z.ZodNativeEnum<typeof MfaFactor>;
312
316
  agent: z.ZodOptional<z.ZodString>;
317
+ name: z.ZodOptional<z.ZodString>;
313
318
  remainCodes: z.ZodOptional<z.ZodNumber>;
314
319
  }, "strip", z.ZodTypeAny, {
315
320
  type: MfaFactor;
316
321
  id: string;
317
322
  createdAt: string;
323
+ name?: string | undefined;
318
324
  agent?: string | undefined;
319
325
  remainCodes?: number | undefined;
320
326
  }, {
321
327
  type: MfaFactor;
322
328
  id: string;
323
329
  createdAt: string;
330
+ name?: string | undefined;
324
331
  agent?: string | undefined;
325
332
  remainCodes?: number | undefined;
326
333
  }>, "many">;
@@ -428,6 +435,7 @@ export declare const featuredUserGuard: z.ZodObject<Pick<{
428
435
  publicKey: string;
429
436
  counter: number;
430
437
  agent: string;
438
+ name?: string | undefined;
431
439
  lastUsedAt?: string | undefined;
432
440
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
433
441
  } | {
@@ -453,6 +461,7 @@ export declare const featuredUserGuard: z.ZodObject<Pick<{
453
461
  publicKey: string;
454
462
  counter: number;
455
463
  agent: string;
464
+ name?: string | undefined;
456
465
  lastUsedAt?: string | undefined;
457
466
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
458
467
  } | {
@@ -478,3 +487,5 @@ export declare const featuredUserGuard: z.ZodObject<Pick<{
478
487
  id: string;
479
488
  avatar: string | null;
480
489
  }>;
490
+ export declare const consoleUserPreferenceKey = "adminConsolePreferences";
491
+ export declare const guideRequestsKey = "guideRequests";
package/lib/types/user.js CHANGED
@@ -30,6 +30,7 @@ export const userMfaVerificationResponseGuard = z
30
30
  createdAt: z.string(),
31
31
  type: z.nativeEnum(MfaFactor),
32
32
  agent: z.string().optional(),
33
+ name: z.string().optional(),
33
34
  remainCodes: z.number().optional(),
34
35
  })
35
36
  .array();
@@ -64,3 +65,5 @@ export const featuredUserGuard = Users.guard.pick({
64
65
  avatar: true,
65
66
  name: true,
66
67
  });
68
+ export const consoleUserPreferenceKey = 'adminConsolePreferences';
69
+ export const guideRequestsKey = 'guideRequests';
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { VerificationType } from './verification-type.js';
3
+ export type BackupCodeVerificationRecordData = {
4
+ id: string;
5
+ type: VerificationType.BackupCode;
6
+ /** UserId is required for backup code verification */
7
+ userId: string;
8
+ code?: string;
9
+ backupCodes?: string[];
10
+ };
11
+ export declare const backupCodeVerificationRecordDataGuard: z.ZodObject<{
12
+ id: z.ZodString;
13
+ type: z.ZodLiteral<VerificationType.BackupCode>;
14
+ userId: z.ZodString;
15
+ code: z.ZodOptional<z.ZodString>;
16
+ backupCodes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ type: VerificationType.BackupCode;
19
+ id: string;
20
+ userId: string;
21
+ code?: string | undefined;
22
+ backupCodes?: string[] | undefined;
23
+ }, {
24
+ type: VerificationType.BackupCode;
25
+ id: string;
26
+ userId: string;
27
+ code?: string | undefined;
28
+ backupCodes?: string[] | undefined;
29
+ }>;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { VerificationType } from './verification-type.js';
3
+ export const backupCodeVerificationRecordDataGuard = z.object({
4
+ id: z.string(),
5
+ type: z.literal(VerificationType.BackupCode),
6
+ userId: z.string(),
7
+ code: z.string().optional(),
8
+ backupCodes: z.string().array().optional(),
9
+ });
@@ -0,0 +1,89 @@
1
+ import { z } from 'zod';
2
+ import { SignInIdentifier, TemplateType } from '../../foundations/index.js';
3
+ import { type VerificationCodeIdentifier } from '../interactions.js';
4
+ import { VerificationType } from './verification-type.js';
5
+ export type CodeVerificationType = VerificationType.EmailVerificationCode | VerificationType.PhoneVerificationCode;
6
+ type SignInIdentifierTypeOf = {
7
+ [VerificationType.EmailVerificationCode]: SignInIdentifier.Email;
8
+ [VerificationType.PhoneVerificationCode]: SignInIdentifier.Phone;
9
+ };
10
+ export type VerificationCodeIdentifierOf<T extends CodeVerificationType> = VerificationCodeIdentifier<SignInIdentifierTypeOf[T]>;
11
+ /** The JSON data type for the `CodeVerification` record */
12
+ export type CodeVerificationRecordData<T extends CodeVerificationType = CodeVerificationType> = {
13
+ id: string;
14
+ type: T;
15
+ identifier: VerificationCodeIdentifierOf<T>;
16
+ templateType: TemplateType;
17
+ verified: boolean;
18
+ };
19
+ export declare const emailCodeVerificationRecordDataGuard: z.ZodObject<{
20
+ id: z.ZodString;
21
+ templateType: z.ZodNativeEnum<typeof TemplateType>;
22
+ verified: z.ZodBoolean;
23
+ } & {
24
+ type: z.ZodLiteral<VerificationType.EmailVerificationCode>;
25
+ identifier: z.ZodObject<{
26
+ type: z.ZodLiteral<SignInIdentifier.Email>;
27
+ value: z.ZodString;
28
+ }, "strip", z.ZodTypeAny, {
29
+ value: string;
30
+ type: SignInIdentifier.Email;
31
+ }, {
32
+ value: string;
33
+ type: SignInIdentifier.Email;
34
+ }>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ type: VerificationType.EmailVerificationCode;
37
+ id: string;
38
+ identifier: {
39
+ value: string;
40
+ type: SignInIdentifier.Email;
41
+ };
42
+ templateType: TemplateType;
43
+ verified: boolean;
44
+ }, {
45
+ type: VerificationType.EmailVerificationCode;
46
+ id: string;
47
+ identifier: {
48
+ value: string;
49
+ type: SignInIdentifier.Email;
50
+ };
51
+ templateType: TemplateType;
52
+ verified: boolean;
53
+ }>;
54
+ export declare const phoneCodeVerificationRecordDataGuard: z.ZodObject<{
55
+ id: z.ZodString;
56
+ templateType: z.ZodNativeEnum<typeof TemplateType>;
57
+ verified: z.ZodBoolean;
58
+ } & {
59
+ type: z.ZodLiteral<VerificationType.PhoneVerificationCode>;
60
+ identifier: z.ZodObject<{
61
+ type: z.ZodLiteral<SignInIdentifier.Phone>;
62
+ value: z.ZodString;
63
+ }, "strip", z.ZodTypeAny, {
64
+ value: string;
65
+ type: SignInIdentifier.Phone;
66
+ }, {
67
+ value: string;
68
+ type: SignInIdentifier.Phone;
69
+ }>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ type: VerificationType.PhoneVerificationCode;
72
+ id: string;
73
+ identifier: {
74
+ value: string;
75
+ type: SignInIdentifier.Phone;
76
+ };
77
+ templateType: TemplateType;
78
+ verified: boolean;
79
+ }, {
80
+ type: VerificationType.PhoneVerificationCode;
81
+ id: string;
82
+ identifier: {
83
+ value: string;
84
+ type: SignInIdentifier.Phone;
85
+ };
86
+ templateType: TemplateType;
87
+ verified: boolean;
88
+ }>;
89
+ export {};
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { SignInIdentifier, TemplateType } from '../../foundations/index.js';
3
+ import { VerificationType } from './verification-type.js';
4
+ const basicCodeVerificationRecordDataGuard = z.object({
5
+ id: z.string(),
6
+ templateType: z.nativeEnum(TemplateType),
7
+ verified: z.boolean(),
8
+ });
9
+ export const emailCodeVerificationRecordDataGuard = basicCodeVerificationRecordDataGuard.extend({
10
+ type: z.literal(VerificationType.EmailVerificationCode),
11
+ identifier: z.object({
12
+ type: z.literal(SignInIdentifier.Email),
13
+ value: z.string(),
14
+ }),
15
+ });
16
+ export const phoneCodeVerificationRecordDataGuard = basicCodeVerificationRecordDataGuard.extend({
17
+ type: z.literal(VerificationType.PhoneVerificationCode),
18
+ identifier: z.object({
19
+ type: z.literal(SignInIdentifier.Phone),
20
+ value: z.string(),
21
+ }),
22
+ });
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ import { type ExtendedSocialUserInfo } from '../sso-connector.js';
3
+ import { VerificationType } from './verification-type.js';
4
+ /** The JSON data type for the EnterpriseSsoVerification record stored in the interaction storage */
5
+ export type EnterpriseSsoVerificationRecordData = {
6
+ id: string;
7
+ connectorId: string;
8
+ type: VerificationType.EnterpriseSso;
9
+ /**
10
+ * The enterprise SSO identity returned by the connector.
11
+ */
12
+ enterpriseSsoUserInfo?: ExtendedSocialUserInfo;
13
+ issuer?: string;
14
+ };
15
+ export declare const enterpriseSsoVerificationRecordDataGuard: z.ZodObject<{
16
+ id: z.ZodString;
17
+ connectorId: z.ZodString;
18
+ type: z.ZodLiteral<VerificationType.EnterpriseSso>;
19
+ enterpriseSsoUserInfo: z.ZodOptional<z.ZodObject<{
20
+ id: z.ZodString;
21
+ email: z.ZodOptional<z.ZodString>;
22
+ phone: z.ZodOptional<z.ZodString>;
23
+ name: z.ZodOptional<z.ZodString>;
24
+ avatar: z.ZodOptional<z.ZodString>;
25
+ rawData: z.ZodOptional<z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
26
+ }, "strip", z.ZodUnknown, z.objectOutputType<{
27
+ id: z.ZodString;
28
+ email: z.ZodOptional<z.ZodString>;
29
+ phone: z.ZodOptional<z.ZodString>;
30
+ name: z.ZodOptional<z.ZodString>;
31
+ avatar: z.ZodOptional<z.ZodString>;
32
+ rawData: z.ZodOptional<z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
33
+ }, z.ZodUnknown, "strip">, z.objectInputType<{
34
+ id: z.ZodString;
35
+ email: z.ZodOptional<z.ZodString>;
36
+ phone: z.ZodOptional<z.ZodString>;
37
+ name: z.ZodOptional<z.ZodString>;
38
+ avatar: z.ZodOptional<z.ZodString>;
39
+ rawData: z.ZodOptional<z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
40
+ }, z.ZodUnknown, "strip">>>;
41
+ issuer: z.ZodOptional<z.ZodString>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ type: VerificationType.EnterpriseSso;
44
+ id: string;
45
+ connectorId: string;
46
+ issuer?: string | undefined;
47
+ enterpriseSsoUserInfo?: z.objectOutputType<{
48
+ id: z.ZodString;
49
+ email: z.ZodOptional<z.ZodString>;
50
+ phone: z.ZodOptional<z.ZodString>;
51
+ name: z.ZodOptional<z.ZodString>;
52
+ avatar: z.ZodOptional<z.ZodString>;
53
+ rawData: z.ZodOptional<z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
54
+ }, z.ZodUnknown, "strip"> | undefined;
55
+ }, {
56
+ type: VerificationType.EnterpriseSso;
57
+ id: string;
58
+ connectorId: string;
59
+ issuer?: string | undefined;
60
+ enterpriseSsoUserInfo?: z.objectInputType<{
61
+ id: z.ZodString;
62
+ email: z.ZodOptional<z.ZodString>;
63
+ phone: z.ZodOptional<z.ZodString>;
64
+ name: z.ZodOptional<z.ZodString>;
65
+ avatar: z.ZodOptional<z.ZodString>;
66
+ rawData: z.ZodOptional<z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
67
+ }, z.ZodUnknown, "strip"> | undefined;
68
+ }>;
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { extendedSocialUserInfoGuard } from '../sso-connector.js';
3
+ import { VerificationType } from './verification-type.js';
4
+ export const enterpriseSsoVerificationRecordDataGuard = z.object({
5
+ id: z.string(),
6
+ connectorId: z.string(),
7
+ type: z.literal(VerificationType.EnterpriseSso),
8
+ enterpriseSsoUserInfo: extendedSocialUserInfoGuard.optional(),
9
+ issuer: z.string().optional(),
10
+ });
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file defines the data types and guards for verification records in Logto.
3
+ * We keep these definitions in @logto/schemas to ensure it can be shared accross different packages.
4
+ *
5
+ * Check {@link @logto/core/src/routes/experience/classes/verifications} for the implementation of verification records.
6
+ */
7
+ export * from './verification-type.js';
8
+ export * from './backup-code-verification.js';
9
+ export * from './code-verification.js';
10
+ export * from './enterprise-sso-verification.js';
11
+ export * from './new-password-identity-verification.js';
12
+ export * from './one-time-token-verification.js';
13
+ export * from './password-verification.js';
14
+ export * from './social-verification.js';
15
+ export * from './totp-verification.js';
16
+ export * from './web-authn-verification.js';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file defines the data types and guards for verification records in Logto.
3
+ * We keep these definitions in @logto/schemas to ensure it can be shared accross different packages.
4
+ *
5
+ * Check {@link @logto/core/src/routes/experience/classes/verifications} for the implementation of verification records.
6
+ */
7
+ export * from './verification-type.js';
8
+ export * from './backup-code-verification.js';
9
+ export * from './code-verification.js';
10
+ export * from './enterprise-sso-verification.js';
11
+ export * from './new-password-identity-verification.js';
12
+ export * from './one-time-token-verification.js';
13
+ export * from './password-verification.js';
14
+ export * from './social-verification.js';
15
+ export * from './totp-verification.js';
16
+ export * from './web-authn-verification.js';
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @deprecated
3
+ * This verification record type is deprecated.
4
+ * DO NOT use this verification record type in new code.
5
+ */
6
+ import { z } from 'zod';
7
+ import { UsersPasswordEncryptionMethod } from '../../db-entries/custom-types.js';
8
+ import { type InteractionIdentifier } from '../interactions.js';
9
+ import { VerificationType } from './verification-type.js';
10
+ export type NewPasswordIdentityVerificationRecordData = {
11
+ id: string;
12
+ type: VerificationType.NewPasswordIdentity;
13
+ /**
14
+ * For now we only support username identifier for new password identity registration.
15
+ * For email and phone new identity registration, a `CodeVerification` record is required.
16
+ */
17
+ identifier: InteractionIdentifier;
18
+ passwordEncrypted?: string;
19
+ passwordEncryptionMethod?: UsersPasswordEncryptionMethod.Argon2i;
20
+ };
21
+ export declare const newPasswordIdentityVerificationRecordDataGuard: z.ZodObject<{
22
+ id: z.ZodString;
23
+ type: z.ZodLiteral<VerificationType.NewPasswordIdentity>;
24
+ identifier: z.ZodObject<{
25
+ type: z.ZodNativeEnum<typeof import("../../index.js").SignInIdentifier>;
26
+ value: z.ZodString;
27
+ }, "strip", z.ZodTypeAny, {
28
+ value: string;
29
+ type: import("../../index.js").SignInIdentifier;
30
+ }, {
31
+ value: string;
32
+ type: import("../../index.js").SignInIdentifier;
33
+ }>;
34
+ passwordEncrypted: z.ZodOptional<z.ZodString>;
35
+ passwordEncryptionMethod: z.ZodOptional<z.ZodLiteral<UsersPasswordEncryptionMethod.Argon2i>>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ type: VerificationType.NewPasswordIdentity;
38
+ id: string;
39
+ identifier: {
40
+ value: string;
41
+ type: import("../../index.js").SignInIdentifier;
42
+ };
43
+ passwordEncrypted?: string | undefined;
44
+ passwordEncryptionMethod?: UsersPasswordEncryptionMethod.Argon2i | undefined;
45
+ }, {
46
+ type: VerificationType.NewPasswordIdentity;
47
+ id: string;
48
+ identifier: {
49
+ value: string;
50
+ type: import("../../index.js").SignInIdentifier;
51
+ };
52
+ passwordEncrypted?: string | undefined;
53
+ passwordEncryptionMethod?: UsersPasswordEncryptionMethod.Argon2i | undefined;
54
+ }>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @deprecated
3
+ * This verification record type is deprecated.
4
+ * DO NOT use this verification record type in new code.
5
+ */
6
+ import { z } from 'zod';
7
+ import { UsersPasswordEncryptionMethod } from '../../db-entries/custom-types.js';
8
+ import { interactionIdentifierGuard } from '../interactions.js';
9
+ import { VerificationType } from './verification-type.js';
10
+ export const newPasswordIdentityVerificationRecordDataGuard = z.object({
11
+ id: z.string(),
12
+ type: z.literal(VerificationType.NewPasswordIdentity),
13
+ identifier: interactionIdentifierGuard,
14
+ passwordEncrypted: z.string().optional(),
15
+ passwordEncryptionMethod: z.literal(UsersPasswordEncryptionMethod.Argon2i).optional(),
16
+ });