@logto/schemas 1.18.0 → 1.20.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 (257) hide show
  1. package/alterations/1.19.0-1720253939-add-organization-branding.ts +18 -0
  2. package/alterations/1.19.0-1720345784-add-color-to-app-sie.ts +18 -0
  3. package/alterations/1.19.0-1720505152-update-custom-ui-assets.ts +20 -0
  4. package/alterations/1.19.0-1721483240-multiple-app-secrets.ts +77 -0
  5. package/alterations/1.19.0-1721645392-add-application-custom-data-column.ts +18 -0
  6. package/alterations/1.19.0-1722926389-argon2d-argon2id.ts +35 -0
  7. package/alterations/1.20.0-1723448981-personal-access-tokens.ts +35 -0
  8. package/alterations/1.20.0-1724229102-add-report-sub-updates-cloud-scope.ts +102 -0
  9. package/alterations/1.20.0-1724316971-add-verified-identifier-to-verification-statuses.ts +18 -0
  10. package/alterations/1.20.0-1725971571-add-verification-record.ts +35 -0
  11. package/alterations-js/1.19.0-1720253939-add-organization-branding.js +14 -0
  12. package/alterations-js/1.19.0-1720345784-add-color-to-app-sie.js +14 -0
  13. package/alterations-js/1.19.0-1720505152-update-custom-ui-assets.js +16 -0
  14. package/alterations-js/1.19.0-1721483240-multiple-app-secrets.js +72 -0
  15. package/alterations-js/1.19.0-1721645392-add-application-custom-data-column.js +14 -0
  16. package/alterations-js/1.19.0-1722926389-argon2d-argon2id.js +30 -0
  17. package/alterations-js/1.20.0-1723448981-personal-access-tokens.js +30 -0
  18. package/alterations-js/1.20.0-1724229102-add-report-sub-updates-cloud-scope.js +59 -0
  19. package/alterations-js/1.20.0-1724316971-add-verified-identifier-to-verification-statuses.js +14 -0
  20. package/alterations-js/1.20.0-1725971571-add-verification-record.js +30 -0
  21. package/lib/consts/experience.d.ts +8 -5
  22. package/lib/consts/experience.js +3 -0
  23. package/lib/consts/oidc.d.ts +48 -4
  24. package/lib/consts/oidc.js +32 -1
  25. package/lib/consts/subscriptions.d.ts +1 -0
  26. package/lib/consts/subscriptions.js +1 -0
  27. package/lib/consts/system.d.ts +2 -0
  28. package/lib/consts/system.js +2 -0
  29. package/lib/db-entries/application-secret.d.ts +28 -0
  30. package/lib/db-entries/application-secret.js +41 -0
  31. package/lib/db-entries/application-sign-in-experience.d.ts +4 -2
  32. package/lib/db-entries/application-sign-in-experience.js +5 -1
  33. package/lib/db-entries/application.d.ts +6 -2
  34. package/lib/db-entries/application.js +5 -1
  35. package/lib/db-entries/custom-types.d.ts +2 -0
  36. package/lib/db-entries/custom-types.js +2 -0
  37. package/lib/db-entries/index.d.ts +3 -0
  38. package/lib/db-entries/index.js +3 -0
  39. package/lib/db-entries/organization.d.ts +6 -2
  40. package/lib/db-entries/organization.js +5 -1
  41. package/lib/db-entries/personal-access-token.d.ts +26 -0
  42. package/lib/db-entries/personal-access-token.js +41 -0
  43. package/lib/db-entries/sign-in-experience.d.ts +4 -4
  44. package/lib/db-entries/sign-in-experience.js +5 -5
  45. package/lib/db-entries/verification-record.d.ts +26 -0
  46. package/lib/db-entries/verification-record.js +42 -0
  47. package/lib/db-entries/verification-status.d.ts +3 -1
  48. package/lib/db-entries/verification-status.js +4 -0
  49. package/lib/foundations/jsonb-types/index.d.ts +1 -0
  50. package/lib/foundations/jsonb-types/index.js +1 -0
  51. package/lib/foundations/jsonb-types/logs.d.ts +3 -0
  52. package/lib/foundations/jsonb-types/logs.js +1 -0
  53. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +37 -3
  54. package/lib/foundations/jsonb-types/sign-in-experience.js +19 -4
  55. package/lib/foundations/jsonb-types/users.d.ts +6 -6
  56. package/lib/foundations/jsonb-types/users.js +2 -2
  57. package/lib/foundations/jsonb-types/verification-records.d.ts +13 -0
  58. package/lib/foundations/jsonb-types/verification-records.js +14 -0
  59. package/lib/seeds/application.js +1 -0
  60. package/lib/seeds/cloud-api.d.ts +5 -1
  61. package/lib/seeds/cloud-api.js +5 -0
  62. package/lib/seeds/sign-in-experience.d.ts +1 -0
  63. package/lib/seeds/sign-in-experience.js +2 -2
  64. package/lib/types/application.d.ts +80 -122
  65. package/lib/types/connector.d.ts +34 -28
  66. package/lib/types/consent.d.ts +180 -33
  67. package/lib/types/cookie.d.ts +7 -1
  68. package/lib/types/cookie.js +3 -1
  69. package/lib/types/domain.d.ts +2 -10
  70. package/lib/types/hook.d.ts +14 -21
  71. package/lib/types/index.d.ts +1 -0
  72. package/lib/types/index.js +1 -0
  73. package/lib/types/interactions.d.ts +202 -65
  74. package/lib/types/interactions.js +39 -23
  75. package/lib/types/log/interaction.d.ts +4 -3
  76. package/lib/types/log/interaction.js +1 -0
  77. package/lib/types/logto-config/index.d.ts +267 -242
  78. package/lib/types/logto-config/jwt-customizer.d.ts +548 -371
  79. package/lib/types/logto-config/jwt-customizer.js +28 -1
  80. package/lib/types/logto-config/oidc-provider.d.ts +6 -6
  81. package/lib/types/mfa.d.ts +16 -16
  82. package/lib/types/scope.d.ts +7 -6
  83. package/lib/types/sign-in-experience.d.ts +57 -120
  84. package/lib/types/sign-in-experience.js +1 -1
  85. package/lib/types/sso-connector.d.ts +14 -19
  86. package/lib/types/ssr.d.ts +25 -0
  87. package/lib/types/ssr.js +9 -0
  88. package/lib/types/system.d.ts +7 -3
  89. package/lib/types/system.js +4 -0
  90. package/lib/types/user-assets.d.ts +25 -5
  91. package/lib/types/user-assets.js +20 -1
  92. package/lib/types/user.d.ts +84 -120
  93. package/lib/utils/application.d.ts +3 -0
  94. package/lib/utils/application.js +7 -0
  95. package/lib/utils/index.d.ts +1 -0
  96. package/lib/utils/index.js +1 -0
  97. package/package.json +9 -9
  98. package/tables/application_secrets.sql +17 -0
  99. package/tables/application_sign_in_experiences.sql +1 -1
  100. package/tables/applications.sql +7 -2
  101. package/tables/organizations.sql +2 -0
  102. package/tables/personal_access_tokens.sql +16 -0
  103. package/tables/sign_in_experiences.sql +1 -1
  104. package/tables/users.sql +1 -1
  105. package/tables/verification_records.sql +15 -0
  106. package/tables/verification_statuses.sql +1 -0
  107. package/alterations-js/1.0.0-1677208902-update-admin-console-config.d.ts +0 -3
  108. package/alterations-js/1.0.0-1677765137-seed-for-admin-tenant.d.ts +0 -3
  109. package/alterations-js/1.0.0-1677907982-allow-admin-create-multiple-tenants.d.ts +0 -3
  110. package/alterations-js/1.0.0-1678157950-privacy-policy-url.d.ts +0 -3
  111. package/alterations-js/1.0.0-1678199795-add-verification-status-table.d.ts +0 -3
  112. package/alterations-js/1.0.0-1678259693-remove-branding-style-config.d.ts +0 -3
  113. package/alterations-js/1.0.0-1678269972-use-restrictive-policies.d.ts +0 -3
  114. package/alterations-js/1.0.0-1678284778-restrict-internal-roles.d.ts +0 -3
  115. package/alterations-js/1.0.0-1678425761-m2m-app-for-tenants.d.ts +0 -3
  116. package/alterations-js/1.0.0-1678450233-support-custom-content.d.ts +0 -3
  117. package/alterations-js/1.0.0-1678716747-service-logs.d.ts +0 -3
  118. package/alterations-js/1.0.0-1678928481-remove-deprecated-logto-config-item.d.ts +0 -3
  119. package/alterations-js/1.0.0-1678953179-update-get-started-task-config.d.ts +0 -3
  120. package/alterations-js/1.0.0-1679209413-drop-connector-database-storage.d.ts +0 -3
  121. package/alterations-js/1.0.0_beta.10-1-logto-config.d.ts +0 -3
  122. package/alterations-js/1.0.0_beta.10-1663923211-machine-to-machine-app.d.ts +0 -3
  123. package/alterations-js/1.0.0_beta.10-1664265197-custom-phrases.d.ts +0 -3
  124. package/alterations-js/1.0.0_beta.11-1664347703-rename-language-key-to-tag.d.ts +0 -3
  125. package/alterations-js/1.0.0_beta.11-1664356000-add-created-at-column-to-users.d.ts +0 -3
  126. package/alterations-js/1.0.0_beta.11-1664462389-correct-user-created-at-column-by-user-logs.d.ts +0 -3
  127. package/alterations-js/1.0.0_beta.14-1665300135-sign-in-sign-up.d.ts +0 -3
  128. package/alterations-js/1.0.0_beta.14-1667283640-remove-forgot-password.d.ts +0 -3
  129. package/alterations-js/1.0.0_beta.14-1667292082-remove-sign-in-method.d.ts +0 -3
  130. package/alterations-js/1.0.0_beta.14-1667374974-user-suspend.d.ts +0 -3
  131. package/alterations-js/1.0.0_beta.14-1667900481-add-passcode-type-continue.d.ts +0 -3
  132. package/alterations-js/1.0.0_beta.18-1668666590-support-multiple-connector-instances.d.ts +0 -3
  133. package/alterations-js/1.0.0_beta.18-1668666600-remove-connector-enabled.d.ts +0 -3
  134. package/alterations-js/1.0.0_beta.18-1669091623-roles-and-scopes.d.ts +0 -3
  135. package/alterations-js/1.0.0_beta.18-1669702299-sign-up.d.ts +0 -3
  136. package/alterations-js/1.0.0_beta.18-1671039448-add-user-name-index.d.ts +0 -3
  137. package/alterations-js/1.0.0_beta.18-1671080370-terms-of-use.d.ts +0 -3
  138. package/alterations-js/1.0.0_beta.18-1671336831-refactor-log-types.d.ts +0 -3
  139. package/alterations-js/1.0.0_beta.18-1671509870-hooks.d.ts +0 -3
  140. package/alterations-js/1.0.0_beta.18-1672119200-align-passcode-type-with-message-type.d.ts +0 -3
  141. package/alterations-js/1.0.0_rc.0-1672815959-user-roles.d.ts +0 -3
  142. package/alterations-js/1.0.0_rc.0-1672820345-scope-resource-id.d.ts +0 -3
  143. package/alterations-js/1.0.0_rc.0-1672901841-roles-and-scopes-not-null.d.ts +0 -3
  144. package/alterations-js/1.0.0_rc.0-1673001922-support-generic-passcode.d.ts +0 -3
  145. package/alterations-js/1.0.0_rc.0-1673165463-scope-name-index.d.ts +0 -3
  146. package/alterations-js/1.0.0_rc.0-1673349501-sms-sign-in-identifier-to-phone.d.ts +0 -3
  147. package/alterations-js/1.0.0_rc.0-1673465463-ac-scope-name.d.ts +0 -3
  148. package/alterations-js/1.0.0_rc.0-1673853579-ac-default-scope.d.ts +0 -3
  149. package/alterations-js/1.0.0_rc.0-1673863835-ac-scope-role.d.ts +0 -3
  150. package/alterations-js/1.0.0_rc.0-1673882867-fix-alteration-issues.d.ts +0 -3
  151. package/alterations-js/1.0.0_rc.0-1673940577-scope-description-not-null.d.ts +0 -3
  152. package/alterations-js/1.0.0_rc.0-1673941897-application-roles.d.ts +0 -3
  153. package/alterations-js/1.0.0_rc.0-1674032095.1-dedup-resources-constraint.d.ts +0 -4
  154. package/alterations-js/1.0.0_rc.0-1674032095.2-oidc-model-pkey.d.ts +0 -3
  155. package/alterations-js/1.0.0_rc.0-1674032095.3-tenant-table.d.ts +0 -3
  156. package/alterations-js/1.0.0_rc.0-1674032095.4-add-id-column.d.ts +0 -3
  157. package/alterations-js/1.0.0_rc.0-1674032095.5-multi-tenancy.d.ts +0 -3
  158. package/alterations-js/1.0.0_rc.0-1674032095.6-add-tenant-id-trigger.d.ts +0 -3
  159. package/alterations-js/1.0.0_rc.0-1674987042-drop-settings-and-create-systems.d.ts +0 -3
  160. package/alterations-js/1.0.0_rc.0-1675316731-update-seed-data.d.ts +0 -3
  161. package/alterations-js/1.0.0_rc.1-1675788753-multi-tenancy-rls.d.ts +0 -3
  162. package/alterations-js/1.0.0_rc.1-1676115897-add-admin-tenant.d.ts +0 -3
  163. package/alterations-js/1.0.0_rc.1-1676185899-fix-logs-index.d.ts +0 -3
  164. package/alterations-js/1.0.0_rc.1-1676190092-migrate-admin-data.d.ts +0 -3
  165. package/alterations-js/1.0.0_rc.1-1676823841-update-sie-primary-key.d.ts +0 -3
  166. package/alterations-js/1.0.0_rc.1-1676874936-support-custom-css.d.ts +0 -3
  167. package/alterations-js/1.0.0_rc.1-1676886855-connector-database-read-write.d.ts +0 -3
  168. package/alterations-js/1.0.0_rc.1-1676906977-remove-demo-app.d.ts +0 -3
  169. package/alterations-js/1.0.0_rc.1-1676956206-move-console-sie-to-database.d.ts +0 -3
  170. package/alterations-js/1.0.0_rc.1-1677059985-move-console-application-to-database.d.ts +0 -3
  171. package/alterations-js/1.10.1-1695647183-update-private-key-type.d.ts +0 -3
  172. package/alterations-js/1.10.1-1696657546-organization-tables.d.ts +0 -3
  173. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.d.ts +0 -3
  174. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.d.ts +0 -3
  175. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.d.ts +0 -4
  176. package/alterations-js/1.10.1-1698910485-user-logto-data.d.ts +0 -3
  177. package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.d.ts +0 -3
  178. package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.d.ts +0 -3
  179. package/alterations-js/1.12.0-1700031616-update-org-role-foreign-keys.d.ts +0 -3
  180. package/alterations-js/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.d.ts +0 -3
  181. package/alterations-js/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.d.ts +0 -3
  182. package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.d.ts +0 -3
  183. package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.d.ts +0 -3
  184. package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.d.ts +0 -18
  185. package/alterations-js/1.13.0-1702871078-protected-application-type.d.ts +0 -3
  186. package/alterations-js/1.13.0-1702877515-protected-app-configs.d.ts +0 -3
  187. package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.d.ts +0 -3
  188. package/alterations-js/1.13.0-1703229996-daily-token-usage.d.ts +0 -3
  189. package/alterations-js/1.13.0-1703230000-update-tenant-roles.d.ts +0 -11
  190. package/alterations-js/1.13.0-1704692973-remove-legacy-resources.d.ts +0 -3
  191. package/alterations-js/1.13.0-1704934999-add-magic-links-table.d.ts +0 -3
  192. package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.d.ts +0 -3
  193. package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.d.ts +0 -3
  194. package/alterations-js/1.13.0-1705991158-update-invitation-indices.d.ts +0 -7
  195. package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.d.ts +0 -3
  196. package/alterations-js/1.13.0-1706510290-protected-app-host-index.d.ts +0 -3
  197. package/alterations-js/1.13.0-1706512952-restore-get-started-page.d.ts +0 -3
  198. package/alterations-js/1.13.0-1706528755-remove-magic-links.d.ts +0 -3
  199. package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.d.ts +0 -3
  200. package/alterations-js/1.13.1-1707360939-grant-is-suspended-read-permission.d.ts +0 -6
  201. package/alterations-js/1.14.0-1708916601-remove-management-api-scopes-assigned-to-user-role.d.ts +0 -3
  202. package/alterations-js/1.14.0-1709190131-enhance-dau-data-accuracy.d.ts +0 -3
  203. package/alterations-js/1.15.0-1709521416-user-password-encrypt-method.d.ts +0 -3
  204. package/alterations-js/1.15.0-1709528944-regenerate-dau-data.d.ts +0 -3
  205. package/alterations-js/1.15.0-1710223946-add-fetch-custom-jwt-cloud-scope.d.ts +0 -3
  206. package/alterations-js/1.15.0-1710408335-make-resource-scopes-description-nullable.d.ts +0 -3
  207. package/alterations-js/1.15.0-1710859622-add-oidc-standard-claim-properties.d.ts +0 -3
  208. package/alterations-js/1.15.0-1711607772-remove-invite-member-scope-from-tenant-member-role.d.ts +0 -3
  209. package/alterations-js/1.15.0-1711624564-add-read-member-scope-to-tenant-roles.d.ts +0 -3
  210. package/alterations-js/1.15.0-1711955211-organization-resource-scope.d.ts +0 -3
  211. package/alterations-js/1.15.0-1712041436-rename-organization-member-role-to-collaborator.d.ts +0 -3
  212. package/alterations-js/1.15.0-1712545011-fix-organization-resource-scope.d.ts +0 -8
  213. package/alterations-js/1.15.0-1712559358-fix-down-organization-resource-scope.d.ts +0 -8
  214. package/alterations-js/1.16.0-1712912361-delete-jwt-customier-with-empty-script.d.ts +0 -3
  215. package/alterations-js/1.16.0-1713942039-add-organization-custom-data.d.ts +0 -4
  216. package/alterations-js/1.16.0-1714270244-application-org-resource-scope.d.ts +0 -3
  217. package/alterations-js/1.17.0-1715826336-add-default-user-role-config.d.ts +0 -3
  218. package/alterations-js/1.17.0-1715829731-rename-data-hook-schema-update-event.d.ts +0 -3
  219. package/alterations-js/1.17.0-1716278409-remove-internal-role-database-policies.d.ts +0 -3
  220. package/alterations-js/1.17.0-1716291265-create-pre-configured-m-api-role.d.ts +0 -7
  221. package/alterations-js/1.17.0-1717148078-remove-service-log-reference.d.ts +0 -3
  222. package/alterations-js/1.18.0-1717567857-social-sign-in-linking.d.ts +0 -3
  223. package/alterations-js/1.18.0-1717597875-add-organization-email-domains-table.d.ts +0 -3
  224. package/alterations-js/1.18.0-1717818597-organization-mfa-requirement.d.ts +0 -3
  225. package/alterations-js/1.18.0-1718340884-rename-org-email-domains-and-add-jit-roles-table.d.ts +0 -3
  226. package/alterations-js/1.18.0-1718594164-add-agree-to-terms-policy.d.ts +0 -3
  227. package/alterations-js/1.18.0-1718785576-organization-application-relations.d.ts +0 -3
  228. package/alterations-js/1.18.0-1718786576-organization-jit-sso-connectors.d.ts +0 -3
  229. package/alterations-js/1.18.0-1718807616-organization-role-application-relations.d.ts +0 -3
  230. package/alterations-js/1.18.0-1718865814-add-subject-tokens.d.ts +0 -3
  231. package/alterations-js/1.18.0-1719014832-organization-role-types.d.ts +0 -3
  232. package/alterations-js/1.18.0-1719221205-fix-functions.d.ts +0 -7
  233. package/alterations-js/1.18.0-1719312694-custom-ui-assets.d.ts +0 -3
  234. package/alterations-js/1.2.0-1681267285-fix-get-started-passwordless-status.d.ts +0 -3
  235. package/alterations-js/1.3.0-1683292832-update-hooks.d.ts +0 -3
  236. package/alterations-js/1.5.0-1684382842-add-name-tag-created-at-for-tenants-table.d.ts +0 -3
  237. package/alterations-js/1.5.0-1684739802-create-hook-id-index-for-logs.d.ts +0 -3
  238. package/alterations-js/1.5.0-1684822341-init-domains.d.ts +0 -3
  239. package/alterations-js/1.5.0-1684837981-add-manage-tenant-self-scope-to-user-role.d.ts +0 -3
  240. package/alterations-js/1.5.0-1685285719-support-default-resource.d.ts +0 -3
  241. package/alterations-js/1.6.0-1685691718-domain-unique.d.ts +0 -3
  242. package/alterations-js/1.7.0-1688375200-sync-cloud-m2m-to-logto-config.d.ts +0 -3
  243. package/alterations-js/1.7.0-1688613459-remove-m2m-credentials-from-existing-logto-email-connector-config.d.ts +0 -3
  244. package/alterations-js/1.7.0-1688627407-daily-active-users.d.ts +0 -3
  245. package/alterations-js/1.8.0-1692088012-add-is-suspend-column-to-tenants-table.d.ts +0 -3
  246. package/alterations-js/1.8.0-1692194751-add-affiliate-scopes.d.ts +0 -3
  247. package/alterations-js/1.9.0-1693554904-add-possword-policy.d.ts +0 -4
  248. package/alterations-js/1.9.0-1694399696-add-type-col-to-roles-table.d.ts +0 -3
  249. package/alterations-js/1.9.0-1694418765-specify-check-role-type-function-to-be-public-schema.d.ts +0 -9
  250. package/alterations-js/1.9.0-1694484927-remove-deprecated-challenge-flag.d.ts +0 -3
  251. package/alterations-js/1.9.0-1694487524-sie-mfa.d.ts +0 -3
  252. package/alterations-js/1.9.0-1694509714-keep-existing-password-policy.d.ts +0 -3
  253. package/alterations-js/1.9.0-1694746763-user-verifications.d.ts +0 -3
  254. package/alterations-js/1.9.2-1694854226-init-sentinel.d.ts +0 -3
  255. package/alterations-js/1.9.2-1695198741-remove-m2m-app-admin-access-switch.d.ts +0 -3
  256. package/alterations-js/utils/1704934999-tables.d.ts +0 -11
  257. package/alterations-js/utils/1716643968-id-generation.d.ts +0 -19
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { MfaFactor } from '../foundations/index.js';
2
+ import { MfaFactor, SignInIdentifier } from '../foundations/index.js';
3
3
  import type { EmailVerificationCodePayload, PhoneVerificationCodePayload } from './verification-code.js';
4
4
  /**
5
5
  * User interaction events defined in Logto RFC 0004.
@@ -10,52 +10,38 @@ export declare enum InteractionEvent {
10
10
  Register = "Register",
11
11
  ForgotPassword = "ForgotPassword"
12
12
  }
13
- export declare enum InteractionIdentifierType {
14
- Username = "username",
15
- Email = "email",
16
- Phone = "phone"
17
- }
18
13
  /** Identifiers that can be used to uniquely identify a user. */
19
- export type InteractionIdentifier = {
20
- type: InteractionIdentifierType;
14
+ export type InteractionIdentifier<T extends SignInIdentifier = SignInIdentifier> = {
15
+ type: T;
21
16
  value: string;
22
17
  };
23
18
  export declare const interactionIdentifierGuard: z.ZodObject<{
24
- type: z.ZodNativeEnum<typeof InteractionIdentifierType>;
19
+ type: z.ZodNativeEnum<typeof SignInIdentifier>;
25
20
  value: z.ZodString;
26
21
  }, "strip", z.ZodTypeAny, {
27
- type: InteractionIdentifierType;
22
+ type: SignInIdentifier;
28
23
  value: string;
29
24
  }, {
30
- type: InteractionIdentifierType;
25
+ type: SignInIdentifier;
31
26
  value: string;
32
27
  }>;
28
+ export type VerificationCodeSignInIdentifier = SignInIdentifier.Email | SignInIdentifier.Phone;
33
29
  /** Currently only email and phone are supported for verification code validation. */
34
- export type VerificationCodeIdentifier = {
35
- type: InteractionIdentifierType.Email | InteractionIdentifierType.Phone;
30
+ export type VerificationCodeIdentifier<T extends VerificationCodeSignInIdentifier = VerificationCodeSignInIdentifier> = {
31
+ type: T;
36
32
  value: string;
37
33
  };
38
34
  export declare const verificationCodeIdentifierGuard: z.ZodObject<{
39
- type: z.ZodEnum<[InteractionIdentifierType.Email, InteractionIdentifierType.Phone]>;
35
+ type: z.ZodEnum<[SignInIdentifier.Email, SignInIdentifier.Phone]>;
40
36
  value: z.ZodString;
41
37
  }, "strip", z.ZodTypeAny, {
42
- type: InteractionIdentifierType.Email | InteractionIdentifierType.Phone;
38
+ type: SignInIdentifier.Email | SignInIdentifier.Phone;
43
39
  value: string;
44
40
  }, {
45
- type: InteractionIdentifierType.Email | InteractionIdentifierType.Phone;
41
+ type: SignInIdentifier.Email | SignInIdentifier.Phone;
46
42
  value: string;
47
43
  }>;
48
- /** Logto supported interaction verification types. */
49
- export declare enum VerificationType {
50
- Password = "Password",
51
- VerificationCode = "VerificationCode",
52
- Social = "Social",
53
- EnterpriseSso = "EnterpriseSso",
54
- TOTP = "Totp",
55
- WebAuthn = "WebAuthn",
56
- BackupCode = "BackupCode"
57
- }
58
- /** Payload type for `POST /api/experience/verification/social/:connectorId/authorization-uri`. */
44
+ /** Payload type for `POST /api/experience/verification/{social|sso}/:connectorId/authorization-uri`. */
59
45
  export type SocialAuthorizationUrlPayload = {
60
46
  state: string;
61
47
  redirectUri: string;
@@ -70,22 +56,22 @@ export declare const socialAuthorizationUrlPayloadGuard: z.ZodObject<{
70
56
  state: string;
71
57
  redirectUri: string;
72
58
  }>;
73
- /** Payload type for `POST /api/experience/verification/social/:connectorId/verify`. */
59
+ /** Payload type for `POST /api/experience/verification/{social|sso}/:connectorId/verify`. */
74
60
  export type SocialVerificationCallbackPayload = {
75
61
  /** The callback data from the social connector. */
76
62
  connectorData: Record<string, unknown>;
77
- /** The verification ID returned from the authorization URI. */
78
- verificationId: string;
63
+ /** The verification ID returned from the authorization URI. Optional for Google one tap callback */
64
+ verificationId?: string;
79
65
  };
80
66
  export declare const socialVerificationCallbackPayloadGuard: z.ZodObject<{
81
67
  connectorData: z.ZodRecord<z.ZodString, z.ZodType<import("@withtyped/server/lib/types.js").Json, z.ZodTypeDef, import("@withtyped/server/lib/types.js").Json>>;
82
- verificationId: z.ZodString;
68
+ verificationId: z.ZodOptional<z.ZodString>;
83
69
  }, "strip", z.ZodTypeAny, {
84
70
  connectorData: Record<string, import("@withtyped/server/lib/types.js").Json>;
85
- verificationId: string;
71
+ verificationId?: string | undefined;
86
72
  }, {
87
73
  connectorData: Record<string, import("@withtyped/server/lib/types.js").Json>;
88
- verificationId: string;
74
+ verificationId?: string | undefined;
89
75
  }>;
90
76
  /** Payload type for `POST /api/experience/verification/password`. */
91
77
  export type PasswordVerificationPayload = {
@@ -94,44 +80,137 @@ export type PasswordVerificationPayload = {
94
80
  };
95
81
  export declare const passwordVerificationPayloadGuard: z.ZodObject<{
96
82
  identifier: z.ZodObject<{
97
- type: z.ZodNativeEnum<typeof InteractionIdentifierType>;
83
+ type: z.ZodNativeEnum<typeof SignInIdentifier>;
98
84
  value: z.ZodString;
99
85
  }, "strip", z.ZodTypeAny, {
100
- type: InteractionIdentifierType;
86
+ type: SignInIdentifier;
101
87
  value: string;
102
88
  }, {
103
- type: InteractionIdentifierType;
89
+ type: SignInIdentifier;
104
90
  value: string;
105
91
  }>;
106
92
  password: z.ZodString;
107
93
  }, "strip", z.ZodTypeAny, {
108
94
  password: string;
109
95
  identifier: {
110
- type: InteractionIdentifierType;
96
+ type: SignInIdentifier;
111
97
  value: string;
112
98
  };
113
99
  }, {
114
100
  password: string;
115
101
  identifier: {
116
- type: InteractionIdentifierType;
102
+ type: SignInIdentifier;
117
103
  value: string;
118
104
  };
119
105
  }>;
106
+ /** Payload type for `POST /api/experience/verification/totp/verify`. */
107
+ export type TotpVerificationVerifyPayload = {
108
+ code: string;
109
+ verificationId?: string;
110
+ };
111
+ export declare const totpVerificationVerifyPayloadGuard: z.ZodObject<{
112
+ code: z.ZodString;
113
+ verificationId: z.ZodOptional<z.ZodString>;
114
+ }, "strip", z.ZodTypeAny, {
115
+ code: string;
116
+ verificationId?: string | undefined;
117
+ }, {
118
+ code: string;
119
+ verificationId?: string | undefined;
120
+ }>;
121
+ /** Payload type for `POST /api/experience/verification/backup-code/verify */
122
+ export type BackupCodeVerificationVerifyPayload = {
123
+ code: string;
124
+ };
125
+ export declare const backupCodeVerificationVerifyPayloadGuard: z.ZodObject<{
126
+ code: z.ZodString;
127
+ }, "strip", z.ZodTypeAny, {
128
+ code: string;
129
+ }, {
130
+ code: string;
131
+ }>;
120
132
  /** Payload type for `POST /api/experience/identification`. */
121
133
  export type IdentificationApiPayload = {
122
- interactionEvent: InteractionEvent;
123
- verificationId: string;
134
+ /**
135
+ * The ID of the verification record that is used to identify the user.
136
+ * Optional for the register interaction event
137
+ */
138
+ verificationId?: string;
139
+ /**
140
+ * Link social identity to a related user account with the same email or phone.
141
+ * Only applicable for social verification records and a related user account is found.
142
+ */
143
+ linkSocialIdentity?: boolean;
124
144
  };
125
145
  export declare const identificationApiPayloadGuard: z.ZodObject<{
146
+ verificationId: z.ZodOptional<z.ZodString>;
147
+ linkSocialIdentity: z.ZodOptional<z.ZodBoolean>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ verificationId?: string | undefined;
150
+ linkSocialIdentity?: boolean | undefined;
151
+ }, {
152
+ verificationId?: string | undefined;
153
+ linkSocialIdentity?: boolean | undefined;
154
+ }>;
155
+ /** Payload type for `POST /api/experience`. */
156
+ export type CreateExperienceApiPayload = {
157
+ interactionEvent: InteractionEvent;
158
+ };
159
+ export declare const CreateExperienceApiPayloadGuard: z.ZodObject<{
126
160
  interactionEvent: z.ZodNativeEnum<typeof InteractionEvent>;
127
- verificationId: z.ZodString;
128
161
  }, "strip", z.ZodTypeAny, {
129
- verificationId: string;
130
162
  interactionEvent: InteractionEvent;
131
163
  }, {
132
- verificationId: string;
133
164
  interactionEvent: InteractionEvent;
134
165
  }>;
166
+ /** Payload type for `POST /api/experience/profile */
167
+ export declare const updateProfileApiPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
168
+ type: z.ZodLiteral<SignInIdentifier.Username>;
169
+ value: z.ZodString;
170
+ }, "strip", z.ZodTypeAny, {
171
+ type: SignInIdentifier.Username;
172
+ value: string;
173
+ }, {
174
+ type: SignInIdentifier.Username;
175
+ value: string;
176
+ }>, z.ZodObject<{
177
+ type: z.ZodLiteral<"password">;
178
+ value: z.ZodString;
179
+ }, "strip", z.ZodTypeAny, {
180
+ type: "password";
181
+ value: string;
182
+ }, {
183
+ type: "password";
184
+ value: string;
185
+ }>, z.ZodObject<{
186
+ type: z.ZodLiteral<SignInIdentifier.Email>;
187
+ verificationId: z.ZodString;
188
+ }, "strip", z.ZodTypeAny, {
189
+ type: SignInIdentifier.Email;
190
+ verificationId: string;
191
+ }, {
192
+ type: SignInIdentifier.Email;
193
+ verificationId: string;
194
+ }>, z.ZodObject<{
195
+ type: z.ZodLiteral<SignInIdentifier.Phone>;
196
+ verificationId: z.ZodString;
197
+ }, "strip", z.ZodTypeAny, {
198
+ type: SignInIdentifier.Phone;
199
+ verificationId: string;
200
+ }, {
201
+ type: SignInIdentifier.Phone;
202
+ verificationId: string;
203
+ }>, z.ZodObject<{
204
+ type: z.ZodLiteral<"social">;
205
+ verificationId: z.ZodString;
206
+ }, "strip", z.ZodTypeAny, {
207
+ type: "social";
208
+ verificationId: string;
209
+ }, {
210
+ type: "social";
211
+ verificationId: string;
212
+ }>]>;
213
+ export type UpdateProfileApiPayload = z.infer<typeof updateProfileApiPayloadGuard>;
135
214
  /**
136
215
  * Legacy interaction identifier payload guard
137
216
  *
@@ -294,14 +373,14 @@ export declare const profileGuard: z.ZodObject<{
294
373
  username?: string | undefined;
295
374
  email?: string | undefined;
296
375
  phone?: string | undefined;
297
- connectorId?: string | undefined;
298
376
  password?: string | undefined;
377
+ connectorId?: string | undefined;
299
378
  }, {
300
379
  username?: string | undefined;
301
380
  email?: string | undefined;
302
381
  phone?: string | undefined;
303
- connectorId?: string | undefined;
304
382
  password?: string | undefined;
383
+ connectorId?: string | undefined;
305
384
  }>;
306
385
  export type Profile = z.infer<typeof profileGuard>;
307
386
  export declare enum MissingProfile {
@@ -341,17 +420,17 @@ export declare const bindWebAuthnPayloadGuard: z.ZodObject<{
341
420
  }, "strip", z.ZodTypeAny, {
342
421
  clientDataJSON: string;
343
422
  attestationObject: string;
344
- authenticatorData?: string | undefined;
423
+ publicKey?: string | undefined;
345
424
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
425
+ authenticatorData?: string | undefined;
346
426
  publicKeyAlgorithm?: number | undefined;
347
- publicKey?: string | undefined;
348
427
  }, {
349
428
  clientDataJSON: string;
350
429
  attestationObject: string;
351
- authenticatorData?: string | undefined;
430
+ publicKey?: string | undefined;
352
431
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
432
+ authenticatorData?: string | undefined;
353
433
  publicKeyAlgorithm?: number | undefined;
354
- publicKey?: string | undefined;
355
434
  }>;
356
435
  authenticatorAttachment: z.ZodOptional<z.ZodEnum<["cross-platform", "platform"]>>;
357
436
  clientExtensionResults: z.ZodObject<{
@@ -384,10 +463,10 @@ export declare const bindWebAuthnPayloadGuard: z.ZodObject<{
384
463
  response: {
385
464
  clientDataJSON: string;
386
465
  attestationObject: string;
387
- authenticatorData?: string | undefined;
466
+ publicKey?: string | undefined;
388
467
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
468
+ authenticatorData?: string | undefined;
389
469
  publicKeyAlgorithm?: number | undefined;
390
- publicKey?: string | undefined;
391
470
  };
392
471
  clientExtensionResults: {
393
472
  appid?: boolean | undefined;
@@ -404,10 +483,10 @@ export declare const bindWebAuthnPayloadGuard: z.ZodObject<{
404
483
  response: {
405
484
  clientDataJSON: string;
406
485
  attestationObject: string;
407
- authenticatorData?: string | undefined;
486
+ publicKey?: string | undefined;
408
487
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
488
+ authenticatorData?: string | undefined;
409
489
  publicKeyAlgorithm?: number | undefined;
410
- publicKey?: string | undefined;
411
490
  };
412
491
  clientExtensionResults: {
413
492
  appid?: boolean | undefined;
@@ -455,17 +534,17 @@ export declare const bindMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.Zod
455
534
  }, "strip", z.ZodTypeAny, {
456
535
  clientDataJSON: string;
457
536
  attestationObject: string;
458
- authenticatorData?: string | undefined;
537
+ publicKey?: string | undefined;
459
538
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
539
+ authenticatorData?: string | undefined;
460
540
  publicKeyAlgorithm?: number | undefined;
461
- publicKey?: string | undefined;
462
541
  }, {
463
542
  clientDataJSON: string;
464
543
  attestationObject: string;
465
- authenticatorData?: string | undefined;
544
+ publicKey?: string | undefined;
466
545
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
546
+ authenticatorData?: string | undefined;
467
547
  publicKeyAlgorithm?: number | undefined;
468
- publicKey?: string | undefined;
469
548
  }>;
470
549
  authenticatorAttachment: z.ZodOptional<z.ZodEnum<["cross-platform", "platform"]>>;
471
550
  clientExtensionResults: z.ZodObject<{
@@ -498,10 +577,10 @@ export declare const bindMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.Zod
498
577
  response: {
499
578
  clientDataJSON: string;
500
579
  attestationObject: string;
501
- authenticatorData?: string | undefined;
580
+ publicKey?: string | undefined;
502
581
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
582
+ authenticatorData?: string | undefined;
503
583
  publicKeyAlgorithm?: number | undefined;
504
- publicKey?: string | undefined;
505
584
  };
506
585
  clientExtensionResults: {
507
586
  appid?: boolean | undefined;
@@ -518,10 +597,10 @@ export declare const bindMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.Zod
518
597
  response: {
519
598
  clientDataJSON: string;
520
599
  attestationObject: string;
521
- authenticatorData?: string | undefined;
600
+ publicKey?: string | undefined;
522
601
  transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
602
+ authenticatorData?: string | undefined;
523
603
  publicKeyAlgorithm?: number | undefined;
524
- publicKey?: string | undefined;
525
604
  };
526
605
  clientExtensionResults: {
527
606
  appid?: boolean | undefined;
@@ -539,6 +618,7 @@ export declare const bindMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.Zod
539
618
  type: MfaFactor.BackupCode;
540
619
  }>]>;
541
620
  export type BindMfaPayload = z.infer<typeof bindMfaPayloadGuard>;
621
+ /** @deprecated Legacy interaction API use only */
542
622
  export declare const totpVerificationPayloadGuard: z.ZodObject<{
543
623
  type: z.ZodLiteral<MfaFactor.TOTP>;
544
624
  code: z.ZodString;
@@ -549,11 +629,39 @@ export declare const totpVerificationPayloadGuard: z.ZodObject<{
549
629
  code: string;
550
630
  type: MfaFactor.TOTP;
551
631
  }>;
632
+ /** @deprecated Legacy interaction API use only */
552
633
  export type TotpVerificationPayload = z.infer<typeof totpVerificationPayloadGuard>;
553
- export declare const webAuthnVerificationPayloadGuard: z.ZodObject<{
634
+ export declare const webAuthnVerificationPayloadGuard: z.ZodObject<z.objectUtil.extendShape<Omit<{
554
635
  type: z.ZodLiteral<MfaFactor.WebAuthn>;
555
636
  id: z.ZodString;
556
637
  rawId: z.ZodString;
638
+ /**
639
+ * The response from WebAuthn API
640
+ *
641
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential}
642
+ */
643
+ response: z.ZodObject<{
644
+ clientDataJSON: z.ZodString;
645
+ attestationObject: z.ZodString;
646
+ authenticatorData: z.ZodOptional<z.ZodString>;
647
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
648
+ publicKeyAlgorithm: z.ZodOptional<z.ZodNumber>;
649
+ publicKey: z.ZodOptional<z.ZodString>;
650
+ }, "strip", z.ZodTypeAny, {
651
+ clientDataJSON: string;
652
+ attestationObject: string;
653
+ publicKey?: string | undefined;
654
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
655
+ authenticatorData?: string | undefined;
656
+ publicKeyAlgorithm?: number | undefined;
657
+ }, {
658
+ clientDataJSON: string;
659
+ attestationObject: string;
660
+ publicKey?: string | undefined;
661
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
662
+ authenticatorData?: string | undefined;
663
+ publicKeyAlgorithm?: number | undefined;
664
+ }>;
557
665
  authenticatorAttachment: z.ZodOptional<z.ZodEnum<["cross-platform", "platform"]>>;
558
666
  clientExtensionResults: z.ZodObject<{
559
667
  appid: z.ZodOptional<z.ZodBoolean>;
@@ -578,6 +686,7 @@ export declare const webAuthnVerificationPayloadGuard: z.ZodObject<{
578
686
  } | undefined;
579
687
  hmacCreateSecret?: boolean | undefined;
580
688
  }>;
689
+ }, "response">, {
581
690
  response: z.ZodObject<{
582
691
  clientDataJSON: z.ZodString;
583
692
  authenticatorData: z.ZodString;
@@ -594,7 +703,7 @@ export declare const webAuthnVerificationPayloadGuard: z.ZodObject<{
594
703
  signature: string;
595
704
  userHandle?: string | undefined;
596
705
  }>;
597
- }, "strip", z.ZodTypeAny, {
706
+ }>, "strip", z.ZodTypeAny, {
598
707
  type: MfaFactor.WebAuthn;
599
708
  id: string;
600
709
  rawId: string;
@@ -652,10 +761,37 @@ export declare const verifyMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.Z
652
761
  }, {
653
762
  code: string;
654
763
  type: MfaFactor.TOTP;
655
- }>, z.ZodObject<{
764
+ }>, z.ZodObject<z.objectUtil.extendShape<Omit<{
656
765
  type: z.ZodLiteral<MfaFactor.WebAuthn>;
657
766
  id: z.ZodString;
658
767
  rawId: z.ZodString;
768
+ /**
769
+ * The response from WebAuthn API
770
+ *
771
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential}
772
+ */
773
+ response: z.ZodObject<{
774
+ clientDataJSON: z.ZodString;
775
+ attestationObject: z.ZodString;
776
+ authenticatorData: z.ZodOptional<z.ZodString>;
777
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
778
+ publicKeyAlgorithm: z.ZodOptional<z.ZodNumber>;
779
+ publicKey: z.ZodOptional<z.ZodString>;
780
+ }, "strip", z.ZodTypeAny, {
781
+ clientDataJSON: string;
782
+ attestationObject: string;
783
+ publicKey?: string | undefined;
784
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
785
+ authenticatorData?: string | undefined;
786
+ publicKeyAlgorithm?: number | undefined;
787
+ }, {
788
+ clientDataJSON: string;
789
+ attestationObject: string;
790
+ publicKey?: string | undefined;
791
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
792
+ authenticatorData?: string | undefined;
793
+ publicKeyAlgorithm?: number | undefined;
794
+ }>;
659
795
  authenticatorAttachment: z.ZodOptional<z.ZodEnum<["cross-platform", "platform"]>>;
660
796
  clientExtensionResults: z.ZodObject<{
661
797
  appid: z.ZodOptional<z.ZodBoolean>;
@@ -680,6 +816,7 @@ export declare const verifyMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.Z
680
816
  } | undefined;
681
817
  hmacCreateSecret?: boolean | undefined;
682
818
  }>;
819
+ }, "response">, {
683
820
  response: z.ZodObject<{
684
821
  clientDataJSON: z.ZodString;
685
822
  authenticatorData: z.ZodString;
@@ -696,7 +833,7 @@ export declare const verifyMfaPayloadGuard: z.ZodDiscriminatedUnion<"type", [z.Z
696
833
  signature: string;
697
834
  userHandle?: string | undefined;
698
835
  }>;
699
- }, "strip", z.ZodTypeAny, {
836
+ }>, "strip", z.ZodTypeAny, {
700
837
  type: MfaFactor.WebAuthn;
701
838
  id: string;
702
839
  rawId: string;
@@ -1,6 +1,6 @@
1
1
  import { emailRegEx, phoneRegEx, usernameRegEx } from '@logto/core-kit';
2
2
  import { z } from 'zod';
3
- import { MfaFactor, jsonObjectGuard, webAuthnTransportGuard } from '../foundations/index.js';
3
+ import { MfaFactor, SignInIdentifier, jsonObjectGuard, webAuthnTransportGuard, } from '../foundations/index.js';
4
4
  import { emailVerificationCodePayloadGuard, phoneVerificationCodePayloadGuard, } from './verification-code.js';
5
5
  /**
6
6
  * User interaction events defined in Logto RFC 0004.
@@ -12,48 +12,63 @@ export var InteractionEvent;
12
12
  InteractionEvent["Register"] = "Register";
13
13
  InteractionEvent["ForgotPassword"] = "ForgotPassword";
14
14
  })(InteractionEvent || (InteractionEvent = {}));
15
- // ====== Experience API payload guards and type definitions start ======
16
- export var InteractionIdentifierType;
17
- (function (InteractionIdentifierType) {
18
- InteractionIdentifierType["Username"] = "username";
19
- InteractionIdentifierType["Email"] = "email";
20
- InteractionIdentifierType["Phone"] = "phone";
21
- })(InteractionIdentifierType || (InteractionIdentifierType = {}));
22
15
  export const interactionIdentifierGuard = z.object({
23
- type: z.nativeEnum(InteractionIdentifierType),
16
+ type: z.nativeEnum(SignInIdentifier),
24
17
  value: z.string(),
25
18
  });
26
19
  export const verificationCodeIdentifierGuard = z.object({
27
- type: z.enum([InteractionIdentifierType.Email, InteractionIdentifierType.Phone]),
20
+ type: z.enum([SignInIdentifier.Email, SignInIdentifier.Phone]),
28
21
  value: z.string(),
29
22
  });
30
- /** Logto supported interaction verification types. */
31
- export var VerificationType;
32
- (function (VerificationType) {
33
- VerificationType["Password"] = "Password";
34
- VerificationType["VerificationCode"] = "VerificationCode";
35
- VerificationType["Social"] = "Social";
36
- VerificationType["EnterpriseSso"] = "EnterpriseSso";
37
- VerificationType["TOTP"] = "Totp";
38
- VerificationType["WebAuthn"] = "WebAuthn";
39
- VerificationType["BackupCode"] = "BackupCode";
40
- })(VerificationType || (VerificationType = {}));
41
23
  export const socialAuthorizationUrlPayloadGuard = z.object({
42
24
  state: z.string(),
43
25
  redirectUri: z.string(),
44
26
  });
45
27
  export const socialVerificationCallbackPayloadGuard = z.object({
46
28
  connectorData: jsonObjectGuard,
47
- verificationId: z.string(),
29
+ verificationId: z.string().optional(),
48
30
  });
49
31
  export const passwordVerificationPayloadGuard = z.object({
50
32
  identifier: interactionIdentifierGuard,
51
33
  password: z.string().min(1),
52
34
  });
35
+ export const totpVerificationVerifyPayloadGuard = z.object({
36
+ code: z.string().min(1),
37
+ verificationId: z.string().optional(),
38
+ });
39
+ export const backupCodeVerificationVerifyPayloadGuard = z.object({
40
+ code: z.string().min(1),
41
+ });
53
42
  export const identificationApiPayloadGuard = z.object({
43
+ verificationId: z.string().optional(),
44
+ linkSocialIdentity: z.boolean().optional(),
45
+ });
46
+ export const CreateExperienceApiPayloadGuard = z.object({
54
47
  interactionEvent: z.nativeEnum(InteractionEvent),
55
- verificationId: z.string(),
56
48
  });
49
+ /** Payload type for `POST /api/experience/profile */
50
+ export const updateProfileApiPayloadGuard = z.discriminatedUnion('type', [
51
+ z.object({
52
+ type: z.literal(SignInIdentifier.Username),
53
+ value: z.string().regex(usernameRegEx),
54
+ }),
55
+ z.object({
56
+ type: z.literal('password'),
57
+ value: z.string(),
58
+ }),
59
+ z.object({
60
+ type: z.literal(SignInIdentifier.Email),
61
+ verificationId: z.string(),
62
+ }),
63
+ z.object({
64
+ type: z.literal(SignInIdentifier.Phone),
65
+ verificationId: z.string(),
66
+ }),
67
+ z.object({
68
+ type: z.literal('social'),
69
+ verificationId: z.string(),
70
+ }),
71
+ ]);
57
72
  // ====== Experience API payload guard and types definitions end ======
58
73
  /**
59
74
  * Legacy interaction identifier payload guard
@@ -158,6 +173,7 @@ export const bindMfaPayloadGuard = z.discriminatedUnion('type', [
158
173
  bindWebAuthnPayloadGuard,
159
174
  bindBackupCodePayloadGuard,
160
175
  ]);
176
+ /** @deprecated Legacy interaction API use only */
161
177
  export const totpVerificationPayloadGuard = bindTotpPayloadGuard;
162
178
  export const webAuthnVerificationPayloadGuard = bindWebAuthnPayloadGuard
163
179
  .omit({ response: true })
@@ -1,4 +1,4 @@
1
- import { type MfaFactor } from '../../foundations/index.js';
1
+ import { type VerificationType, type MfaFactor } from '../../foundations/index.js';
2
2
  import type { InteractionEvent } from '../interactions.js';
3
3
  export type Prefix = 'Interaction';
4
4
  export declare const prefix: Prefix;
@@ -8,7 +8,8 @@ export declare enum Field {
8
8
  Identifier = "Identifier",
9
9
  Profile = "Profile",
10
10
  BindMfa = "BindMfa",
11
- Mfa = "Mfa"
11
+ Mfa = "Mfa",
12
+ Verification = "Verification"
12
13
  }
13
14
  /** Method to verify the identifier */
14
15
  export declare enum Method {
@@ -66,4 +67,4 @@ export declare enum Action {
66
67
  * - When {@link Method} is `VerificationCode`, {@link Action} can be `Create` (generate and send a code) or `Submit` (verify and submit to the identifiers);
67
68
  * - Otherwise, {@link Action} is fixed to `Submit` (other methods can be verified on submitting).
68
69
  */
69
- export type LogKey = `${Prefix}.${Action.Create | Action.End}` | `${Prefix}.${InteractionEvent}.${Action.Update | Action.Submit}` | `${Prefix}.${InteractionEvent}.${Field.Profile}.${Action.Update | Action.Create | Action.Delete}` | `${Prefix}.${Exclude<InteractionEvent, InteractionEvent.ForgotPassword>}.${Field.Identifier}.${Exclude<Method, Method.Password>}.${Action.Create | Action.Submit}` | `${Prefix}.${Exclude<InteractionEvent, InteractionEvent.ForgotPassword>}.${Field.Identifier}.${Method.Password}.${Action.Submit}` | `${Prefix}.${InteractionEvent.ForgotPassword}.${Field.Identifier}.${Method.VerificationCode}.${Action.Create | Action.Submit}` | `${Prefix}.${InteractionEvent}.${Field.BindMfa}.${MfaFactor}.${Action.Submit | Action.Create}` | `${Prefix}.${InteractionEvent.SignIn}.${Field.Mfa}.${MfaFactor}.${Action.Submit | Action.Create}`;
70
+ export type LogKey = `${Prefix}.${Action.Create | Action.End}` | `${Prefix}.${InteractionEvent}.${Action.Create | Action.Update | Action.Submit}` | `${Prefix}.${InteractionEvent}.${Field.Profile}.${Action.Update | Action.Create | Action.Delete}` | `${Prefix}.${Exclude<InteractionEvent, InteractionEvent.ForgotPassword>}.${Field.Identifier}.${Exclude<Method, Method.Password>}.${Action.Create | Action.Submit}` | `${Prefix}.${Exclude<InteractionEvent, InteractionEvent.ForgotPassword>}.${Field.Identifier}.${Method.Password}.${Action.Submit}` | `${Prefix}.${InteractionEvent.ForgotPassword}.${Field.Identifier}.${Method.VerificationCode}.${Action.Create | Action.Submit}` | `${Prefix}.${InteractionEvent}.${Field.BindMfa}.${MfaFactor}.${Action.Submit | Action.Create}` | `${Prefix}.${InteractionEvent.SignIn}.${Field.Mfa}.${MfaFactor}.${Action.Submit | Action.Create}` | `${Prefix}.${InteractionEvent}.${Field.Verification}.${VerificationType}.${Action}` | `${Prefix}.${InteractionEvent}.${Field.Identifier}.${Action.Submit}`;
@@ -7,6 +7,7 @@ export var Field;
7
7
  Field["Profile"] = "Profile";
8
8
  Field["BindMfa"] = "BindMfa";
9
9
  Field["Mfa"] = "Mfa";
10
+ Field["Verification"] = "Verification";
10
11
  })(Field || (Field = {}));
11
12
  /** Method to verify the identifier */
12
13
  export var Method;