@logto/schemas 1.28.0 → 1.30.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 (129) hide show
  1. package/alterations/1.29.0-1748832174-add-webauthn-related-origins.ts +20 -0
  2. package/alterations/1.29.0-1749005587-user-sso-identities-table-add-updated-at-column.ts +31 -0
  3. package/alterations/1.29.0-1749026308-add-oidc-session-extension-table.ts +41 -0
  4. package/alterations/1.29.0-1749523818-add-custom-profile-fields.ts +58 -0
  5. package/alterations/1.29.0-1749724664-drop-sie-order-constraint-from-custom-profile-fields.ts +20 -0
  6. package/alterations/1.29.0-1750663091-change-user-password-encrypted-length.ts +18 -0
  7. package/alterations/1.29.0-1750744518-add-secrets-table.ts +50 -0
  8. package/alterations/1.29.0-1750744539-add-secret-connector-relations-table.ts +109 -0
  9. package/alterations/1.30.0-1750744685-add-triggers-to-delete-secrets-on-social-identities-deletion.ts +81 -0
  10. package/alterations/1.30.0-1750748516-add-enable-token-storage-column-to-connectors-table.ts +20 -0
  11. package/alterations/1.30.0-1751255436-split-secret-connector-relatioins-table.ts +359 -0
  12. package/alterations/1.30.0-1751337183-add-require-mfa-on-sign-in-to-users.ts +20 -0
  13. package/alterations/1.30.0-1751400000-move-require-mfa-on-sign-in-to-logto-config.ts +21 -0
  14. package/alterations/1.30.0-1751529530-add-enable-token-storage-column-to-sso-connectors-table.ts +20 -0
  15. package/alterations/1.30.0-1752630302-alterate-enable-column-default-value-in-account-centers-table.ts +20 -0
  16. package/alterations/1.30.0-1753669579-add-organization-user-relations-foreign-key.ts +46 -0
  17. package/alterations-js/1.29.0-1748832174-add-webauthn-related-origins.js +16 -0
  18. package/alterations-js/1.29.0-1749005587-user-sso-identities-table-add-updated-at-column.js +25 -0
  19. package/alterations-js/1.29.0-1749026308-add-oidc-session-extension-table.js +33 -0
  20. package/alterations-js/1.29.0-1749523818-add-custom-profile-fields.js +52 -0
  21. package/alterations-js/1.29.0-1749724664-drop-sie-order-constraint-from-custom-profile-fields.js +16 -0
  22. package/alterations-js/1.29.0-1750663091-change-user-password-encrypted-length.js +14 -0
  23. package/alterations-js/1.29.0-1750744518-add-secrets-table.js +42 -0
  24. package/alterations-js/1.29.0-1750744539-add-secret-connector-relations-table.js +99 -0
  25. package/alterations-js/1.30.0-1750744685-add-triggers-to-delete-secrets-on-social-identities-deletion.js +76 -0
  26. package/alterations-js/1.30.0-1750748516-add-enable-token-storage-column-to-connectors-table.js +16 -0
  27. package/alterations-js/1.30.0-1751255436-split-secret-connector-relatioins-table.js +338 -0
  28. package/alterations-js/1.30.0-1751337183-add-require-mfa-on-sign-in-to-users.js +16 -0
  29. package/alterations-js/1.30.0-1751400000-move-require-mfa-on-sign-in-to-logto-config.js +17 -0
  30. package/alterations-js/1.30.0-1751529530-add-enable-token-storage-column-to-sso-connectors-table.js +16 -0
  31. package/alterations-js/1.30.0-1752630302-alterate-enable-column-default-value-in-account-centers-table.js +16 -0
  32. package/alterations-js/1.30.0-1753669579-add-organization-user-relations-foreign-key.js +38 -0
  33. package/lib/consts/oidc.d.ts +9 -1
  34. package/lib/consts/oidc.js +5 -0
  35. package/lib/db-entries/account-center.d.ts +4 -2
  36. package/lib/db-entries/account-center.js +5 -1
  37. package/lib/db-entries/connector.d.ts +5 -1
  38. package/lib/db-entries/connector.js +4 -0
  39. package/lib/db-entries/custom-profile-field.d.ts +32 -0
  40. package/lib/db-entries/custom-profile-field.js +58 -0
  41. package/lib/db-entries/index.d.ts +5 -0
  42. package/lib/db-entries/index.js +5 -0
  43. package/lib/db-entries/oidc-session-extension.d.ts +24 -0
  44. package/lib/db-entries/oidc-session-extension.js +42 -0
  45. package/lib/db-entries/secret-enterprise-sso-connector-relation.d.ts +28 -0
  46. package/lib/db-entries/secret-enterprise-sso-connector-relation.js +37 -0
  47. package/lib/db-entries/secret-social-connector-relation.d.ts +28 -0
  48. package/lib/db-entries/secret-social-connector-relation.js +37 -0
  49. package/lib/db-entries/secret.d.ts +44 -0
  50. package/lib/db-entries/secret.js +62 -0
  51. package/lib/db-entries/sso-connector.d.ts +5 -1
  52. package/lib/db-entries/sso-connector.js +4 -0
  53. package/lib/db-entries/user-sso-identity.d.ts +5 -1
  54. package/lib/db-entries/user-sso-identity.js +4 -0
  55. package/lib/db-entries/user.js +2 -2
  56. package/lib/foundations/jsonb-types/account-centers.d.ts +5 -0
  57. package/lib/foundations/jsonb-types/account-centers.js +2 -0
  58. package/lib/foundations/jsonb-types/custom-profile-fields.d.ts +441 -0
  59. package/lib/foundations/jsonb-types/custom-profile-fields.js +44 -0
  60. package/lib/foundations/jsonb-types/index.d.ts +2 -1
  61. package/lib/foundations/jsonb-types/index.js +2 -1
  62. package/lib/foundations/jsonb-types/secrets.d.ts +11 -0
  63. package/lib/foundations/jsonb-types/secrets.js +15 -0
  64. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +3 -1
  65. package/lib/foundations/jsonb-types/sign-in-experience.js +2 -0
  66. package/lib/foundations/jsonb-types/users.d.ts +126 -0
  67. package/lib/foundations/jsonb-types/users.js +22 -10
  68. package/lib/types/connector.d.ts +39 -0
  69. package/lib/types/connector.js +1 -0
  70. package/lib/types/consent.d.ts +44 -0
  71. package/lib/types/custom-profile-fields.d.ts +2587 -0
  72. package/lib/types/custom-profile-fields.js +159 -0
  73. package/lib/types/index.d.ts +4 -0
  74. package/lib/types/index.js +4 -0
  75. package/lib/types/interactions.d.ts +181 -1
  76. package/lib/types/interactions.js +49 -1
  77. package/lib/types/log/interaction.d.ts +2 -1
  78. package/lib/types/logto-config/index.d.ts +1139 -18
  79. package/lib/types/logto-config/jwt-customizer.d.ts +2529 -32
  80. package/lib/types/logto-config/jwt-customizer.js +55 -1
  81. package/lib/types/logto-config/oidc-provider.d.ts +6 -6
  82. package/lib/types/mfa.d.ts +10 -10
  83. package/lib/types/secrets.d.ts +436 -0
  84. package/lib/types/secrets.js +73 -0
  85. package/lib/types/sign-in-experience.d.ts +21 -3
  86. package/lib/types/sign-in-experience.js +3 -1
  87. package/lib/types/sso-connector.d.ts +28 -2
  88. package/lib/types/sso-connector.js +3 -0
  89. package/lib/types/tenant.d.ts +1 -0
  90. package/lib/types/tenant.js +1 -0
  91. package/lib/types/user-logto-config.d.ts +45 -0
  92. package/lib/types/user-logto-config.js +18 -0
  93. package/lib/types/user.d.ts +626 -0
  94. package/lib/types/user.js +17 -1
  95. package/lib/types/verification-records/backup-code-verification.d.ts +47 -0
  96. package/lib/types/verification-records/backup-code-verification.js +12 -0
  97. package/lib/types/verification-records/code-verification.d.ts +89 -0
  98. package/lib/types/verification-records/code-verification.js +22 -0
  99. package/lib/types/verification-records/enterprise-sso-verification.d.ts +213 -0
  100. package/lib/types/verification-records/enterprise-sso-verification.js +15 -0
  101. package/lib/types/verification-records/index.d.ts +16 -0
  102. package/lib/types/verification-records/index.js +16 -0
  103. package/lib/types/verification-records/new-password-identity-verification.d.ts +85 -0
  104. package/lib/types/verification-records/new-password-identity-verification.js +20 -0
  105. package/lib/types/verification-records/one-time-token-verification.d.ts +55 -0
  106. package/lib/types/verification-records/one-time-token-verification.js +13 -0
  107. package/lib/types/verification-records/password-verification.d.ts +40 -0
  108. package/lib/types/verification-records/password-verification.js +9 -0
  109. package/lib/types/verification-records/social-verification.d.ts +270 -0
  110. package/lib/types/verification-records/social-verification.js +16 -0
  111. package/lib/types/verification-records/totp-verification.d.ts +47 -0
  112. package/lib/types/verification-records/totp-verification.js +12 -0
  113. package/lib/types/verification-records/web-authn-verification.d.ts +124 -0
  114. package/lib/types/verification-records/web-authn-verification.js +17 -0
  115. package/package.json +6 -6
  116. package/tables/account_centers.sql +2 -1
  117. package/tables/connectors.sql +4 -0
  118. package/tables/custom_profile_fields.sql +31 -0
  119. package/tables/oidc_model_instances.sql +2 -0
  120. package/tables/oidc_session_extensions.sql +18 -0
  121. package/tables/organization_user_relations.sql +4 -1
  122. package/tables/secret_enterprise_sso_connector_relations.sql +60 -0
  123. package/tables/secret_social_connector_relations.sql +75 -0
  124. package/tables/secrets.sql +26 -0
  125. package/tables/sso_connectors.sql +2 -0
  126. package/tables/user_sso_identities.sql +8 -0
  127. package/tables/users.sql +3 -2
  128. /package/lib/{foundations/jsonb-types/verification-records.d.ts → types/verification-records/verification-type.d.ts} +0 -0
  129. /package/lib/{foundations/jsonb-types/verification-records.js → types/verification-records/verification-type.js} +0 -0
@@ -1,10 +1,20 @@
1
- import { jsonObjectGuard } from '@logto/connector-kit';
1
+ import { jsonGuard, jsonObjectGuard, socialUserInfoGuard } from '@logto/connector-kit';
2
2
  import { z } from 'zod';
3
3
  import { Organizations, Roles, UserSsoIdentities, } from '../../db-entries/index.js';
4
4
  import { mfaFactorsGuard } from '../../foundations/index.js';
5
+ import { InteractionEvent } from '../interactions.js';
5
6
  import { GrantType } from '../oidc-config.js';
6
7
  import { scopeResponseGuard } from '../scope.js';
7
8
  import { userInfoGuard } from '../user.js';
9
+ import { backupCodeVerificationRecordDataGuard } from '../verification-records/backup-code-verification.js';
10
+ import { emailCodeVerificationRecordDataGuard, phoneCodeVerificationRecordDataGuard, } from '../verification-records/code-verification.js';
11
+ import { enterpriseSsoVerificationRecordDataGuard } from '../verification-records/enterprise-sso-verification.js';
12
+ import { newPasswordIdentityVerificationRecordDataGuard } from '../verification-records/new-password-identity-verification.js';
13
+ import { oneTimeTokenVerificationRecordDataGuard } from '../verification-records/one-time-token-verification.js';
14
+ import { passwordVerificationRecordDataGuard } from '../verification-records/password-verification.js';
15
+ import { socialVerificationRecordDataGuard } from '../verification-records/social-verification.js';
16
+ import { totpVerificationRecordDataGuard } from '../verification-records/totp-verification.js';
17
+ import { webAuthnVerificationRecordDataGuard } from '../verification-records/web-authn-verification.js';
8
18
  import { accessTokenPayloadGuard, clientCredentialsPayloadGuard } from './oidc-provider.js';
9
19
  export const jwtCustomizerGuard = z.object({
10
20
  script: z.string(),
@@ -43,6 +53,49 @@ export const jwtCustomizerGrantContextGuard = z.object({
43
53
  type: z.literal(GrantType.TokenExchange), // Only support token exchange for now
44
54
  subjectTokenContext: jsonObjectGuard,
45
55
  });
56
+ // Unlike the verification record guard defined in experience interaction,
57
+ // we need to omit sensitive fields like MFA code and secrets from some of the verification record.
58
+ const jwtCustomizerUserInteractionVerificationRecordGuard = z.discriminatedUnion('type', [
59
+ passwordVerificationRecordDataGuard,
60
+ emailCodeVerificationRecordDataGuard,
61
+ phoneCodeVerificationRecordDataGuard,
62
+ socialVerificationRecordDataGuard.omit({
63
+ connectorSession: true,
64
+ encryptedTokenSet: true,
65
+ }),
66
+ enterpriseSsoVerificationRecordDataGuard
67
+ .omit({
68
+ encryptedTokenSet: true,
69
+ })
70
+ .extend({
71
+ // The original `enterpriseSsoUserInfo` field type is extended with `socialUserInfo` with `catchall(unknown)`.
72
+ // However, the unknown type may cause error when using the `sql.jsonb` function in Slonik.
73
+ // See {@logto/cli/src/queries/logto-config.ts#updateValueByKey} for more reference.
74
+ // So we use `socialUserInfoGuard.catchall(jsonGuard)` to ensure the type is JSON serializable.
75
+ enterpriseSsoUserInfo: socialUserInfoGuard.catchall(jsonGuard).optional(),
76
+ }),
77
+ totpVerificationRecordDataGuard.omit({
78
+ secret: true,
79
+ }),
80
+ backupCodeVerificationRecordDataGuard.omit({
81
+ backupCodes: true,
82
+ }),
83
+ webAuthnVerificationRecordDataGuard.omit({
84
+ registrationChallenge: true,
85
+ authenticationChallenge: true,
86
+ registrationInfo: true,
87
+ }),
88
+ oneTimeTokenVerificationRecordDataGuard,
89
+ newPasswordIdentityVerificationRecordDataGuard.omit({
90
+ passwordEncrypted: true,
91
+ passwordEncryptionMethod: true,
92
+ }),
93
+ ]);
94
+ export const jwtCustomizerUserInteractionContextGuard = z.object({
95
+ interactionEvent: z.nativeEnum(InteractionEvent),
96
+ userId: z.string(),
97
+ verificationRecords: jwtCustomizerUserInteractionVerificationRecordGuard.array(),
98
+ });
46
99
  export const accessTokenJwtCustomizerGuard = jwtCustomizerGuard
47
100
  .extend({
48
101
  // Use partial token guard since users customization may not rely on all fields.
@@ -51,6 +104,7 @@ export const accessTokenJwtCustomizerGuard = jwtCustomizerGuard
51
104
  .object({
52
105
  user: jwtCustomizerUserContextGuard.partial(),
53
106
  grant: jwtCustomizerGrantContextGuard.partial().optional(),
107
+ interaction: jwtCustomizerUserInteractionContextGuard.partial().optional(),
54
108
  })
55
109
  .optional(),
56
110
  })
@@ -22,25 +22,25 @@ export declare const accessTokenPayloadGuard: z.ZodObject<{
22
22
  }, "strict", z.ZodTypeAny, {
23
23
  grantId: string;
24
24
  accountId: string;
25
+ jti: string;
25
26
  gty: string;
26
27
  kind: "AccessToken";
27
- jti: string;
28
28
  aud: string | string[];
29
29
  scope?: string | undefined;
30
- expiresWithSession?: boolean | undefined;
31
30
  sessionUid?: string | undefined;
31
+ expiresWithSession?: boolean | undefined;
32
32
  sid?: string | undefined;
33
33
  clientId?: string | undefined;
34
34
  }, {
35
35
  grantId: string;
36
36
  accountId: string;
37
+ jti: string;
37
38
  gty: string;
38
39
  kind: "AccessToken";
39
- jti: string;
40
40
  aud: string | string[];
41
41
  scope?: string | undefined;
42
- expiresWithSession?: boolean | undefined;
43
42
  sessionUid?: string | undefined;
43
+ expiresWithSession?: boolean | undefined;
44
44
  sid?: string | undefined;
45
45
  clientId?: string | undefined;
46
46
  }>;
@@ -52,14 +52,14 @@ export declare const clientCredentialsPayloadGuard: z.ZodObject<{
52
52
  scope: z.ZodOptional<z.ZodString>;
53
53
  clientId: z.ZodOptional<z.ZodString>;
54
54
  }, "strict", z.ZodTypeAny, {
55
- kind: "ClientCredentials";
56
55
  jti: string;
56
+ kind: "ClientCredentials";
57
57
  aud: string | string[];
58
58
  scope?: string | undefined;
59
59
  clientId?: string | undefined;
60
60
  }, {
61
- kind: "ClientCredentials";
62
61
  jti: string;
62
+ kind: "ClientCredentials";
63
63
  aud: string | string[];
64
64
  scope?: string | undefined;
65
65
  clientId?: string | undefined;
@@ -56,13 +56,13 @@ export declare const webAuthnRegistrationOptionsGuard: z.ZodObject<{
56
56
  }, "strip", z.ZodTypeAny, {
57
57
  authenticatorAttachment?: "platform" | "cross-platform" | undefined;
58
58
  requireResidentKey?: boolean | undefined;
59
- residentKey?: "discouraged" | "preferred" | "required" | undefined;
60
- userVerification?: "discouraged" | "preferred" | "required" | undefined;
59
+ residentKey?: "required" | "discouraged" | "preferred" | undefined;
60
+ userVerification?: "required" | "discouraged" | "preferred" | undefined;
61
61
  }, {
62
62
  authenticatorAttachment?: "platform" | "cross-platform" | undefined;
63
63
  requireResidentKey?: boolean | undefined;
64
- residentKey?: "discouraged" | "preferred" | "required" | undefined;
65
- userVerification?: "discouraged" | "preferred" | "required" | undefined;
64
+ residentKey?: "required" | "discouraged" | "preferred" | undefined;
65
+ userVerification?: "required" | "discouraged" | "preferred" | undefined;
66
66
  }>>;
67
67
  attestation: z.ZodOptional<z.ZodEnum<["none", "indirect", "direct", "enterprise"]>>;
68
68
  extensions: z.ZodOptional<z.ZodObject<{
@@ -102,8 +102,8 @@ export declare const webAuthnRegistrationOptionsGuard: z.ZodObject<{
102
102
  authenticatorSelection?: {
103
103
  authenticatorAttachment?: "platform" | "cross-platform" | undefined;
104
104
  requireResidentKey?: boolean | undefined;
105
- residentKey?: "discouraged" | "preferred" | "required" | undefined;
106
- userVerification?: "discouraged" | "preferred" | "required" | undefined;
105
+ residentKey?: "required" | "discouraged" | "preferred" | undefined;
106
+ userVerification?: "required" | "discouraged" | "preferred" | undefined;
107
107
  } | undefined;
108
108
  attestation?: "none" | "indirect" | "direct" | "enterprise" | undefined;
109
109
  extensions?: {
@@ -135,8 +135,8 @@ export declare const webAuthnRegistrationOptionsGuard: z.ZodObject<{
135
135
  authenticatorSelection?: {
136
136
  authenticatorAttachment?: "platform" | "cross-platform" | undefined;
137
137
  requireResidentKey?: boolean | undefined;
138
- residentKey?: "discouraged" | "preferred" | "required" | undefined;
139
- userVerification?: "discouraged" | "preferred" | "required" | undefined;
138
+ residentKey?: "required" | "discouraged" | "preferred" | undefined;
139
+ userVerification?: "required" | "discouraged" | "preferred" | undefined;
140
140
  } | undefined;
141
141
  attestation?: "none" | "indirect" | "direct" | "enterprise" | undefined;
142
142
  extensions?: {
@@ -180,7 +180,7 @@ export declare const webAuthnAuthenticationOptionsGuard: z.ZodObject<{
180
180
  }, "strip", z.ZodTypeAny, {
181
181
  challenge: string;
182
182
  timeout?: number | undefined;
183
- userVerification?: "discouraged" | "preferred" | "required" | undefined;
183
+ userVerification?: "required" | "discouraged" | "preferred" | undefined;
184
184
  extensions?: {
185
185
  appid?: string | undefined;
186
186
  hmacCreateSecret?: boolean | undefined;
@@ -195,7 +195,7 @@ export declare const webAuthnAuthenticationOptionsGuard: z.ZodObject<{
195
195
  }, {
196
196
  challenge: string;
197
197
  timeout?: number | undefined;
198
- userVerification?: "discouraged" | "preferred" | "required" | undefined;
198
+ userVerification?: "required" | "discouraged" | "preferred" | undefined;
199
199
  extensions?: {
200
200
  appid?: string | undefined;
201
201
  hmacCreateSecret?: boolean | undefined;
@@ -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>;