@logto/schemas 1.29.0 → 1.30.1

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 (83) hide show
  1. package/alterations/1.30.0-1750744685-add-triggers-to-delete-secrets-on-social-identities-deletion.ts +81 -0
  2. package/alterations/1.30.0-1750748516-add-enable-token-storage-column-to-connectors-table.ts +20 -0
  3. package/alterations/1.30.0-1751255436-split-secret-connector-relatioins-table.ts +359 -0
  4. package/alterations/1.30.0-1751337183-add-require-mfa-on-sign-in-to-users.ts +20 -0
  5. package/alterations/1.30.0-1751400000-move-require-mfa-on-sign-in-to-logto-config.ts +21 -0
  6. package/alterations/1.30.0-1751529530-add-enable-token-storage-column-to-sso-connectors-table.ts +20 -0
  7. package/alterations/1.30.0-1752630302-alterate-enable-column-default-value-in-account-centers-table.ts +20 -0
  8. package/alterations/1.30.0-1753669579-add-organization-user-relations-foreign-key.ts +46 -0
  9. package/alterations-js/1.30.0-1750744685-add-triggers-to-delete-secrets-on-social-identities-deletion.js +76 -0
  10. package/alterations-js/1.30.0-1750748516-add-enable-token-storage-column-to-connectors-table.js +16 -0
  11. package/alterations-js/1.30.0-1751255436-split-secret-connector-relatioins-table.js +338 -0
  12. package/alterations-js/1.30.0-1751337183-add-require-mfa-on-sign-in-to-users.js +16 -0
  13. package/alterations-js/1.30.0-1751400000-move-require-mfa-on-sign-in-to-logto-config.js +17 -0
  14. package/alterations-js/1.30.0-1751529530-add-enable-token-storage-column-to-sso-connectors-table.js +16 -0
  15. package/alterations-js/1.30.0-1752630302-alterate-enable-column-default-value-in-account-centers-table.js +16 -0
  16. package/alterations-js/1.30.0-1753669579-add-organization-user-relations-foreign-key.js +38 -0
  17. package/lib/consts/oidc.d.ts +9 -1
  18. package/lib/consts/oidc.js +5 -0
  19. package/lib/db-entries/connector.d.ts +5 -1
  20. package/lib/db-entries/connector.js +4 -0
  21. package/lib/db-entries/index.d.ts +2 -1
  22. package/lib/db-entries/index.js +2 -1
  23. package/lib/db-entries/secret-enterprise-sso-connector-relation.d.ts +28 -0
  24. package/lib/db-entries/secret-enterprise-sso-connector-relation.js +37 -0
  25. package/lib/db-entries/secret-social-connector-relation.d.ts +28 -0
  26. package/lib/db-entries/secret-social-connector-relation.js +37 -0
  27. package/lib/db-entries/secret.d.ts +9 -9
  28. package/lib/db-entries/secret.js +9 -9
  29. package/lib/db-entries/sso-connector.d.ts +5 -1
  30. package/lib/db-entries/sso-connector.js +4 -0
  31. package/lib/foundations/jsonb-types/custom-profile-fields.d.ts +336 -11
  32. package/lib/foundations/jsonb-types/custom-profile-fields.js +17 -9
  33. package/lib/foundations/jsonb-types/secrets.d.ts +2 -0
  34. package/lib/foundations/jsonb-types/secrets.js +5 -0
  35. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +3 -1
  36. package/lib/foundations/jsonb-types/sign-in-experience.js +2 -0
  37. package/lib/foundations/jsonb-types/users.d.ts +94 -0
  38. package/lib/foundations/jsonb-types/users.js +11 -0
  39. package/lib/types/connector.d.ts +39 -0
  40. package/lib/types/connector.js +1 -0
  41. package/lib/types/consent.d.ts +40 -0
  42. package/lib/types/custom-profile-fields.d.ts +1410 -133
  43. package/lib/types/custom-profile-fields.js +51 -15
  44. package/lib/types/index.d.ts +2 -0
  45. package/lib/types/index.js +2 -0
  46. package/lib/types/interactions.d.ts +175 -1
  47. package/lib/types/interactions.js +48 -1
  48. package/lib/types/logto-config/index.d.ts +214 -179
  49. package/lib/types/logto-config/jwt-customizer.d.ts +453 -328
  50. package/lib/types/logto-config/jwt-customizer.js +6 -1
  51. package/lib/types/secrets.d.ts +436 -0
  52. package/lib/types/secrets.js +73 -0
  53. package/lib/types/sign-in-experience.d.ts +19 -1
  54. package/lib/types/sign-in-experience.js +3 -1
  55. package/lib/types/sso-connector.d.ts +5 -2
  56. package/lib/types/user-logto-config.d.ts +45 -0
  57. package/lib/types/user-logto-config.js +18 -0
  58. package/lib/types/user.d.ts +615 -0
  59. package/lib/types/user.js +14 -1
  60. package/lib/types/verification-records/backup-code-verification.d.ts +18 -0
  61. package/lib/types/verification-records/backup-code-verification.js +3 -0
  62. package/lib/types/verification-records/enterprise-sso-verification.d.ts +145 -0
  63. package/lib/types/verification-records/enterprise-sso-verification.js +5 -0
  64. package/lib/types/verification-records/new-password-identity-verification.d.ts +31 -0
  65. package/lib/types/verification-records/new-password-identity-verification.js +4 -0
  66. package/lib/types/verification-records/social-verification.d.ts +164 -0
  67. package/lib/types/verification-records/social-verification.js +6 -0
  68. package/lib/types/verification-records/totp-verification.d.ts +18 -0
  69. package/lib/types/verification-records/totp-verification.js +3 -0
  70. package/lib/types/verification-records/web-authn-verification.d.ts +44 -0
  71. package/lib/types/verification-records/web-authn-verification.js +5 -0
  72. package/package.json +7 -7
  73. package/tables/account_centers.sql +1 -1
  74. package/tables/connectors.sql +2 -0
  75. package/tables/organization_user_relations.sql +4 -1
  76. package/tables/secret_enterprise_sso_connector_relations.sql +60 -0
  77. package/tables/secret_social_connector_relations.sql +75 -0
  78. package/tables/secrets.sql +4 -4
  79. package/tables/sso_connectors.sql +2 -0
  80. package/tables/users.sql +2 -1
  81. package/lib/db-entries/secret-connector-relation.d.ts +0 -40
  82. package/lib/db-entries/secret-connector-relation.js +0 -49
  83. package/tables/secret_connector_relations.sql +0 -78
@@ -61,8 +61,13 @@ const jwtCustomizerUserInteractionVerificationRecordGuard = z.discriminatedUnion
61
61
  phoneCodeVerificationRecordDataGuard,
62
62
  socialVerificationRecordDataGuard.omit({
63
63
  connectorSession: true,
64
+ encryptedTokenSet: true,
64
65
  }),
65
- enterpriseSsoVerificationRecordDataGuard.extend({
66
+ enterpriseSsoVerificationRecordDataGuard
67
+ .omit({
68
+ encryptedTokenSet: true,
69
+ })
70
+ .extend({
66
71
  // The original `enterpriseSsoUserInfo` field type is extended with `socialUserInfo` with `catchall(unknown)`.
67
72
  // However, the unknown type may cause error when using the `sql.jsonb` function in Slonik.
68
73
  // See {@logto/cli/src/queries/logto-config.ts#updateValueByKey} for more reference.
@@ -0,0 +1,436 @@
1
+ import { z } from 'zod';
2
+ import { type CreateSecret } from '../db-entries/secret.js';
3
+ import { SecretType } from '../foundations/index.js';
4
+ export declare const encryptedSecretGuard: z.ZodObject<Pick<{
5
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
6
+ id: z.ZodType<string, z.ZodTypeDef, string>;
7
+ userId: z.ZodType<string, z.ZodTypeDef, string>;
8
+ type: z.ZodType<SecretType, z.ZodTypeDef, SecretType>;
9
+ encryptedDek: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
10
+ iv: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
11
+ authTag: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
12
+ ciphertext: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
13
+ metadata: z.ZodType<import("@withtyped/server/lib/types.js").JsonObject, z.ZodTypeDef, import("@withtyped/server/lib/types.js").JsonObject>;
14
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
15
+ updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
16
+ }, "encryptedDek" | "iv" | "authTag" | "ciphertext">, "strip", z.ZodTypeAny, {
17
+ encryptedDek: import("../foundations/index.js").BufferLike;
18
+ iv: import("../foundations/index.js").BufferLike;
19
+ authTag: import("../foundations/index.js").BufferLike;
20
+ ciphertext: import("../foundations/index.js").BufferLike;
21
+ }, {
22
+ encryptedDek: import("../foundations/index.js").BufferLike;
23
+ iv: import("../foundations/index.js").BufferLike;
24
+ authTag: import("../foundations/index.js").BufferLike;
25
+ ciphertext: import("../foundations/index.js").BufferLike;
26
+ }>;
27
+ export type EncryptedSecret = z.infer<typeof encryptedSecretGuard>;
28
+ export declare const tokenSetGuard: z.ZodObject<{
29
+ id_token: z.ZodOptional<z.ZodString>;
30
+ access_token: z.ZodString;
31
+ refresh_token: z.ZodOptional<z.ZodString>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ access_token: string;
34
+ id_token?: string | undefined;
35
+ refresh_token?: string | undefined;
36
+ }, {
37
+ access_token: string;
38
+ id_token?: string | undefined;
39
+ refresh_token?: string | undefined;
40
+ }>;
41
+ export type TokenSet = z.infer<typeof tokenSetGuard>;
42
+ export declare const tokenSetMetadataGuard: z.ZodObject<{
43
+ scope: z.ZodOptional<z.ZodString>;
44
+ expiresAt: z.ZodOptional<z.ZodNumber>;
45
+ tokenType: z.ZodOptional<z.ZodString>;
46
+ hasRefreshToken: z.ZodBoolean;
47
+ }, "strip", z.ZodTypeAny, {
48
+ hasRefreshToken: boolean;
49
+ scope?: string | undefined;
50
+ expiresAt?: number | undefined;
51
+ tokenType?: string | undefined;
52
+ }, {
53
+ hasRefreshToken: boolean;
54
+ scope?: string | undefined;
55
+ expiresAt?: number | undefined;
56
+ tokenType?: string | undefined;
57
+ }>;
58
+ export type TokenSetMetadata = z.infer<typeof tokenSetMetadataGuard>;
59
+ export declare const encryptedTokenSetGuard: z.ZodObject<{
60
+ encryptedTokenSetBase64: z.ZodString;
61
+ metadata: z.ZodObject<{
62
+ scope: z.ZodOptional<z.ZodString>;
63
+ expiresAt: z.ZodOptional<z.ZodNumber>;
64
+ tokenType: z.ZodOptional<z.ZodString>;
65
+ hasRefreshToken: z.ZodBoolean;
66
+ }, "strip", z.ZodTypeAny, {
67
+ hasRefreshToken: boolean;
68
+ scope?: string | undefined;
69
+ expiresAt?: number | undefined;
70
+ tokenType?: string | undefined;
71
+ }, {
72
+ hasRefreshToken: boolean;
73
+ scope?: string | undefined;
74
+ expiresAt?: number | undefined;
75
+ tokenType?: string | undefined;
76
+ }>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ metadata: {
79
+ hasRefreshToken: boolean;
80
+ scope?: string | undefined;
81
+ expiresAt?: number | undefined;
82
+ tokenType?: string | undefined;
83
+ };
84
+ encryptedTokenSetBase64: string;
85
+ }, {
86
+ metadata: {
87
+ hasRefreshToken: boolean;
88
+ scope?: string | undefined;
89
+ expiresAt?: number | undefined;
90
+ tokenType?: string | undefined;
91
+ };
92
+ encryptedTokenSetBase64: string;
93
+ }>;
94
+ export type EncryptedTokenSet = z.infer<typeof encryptedTokenSetGuard>;
95
+ export type CreateSocialTokenSetSecret = CreateSecret & {
96
+ metadata: TokenSetMetadata;
97
+ };
98
+ export declare const secretSocialConnectorRelationPayloadGuard: z.ZodObject<Pick<{
99
+ tenantId: z.ZodOptional<z.ZodType<string, z.ZodTypeDef, string>>;
100
+ secretId: z.ZodType<string, z.ZodTypeDef, string>;
101
+ connectorId: z.ZodType<string, z.ZodTypeDef, string>;
102
+ target: z.ZodType<string, z.ZodTypeDef, string>;
103
+ identityId: z.ZodType<string, z.ZodTypeDef, string>;
104
+ }, "connectorId" | "target" | "identityId">, "strip", z.ZodTypeAny, {
105
+ connectorId: string;
106
+ target: string;
107
+ identityId: string;
108
+ }, {
109
+ connectorId: string;
110
+ target: string;
111
+ identityId: string;
112
+ }>;
113
+ export type SecretSocialConnectorRelationPayload = z.infer<typeof secretSocialConnectorRelationPayloadGuard>;
114
+ export declare const secretEnterpriseSsoConnectorRelationPayloadGuard: z.ZodObject<Pick<{
115
+ tenantId: z.ZodOptional<z.ZodType<string, z.ZodTypeDef, string>>;
116
+ secretId: z.ZodType<string, z.ZodTypeDef, string>;
117
+ ssoConnectorId: z.ZodType<string, z.ZodTypeDef, string>;
118
+ issuer: z.ZodType<string, z.ZodTypeDef, string>;
119
+ identityId: z.ZodType<string, z.ZodTypeDef, string>;
120
+ }, "issuer" | "ssoConnectorId" | "identityId">, "strip", z.ZodTypeAny, {
121
+ issuer: string;
122
+ ssoConnectorId: string;
123
+ identityId: string;
124
+ }, {
125
+ issuer: string;
126
+ ssoConnectorId: string;
127
+ identityId: string;
128
+ }>;
129
+ export type SecretEnterpriseSsoConnectorRelationPayload = z.infer<typeof secretEnterpriseSsoConnectorRelationPayloadGuard>;
130
+ export declare const socialTokenSetSecretGuard: z.ZodObject<{
131
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
132
+ id: z.ZodType<string, z.ZodTypeDef, string>;
133
+ userId: z.ZodType<string, z.ZodTypeDef, string>;
134
+ encryptedDek: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
135
+ iv: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
136
+ authTag: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
137
+ ciphertext: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
138
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
139
+ updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
140
+ } & {
141
+ type: z.ZodLiteral<SecretType>;
142
+ metadata: z.ZodObject<{
143
+ scope: z.ZodOptional<z.ZodString>;
144
+ expiresAt: z.ZodOptional<z.ZodNumber>;
145
+ tokenType: z.ZodOptional<z.ZodString>;
146
+ hasRefreshToken: z.ZodBoolean;
147
+ }, "strip", z.ZodTypeAny, {
148
+ hasRefreshToken: boolean;
149
+ scope?: string | undefined;
150
+ expiresAt?: number | undefined;
151
+ tokenType?: string | undefined;
152
+ }, {
153
+ hasRefreshToken: boolean;
154
+ scope?: string | undefined;
155
+ expiresAt?: number | undefined;
156
+ tokenType?: string | undefined;
157
+ }>;
158
+ connectorId: z.ZodString;
159
+ identityId: z.ZodString;
160
+ target: z.ZodString;
161
+ }, "strip", z.ZodTypeAny, {
162
+ type: SecretType;
163
+ id: string;
164
+ userId: string;
165
+ tenantId: string;
166
+ createdAt: number;
167
+ updatedAt: number;
168
+ connectorId: string;
169
+ metadata: {
170
+ hasRefreshToken: boolean;
171
+ scope?: string | undefined;
172
+ expiresAt?: number | undefined;
173
+ tokenType?: string | undefined;
174
+ };
175
+ target: string;
176
+ identityId: string;
177
+ encryptedDek: import("../foundations/index.js").BufferLike;
178
+ iv: import("../foundations/index.js").BufferLike;
179
+ authTag: import("../foundations/index.js").BufferLike;
180
+ ciphertext: import("../foundations/index.js").BufferLike;
181
+ }, {
182
+ type: SecretType;
183
+ id: string;
184
+ userId: string;
185
+ tenantId: string;
186
+ createdAt: number;
187
+ updatedAt: number;
188
+ connectorId: string;
189
+ metadata: {
190
+ hasRefreshToken: boolean;
191
+ scope?: string | undefined;
192
+ expiresAt?: number | undefined;
193
+ tokenType?: string | undefined;
194
+ };
195
+ target: string;
196
+ identityId: string;
197
+ encryptedDek: import("../foundations/index.js").BufferLike;
198
+ iv: import("../foundations/index.js").BufferLike;
199
+ authTag: import("../foundations/index.js").BufferLike;
200
+ ciphertext: import("../foundations/index.js").BufferLike;
201
+ }>;
202
+ /**
203
+ * Social token set secret type
204
+ * - Secret type is `FederatedTokenSet`
205
+ * - Metadata is the social connector token set metadata
206
+ * - Joined with the social connector relation
207
+ */
208
+ export type SocialTokenSetSecret = z.infer<typeof socialTokenSetSecretGuard>;
209
+ export declare const desensitizedSocialTokenSetSecretGuard: z.ZodObject<Omit<{
210
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
211
+ id: z.ZodType<string, z.ZodTypeDef, string>;
212
+ userId: z.ZodType<string, z.ZodTypeDef, string>;
213
+ encryptedDek: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
214
+ iv: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
215
+ authTag: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
216
+ ciphertext: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
217
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
218
+ updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
219
+ } & {
220
+ type: z.ZodLiteral<SecretType>;
221
+ metadata: z.ZodObject<{
222
+ scope: z.ZodOptional<z.ZodString>;
223
+ expiresAt: z.ZodOptional<z.ZodNumber>;
224
+ tokenType: z.ZodOptional<z.ZodString>;
225
+ hasRefreshToken: z.ZodBoolean;
226
+ }, "strip", z.ZodTypeAny, {
227
+ hasRefreshToken: boolean;
228
+ scope?: string | undefined;
229
+ expiresAt?: number | undefined;
230
+ tokenType?: string | undefined;
231
+ }, {
232
+ hasRefreshToken: boolean;
233
+ scope?: string | undefined;
234
+ expiresAt?: number | undefined;
235
+ tokenType?: string | undefined;
236
+ }>;
237
+ connectorId: z.ZodString;
238
+ identityId: z.ZodString;
239
+ target: z.ZodString;
240
+ }, "encryptedDek" | "iv" | "authTag" | "ciphertext">, "strip", z.ZodTypeAny, {
241
+ type: SecretType;
242
+ id: string;
243
+ userId: string;
244
+ tenantId: string;
245
+ createdAt: number;
246
+ updatedAt: number;
247
+ connectorId: string;
248
+ metadata: {
249
+ hasRefreshToken: boolean;
250
+ scope?: string | undefined;
251
+ expiresAt?: number | undefined;
252
+ tokenType?: string | undefined;
253
+ };
254
+ target: string;
255
+ identityId: string;
256
+ }, {
257
+ type: SecretType;
258
+ id: string;
259
+ userId: string;
260
+ tenantId: string;
261
+ createdAt: number;
262
+ updatedAt: number;
263
+ connectorId: string;
264
+ metadata: {
265
+ hasRefreshToken: boolean;
266
+ scope?: string | undefined;
267
+ expiresAt?: number | undefined;
268
+ tokenType?: string | undefined;
269
+ };
270
+ target: string;
271
+ identityId: string;
272
+ }>;
273
+ export type DesensitizedSocialTokenSetSecret = z.infer<typeof desensitizedSocialTokenSetSecretGuard>;
274
+ export declare const enterpriseSsoTokenSetSecretGuard: z.ZodObject<{
275
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
276
+ id: z.ZodType<string, z.ZodTypeDef, string>;
277
+ userId: z.ZodType<string, z.ZodTypeDef, string>;
278
+ encryptedDek: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
279
+ iv: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
280
+ authTag: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
281
+ ciphertext: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
282
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
283
+ updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
284
+ } & {
285
+ type: z.ZodLiteral<SecretType>;
286
+ metadata: z.ZodObject<{
287
+ scope: z.ZodOptional<z.ZodString>;
288
+ expiresAt: z.ZodOptional<z.ZodNumber>;
289
+ tokenType: z.ZodOptional<z.ZodString>;
290
+ hasRefreshToken: z.ZodBoolean;
291
+ }, "strip", z.ZodTypeAny, {
292
+ hasRefreshToken: boolean;
293
+ scope?: string | undefined;
294
+ expiresAt?: number | undefined;
295
+ tokenType?: string | undefined;
296
+ }, {
297
+ hasRefreshToken: boolean;
298
+ scope?: string | undefined;
299
+ expiresAt?: number | undefined;
300
+ tokenType?: string | undefined;
301
+ }>;
302
+ ssoConnectorId: z.ZodString;
303
+ issuer: z.ZodString;
304
+ identityId: z.ZodString;
305
+ }, "strip", z.ZodTypeAny, {
306
+ type: SecretType;
307
+ id: string;
308
+ userId: string;
309
+ tenantId: string;
310
+ createdAt: number;
311
+ issuer: string;
312
+ updatedAt: number;
313
+ metadata: {
314
+ hasRefreshToken: boolean;
315
+ scope?: string | undefined;
316
+ expiresAt?: number | undefined;
317
+ tokenType?: string | undefined;
318
+ };
319
+ ssoConnectorId: string;
320
+ identityId: string;
321
+ encryptedDek: import("../foundations/index.js").BufferLike;
322
+ iv: import("../foundations/index.js").BufferLike;
323
+ authTag: import("../foundations/index.js").BufferLike;
324
+ ciphertext: import("../foundations/index.js").BufferLike;
325
+ }, {
326
+ type: SecretType;
327
+ id: string;
328
+ userId: string;
329
+ tenantId: string;
330
+ createdAt: number;
331
+ issuer: string;
332
+ updatedAt: number;
333
+ metadata: {
334
+ hasRefreshToken: boolean;
335
+ scope?: string | undefined;
336
+ expiresAt?: number | undefined;
337
+ tokenType?: string | undefined;
338
+ };
339
+ ssoConnectorId: string;
340
+ identityId: string;
341
+ encryptedDek: import("../foundations/index.js").BufferLike;
342
+ iv: import("../foundations/index.js").BufferLike;
343
+ authTag: import("../foundations/index.js").BufferLike;
344
+ ciphertext: import("../foundations/index.js").BufferLike;
345
+ }>;
346
+ /**
347
+ * Enterprise SSO token set secret type
348
+ * - Secret type is `FederatedTokenSet`
349
+ * - Metadata is the Enterprise SSO connector token set metadata
350
+ * - Joined with the Enterprise SSO connector relation
351
+ */
352
+ export type EnterpriseSsoTokenSetSecret = z.infer<typeof enterpriseSsoTokenSetSecretGuard>;
353
+ export declare const desensitizedEnterpriseSsoTokenSetSecretGuard: z.ZodObject<Omit<{
354
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
355
+ id: z.ZodType<string, z.ZodTypeDef, string>;
356
+ userId: z.ZodType<string, z.ZodTypeDef, string>;
357
+ encryptedDek: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
358
+ iv: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
359
+ authTag: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
360
+ ciphertext: z.ZodType<Buffer, z.ZodTypeDef, Buffer>;
361
+ createdAt: z.ZodType<number, z.ZodTypeDef, number>;
362
+ updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
363
+ } & {
364
+ type: z.ZodLiteral<SecretType>;
365
+ metadata: z.ZodObject<{
366
+ scope: z.ZodOptional<z.ZodString>;
367
+ expiresAt: z.ZodOptional<z.ZodNumber>;
368
+ tokenType: z.ZodOptional<z.ZodString>;
369
+ hasRefreshToken: z.ZodBoolean;
370
+ }, "strip", z.ZodTypeAny, {
371
+ hasRefreshToken: boolean;
372
+ scope?: string | undefined;
373
+ expiresAt?: number | undefined;
374
+ tokenType?: string | undefined;
375
+ }, {
376
+ hasRefreshToken: boolean;
377
+ scope?: string | undefined;
378
+ expiresAt?: number | undefined;
379
+ tokenType?: string | undefined;
380
+ }>;
381
+ ssoConnectorId: z.ZodString;
382
+ issuer: z.ZodString;
383
+ identityId: z.ZodString;
384
+ }, "encryptedDek" | "iv" | "authTag" | "ciphertext">, "strip", z.ZodTypeAny, {
385
+ type: SecretType;
386
+ id: string;
387
+ userId: string;
388
+ tenantId: string;
389
+ createdAt: number;
390
+ issuer: string;
391
+ updatedAt: number;
392
+ metadata: {
393
+ hasRefreshToken: boolean;
394
+ scope?: string | undefined;
395
+ expiresAt?: number | undefined;
396
+ tokenType?: string | undefined;
397
+ };
398
+ ssoConnectorId: string;
399
+ identityId: string;
400
+ }, {
401
+ type: SecretType;
402
+ id: string;
403
+ userId: string;
404
+ tenantId: string;
405
+ createdAt: number;
406
+ issuer: string;
407
+ updatedAt: number;
408
+ metadata: {
409
+ hasRefreshToken: boolean;
410
+ scope?: string | undefined;
411
+ expiresAt?: number | undefined;
412
+ tokenType?: string | undefined;
413
+ };
414
+ ssoConnectorId: string;
415
+ identityId: string;
416
+ }>;
417
+ export type DesensitizedEnterpriseSsoTokenSetSecret = z.infer<typeof desensitizedEnterpriseSsoTokenSetSecretGuard>;
418
+ export type DesensitizedTokenSetSecret<T extends SocialTokenSetSecret | EnterpriseSsoTokenSetSecret> = Omit<T, 'encryptedDek' | 'iv' | 'authTag' | 'ciphertext'>;
419
+ export declare const getThirdPartyAccessTokenResponseGuard: z.ZodObject<{
420
+ scope: z.ZodOptional<z.ZodString>;
421
+ expires_in: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
422
+ token_type: z.ZodOptional<z.ZodString>;
423
+ } & {
424
+ access_token: z.ZodString;
425
+ }, "strip", z.ZodTypeAny, {
426
+ access_token: string;
427
+ scope?: string | undefined;
428
+ expires_in?: string | number | undefined;
429
+ token_type?: string | undefined;
430
+ }, {
431
+ access_token: string;
432
+ scope?: string | undefined;
433
+ expires_in?: string | number | undefined;
434
+ token_type?: string | undefined;
435
+ }>;
436
+ export type GetThirdPartyAccessTokenResponse = z.infer<typeof getThirdPartyAccessTokenResponseGuard>;
@@ -0,0 +1,73 @@
1
+ import { tokenResponseGuard } from '@logto/connector-kit';
2
+ import { z } from 'zod';
3
+ import { SecretEnterpriseSsoConnectorRelations } from '../db-entries/secret-enterprise-sso-connector-relation.js';
4
+ import { SecretSocialConnectorRelations } from '../db-entries/secret-social-connector-relation.js';
5
+ import { Secrets } from '../db-entries/secret.js';
6
+ import { SecretType } from '../foundations/index.js';
7
+ export const encryptedSecretGuard = Secrets.guard.pick({
8
+ encryptedDek: true,
9
+ iv: true,
10
+ authTag: true,
11
+ ciphertext: true,
12
+ });
13
+ export const tokenSetGuard = z.object({
14
+ id_token: z.string().optional(),
15
+ access_token: z.string(),
16
+ refresh_token: z.string().optional(),
17
+ });
18
+ export const tokenSetMetadataGuard = z.object({
19
+ scope: z.string().optional(),
20
+ expiresAt: z.number().optional(),
21
+ tokenType: z.string().optional(),
22
+ hasRefreshToken: z.boolean(),
23
+ });
24
+ export const encryptedTokenSetGuard = z.object({
25
+ encryptedTokenSetBase64: z.string(),
26
+ metadata: tokenSetMetadataGuard,
27
+ });
28
+ export const secretSocialConnectorRelationPayloadGuard = SecretSocialConnectorRelations.createGuard.pick({
29
+ connectorId: true,
30
+ target: true,
31
+ identityId: true,
32
+ });
33
+ export const secretEnterpriseSsoConnectorRelationPayloadGuard = SecretEnterpriseSsoConnectorRelations.createGuard.pick({
34
+ ssoConnectorId: true,
35
+ issuer: true,
36
+ identityId: true,
37
+ });
38
+ export const socialTokenSetSecretGuard = Secrets.guard.extend({
39
+ type: z.literal(SecretType.FederatedTokenSet),
40
+ metadata: tokenSetMetadataGuard,
41
+ connectorId: z.string(),
42
+ identityId: z.string(),
43
+ target: z.string(),
44
+ });
45
+ export const desensitizedSocialTokenSetSecretGuard = socialTokenSetSecretGuard.omit({
46
+ encryptedDek: true,
47
+ iv: true,
48
+ authTag: true,
49
+ ciphertext: true,
50
+ });
51
+ export const enterpriseSsoTokenSetSecretGuard = Secrets.guard.extend({
52
+ type: z.literal(SecretType.FederatedTokenSet),
53
+ metadata: tokenSetMetadataGuard,
54
+ ssoConnectorId: z.string(),
55
+ issuer: z.string(),
56
+ identityId: z.string(),
57
+ });
58
+ export const desensitizedEnterpriseSsoTokenSetSecretGuard = enterpriseSsoTokenSetSecretGuard.omit({
59
+ encryptedDek: true,
60
+ iv: true,
61
+ authTag: true,
62
+ ciphertext: true,
63
+ });
64
+ export const getThirdPartyAccessTokenResponseGuard = tokenResponseGuard
65
+ .pick({
66
+ access_token: true,
67
+ scope: true,
68
+ token_type: true,
69
+ expires_in: true,
70
+ })
71
+ .extend({
72
+ access_token: z.string(),
73
+ });
@@ -1,6 +1,6 @@
1
1
  import { type ConnectorMetadata, type GoogleOneTapConfig } from '@logto/connector-kit';
2
2
  import { z } from 'zod';
3
- import { type SignInExperience } from '../db-entries/index.js';
3
+ import { type CustomProfileField, type SignInExperience } from '../db-entries/index.js';
4
4
  import { CaptchaType } from '../foundations/jsonb-types/index.js';
5
5
  import { type SsoConnectorMetadata } from './sso-connector.js';
6
6
  type ForgotPassword = {
@@ -33,6 +33,7 @@ export type FullSignInExperience = SignInExperience & {
33
33
  type: CaptchaType;
34
34
  siteKey: string;
35
35
  };
36
+ customProfileFields?: Readonly<CustomProfileField[]>;
36
37
  };
37
38
  export declare const fullSignInExperienceGuard: z.ZodObject<{
38
39
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
@@ -165,6 +166,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
165
166
  description: z.ZodOptional<z.ZodString>;
166
167
  tooltip: z.ZodOptional<z.ZodString>;
167
168
  isConfidential: z.ZodOptional<z.ZodBoolean>;
169
+ isDevFeature: z.ZodOptional<z.ZodBoolean>;
168
170
  type: z.ZodLiteral<import("@logto/connector-kit").ConnectorConfigFormItemType.Select>;
169
171
  selectItems: z.ZodArray<z.ZodObject<{
170
172
  value: z.ZodString;
@@ -194,6 +196,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
194
196
  description?: string | undefined;
195
197
  tooltip?: string | undefined;
196
198
  isConfidential?: boolean | undefined;
199
+ isDevFeature?: boolean | undefined;
197
200
  }, {
198
201
  type: import("@logto/connector-kit").ConnectorConfigFormItemType.Select;
199
202
  selectItems: {
@@ -212,6 +215,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
212
215
  description?: string | undefined;
213
216
  tooltip?: string | undefined;
214
217
  isConfidential?: boolean | undefined;
218
+ isDevFeature?: boolean | undefined;
215
219
  }>, z.ZodObject<{
216
220
  key: z.ZodString;
217
221
  label: z.ZodString;
@@ -231,6 +235,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
231
235
  description: z.ZodOptional<z.ZodString>;
232
236
  tooltip: z.ZodOptional<z.ZodString>;
233
237
  isConfidential: z.ZodOptional<z.ZodBoolean>;
238
+ isDevFeature: z.ZodOptional<z.ZodBoolean>;
234
239
  type: z.ZodLiteral<import("@logto/connector-kit").ConnectorConfigFormItemType.MultiSelect>;
235
240
  selectItems: z.ZodArray<z.ZodObject<{
236
241
  value: z.ZodString;
@@ -256,6 +261,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
256
261
  description?: string | undefined;
257
262
  tooltip?: string | undefined;
258
263
  isConfidential?: boolean | undefined;
264
+ isDevFeature?: boolean | undefined;
259
265
  }, {
260
266
  type: import("@logto/connector-kit").ConnectorConfigFormItemType.MultiSelect;
261
267
  selectItems: {
@@ -273,6 +279,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
273
279
  description?: string | undefined;
274
280
  tooltip?: string | undefined;
275
281
  isConfidential?: boolean | undefined;
282
+ isDevFeature?: boolean | undefined;
276
283
  }>, z.ZodObject<{
277
284
  key: z.ZodString;
278
285
  label: z.ZodString;
@@ -292,6 +299,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
292
299
  description: z.ZodOptional<z.ZodString>;
293
300
  tooltip: z.ZodOptional<z.ZodString>;
294
301
  isConfidential: z.ZodOptional<z.ZodBoolean>;
302
+ isDevFeature: z.ZodOptional<z.ZodBoolean>;
295
303
  type: z.ZodEnum<[import("@logto/connector-kit").ConnectorConfigFormItemType.Text, import("@logto/connector-kit").ConnectorConfigFormItemType.Number, import("@logto/connector-kit").ConnectorConfigFormItemType.MultilineText, import("@logto/connector-kit").ConnectorConfigFormItemType.Switch, import("@logto/connector-kit").ConnectorConfigFormItemType.Json]>;
296
304
  }, "strip", z.ZodTypeAny, {
297
305
  type: import("@logto/connector-kit").ConnectorConfigFormItemType.Text | import("@logto/connector-kit").ConnectorConfigFormItemType.Number | import("@logto/connector-kit").ConnectorConfigFormItemType.MultilineText | import("@logto/connector-kit").ConnectorConfigFormItemType.Switch | import("@logto/connector-kit").ConnectorConfigFormItemType.Json;
@@ -307,6 +315,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
307
315
  description?: string | undefined;
308
316
  tooltip?: string | undefined;
309
317
  isConfidential?: boolean | undefined;
318
+ isDevFeature?: boolean | undefined;
310
319
  }, {
311
320
  type: import("@logto/connector-kit").ConnectorConfigFormItemType.Text | import("@logto/connector-kit").ConnectorConfigFormItemType.Number | import("@logto/connector-kit").ConnectorConfigFormItemType.MultilineText | import("@logto/connector-kit").ConnectorConfigFormItemType.Switch | import("@logto/connector-kit").ConnectorConfigFormItemType.Json;
312
321
  key: string;
@@ -321,12 +330,14 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
321
330
  description?: string | undefined;
322
331
  tooltip?: string | undefined;
323
332
  isConfidential?: boolean | undefined;
333
+ isDevFeature?: boolean | undefined;
324
334
  }>]>, "many">>;
325
335
  customData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
326
336
  fromEmail: z.ZodOptional<z.ZodString>;
327
337
  } & {
328
338
  platform: z.ZodNullable<z.ZodNativeEnum<typeof import("@logto/connector-kit").ConnectorPlatform>>;
329
339
  isStandard: z.ZodOptional<z.ZodBoolean>;
340
+ isTokenStorageSupported: z.ZodOptional<z.ZodBoolean>;
330
341
  }, "customData" | "description" | "readme" | "configTemplate" | "formItems">, "strip", z.ZodTypeAny, {
331
342
  name: {
332
343
  en: string;
@@ -466,6 +477,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
466
477
  platform: import("@logto/connector-kit").ConnectorPlatform | null;
467
478
  fromEmail?: string | undefined;
468
479
  isStandard?: boolean | undefined;
480
+ isTokenStorageSupported?: boolean | undefined;
469
481
  }, {
470
482
  name: {
471
483
  en: string;
@@ -605,6 +617,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
605
617
  platform: import("@logto/connector-kit").ConnectorPlatform | null;
606
618
  fromEmail?: string | undefined;
607
619
  isStandard?: boolean | undefined;
620
+ isTokenStorageSupported?: boolean | undefined;
608
621
  }>, "many">;
609
622
  ssoConnectors: z.ZodArray<z.ZodObject<{
610
623
  id: z.ZodString;
@@ -666,6 +679,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
666
679
  type: CaptchaType;
667
680
  siteKey: string;
668
681
  }>>;
682
+ customProfileFields: z.ZodOptional<z.ZodArray<import("../index.js").Guard<CustomProfileField>, "many">>;
669
683
  }, "strip", z.ZodTypeAny, {
670
684
  id: string;
671
685
  tenantId: string;
@@ -831,6 +845,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
831
845
  platform: import("@logto/connector-kit").ConnectorPlatform | null;
832
846
  fromEmail?: string | undefined;
833
847
  isStandard?: boolean | undefined;
848
+ isTokenStorageSupported?: boolean | undefined;
834
849
  }[];
835
850
  ssoConnectors: {
836
851
  id: string;
@@ -855,6 +870,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
855
870
  type: CaptchaType;
856
871
  siteKey: string;
857
872
  } | undefined;
873
+ customProfileFields?: CustomProfileField[] | undefined;
858
874
  }, {
859
875
  id: string;
860
876
  tenantId: string;
@@ -1020,6 +1036,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
1020
1036
  platform: import("@logto/connector-kit").ConnectorPlatform | null;
1021
1037
  fromEmail?: string | undefined;
1022
1038
  isStandard?: boolean | undefined;
1039
+ isTokenStorageSupported?: boolean | undefined;
1023
1040
  }[];
1024
1041
  ssoConnectors: {
1025
1042
  id: string;
@@ -1044,5 +1061,6 @@ export declare const fullSignInExperienceGuard: z.ZodObject<{
1044
1061
  type: CaptchaType;
1045
1062
  siteKey: string;
1046
1063
  } | undefined;
1064
+ customProfileFields?: CustomProfileField[] | undefined;
1047
1065
  }>;
1048
1066
  export {};
@@ -1,6 +1,6 @@
1
1
  import { connectorMetadataGuard, googleOneTapConfigGuard, } from '@logto/connector-kit';
2
2
  import { z } from 'zod';
3
- import { SignInExperiences } from '../db-entries/index.js';
3
+ import { CustomProfileFields, SignInExperiences, } from '../db-entries/index.js';
4
4
  import { CaptchaType } from '../foundations/jsonb-types/index.js';
5
5
  import { ssoConnectorMetadataGuard } from './sso-connector.js';
6
6
  export const fullSignInExperienceGuard = SignInExperiences.guard.extend({
@@ -25,4 +25,6 @@ export const fullSignInExperienceGuard = SignInExperiences.guard.extend({
25
25
  siteKey: z.string(),
26
26
  })
27
27
  .optional(),
28
+ // @charles TODO: Remove `optional` before release
29
+ customProfileFields: CustomProfileFields.guard.array().optional(),
28
30
  });