@azure/msal-browser 5.22.0 → 5.24.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 (574) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  4. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +133 -29
  5. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs.map +1 -1
  6. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +178 -64
  7. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs.map +1 -1
  8. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +61 -22
  9. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs.map +1 -1
  10. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +49 -0
  11. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs.map +1 -0
  12. package/dist/cache/AccountManager.mjs +1 -1
  13. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  14. package/dist/cache/BrowserCacheManager.mjs +1 -1
  15. package/dist/cache/CacheHelpers.mjs +1 -1
  16. package/dist/cache/CacheKeys.mjs +1 -1
  17. package/dist/cache/CookieStorage.mjs +1 -1
  18. package/dist/cache/DatabaseStorage.mjs +1 -1
  19. package/dist/cache/EncryptedData.mjs +1 -1
  20. package/dist/cache/LocalStorage.mjs +97 -29
  21. package/dist/cache/LocalStorage.mjs.map +1 -1
  22. package/dist/cache/MemoryStorage.mjs +1 -1
  23. package/dist/cache/SessionStorage.mjs +1 -1
  24. package/dist/cache/TokenCache.mjs +1 -1
  25. package/dist/config/Configuration.mjs +1 -1
  26. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  27. package/dist/controllers/StandardController.mjs +10 -10
  28. package/dist/controllers/StandardController.mjs.map +1 -1
  29. package/dist/crypto/BrowserCrypto.mjs +1 -1
  30. package/dist/crypto/CryptoOps.mjs +1 -1
  31. package/dist/crypto/PkceGenerator.mjs +1 -1
  32. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  33. package/dist/crypto/TokenBindingKeyManager.mjs +1 -1
  34. package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
  35. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +27 -2
  36. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs.map +1 -1
  37. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +192 -2
  38. package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
  39. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  40. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  41. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  51. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  52. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  53. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  54. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  55. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  56. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +21 -0
  57. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs.map +1 -0
  58. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +80 -0
  59. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs.map +1 -0
  60. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs +102 -0
  61. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs.map +1 -0
  62. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +12 -0
  63. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs.map +1 -0
  64. package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs +20 -0
  65. package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs.map +1 -0
  66. package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs +36 -0
  67. package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs.map +1 -0
  68. package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs +29 -0
  69. package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs.map +1 -0
  70. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +76 -0
  71. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -0
  72. package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs +36 -0
  73. package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs.map +1 -0
  74. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +36 -0
  75. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -0
  76. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +134 -0
  77. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -0
  78. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +23 -0
  79. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs.map +1 -0
  80. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +22 -0
  81. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs.map +1 -0
  82. package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs +61 -0
  83. package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs.map +1 -0
  84. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +87 -0
  85. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -0
  86. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +3 -2
  87. package/dist/custom_auth/core/error/CustomAuthApiError.mjs.map +1 -1
  88. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  89. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  90. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  91. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
  92. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  93. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  94. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  95. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  96. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  97. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  98. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  99. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  100. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  101. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  102. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  103. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
  104. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
  105. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  106. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  107. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  108. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  109. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +602 -0
  110. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -0
  111. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +67 -0
  112. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs.map +1 -0
  113. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +46 -0
  114. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +1 -0
  115. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  116. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  117. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +3 -2
  118. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs.map +1 -1
  119. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  120. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  121. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  122. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  123. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  124. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  125. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +30 -0
  126. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -0
  127. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +193 -0
  128. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs.map +1 -0
  129. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +236 -0
  130. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -0
  131. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +26 -0
  132. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs.map +1 -0
  133. package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +66 -0
  134. package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs.map +1 -0
  135. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +97 -0
  136. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -0
  137. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +56 -0
  138. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs.map +1 -0
  139. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +23 -0
  140. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -0
  141. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +14 -0
  142. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +1 -0
  143. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  144. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +3 -2
  145. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs.map +1 -1
  146. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +38 -0
  147. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -0
  148. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +20 -3
  149. package/dist/custom_auth/core/telemetry/PublicApiId.mjs.map +1 -1
  150. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
  151. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  152. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  153. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  154. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  155. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  156. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  157. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  158. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  159. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  160. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  161. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
  162. package/dist/custom_auth/index.mjs +23 -1
  163. package/dist/custom_auth/index.mjs.map +1 -1
  164. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  165. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  166. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  167. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  168. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  169. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  170. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  171. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  172. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  173. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  174. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  175. package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs +29 -0
  176. package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs.map +1 -0
  177. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +59 -0
  178. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -0
  179. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  180. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  181. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  182. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  183. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  184. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  185. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  186. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  187. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  188. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  189. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  190. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  191. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  192. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs +18 -0
  193. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs.map +1 -0
  194. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs +37 -0
  195. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs.map +1 -0
  196. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs +23 -0
  197. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs.map +1 -0
  198. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +70 -0
  199. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -0
  200. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +61 -0
  201. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs.map +1 -0
  202. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  203. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  204. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  205. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  206. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  207. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  208. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  209. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  210. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  211. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  212. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  213. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  214. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  215. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  216. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs +25 -0
  217. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs.map +1 -0
  218. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs +33 -0
  219. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs.map +1 -0
  220. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +40 -0
  221. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs.map +1 -0
  222. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +25 -0
  223. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs.map +1 -0
  224. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +47 -0
  225. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs.map +1 -0
  226. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +60 -0
  227. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +1 -0
  228. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  229. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  230. package/dist/encode/Base64Decode.mjs +1 -1
  231. package/dist/encode/Base64Encode.mjs +1 -1
  232. package/dist/error/BrowserAuthError.mjs +1 -1
  233. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  234. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  235. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  236. package/dist/error/NativeAuthError.mjs +1 -1
  237. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  238. package/dist/error/NestedAppAuthError.mjs +1 -1
  239. package/dist/event/EventHandler.mjs +1 -1
  240. package/dist/event/EventMessage.mjs +1 -1
  241. package/dist/event/EventType.mjs +1 -1
  242. package/dist/index.mjs +1 -1
  243. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  244. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  245. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +21 -14
  246. package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
  247. package/dist/interaction_client/PopupClient.mjs +1 -1
  248. package/dist/interaction_client/RedirectClient.mjs +11 -8
  249. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  250. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  251. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  252. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  253. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  254. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  255. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  256. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  257. package/dist/log-strings-mapping.json +1381 -1185
  258. package/dist/naa/BridgeError.mjs +1 -1
  259. package/dist/naa/BridgeProxy.mjs +1 -1
  260. package/dist/naa/BridgeStatusCode.mjs +1 -1
  261. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  262. package/dist/navigation/NavigationClient.mjs +1 -1
  263. package/dist/network/FetchClient.mjs +1 -1
  264. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  265. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  266. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  267. package/dist/packageMetadata.mjs +2 -2
  268. package/dist/popup_relay/constants.mjs +1 -1
  269. package/dist/popup_relay/index.mjs +1 -1
  270. package/dist/popup_relay/relayClient.mjs +1 -1
  271. package/dist/protocol/Authorize.mjs +1 -1
  272. package/dist/redirect_bridge/index.mjs +1 -1
  273. package/dist/request/RequestHelpers.mjs +1 -1
  274. package/dist/response/ResponseHandler.mjs +1 -1
  275. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  276. package/dist/telemetry/BrowserPerformanceEvents.mjs +16 -2
  277. package/dist/telemetry/BrowserPerformanceEvents.mjs.map +1 -1
  278. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  279. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  280. package/dist/utils/BrowserConstants.mjs +1 -1
  281. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  282. package/dist/utils/BrowserUtils.mjs +1 -1
  283. package/dist/utils/Helpers.mjs +1 -1
  284. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  285. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
  286. package/dist/webBrokerBridge/PerfEventNames.mjs +38 -0
  287. package/dist/webBrokerBridge/PerfEventNames.mjs.map +1 -0
  288. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
  289. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
  290. package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
  291. package/dist/webBrokerBridge/index.mjs +2 -1
  292. package/dist/webBrokerBridge/index.mjs.map +1 -1
  293. package/lib/custom-auth-path/log-strings-mapping.json +215 -19
  294. package/lib/custom-auth-path/msal-custom-auth.cjs +3571 -479
  295. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  296. package/lib/custom-auth-path/msal-custom-auth.js +3571 -479
  297. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  298. package/lib/log-strings-mapping.json +23 -11
  299. package/lib/msal-browser.cjs +622 -233
  300. package/lib/msal-browser.cjs.map +1 -1
  301. package/lib/msal-browser.js +622 -233
  302. package/lib/msal-browser.js.map +1 -1
  303. package/lib/msal-browser.min.js +2 -2
  304. package/lib/popup-relay/msal-popup-relay.cjs +2 -2
  305. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  306. package/lib/popup-relay/msal-popup-relay.js +2 -2
  307. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  308. package/lib/popup-relay/msal-popup-relay.min.js +1 -1
  309. package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
  310. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  311. package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
  312. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  313. package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
  314. package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +59 -1
  315. package/lib/web-broker-bridge/msal-web-broker-bridge.cjs.map +1 -1
  316. package/package.json +3 -3
  317. package/src/broker/nativeBroker/PlatformAuthDOMHandler.ts +217 -45
  318. package/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts +261 -107
  319. package/src/broker/nativeBroker/PlatformAuthProvider.ts +92 -37
  320. package/src/broker/nativeBroker/PlatformAuthRequest.ts +118 -6
  321. package/src/broker/nativeBroker/PlatformAuthResponse.ts +14 -1
  322. package/src/cache/LocalStorage.ts +135 -28
  323. package/src/controllers/StandardController.ts +17 -23
  324. package/src/custom_auth/CustomAuthActionInputs.ts +11 -0
  325. package/src/custom_auth/CustomAuthPublicClientApplication.ts +40 -4
  326. package/src/custom_auth/ICustomAuthPublicClientApplicationV2.ts +44 -0
  327. package/src/custom_auth/controller/CustomAuthStandardController.ts +360 -1
  328. package/src/custom_auth/controller/ICustomAuthStandardController.ts +14 -0
  329. package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.ts +18 -0
  330. package/src/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.ts +20 -0
  331. package/src/custom_auth/core/auth_flow/v2/CustomAuthResultV2.ts +133 -0
  332. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.ts +146 -0
  333. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.ts +8 -0
  334. package/src/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.ts +15 -0
  335. package/src/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.ts +33 -0
  336. package/src/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.ts +25 -0
  337. package/src/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.ts +18 -0
  338. package/src/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.ts +26 -0
  339. package/src/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.ts +26 -0
  340. package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +25 -0
  341. package/src/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.ts +30 -0
  342. package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +40 -0
  343. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +100 -0
  344. package/src/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.ts +59 -0
  345. package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +53 -0
  346. package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +196 -0
  347. package/src/custom_auth/core/auth_flow/v2/state/CompletedStateV2.ts +16 -0
  348. package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +44 -0
  349. package/src/custom_auth/core/auth_flow/v2/state/FailedStateV2.ts +15 -0
  350. package/src/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.ts +76 -0
  351. package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +119 -0
  352. package/src/custom_auth/core/error/CustomAuthApiError.ts +3 -1
  353. package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +35 -0
  354. package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +1145 -0
  355. package/src/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.ts +150 -0
  356. package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +66 -0
  357. package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +185 -0
  358. package/src/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.ts +1 -0
  359. package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +30 -0
  360. package/src/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.ts +423 -0
  361. package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +553 -0
  362. package/src/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.ts +24 -0
  363. package/src/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.ts +81 -0
  364. package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +177 -0
  365. package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +129 -0
  366. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.ts +68 -0
  367. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.ts +50 -0
  368. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/HalResource.ts +20 -0
  369. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +202 -0
  370. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +111 -0
  371. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +26 -0
  372. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +44 -0
  373. package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +64 -0
  374. package/src/custom_auth/core/telemetry/PublicApiId.ts +18 -0
  375. package/src/custom_auth/index.ts +96 -0
  376. package/src/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.ts +25 -0
  377. package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +33 -0
  378. package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +69 -0
  379. package/src/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateParametersV2.ts +9 -0
  380. package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.ts +13 -0
  381. package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.ts +35 -0
  382. package/src/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.ts +19 -0
  383. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.ts +31 -0
  384. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +32 -0
  385. package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +22 -0
  386. package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +96 -0
  387. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.ts +83 -0
  388. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.ts +12 -0
  389. package/src/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.ts +21 -0
  390. package/src/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.ts +32 -0
  391. package/src/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.ts +28 -0
  392. package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +20 -0
  393. package/src/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.ts +48 -0
  394. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.ts +34 -0
  395. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.ts +63 -0
  396. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.ts +24 -0
  397. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +112 -0
  398. package/src/interaction_client/PlatformAuthInteractionClient.ts +79 -17
  399. package/src/interaction_client/RedirectClient.ts +15 -5
  400. package/src/packageMetadata.ts +1 -1
  401. package/src/telemetry/BrowserPerformanceEvents.ts +20 -0
  402. package/src/webBrokerBridge/PerfEventNames.ts +43 -0
  403. package/src/webBrokerBridge/index.ts +26 -0
  404. package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts +3 -1
  405. package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts.map +1 -1
  406. package/types/broker/nativeBroker/PlatformAuthExtensionHandler.d.ts +3 -1
  407. package/types/broker/nativeBroker/PlatformAuthExtensionHandler.d.ts.map +1 -1
  408. package/types/broker/nativeBroker/PlatformAuthProvider.d.ts +1 -1
  409. package/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
  410. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +68 -5
  411. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
  412. package/types/broker/nativeBroker/PlatformAuthResponse.d.ts +12 -1
  413. package/types/broker/nativeBroker/PlatformAuthResponse.d.ts.map +1 -1
  414. package/types/cache/LocalStorage.d.ts +4 -5
  415. package/types/cache/LocalStorage.d.ts.map +1 -1
  416. package/types/controllers/StandardController.d.ts.map +1 -1
  417. package/types/custom_auth/CustomAuthActionInputs.d.ts +7 -0
  418. package/types/custom_auth/CustomAuthActionInputs.d.ts.map +1 -1
  419. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  420. package/types/custom_auth/CustomAuthPublicClientApplication.d.ts +27 -5
  421. package/types/custom_auth/CustomAuthPublicClientApplication.d.ts.map +1 -1
  422. package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts +30 -0
  423. package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts.map +1 -0
  424. package/types/custom_auth/controller/CustomAuthStandardController.d.ts +11 -2
  425. package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
  426. package/types/custom_auth/controller/ICustomAuthStandardController.d.ts +7 -1
  427. package/types/custom_auth/controller/ICustomAuthStandardController.d.ts.map +1 -1
  428. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts +14 -0
  429. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts.map +1 -0
  430. package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts +14 -0
  431. package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts.map +1 -0
  432. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts +53 -0
  433. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts.map +1 -0
  434. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts +40 -0
  435. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts.map +1 -0
  436. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts +4 -0
  437. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts.map +1 -0
  438. package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts +11 -0
  439. package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts.map +1 -0
  440. package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts +23 -0
  441. package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts.map +1 -0
  442. package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts +18 -0
  443. package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts.map +1 -0
  444. package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts +7 -0
  445. package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts.map +1 -0
  446. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts +15 -0
  447. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts.map +1 -0
  448. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts +16 -0
  449. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts.map +1 -0
  450. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +16 -0
  451. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts.map +1 -0
  452. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts +18 -0
  453. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts.map +1 -0
  454. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +23 -0
  455. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -0
  456. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts +21 -0
  457. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -0
  458. package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts +17 -0
  459. package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts.map +1 -0
  460. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts +14 -0
  461. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -0
  462. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts +25 -0
  463. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -0
  464. package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts +11 -0
  465. package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts.map +1 -0
  466. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +28 -0
  467. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -0
  468. package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts +10 -0
  469. package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts.map +1 -0
  470. package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts +18 -0
  471. package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts.map +1 -0
  472. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts +25 -0
  473. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -0
  474. package/types/custom_auth/core/error/CustomAuthApiError.d.ts +3 -1
  475. package/types/custom_auth/core/error/CustomAuthApiError.d.ts.map +1 -1
  476. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +21 -0
  477. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -0
  478. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +35 -0
  479. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -0
  480. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts +26 -0
  481. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts.map +1 -0
  482. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +43 -0
  483. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -0
  484. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +80 -0
  485. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -0
  486. package/types/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.d.ts +1 -0
  487. package/types/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.d.ts.map +1 -1
  488. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +17 -0
  489. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -0
  490. package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts +31 -0
  491. package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts.map +1 -0
  492. package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts +23 -0
  493. package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -0
  494. package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts +19 -0
  495. package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts.map +1 -0
  496. package/types/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.d.ts +2 -0
  497. package/types/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.d.ts.map +1 -0
  498. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +15 -0
  499. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -0
  500. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +52 -0
  501. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -0
  502. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.d.ts +3 -0
  503. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.d.ts.map +1 -0
  504. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts +37 -0
  505. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts.map +1 -0
  506. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/HalResource.d.ts +12 -0
  507. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/HalResource.d.ts.map +1 -0
  508. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +133 -0
  509. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -0
  510. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts +70 -0
  511. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -0
  512. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +10 -0
  513. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -0
  514. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +33 -0
  515. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -0
  516. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +4 -0
  517. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -0
  518. package/types/custom_auth/core/telemetry/PublicApiId.d.ts +16 -0
  519. package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
  520. package/types/custom_auth/index.d.ts +37 -0
  521. package/types/custom_auth/index.d.ts.map +1 -1
  522. package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts +18 -0
  523. package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts.map +1 -0
  524. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +22 -0
  525. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -0
  526. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +19 -0
  527. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -0
  528. package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateParametersV2.d.ts +3 -0
  529. package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateParametersV2.d.ts.map +1 -0
  530. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts +9 -0
  531. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts.map +1 -0
  532. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts +22 -0
  533. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts.map +1 -0
  534. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts +12 -0
  535. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts.map +1 -0
  536. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts +21 -0
  537. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts.map +1 -0
  538. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +17 -0
  539. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -0
  540. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +9 -0
  541. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -0
  542. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts +17 -0
  543. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -0
  544. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts +24 -0
  545. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts.map +1 -0
  546. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts +4 -0
  547. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts.map +1 -0
  548. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts +14 -0
  549. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts.map +1 -0
  550. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts +20 -0
  551. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts.map +1 -0
  552. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts +15 -0
  553. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts.map +1 -0
  554. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +8 -0
  555. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -0
  556. package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts +15 -0
  557. package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts.map +1 -0
  558. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts +11 -0
  559. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts.map +1 -0
  560. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts +19 -0
  561. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts.map +1 -0
  562. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts +14 -0
  563. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts.map +1 -0
  564. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts +10 -0
  565. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -0
  566. package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  567. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  568. package/types/packageMetadata.d.ts +1 -1
  569. package/types/telemetry/BrowserPerformanceEvents.d.ts +13 -0
  570. package/types/telemetry/BrowserPerformanceEvents.d.ts.map +1 -1
  571. package/types/webBrokerBridge/PerfEventNames.d.ts +30 -0
  572. package/types/webBrokerBridge/PerfEventNames.d.ts.map +1 -0
  573. package/types/webBrokerBridge/index.d.ts +1 -0
  574. package/types/webBrokerBridge/index.d.ts.map +1 -1
@@ -0,0 +1,1145 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ ICrypto,
8
+ IPerformanceClient,
9
+ Logger,
10
+ } from "@azure/msal-common/browser";
11
+ import { InteractionClientBaseV2 } from "./InteractionClientBaseV2.js";
12
+ import {
13
+ FlowStartParamsV2,
14
+ FlowSignInStartParamsV2,
15
+ FlowSignUpStartParamsV2,
16
+ FlowChallengeParamsV2,
17
+ FlowSubmitCodeParamsV2,
18
+ FlowSubmitNewPasswordParamsV2,
19
+ FlowSubmitSignInPasswordParamsV2,
20
+ FlowSubmitSignUpAttributesParamsV2,
21
+ FlowSignInWithContinuationParamsV2,
22
+ } from "./parameter/FlowParamsV2.js";
23
+ import {
24
+ createFlowMethodSelectionRequiredResultV2,
25
+ createFlowCodeRequiredResultV2,
26
+ createFlowPasswordRequiredResultV2,
27
+ createFlowSignUpPasswordRequiredResultV2,
28
+ createFlowMFARequiredResultV2,
29
+ createFlowNewPasswordRequiredResultV2,
30
+ createFlowAttributesRequiredResultV2,
31
+ createFlowSignInContinuationRequiredResultV2,
32
+ createFlowCompletedResultV2,
33
+ FLOW_CODE_REQUIRED_V2,
34
+ FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2,
35
+ } from "./result/FlowActionResultV2.js";
36
+ import type {
37
+ FlowMethodSelectionRequiredResultV2,
38
+ FlowCodeRequiredResultV2,
39
+ FlowSignInCodeRequiredResultV2,
40
+ FlowResetPasswordCodeRequiredResultV2,
41
+ FlowPasswordRequiredResultV2,
42
+ FlowSignUpPasswordRequiredResultV2,
43
+ FlowMFARequiredResultV2,
44
+ FlowAttributesRequiredResultV2,
45
+ FlowSignInContinuationRequiredResultV2,
46
+ FlowCompletedResultV2,
47
+ FlowSignUpActionResultV2,
48
+ FlowSubmitCodeResultV2,
49
+ } from "./result/FlowActionResultV2.js";
50
+ import { BrowserConfiguration } from "../../../../config/Configuration.js";
51
+ import { BrowserCacheManager } from "../../../../cache/BrowserCacheManager.js";
52
+ import { EventHandler } from "../../../../event/EventHandler.js";
53
+ import { INavigationClient } from "../../../../navigation/INavigationClient.js";
54
+ import { CustomAuthAuthority } from "../../CustomAuthAuthority.js";
55
+ import { CustomAuthApiClientV2 } from "../../network_client/custom_auth_api/v2/CustomAuthApiClientV2.js";
56
+ import { CustomAuthError } from "../../error/CustomAuthError.js";
57
+ import {
58
+ CONTINUATION_LINK_MISSING,
59
+ RESET_PASSWORD_UNSUPPORTED,
60
+ RESET_PASSWORD_TIMEOUT,
61
+ SIGN_IN_UNSUPPORTED,
62
+ SIGN_UP_UNSUPPORTED,
63
+ UNSUPPORTED_FLOW_STEP,
64
+ UNSUPPORTED_FLOW_TRANSITION,
65
+ } from "../../network_client/custom_auth_api/v2/ErrorCodesV2.js";
66
+ import { CustomAuthFlowScenarioV2 } from "../../auth_flow/v2/CustomAuthFlowScenarioV2.js";
67
+ import * as PublicApiId from "../../telemetry/PublicApiId.js";
68
+ import {
69
+ getPublicApiIdV2,
70
+ FlowStepV2,
71
+ } from "../../telemetry/FlowApiIdHelperV2.js";
72
+ import {
73
+ AuthenticationFactorV2,
74
+ ChallengeNextActionV2,
75
+ type ChallengeVerificationResultV2,
76
+ VerifyNextActionV2,
77
+ type VerifyResultV2,
78
+ } from "../../network_client/custom_auth_api/v2/result/BaseResultsV2.js";
79
+ import { AuthenticationMethodTypeV2 } from "../../network_client/custom_auth_api/v2/ApiClientConstantsV2.js";
80
+ import type { FlowContinuationStateV2 } from "./FlowContinuationStateV2.js";
81
+ import type { AuthenticationMethodV2 } from "../../auth_flow/v2/AuthenticationMethodV2.js";
82
+ import {
83
+ SignUpSubmitAttributesNextActionV2,
84
+ type SignUpSubmitAttributesApiResultV2,
85
+ } from "../../network_client/custom_auth_api/v2/result/SignUpResultsV2.js";
86
+
87
+ /*
88
+ * Polls up to five times for password-update completion, waiting 1.5 seconds
89
+ * between attempts. The first request runs immediately.
90
+ */
91
+ const POLL_MAX_ATTEMPTS = 5;
92
+ // TODO: Replace this fallback with the server-provided polling interval once available.
93
+ const POLL_INTERVAL_MS = 1500;
94
+
95
+ const delay = (ms: number): Promise<void> =>
96
+ new Promise((resolve) => setTimeout(resolve, ms));
97
+
98
+ /*
99
+ * Drives server-directed Native Auth V2 flows using opaque continuation state
100
+ * and HAL links. Each operation returns only its valid discriminated results.
101
+ */
102
+ export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
103
+ constructor(
104
+ config: BrowserConfiguration,
105
+ storageImpl: BrowserCacheManager,
106
+ browserCrypto: ICrypto,
107
+ logger: Logger,
108
+ eventHandler: EventHandler,
109
+ navigationClient: INavigationClient,
110
+ performanceClient: IPerformanceClient,
111
+ customAuthAuthority: CustomAuthAuthority,
112
+ protected apiClient: CustomAuthApiClientV2
113
+ ) {
114
+ super(
115
+ config,
116
+ storageImpl,
117
+ browserCrypto,
118
+ logger,
119
+ eventHandler,
120
+ navigationClient,
121
+ performanceClient,
122
+ customAuthAuthority
123
+ );
124
+ }
125
+
126
+ /*
127
+ * Starts sign-in using the preferred supported method offered by the server.
128
+ */
129
+ async signIn(
130
+ parameters: FlowSignInStartParamsV2
131
+ ): Promise<
132
+ | FlowPasswordRequiredResultV2
133
+ | FlowSignInCodeRequiredResultV2
134
+ | FlowMFARequiredResultV2
135
+ | FlowCompletedResultV2
136
+ > {
137
+ const correlationId = parameters.correlationId;
138
+ const context = this.createRequestContext(
139
+ PublicApiId.SIGN_IN_V2_START,
140
+ correlationId
141
+ );
142
+
143
+ this.logger.verbose("Starting V2 sign-in.", correlationId);
144
+
145
+ const entryResult = await this.apiClient.authorizeChallengeStart(
146
+ context
147
+ );
148
+ const startResult = await this.apiClient.signInStart(
149
+ this.requireLink(correlationId, entryResult.signInHref, {
150
+ code: SIGN_IN_UNSUPPORTED,
151
+ message:
152
+ "The authorize-challenge entry response did not include a sign-in link.",
153
+ }),
154
+ {
155
+ continuationToken: entryResult.continuationToken,
156
+ username: parameters.username,
157
+ },
158
+ context
159
+ );
160
+ this.ensureAuthenticationFactor(
161
+ startResult.authenticationFactor,
162
+ AuthenticationFactorV2.SINGLE_FACTOR,
163
+ "sign-in start",
164
+ correlationId
165
+ );
166
+
167
+ const continuationState: FlowContinuationStateV2 = {
168
+ continuationToken: startResult.continuationToken,
169
+ scenario: CustomAuthFlowScenarioV2.SignIn,
170
+ links: {},
171
+ tokenRequest: {
172
+ scopes: parameters.scopes,
173
+ },
174
+ };
175
+ const methods = startResult.methods.map((method) => ({
176
+ id: method.id,
177
+ type: method.type ?? "",
178
+ hint: method.hint,
179
+ challengeHref: method.challengeHref,
180
+ }));
181
+ const selectedMethod = this.selectSignInMethod(
182
+ methods,
183
+ parameters.password !== undefined,
184
+ correlationId
185
+ );
186
+
187
+ const challengeResult = await this.requestChallenge({
188
+ correlationId,
189
+ continuationState: {
190
+ ...continuationState,
191
+ links: {
192
+ ...continuationState.links,
193
+ challenge: selectedMethod.challengeHref,
194
+ },
195
+ },
196
+ });
197
+
198
+ if (challengeResult.type === FLOW_CODE_REQUIRED_V2) {
199
+ return {
200
+ ...challengeResult,
201
+ method: selectedMethod,
202
+ };
203
+ }
204
+
205
+ if (parameters.password) {
206
+ return this.submitSignInPassword({
207
+ correlationId,
208
+ continuationState: challengeResult.continuationState,
209
+ password: parameters.password,
210
+ });
211
+ }
212
+
213
+ return challengeResult;
214
+ }
215
+
216
+ /*
217
+ * Starts sign-up and resolves the server-provided attribute-submission transition.
218
+ */
219
+ async signUp(
220
+ parameters: FlowSignUpStartParamsV2
221
+ ): Promise<
222
+ | FlowCodeRequiredResultV2
223
+ | FlowSignUpPasswordRequiredResultV2
224
+ | FlowAttributesRequiredResultV2
225
+ > {
226
+ const correlationId = parameters.correlationId;
227
+ const context = this.createRequestContext(
228
+ PublicApiId.SIGN_UP_V2_START,
229
+ correlationId
230
+ );
231
+
232
+ this.logger.verbose("Starting V2 sign-up.", correlationId);
233
+
234
+ const entryResult = await this.apiClient.authorizeChallengeStart(
235
+ context,
236
+ parameters.scopes
237
+ );
238
+ const startResult = await this.apiClient.signUpStart(
239
+ this.requireLink(correlationId, entryResult.signUpHref, {
240
+ code: SIGN_UP_UNSUPPORTED,
241
+ message:
242
+ "The authorize-challenge entry response did not include a sign-up link.",
243
+ }),
244
+ {
245
+ continuationToken: entryResult.continuationToken,
246
+ },
247
+ context
248
+ );
249
+ const attributes = Object.fromEntries(
250
+ Object.entries(parameters.attributes ?? {}).filter(
251
+ ([name]) =>
252
+ name.toLowerCase() !== "email" &&
253
+ name.toLowerCase() !== "password"
254
+ )
255
+ );
256
+ attributes.email = parameters.username;
257
+ if (parameters.password !== undefined) {
258
+ attributes.password = parameters.password;
259
+ }
260
+ const submitResult = await this.apiClient.submitSignUpAttributes(
261
+ startResult.submitAttributesHref,
262
+ {
263
+ continuationToken: startResult.continuationToken,
264
+ attributes,
265
+ },
266
+ context
267
+ );
268
+ const continuationState: FlowContinuationStateV2 = {
269
+ continuationToken: startResult.continuationToken,
270
+ scenario: CustomAuthFlowScenarioV2.SignUp,
271
+ links: {},
272
+ tokenRequest: {
273
+ scopes: parameters.scopes,
274
+ },
275
+ signUp: {
276
+ passwordWasSupplied: attributes.password !== undefined,
277
+ },
278
+ };
279
+
280
+ const result = this.toSignUpActionResult(
281
+ submitResult,
282
+ continuationState,
283
+ correlationId
284
+ );
285
+
286
+ if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
287
+ const message =
288
+ "Initial sign-up attribute submission cannot complete without code verification or additional attributes.";
289
+ this.logger.error(message, correlationId);
290
+ throw new CustomAuthError(
291
+ UNSUPPORTED_FLOW_TRANSITION,
292
+ message,
293
+ correlationId
294
+ );
295
+ }
296
+
297
+ return result;
298
+ }
299
+
300
+ /*
301
+ * Starts password reset, automatically challenging a sole method or
302
+ * returning multiple methods for selection.
303
+ */
304
+ async resetPassword(
305
+ parameters: FlowStartParamsV2
306
+ ): Promise<
307
+ | FlowMethodSelectionRequiredResultV2
308
+ | FlowResetPasswordCodeRequiredResultV2
309
+ > {
310
+ const correlationId = parameters.correlationId;
311
+ const context = this.createRequestContext(
312
+ PublicApiId.RESET_PASSWORD_V2_START,
313
+ correlationId
314
+ );
315
+
316
+ this.logger.verbose(
317
+ "Starting V2 self-service password reset.",
318
+ correlationId
319
+ );
320
+
321
+ const entryResult = await this.apiClient.authorizeChallengeStart(
322
+ context
323
+ );
324
+ const startResult = await this.apiClient.resetPasswordStart(
325
+ this.requireLink(correlationId, entryResult.resetPasswordHref, {
326
+ code: RESET_PASSWORD_UNSUPPORTED,
327
+ message:
328
+ "The authorize-challenge entry response did not include a reset-password link.",
329
+ }),
330
+ {
331
+ username: parameters.username,
332
+ continuationToken: entryResult.continuationToken,
333
+ },
334
+ context
335
+ );
336
+ this.ensureAuthenticationFactor(
337
+ startResult.authenticationFactor,
338
+ AuthenticationFactorV2.SINGLE_FACTOR,
339
+ "password-reset start",
340
+ correlationId
341
+ );
342
+ const continuationState: FlowContinuationStateV2 = {
343
+ continuationToken: startResult.continuationToken,
344
+ scenario: CustomAuthFlowScenarioV2.PasswordReset,
345
+ links: {},
346
+ };
347
+ const methods = startResult.methods.map((method) => ({
348
+ id: method.id,
349
+ type: method.type ?? "",
350
+ hint: method.hint,
351
+ challengeHref: method.challengeHref,
352
+ }));
353
+
354
+ if (methods.length === 0) {
355
+ const message =
356
+ "The password-reset start response did not include an authentication method.";
357
+ this.logger.error(message, correlationId);
358
+ throw new CustomAuthError(
359
+ UNSUPPORTED_FLOW_TRANSITION,
360
+ message,
361
+ correlationId
362
+ );
363
+ }
364
+
365
+ if (methods.length === 1) {
366
+ const selectedMethod = methods[0];
367
+ const challengeResult = await this.requestChallenge({
368
+ correlationId,
369
+ continuationState: {
370
+ ...continuationState,
371
+ links: {
372
+ challenge: selectedMethod.challengeHref,
373
+ },
374
+ },
375
+ });
376
+
377
+ if (
378
+ challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
379
+ (challengeResult.channel?.toLowerCase() ===
380
+ AuthenticationMethodTypeV2.EMAIL ||
381
+ challengeResult.channel?.toLowerCase() ===
382
+ AuthenticationMethodTypeV2.SMS)
383
+ ) {
384
+ return {
385
+ ...challengeResult,
386
+ method: selectedMethod,
387
+ };
388
+ }
389
+
390
+ const channel =
391
+ challengeResult.type === FLOW_CODE_REQUIRED_V2
392
+ ? challengeResult.channel
393
+ : AuthenticationMethodTypeV2.PASSWORD;
394
+ const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
395
+ this.logger.error(message, correlationId);
396
+ throw new CustomAuthError(
397
+ UNSUPPORTED_FLOW_TRANSITION,
398
+ message,
399
+ correlationId
400
+ );
401
+ }
402
+
403
+ this.logger.verbose(
404
+ "V2 self-service password reset method selection required.",
405
+ correlationId
406
+ );
407
+
408
+ return createFlowMethodSelectionRequiredResultV2({
409
+ correlationId,
410
+ continuationState,
411
+ methods,
412
+ });
413
+ }
414
+
415
+ /*
416
+ * Requests a one-time code for the selected authentication method. Returns
417
+ * the continuation state and code metadata needed for verification.
418
+ */
419
+ async requestChallenge(
420
+ parameters: FlowChallengeParamsV2
421
+ ): Promise<FlowCodeRequiredResultV2 | FlowPasswordRequiredResultV2> {
422
+ const challengeResult = await this.sendMethodChallenge(
423
+ parameters,
424
+ "requestChallenge"
425
+ );
426
+ const challengeType =
427
+ challengeResult.type ?? AuthenticationMethodTypeV2.EMAIL;
428
+ const continuationState = this.createChallengeContinuationState(
429
+ parameters.continuationState,
430
+ challengeResult
431
+ );
432
+
433
+ if (
434
+ challengeType.toLowerCase() === AuthenticationMethodTypeV2.PASSWORD
435
+ ) {
436
+ return createFlowPasswordRequiredResultV2({
437
+ correlationId: parameters.correlationId,
438
+ continuationState,
439
+ });
440
+ }
441
+
442
+ return createFlowCodeRequiredResultV2({
443
+ correlationId: parameters.correlationId,
444
+ continuationState,
445
+ channel: challengeType,
446
+ sentTo: challengeResult.hint,
447
+ codeLength: challengeResult.codeLength,
448
+ });
449
+ }
450
+
451
+ /*
452
+ * Verifies the submitted one-time code using the server-provided link. The
453
+ * response determines the next required action.
454
+ */
455
+ async submitCode(
456
+ parameters: FlowSubmitCodeParamsV2
457
+ ): Promise<FlowSubmitCodeResultV2> {
458
+ const continuationState = parameters.continuationState;
459
+ const correlationId = parameters.correlationId;
460
+ const context = this.createRequestContext(
461
+ this.resolveStepApiId(
462
+ continuationState.scenario,
463
+ "submitCode",
464
+ correlationId
465
+ ),
466
+ correlationId
467
+ );
468
+
469
+ this.logger.verbose("Submitting V2 one-time code.", correlationId);
470
+
471
+ const verifyHref = this.requireLink(
472
+ correlationId,
473
+ continuationState.links.verify
474
+ );
475
+ const verifyRequest = {
476
+ continuationToken: continuationState.continuationToken,
477
+ otp: parameters.code,
478
+ };
479
+ const verifyResult = await this.apiClient.verifyChallenge(
480
+ verifyHref,
481
+ verifyRequest,
482
+ context
483
+ );
484
+
485
+ if (
486
+ continuationState.scenario ===
487
+ CustomAuthFlowScenarioV2.PasswordReset &&
488
+ verifyResult.nextAction === VerifyNextActionV2.UPDATE
489
+ ) {
490
+ return createFlowNewPasswordRequiredResultV2({
491
+ correlationId,
492
+ continuationState: {
493
+ continuationToken: verifyResult.continuationToken,
494
+ scenario: continuationState.scenario,
495
+ links: { update: verifyResult.updateHref },
496
+ },
497
+ });
498
+ }
499
+
500
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
501
+ return this.handleSignInVerification(
502
+ continuationState,
503
+ verifyResult,
504
+ correlationId
505
+ );
506
+ }
507
+
508
+ if (
509
+ continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
510
+ verifyResult.nextAction === VerifyNextActionV2.COLLECT_ATTRIBUTES
511
+ ) {
512
+ const requiredPasswordAttribute = verifyResult.attributes.find(
513
+ (attribute) =>
514
+ attribute.attributeId.toLowerCase() === "password" &&
515
+ attribute.required === true
516
+ );
517
+ const nextContinuationState: FlowContinuationStateV2 = {
518
+ continuationToken: verifyResult.continuationToken,
519
+ scenario: continuationState.scenario,
520
+ links: {
521
+ submitAttributes: verifyResult.submitAttributesHref,
522
+ },
523
+ tokenRequest: continuationState.tokenRequest,
524
+ signUp: continuationState.signUp,
525
+ };
526
+ const attributes = verifyResult.attributes.filter(
527
+ (attribute) =>
528
+ attribute.attributeId.toLowerCase() !== "password"
529
+ );
530
+
531
+ if (
532
+ requiredPasswordAttribute &&
533
+ continuationState.signUp?.passwordWasSupplied !== true
534
+ ) {
535
+ return createFlowSignUpPasswordRequiredResultV2({
536
+ correlationId,
537
+ continuationState: nextContinuationState,
538
+ attributes,
539
+ requiredPasswordAttribute,
540
+ });
541
+ }
542
+
543
+ return createFlowAttributesRequiredResultV2({
544
+ correlationId,
545
+ continuationState: nextContinuationState,
546
+ attributes,
547
+ });
548
+ }
549
+
550
+ if (
551
+ continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
552
+ verifyResult.nextAction === VerifyNextActionV2.CONTINUE
553
+ ) {
554
+ return createFlowSignInContinuationRequiredResultV2({
555
+ correlationId,
556
+ continuationState: {
557
+ continuationToken: verifyResult.continuationToken,
558
+ scenario: continuationState.scenario,
559
+ links: {},
560
+ tokenRequest: continuationState.tokenRequest,
561
+ },
562
+ });
563
+ }
564
+
565
+ const message = `Verification next action '${verifyResult.nextAction}' is not supported for the '${continuationState.scenario}' flow.`;
566
+ this.logger.error(message, correlationId);
567
+
568
+ throw new CustomAuthError(
569
+ UNSUPPORTED_FLOW_TRANSITION,
570
+ message,
571
+ correlationId
572
+ );
573
+ }
574
+
575
+ /*
576
+ * Requests a new one-time code using the server-provided resend link.
577
+ * Returns refreshed continuation state and code metadata.
578
+ */
579
+ async resendCode(
580
+ parameters: FlowChallengeParamsV2
581
+ ): Promise<FlowCodeRequiredResultV2> {
582
+ const challengeResult = await this.sendMethodChallenge(
583
+ parameters,
584
+ "resendCode"
585
+ );
586
+
587
+ return createFlowCodeRequiredResultV2({
588
+ correlationId: parameters.correlationId,
589
+ continuationState: this.createChallengeContinuationState(
590
+ parameters.continuationState,
591
+ challengeResult
592
+ ),
593
+ channel: challengeResult.type,
594
+ sentTo: challengeResult.hint,
595
+ codeLength: challengeResult.codeLength,
596
+ });
597
+ }
598
+
599
+ async submitSignUpAttributes(
600
+ parameters: FlowSubmitSignUpAttributesParamsV2
601
+ ): Promise<FlowSignUpActionResultV2> {
602
+ const { continuationState, correlationId, attributes } = parameters;
603
+ const context = this.createRequestContext(
604
+ this.resolveStepApiId(
605
+ continuationState.scenario,
606
+ "submitAttributes",
607
+ correlationId
608
+ ),
609
+ correlationId
610
+ );
611
+
612
+ this.logger.verbose(
613
+ "Submitting additional V2 sign-up attributes.",
614
+ correlationId
615
+ );
616
+
617
+ const submitResult = await this.apiClient.submitSignUpAttributes(
618
+ this.requireLink(
619
+ correlationId,
620
+ continuationState.links.submitAttributes
621
+ ),
622
+ {
623
+ continuationToken: continuationState.continuationToken,
624
+ attributes,
625
+ },
626
+ context
627
+ );
628
+
629
+ return this.toSignUpActionResult(
630
+ submitResult,
631
+ {
632
+ ...continuationState,
633
+ signUp: {
634
+ passwordWasSupplied:
635
+ continuationState.signUp?.passwordWasSupplied ===
636
+ true || attributes.password !== undefined,
637
+ },
638
+ },
639
+ correlationId
640
+ );
641
+ }
642
+
643
+ /*
644
+ * Submits the new password and polls until the reset completes. The result
645
+ * contains the continuation state required for explicit sign-in.
646
+ */
647
+ async submitNewPassword(
648
+ parameters: FlowSubmitNewPasswordParamsV2
649
+ ): Promise<FlowSignInContinuationRequiredResultV2> {
650
+ const continuationState = parameters.continuationState;
651
+ const correlationId = parameters.correlationId;
652
+ const context = this.createRequestContext(
653
+ this.resolveStepApiId(
654
+ continuationState.scenario,
655
+ "submitNewPassword",
656
+ correlationId
657
+ ),
658
+ correlationId
659
+ );
660
+
661
+ this.logger.verbose("Submitting V2 new password.", correlationId);
662
+
663
+ const updateResult = await this.apiClient.submitNewPassword(
664
+ this.requireLink(correlationId, continuationState.links.update),
665
+ {
666
+ continuationToken: continuationState.continuationToken,
667
+ newPassword: parameters.newPassword,
668
+ },
669
+ context
670
+ );
671
+
672
+ let pollToken = updateResult.continuationToken;
673
+ let pollHref = updateResult.pollHref;
674
+ let completionToken: string | undefined;
675
+
676
+ for (let attempt = 1; attempt <= POLL_MAX_ATTEMPTS; attempt++) {
677
+ const pollResult = await this.apiClient.poll(
678
+ pollHref,
679
+ { continuationToken: pollToken },
680
+ context
681
+ );
682
+
683
+ if (pollResult.isCompleted) {
684
+ completionToken = pollResult.continuationToken;
685
+ break;
686
+ }
687
+
688
+ pollToken = pollResult.continuationToken;
689
+ pollHref = pollResult.pollHref ?? pollHref;
690
+
691
+ if (attempt < POLL_MAX_ATTEMPTS) {
692
+ await delay(POLL_INTERVAL_MS);
693
+ }
694
+ }
695
+
696
+ if (!completionToken) {
697
+ const message =
698
+ "The password reset did not complete within the allotted number of polling attempts.";
699
+ this.logger.error(message, correlationId);
700
+
701
+ throw new CustomAuthError(
702
+ RESET_PASSWORD_TIMEOUT,
703
+ message,
704
+ correlationId
705
+ );
706
+ }
707
+
708
+ this.logger.verbose(
709
+ "V2 password reset applied; sign-in required.",
710
+ correlationId
711
+ );
712
+
713
+ return createFlowSignInContinuationRequiredResultV2({
714
+ correlationId,
715
+ continuationState: {
716
+ continuationToken: completionToken,
717
+ scenario: continuationState.scenario,
718
+ links: {},
719
+ },
720
+ });
721
+ }
722
+
723
+ /*
724
+ * Verifies a sign-in password and returns the next sign-in action.
725
+ */
726
+ async submitSignInPassword(
727
+ parameters: FlowSubmitSignInPasswordParamsV2
728
+ ): Promise<FlowMFARequiredResultV2 | FlowCompletedResultV2> {
729
+ const verifyResult = await this.verifySignInPassword(parameters);
730
+
731
+ return this.handleSignInVerification(
732
+ parameters.continuationState,
733
+ verifyResult,
734
+ parameters.correlationId
735
+ );
736
+ }
737
+
738
+ /*
739
+ * Redeems the completed flow continuation for tokens. Returns the
740
+ * authentication result after validating and caching the response.
741
+ */
742
+ async signInWithContinuation(
743
+ parameters: FlowSignInWithContinuationParamsV2
744
+ ): Promise<FlowCompletedResultV2> {
745
+ const continuationState = parameters.continuationState;
746
+ const correlationId = parameters.correlationId;
747
+ const apiId = this.resolveStepApiId(
748
+ continuationState.scenario,
749
+ "signInWithContinuation",
750
+ correlationId
751
+ );
752
+ const context = this.createRequestContext(apiId, correlationId);
753
+
754
+ this.logger.verbose(
755
+ "Signing in with a V2 continuation.",
756
+ correlationId
757
+ );
758
+
759
+ const scopes = this.getScopes(parameters.scopes);
760
+
761
+ const tokenResponse = await this.apiClient.completeWithTokens(
762
+ {
763
+ continuationToken: continuationState.continuationToken,
764
+ scopes,
765
+ },
766
+ context
767
+ );
768
+
769
+ const authenticationResult = await this.handleTokenResponse(
770
+ tokenResponse,
771
+ scopes,
772
+ correlationId,
773
+ apiId
774
+ );
775
+
776
+ this.logger.verbose(
777
+ "V2 continuation sign-in completed.",
778
+ correlationId
779
+ );
780
+
781
+ return createFlowCompletedResultV2({
782
+ correlationId,
783
+ authenticationResult,
784
+ });
785
+ }
786
+
787
+ private async handleSignInVerification(
788
+ continuationState: FlowContinuationStateV2,
789
+ verifyResult: VerifyResultV2,
790
+ correlationId: string
791
+ ): Promise<FlowMFARequiredResultV2 | FlowCompletedResultV2> {
792
+ if (verifyResult.nextAction === VerifyNextActionV2.CHALLENGE) {
793
+ this.ensureAuthenticationFactor(
794
+ verifyResult.authenticationFactor,
795
+ AuthenticationFactorV2.MULTI_FACTOR,
796
+ "after sign-in verification",
797
+ correlationId
798
+ );
799
+
800
+ return createFlowMFARequiredResultV2({
801
+ correlationId,
802
+ continuationState: {
803
+ continuationToken: verifyResult.continuationToken,
804
+ scenario: continuationState.scenario,
805
+ links: {},
806
+ tokenRequest: continuationState.tokenRequest,
807
+ },
808
+ methods: verifyResult.methods.map((method) => ({
809
+ id: method.id,
810
+ type: method.type ?? "",
811
+ hint: method.hint,
812
+ challengeHref: method.challengeHref,
813
+ })),
814
+ });
815
+ }
816
+
817
+ if (verifyResult.nextAction === VerifyNextActionV2.CONTINUE) {
818
+ return this.completeSignInAfterVerification(
819
+ continuationState,
820
+ verifyResult.continuationToken,
821
+ correlationId
822
+ );
823
+ }
824
+
825
+ const message = `Verification next action '${verifyResult.nextAction}' is not supported for sign-in.`;
826
+ this.logger.error(message, correlationId);
827
+ throw new CustomAuthError(
828
+ UNSUPPORTED_FLOW_TRANSITION,
829
+ message,
830
+ correlationId
831
+ );
832
+ }
833
+
834
+ private selectSignInMethod(
835
+ methods: AuthenticationMethodV2[],
836
+ passwordProvided: boolean,
837
+ correlationId: string
838
+ ): AuthenticationMethodV2 {
839
+ const passwordMethod = methods.find(
840
+ (method) =>
841
+ method.type.toLowerCase() ===
842
+ AuthenticationMethodTypeV2.PASSWORD
843
+ );
844
+ const emailMethod = methods.find(
845
+ (method) =>
846
+ method.type.toLowerCase() === AuthenticationMethodTypeV2.EMAIL
847
+ );
848
+
849
+ if (passwordProvided) {
850
+ if (passwordMethod) {
851
+ return passwordMethod;
852
+ }
853
+
854
+ const message =
855
+ "A password was supplied, but the sign-in response did not include a password method.";
856
+ this.logger.error(message, correlationId);
857
+ throw new CustomAuthError(
858
+ UNSUPPORTED_FLOW_TRANSITION,
859
+ message,
860
+ correlationId
861
+ );
862
+ }
863
+
864
+ const selectedMethod = emailMethod ?? passwordMethod;
865
+ if (selectedMethod) {
866
+ return selectedMethod;
867
+ }
868
+
869
+ const message =
870
+ "The sign-in start response did not include a supported email or password method.";
871
+ this.logger.error(message, correlationId);
872
+ throw new CustomAuthError(
873
+ UNSUPPORTED_FLOW_TRANSITION,
874
+ message,
875
+ correlationId
876
+ );
877
+ }
878
+
879
+ private toSignUpActionResult(
880
+ result: SignUpSubmitAttributesApiResultV2,
881
+ continuationState: FlowContinuationStateV2,
882
+ correlationId: string
883
+ ): FlowSignUpActionResultV2 {
884
+ const nextAction: string = result.nextAction;
885
+
886
+ if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
887
+ return createFlowCodeRequiredResultV2({
888
+ correlationId,
889
+ continuationState: {
890
+ continuationToken: result.continuationToken,
891
+ scenario: continuationState.scenario,
892
+ links: {
893
+ verify: result.verifyHref,
894
+ resend: result.resendHref,
895
+ },
896
+ tokenRequest: continuationState.tokenRequest,
897
+ signUp: continuationState.signUp,
898
+ },
899
+ channel: result.type,
900
+ sentTo: result.hint,
901
+ codeLength: result.codeLength,
902
+ });
903
+ }
904
+
905
+ if (
906
+ result.nextAction ===
907
+ SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES
908
+ ) {
909
+ const requiredPasswordAttribute = result.attributes.find(
910
+ (attribute) =>
911
+ attribute.attributeId.toLowerCase() === "password" &&
912
+ attribute.required === true
913
+ );
914
+ const nextContinuationState: FlowContinuationStateV2 = {
915
+ continuationToken: result.continuationToken,
916
+ scenario: continuationState.scenario,
917
+ links: {
918
+ submitAttributes: result.submitAttributesHref,
919
+ },
920
+ tokenRequest: continuationState.tokenRequest,
921
+ signUp: continuationState.signUp,
922
+ };
923
+ const attributes = result.attributes.filter(
924
+ (attribute) =>
925
+ attribute.attributeId.toLowerCase() !== "password"
926
+ );
927
+
928
+ if (
929
+ requiredPasswordAttribute &&
930
+ continuationState.signUp?.passwordWasSupplied !== true
931
+ ) {
932
+ return createFlowSignUpPasswordRequiredResultV2({
933
+ correlationId,
934
+ continuationState: nextContinuationState,
935
+ attributes,
936
+ requiredPasswordAttribute,
937
+ });
938
+ }
939
+
940
+ return createFlowAttributesRequiredResultV2({
941
+ correlationId,
942
+ continuationState: nextContinuationState,
943
+ attributes,
944
+ });
945
+ }
946
+
947
+ if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
948
+ return createFlowSignInContinuationRequiredResultV2({
949
+ correlationId,
950
+ continuationState: {
951
+ continuationToken: result.continuationToken,
952
+ scenario: continuationState.scenario,
953
+ links: {},
954
+ tokenRequest: continuationState.tokenRequest,
955
+ },
956
+ });
957
+ }
958
+
959
+ const message = `Sign-up attribute submission next action '${nextAction}' is not supported.`;
960
+ this.logger.error(message, correlationId);
961
+ throw new CustomAuthError(
962
+ UNSUPPORTED_FLOW_TRANSITION,
963
+ message,
964
+ correlationId
965
+ );
966
+ }
967
+
968
+ private ensureAuthenticationFactor(
969
+ authenticationFactor: AuthenticationFactorV2,
970
+ expectedFactor: AuthenticationFactorV2,
971
+ transition: string,
972
+ correlationId: string
973
+ ): void {
974
+ if (authenticationFactor === expectedFactor) {
975
+ return;
976
+ }
977
+
978
+ const message = `Authentication factor '${authenticationFactor}' is not supported for ${transition}.`;
979
+ this.logger.error(message, correlationId);
980
+ throw new CustomAuthError(
981
+ UNSUPPORTED_FLOW_TRANSITION,
982
+ message,
983
+ correlationId
984
+ );
985
+ }
986
+
987
+ private async verifySignInPassword(
988
+ parameters: FlowSubmitSignInPasswordParamsV2
989
+ ): Promise<VerifyResultV2> {
990
+ const { continuationState, correlationId } = parameters;
991
+ const context = this.createRequestContext(
992
+ this.resolveStepApiId(
993
+ continuationState.scenario,
994
+ "submitPassword",
995
+ correlationId
996
+ ),
997
+ correlationId
998
+ );
999
+
1000
+ this.logger.verbose("Submitting V2 sign-in password.", correlationId);
1001
+
1002
+ return this.apiClient.verifyChallenge(
1003
+ this.requireLink(correlationId, continuationState.links.verify),
1004
+ {
1005
+ continuationToken: continuationState.continuationToken,
1006
+ password: parameters.password,
1007
+ },
1008
+ context
1009
+ );
1010
+ }
1011
+
1012
+ private completeSignInAfterVerification(
1013
+ continuationState: FlowContinuationStateV2,
1014
+ continuationToken: string,
1015
+ correlationId: string
1016
+ ): Promise<FlowCompletedResultV2> {
1017
+ return this.signInWithContinuation({
1018
+ correlationId,
1019
+ continuationState: {
1020
+ continuationToken,
1021
+ scenario: continuationState.scenario,
1022
+ links: {},
1023
+ tokenRequest: continuationState.tokenRequest,
1024
+ },
1025
+ scopes: continuationState.tokenRequest?.scopes,
1026
+ });
1027
+ }
1028
+
1029
+ private async sendMethodChallenge(
1030
+ parameters: FlowChallengeParamsV2,
1031
+ step: "requestChallenge" | "resendCode"
1032
+ ): Promise<ChallengeVerificationResultV2> {
1033
+ const continuationState = parameters.continuationState;
1034
+ const correlationId = parameters.correlationId;
1035
+ const challengeHref =
1036
+ step === "resendCode"
1037
+ ? continuationState.links.resend
1038
+ : continuationState.links.challenge;
1039
+ const context = this.createRequestContext(
1040
+ this.resolveStepApiId(
1041
+ continuationState.scenario,
1042
+ step,
1043
+ correlationId
1044
+ ),
1045
+ correlationId
1046
+ );
1047
+
1048
+ this.logger.verbose(
1049
+ step === "resendCode"
1050
+ ? "Resending V2 one-time code."
1051
+ : "Requesting V2 challenge.",
1052
+ correlationId
1053
+ );
1054
+
1055
+ const challengeResult = await this.apiClient.requestChallenge(
1056
+ this.requireLink(correlationId, challengeHref),
1057
+ { continuationToken: continuationState.continuationToken },
1058
+ context
1059
+ );
1060
+ const nextAction: string = challengeResult.nextAction;
1061
+
1062
+ if (challengeResult.nextAction === ChallengeNextActionV2.VERIFY) {
1063
+ return challengeResult;
1064
+ }
1065
+
1066
+ if (challengeResult.nextAction === ChallengeNextActionV2.RISK_VERIFY) {
1067
+ return this.apiClient.verifyRisk(
1068
+ challengeResult.riskVerifyHref,
1069
+ { continuationToken: challengeResult.continuationToken },
1070
+ context
1071
+ );
1072
+ }
1073
+
1074
+ const message = `Challenge next action '${nextAction}' is not supported.`;
1075
+ this.logger.error(message, correlationId);
1076
+ throw new CustomAuthError(
1077
+ UNSUPPORTED_FLOW_TRANSITION,
1078
+ message,
1079
+ correlationId
1080
+ );
1081
+ }
1082
+
1083
+ private createChallengeContinuationState(
1084
+ continuationState: FlowContinuationStateV2,
1085
+ challengeResult: ChallengeVerificationResultV2
1086
+ ): FlowContinuationStateV2 {
1087
+ return {
1088
+ continuationToken: challengeResult.continuationToken,
1089
+ scenario: continuationState.scenario,
1090
+ links: {
1091
+ challenge: continuationState.links.challenge,
1092
+ verify: challengeResult.verifyHref,
1093
+ resend:
1094
+ challengeResult.resendHref ??
1095
+ continuationState.links.resend,
1096
+ },
1097
+ ...(continuationState.tokenRequest && {
1098
+ tokenRequest: continuationState.tokenRequest,
1099
+ }),
1100
+ ...(continuationState.signUp && {
1101
+ signUp: continuationState.signUp,
1102
+ }),
1103
+ };
1104
+ }
1105
+
1106
+ private resolveStepApiId(
1107
+ scenario: CustomAuthFlowScenarioV2,
1108
+ step: FlowStepV2,
1109
+ correlationId: string
1110
+ ): number {
1111
+ const apiId = getPublicApiIdV2(scenario, step);
1112
+
1113
+ if (apiId === undefined) {
1114
+ const message = `No telemetry API id is registered for step '${step}' of the '${scenario}' flow.`;
1115
+ this.logger.error(message, correlationId);
1116
+
1117
+ throw new CustomAuthError(
1118
+ UNSUPPORTED_FLOW_STEP,
1119
+ message,
1120
+ correlationId
1121
+ );
1122
+ }
1123
+
1124
+ return apiId;
1125
+ }
1126
+
1127
+ private requireLink(
1128
+ correlationId: string,
1129
+ href: string | undefined,
1130
+ missingLinkError?: { code: string; message: string }
1131
+ ): string {
1132
+ if (!href) {
1133
+ const errorCode =
1134
+ missingLinkError?.code ?? CONTINUATION_LINK_MISSING;
1135
+ const message =
1136
+ missingLinkError?.message ??
1137
+ "The continuation state is missing a link required to advance the flow.";
1138
+ this.logger.error(message, correlationId);
1139
+
1140
+ throw new CustomAuthError(errorCode, message, correlationId);
1141
+ }
1142
+
1143
+ return href;
1144
+ }
1145
+ }