@aws-amplify/auth 6.7.1-unstable.ab33a03.0 → 6.8.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 (398) hide show
  1. package/dist/cjs/client/apis/associateWebAuthnCredential.js +62 -0
  2. package/dist/cjs/client/apis/associateWebAuthnCredential.js.map +1 -0
  3. package/dist/cjs/client/apis/deleteWebAuthnCredential.js +22 -0
  4. package/dist/cjs/client/apis/deleteWebAuthnCredential.js.map +1 -0
  5. package/dist/cjs/client/apis/index.js +13 -0
  6. package/dist/cjs/client/apis/index.js.map +1 -0
  7. package/dist/cjs/client/apis/listWebAuthnCredentials.js +23 -0
  8. package/dist/cjs/client/apis/listWebAuthnCredentials.js.map +1 -0
  9. package/dist/cjs/client/flows/shared/handlePasswordSRP.js +79 -0
  10. package/dist/cjs/client/flows/shared/handlePasswordSRP.js.map +1 -0
  11. package/dist/cjs/client/flows/userAuth/handleSelectChallenge.js +46 -0
  12. package/dist/cjs/client/flows/userAuth/handleSelectChallenge.js.map +1 -0
  13. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPassword.js +59 -0
  14. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPassword.js.map +1 -0
  15. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.js +74 -0
  16. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.js.map +1 -0
  17. package/dist/cjs/client/flows/userAuth/handleUserAuthFlow.js +84 -0
  18. package/dist/cjs/client/flows/userAuth/handleUserAuthFlow.js.map +1 -0
  19. package/dist/cjs/client/flows/userAuth/handleWebAuthnSignInResult.js +88 -0
  20. package/dist/cjs/client/flows/userAuth/handleWebAuthnSignInResult.js.map +1 -0
  21. package/dist/cjs/client/utils/index.js +9 -0
  22. package/dist/cjs/client/utils/index.js.map +1 -0
  23. package/dist/cjs/client/utils/passkey/errors.js +180 -0
  24. package/dist/cjs/client/utils/passkey/errors.js.map +1 -0
  25. package/dist/cjs/client/utils/passkey/getIsPasskeySupported.js +20 -0
  26. package/dist/cjs/client/utils/passkey/getIsPasskeySupported.js.map +1 -0
  27. package/dist/cjs/client/utils/passkey/getIsPasskeySupported.native.js +12 -0
  28. package/dist/cjs/client/utils/passkey/getIsPasskeySupported.native.js.map +1 -0
  29. package/dist/cjs/client/utils/passkey/getPasskey.js +27 -0
  30. package/dist/cjs/client/utils/passkey/getPasskey.js.map +1 -0
  31. package/dist/cjs/client/utils/passkey/getPasskey.native.js +12 -0
  32. package/dist/cjs/client/utils/passkey/getPasskey.native.js.map +1 -0
  33. package/dist/cjs/client/utils/passkey/index.js +11 -0
  34. package/dist/cjs/client/utils/passkey/index.js.map +1 -0
  35. package/dist/cjs/client/utils/passkey/registerPasskey.js +32 -0
  36. package/dist/cjs/client/utils/passkey/registerPasskey.js.map +1 -0
  37. package/dist/cjs/client/utils/passkey/registerPasskey.native.js +12 -0
  38. package/dist/cjs/client/utils/passkey/registerPasskey.native.js.map +1 -0
  39. package/dist/cjs/client/utils/passkey/serde.js +106 -0
  40. package/dist/cjs/client/utils/passkey/serde.js.map +1 -0
  41. package/dist/cjs/client/utils/passkey/types/index.js +25 -0
  42. package/dist/cjs/client/utils/passkey/types/index.js.map +1 -0
  43. package/dist/cjs/client/utils/passkey/types/shared.js +18 -0
  44. package/dist/cjs/client/utils/passkey/types/shared.js.map +1 -0
  45. package/dist/cjs/client/utils/store/autoSignInStore.js +45 -0
  46. package/dist/cjs/client/utils/store/autoSignInStore.js.map +1 -0
  47. package/dist/cjs/client/utils/store/index.js +9 -0
  48. package/dist/cjs/client/utils/store/index.js.map +1 -0
  49. package/dist/cjs/client/utils/store/signInStore.js.map +1 -0
  50. package/dist/cjs/client/utils/store/types.js +6 -0
  51. package/dist/cjs/client/utils/store/types.js.map +1 -0
  52. package/dist/cjs/foundation/apis/deleteWebAuthnCredential.js +33 -0
  53. package/dist/cjs/foundation/apis/deleteWebAuthnCredential.js.map +1 -0
  54. package/dist/cjs/foundation/apis/index.js +11 -0
  55. package/dist/cjs/foundation/apis/index.js.map +1 -0
  56. package/dist/cjs/foundation/apis/listWebAuthnCredentials.js +46 -0
  57. package/dist/cjs/foundation/apis/listWebAuthnCredentials.js.map +1 -0
  58. package/dist/cjs/foundation/convert/base64url/convertArrayBufferToBase64Url.js +21 -0
  59. package/dist/cjs/foundation/convert/base64url/convertArrayBufferToBase64Url.js.map +1 -0
  60. package/dist/cjs/foundation/convert/base64url/convertBase64UrlToArrayBuffer.js +17 -0
  61. package/dist/cjs/foundation/convert/base64url/convertBase64UrlToArrayBuffer.js.map +1 -0
  62. package/dist/cjs/foundation/convert/base64url/index.js +11 -0
  63. package/dist/cjs/foundation/convert/base64url/index.js.map +1 -0
  64. package/dist/cjs/foundation/convert/index.js +10 -0
  65. package/dist/cjs/foundation/convert/index.js.map +1 -0
  66. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.js +16 -0
  67. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.js.map +1 -0
  68. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.js +16 -0
  69. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.js.map +1 -0
  70. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.js +16 -0
  71. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.js.map +1 -0
  72. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.js +33 -4
  73. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.js.map +1 -1
  74. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.js +16 -0
  75. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.js.map +1 -0
  76. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/index.js +9 -1
  77. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/index.js.map +1 -1
  78. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.js +44 -0
  79. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.js.map +1 -0
  80. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.js +3 -2
  81. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.js.map +1 -1
  82. package/dist/cjs/foundation/types/index.js +6 -0
  83. package/dist/cjs/foundation/types/index.js.map +1 -0
  84. package/dist/cjs/foundation/types/inputs.js +6 -0
  85. package/dist/cjs/foundation/types/inputs.js.map +1 -0
  86. package/dist/cjs/foundation/types/models.js +6 -0
  87. package/dist/cjs/foundation/types/models.js.map +1 -0
  88. package/dist/cjs/foundation/types/outputs.js +6 -0
  89. package/dist/cjs/foundation/types/outputs.js.map +1 -0
  90. package/dist/cjs/index.js +6 -1
  91. package/dist/cjs/index.js.map +1 -1
  92. package/dist/cjs/providers/cognito/apis/autoSignIn.js +6 -2
  93. package/dist/cjs/providers/cognito/apis/autoSignIn.js.map +1 -1
  94. package/dist/cjs/providers/cognito/apis/confirmSignIn.js +4 -4
  95. package/dist/cjs/providers/cognito/apis/confirmSignIn.js.map +1 -1
  96. package/dist/cjs/providers/cognito/apis/confirmSignUp.js +8 -5
  97. package/dist/cjs/providers/cognito/apis/confirmSignUp.js.map +1 -1
  98. package/dist/cjs/providers/cognito/apis/signIn.js +9 -0
  99. package/dist/cjs/providers/cognito/apis/signIn.js.map +1 -1
  100. package/dist/cjs/providers/cognito/apis/signInWithCustomAuth.js +4 -4
  101. package/dist/cjs/providers/cognito/apis/signInWithCustomAuth.js.map +1 -1
  102. package/dist/cjs/providers/cognito/apis/signInWithCustomSRPAuth.js +4 -4
  103. package/dist/cjs/providers/cognito/apis/signInWithCustomSRPAuth.js.map +1 -1
  104. package/dist/cjs/providers/cognito/apis/signInWithSRP.js +7 -4
  105. package/dist/cjs/providers/cognito/apis/signInWithSRP.js.map +1 -1
  106. package/dist/cjs/providers/cognito/apis/signInWithUserAuth.js +102 -0
  107. package/dist/cjs/providers/cognito/apis/signInWithUserAuth.js.map +1 -0
  108. package/dist/cjs/providers/cognito/apis/signInWithUserPassword.js +7 -4
  109. package/dist/cjs/providers/cognito/apis/signInWithUserPassword.js.map +1 -1
  110. package/dist/cjs/providers/cognito/apis/signUp.js +56 -49
  111. package/dist/cjs/providers/cognito/apis/signUp.js.map +1 -1
  112. package/dist/cjs/providers/cognito/utils/signInHelpers.js +60 -42
  113. package/dist/cjs/providers/cognito/utils/signInHelpers.js.map +1 -1
  114. package/dist/cjs/providers/cognito/utils/signUpHelpers.js +5 -31
  115. package/dist/cjs/providers/cognito/utils/signUpHelpers.js.map +1 -1
  116. package/dist/esm/client/apis/associateWebAuthnCredential.d.ts +14 -0
  117. package/dist/esm/client/apis/associateWebAuthnCredential.mjs +69 -0
  118. package/dist/esm/client/apis/associateWebAuthnCredential.mjs.map +1 -0
  119. package/dist/esm/client/apis/deleteWebAuthnCredential.d.ts +11 -0
  120. package/dist/esm/client/apis/deleteWebAuthnCredential.mjs +29 -0
  121. package/dist/esm/client/apis/deleteWebAuthnCredential.mjs.map +1 -0
  122. package/dist/esm/client/apis/index.d.ts +3 -0
  123. package/dist/esm/client/apis/index.mjs +4 -0
  124. package/dist/esm/client/apis/index.mjs.map +1 -0
  125. package/dist/esm/client/apis/listWebAuthnCredentials.d.ts +12 -0
  126. package/dist/esm/client/apis/listWebAuthnCredentials.mjs +30 -0
  127. package/dist/esm/client/apis/listWebAuthnCredentials.mjs.map +1 -0
  128. package/dist/esm/client/flows/shared/handlePasswordSRP.d.ts +31 -0
  129. package/dist/esm/client/flows/shared/handlePasswordSRP.mjs +86 -0
  130. package/dist/esm/client/flows/shared/handlePasswordSRP.mjs.map +1 -0
  131. package/dist/esm/client/flows/userAuth/handleSelectChallenge.d.ts +23 -0
  132. package/dist/esm/client/flows/userAuth/handleSelectChallenge.mjs +51 -0
  133. package/dist/esm/client/flows/userAuth/handleSelectChallenge.mjs.map +1 -0
  134. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.d.ts +16 -0
  135. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.mjs +64 -0
  136. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.mjs.map +1 -0
  137. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.d.ts +18 -0
  138. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.mjs +81 -0
  139. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.mjs.map +1 -0
  140. package/dist/esm/client/flows/userAuth/handleUserAuthFlow.d.ts +27 -0
  141. package/dist/esm/client/flows/userAuth/handleUserAuthFlow.mjs +88 -0
  142. package/dist/esm/client/flows/userAuth/handleUserAuthFlow.mjs.map +1 -0
  143. package/dist/esm/client/flows/userAuth/handleWebAuthnSignInResult.d.ts +3 -0
  144. package/dist/esm/client/flows/userAuth/handleWebAuthnSignInResult.mjs +93 -0
  145. package/dist/esm/client/flows/userAuth/handleWebAuthnSignInResult.mjs.map +1 -0
  146. package/dist/esm/client/utils/index.d.ts +1 -0
  147. package/dist/esm/client/utils/index.mjs +4 -0
  148. package/dist/esm/client/utils/index.mjs.map +1 -0
  149. package/dist/esm/client/utils/passkey/errors.d.ts +33 -0
  150. package/dist/esm/client/utils/passkey/errors.mjs +176 -0
  151. package/dist/esm/client/utils/passkey/errors.mjs.map +1 -0
  152. package/dist/esm/client/utils/passkey/getIsPasskeySupported.d.ts +6 -0
  153. package/dist/esm/client/utils/passkey/getIsPasskeySupported.mjs +18 -0
  154. package/dist/esm/client/utils/passkey/getIsPasskeySupported.mjs.map +1 -0
  155. package/dist/esm/client/utils/passkey/getIsPasskeySupported.native.d.ts +1 -0
  156. package/dist/esm/client/utils/passkey/getIsPasskeySupported.native.mjs +10 -0
  157. package/dist/esm/client/utils/passkey/getIsPasskeySupported.native.mjs.map +1 -0
  158. package/dist/esm/client/utils/passkey/getPasskey.d.ts +2 -0
  159. package/dist/esm/client/utils/passkey/getPasskey.mjs +25 -0
  160. package/dist/esm/client/utils/passkey/getPasskey.mjs.map +1 -0
  161. package/dist/esm/client/utils/passkey/getPasskey.native.d.ts +1 -0
  162. package/dist/esm/client/utils/passkey/getPasskey.native.mjs +10 -0
  163. package/dist/esm/client/utils/passkey/getPasskey.native.mjs.map +1 -0
  164. package/dist/esm/client/utils/passkey/index.d.ts +2 -0
  165. package/dist/esm/client/utils/passkey/index.mjs +3 -0
  166. package/dist/esm/client/utils/passkey/index.mjs.map +1 -0
  167. package/dist/esm/client/utils/passkey/registerPasskey.d.ts +7 -0
  168. package/dist/esm/client/utils/passkey/registerPasskey.mjs +30 -0
  169. package/dist/esm/client/utils/passkey/registerPasskey.mjs.map +1 -0
  170. package/dist/esm/client/utils/passkey/registerPasskey.native.d.ts +1 -0
  171. package/dist/esm/client/utils/passkey/registerPasskey.native.mjs +10 -0
  172. package/dist/esm/client/utils/passkey/registerPasskey.native.mjs.map +1 -0
  173. package/dist/esm/client/utils/passkey/serde.d.ts +25 -0
  174. package/dist/esm/client/utils/passkey/serde.mjs +102 -0
  175. package/dist/esm/client/utils/passkey/serde.mjs.map +1 -0
  176. package/dist/esm/client/utils/passkey/types/index.d.ts +16 -0
  177. package/dist/esm/client/utils/passkey/types/index.mjs +18 -0
  178. package/dist/esm/client/utils/passkey/types/index.mjs.map +1 -0
  179. package/dist/esm/client/utils/passkey/types/shared.d.ts +106 -0
  180. package/dist/esm/client/utils/passkey/types/shared.mjs +16 -0
  181. package/dist/esm/client/utils/passkey/types/shared.mjs.map +1 -0
  182. package/dist/esm/client/utils/store/autoSignInStore.d.ts +21 -0
  183. package/dist/esm/client/utils/store/autoSignInStore.mjs +43 -0
  184. package/dist/esm/client/utils/store/autoSignInStore.mjs.map +1 -0
  185. package/dist/esm/client/utils/store/index.d.ts +2 -0
  186. package/dist/esm/client/utils/store/index.mjs +3 -0
  187. package/dist/esm/client/utils/store/index.mjs.map +1 -0
  188. package/dist/esm/{providers/cognito/utils → client/utils/store}/signInStore.d.ts +1 -1
  189. package/dist/esm/client/utils/store/signInStore.mjs.map +1 -0
  190. package/dist/esm/client/utils/store/types.d.ts +5 -0
  191. package/dist/esm/client/utils/store/types.mjs +2 -0
  192. package/dist/esm/client/utils/store/types.mjs.map +1 -0
  193. package/dist/esm/foundation/apis/deleteWebAuthnCredential.d.ts +3 -0
  194. package/dist/esm/foundation/apis/deleteWebAuthnCredential.mjs +38 -0
  195. package/dist/esm/foundation/apis/deleteWebAuthnCredential.mjs.map +1 -0
  196. package/dist/esm/foundation/apis/index.d.ts +2 -0
  197. package/dist/esm/foundation/apis/index.mjs +3 -0
  198. package/dist/esm/foundation/apis/index.mjs.map +1 -0
  199. package/dist/esm/foundation/apis/listWebAuthnCredentials.d.ts +3 -0
  200. package/dist/esm/foundation/apis/listWebAuthnCredentials.mjs +51 -0
  201. package/dist/esm/foundation/apis/listWebAuthnCredentials.mjs.map +1 -0
  202. package/dist/esm/foundation/convert/base64url/convertArrayBufferToBase64Url.d.ts +6 -0
  203. package/dist/esm/foundation/convert/base64url/convertArrayBufferToBase64Url.mjs +19 -0
  204. package/dist/esm/foundation/convert/base64url/convertArrayBufferToBase64Url.mjs.map +1 -0
  205. package/dist/esm/foundation/convert/base64url/convertBase64UrlToArrayBuffer.d.ts +6 -0
  206. package/dist/esm/foundation/convert/base64url/convertBase64UrlToArrayBuffer.mjs +15 -0
  207. package/dist/esm/foundation/convert/base64url/convertBase64UrlToArrayBuffer.mjs.map +1 -0
  208. package/dist/esm/foundation/convert/base64url/index.d.ts +2 -0
  209. package/dist/esm/foundation/convert/base64url/index.mjs +3 -0
  210. package/dist/esm/foundation/convert/base64url/index.mjs.map +1 -0
  211. package/dist/esm/foundation/convert/index.d.ts +1 -0
  212. package/dist/esm/foundation/convert/index.mjs +3 -0
  213. package/dist/esm/foundation/convert/index.mjs.map +1 -0
  214. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.d.ts +13 -0
  215. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.mjs +17 -0
  216. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.mjs.map +1 -0
  217. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.d.ts +13 -0
  218. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.mjs +17 -0
  219. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.mjs.map +1 -0
  220. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.d.ts +13 -0
  221. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.mjs +17 -0
  222. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.mjs.map +1 -0
  223. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.d.ts +3 -1
  224. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.mjs +32 -7
  225. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.mjs.map +1 -1
  226. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.d.ts +13 -0
  227. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.mjs +17 -0
  228. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.mjs.map +1 -0
  229. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/index.d.ts +4 -0
  230. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/index.mjs +4 -0
  231. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/index.mjs.map +1 -1
  232. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createUserPoolSerializer.d.ts +1 -1
  233. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.d.ts +37 -0
  234. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.mjs +46 -0
  235. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.mjs.map +1 -0
  236. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.d.ts +1 -0
  237. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.mjs +1 -1
  238. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/sdk.d.ts +109 -5
  239. package/dist/esm/foundation/types/index.d.ts +3 -0
  240. package/dist/esm/foundation/types/index.mjs +2 -0
  241. package/dist/esm/foundation/types/index.mjs.map +1 -0
  242. package/dist/esm/foundation/types/inputs.d.ts +10 -0
  243. package/dist/esm/foundation/types/inputs.mjs +2 -0
  244. package/dist/esm/foundation/types/inputs.mjs.map +1 -0
  245. package/dist/esm/foundation/types/models.d.ts +11 -0
  246. package/dist/esm/foundation/types/models.mjs +2 -0
  247. package/dist/esm/foundation/types/models.mjs.map +1 -0
  248. package/dist/esm/foundation/types/outputs.d.ts +8 -0
  249. package/dist/esm/foundation/types/outputs.mjs +2 -0
  250. package/dist/esm/foundation/types/outputs.mjs.map +1 -0
  251. package/dist/esm/index.d.ts +3 -0
  252. package/dist/esm/index.mjs +3 -0
  253. package/dist/esm/index.mjs.map +1 -1
  254. package/dist/esm/providers/cognito/apis/autoSignIn.d.ts +1 -1
  255. package/dist/esm/providers/cognito/apis/autoSignIn.mjs +7 -2
  256. package/dist/esm/providers/cognito/apis/autoSignIn.mjs.map +1 -1
  257. package/dist/esm/providers/cognito/apis/confirmResetPassword.mjs +2 -0
  258. package/dist/esm/providers/cognito/apis/confirmResetPassword.mjs.map +1 -1
  259. package/dist/esm/providers/cognito/apis/confirmSignIn.mjs +2 -1
  260. package/dist/esm/providers/cognito/apis/confirmSignIn.mjs.map +1 -1
  261. package/dist/esm/providers/cognito/apis/confirmSignUp.mjs +11 -5
  262. package/dist/esm/providers/cognito/apis/confirmSignUp.mjs.map +1 -1
  263. package/dist/esm/providers/cognito/apis/confirmUserAttribute.mjs +2 -0
  264. package/dist/esm/providers/cognito/apis/confirmUserAttribute.mjs.map +1 -1
  265. package/dist/esm/providers/cognito/apis/deleteUser.mjs +3 -0
  266. package/dist/esm/providers/cognito/apis/deleteUser.mjs.map +1 -1
  267. package/dist/esm/providers/cognito/apis/deleteUserAttributes.mjs +3 -0
  268. package/dist/esm/providers/cognito/apis/deleteUserAttributes.mjs.map +1 -1
  269. package/dist/esm/providers/cognito/apis/fetchDevices.mjs +3 -0
  270. package/dist/esm/providers/cognito/apis/fetchDevices.mjs.map +1 -1
  271. package/dist/esm/providers/cognito/apis/fetchMFAPreference.mjs +3 -0
  272. package/dist/esm/providers/cognito/apis/fetchMFAPreference.mjs.map +1 -1
  273. package/dist/esm/providers/cognito/apis/forgetDevice.mjs +3 -0
  274. package/dist/esm/providers/cognito/apis/forgetDevice.mjs.map +1 -1
  275. package/dist/esm/providers/cognito/apis/internal/fetchUserAttributes.mjs +3 -0
  276. package/dist/esm/providers/cognito/apis/internal/fetchUserAttributes.mjs.map +1 -1
  277. package/dist/esm/providers/cognito/apis/rememberDevice.mjs +3 -0
  278. package/dist/esm/providers/cognito/apis/rememberDevice.mjs.map +1 -1
  279. package/dist/esm/providers/cognito/apis/resendSignUpCode.mjs +2 -0
  280. package/dist/esm/providers/cognito/apis/resendSignUpCode.mjs.map +1 -1
  281. package/dist/esm/providers/cognito/apis/resetPassword.mjs +2 -0
  282. package/dist/esm/providers/cognito/apis/resetPassword.mjs.map +1 -1
  283. package/dist/esm/providers/cognito/apis/sendUserAttributeVerificationCode.mjs +3 -0
  284. package/dist/esm/providers/cognito/apis/sendUserAttributeVerificationCode.mjs.map +1 -1
  285. package/dist/esm/providers/cognito/apis/setUpTOTP.mjs +2 -0
  286. package/dist/esm/providers/cognito/apis/setUpTOTP.mjs.map +1 -1
  287. package/dist/esm/providers/cognito/apis/signIn.mjs +9 -0
  288. package/dist/esm/providers/cognito/apis/signIn.mjs.map +1 -1
  289. package/dist/esm/providers/cognito/apis/signInWithCustomAuth.mjs +2 -1
  290. package/dist/esm/providers/cognito/apis/signInWithCustomAuth.mjs.map +1 -1
  291. package/dist/esm/providers/cognito/apis/signInWithCustomSRPAuth.mjs +2 -1
  292. package/dist/esm/providers/cognito/apis/signInWithCustomSRPAuth.mjs.map +1 -1
  293. package/dist/esm/providers/cognito/apis/signInWithSRP.mjs +5 -1
  294. package/dist/esm/providers/cognito/apis/signInWithSRP.mjs.map +1 -1
  295. package/dist/esm/providers/cognito/apis/signInWithUserAuth.d.ts +13 -0
  296. package/dist/esm/providers/cognito/apis/signInWithUserAuth.mjs +104 -0
  297. package/dist/esm/providers/cognito/apis/signInWithUserAuth.mjs.map +1 -0
  298. package/dist/esm/providers/cognito/apis/signInWithUserPassword.mjs +6 -2
  299. package/dist/esm/providers/cognito/apis/signInWithUserPassword.mjs.map +1 -1
  300. package/dist/esm/providers/cognito/apis/signOut.mjs +2 -0
  301. package/dist/esm/providers/cognito/apis/signOut.mjs.map +1 -1
  302. package/dist/esm/providers/cognito/apis/signUp.mjs +58 -50
  303. package/dist/esm/providers/cognito/apis/signUp.mjs.map +1 -1
  304. package/dist/esm/providers/cognito/apis/updateMFAPreference.mjs +3 -0
  305. package/dist/esm/providers/cognito/apis/updateMFAPreference.mjs.map +1 -1
  306. package/dist/esm/providers/cognito/apis/updatePassword.mjs +2 -0
  307. package/dist/esm/providers/cognito/apis/updatePassword.mjs.map +1 -1
  308. package/dist/esm/providers/cognito/apis/updateUserAttributes.mjs +3 -0
  309. package/dist/esm/providers/cognito/apis/updateUserAttributes.mjs.map +1 -1
  310. package/dist/esm/providers/cognito/apis/verifyTOTPSetup.mjs +2 -0
  311. package/dist/esm/providers/cognito/apis/verifyTOTPSetup.mjs.map +1 -1
  312. package/dist/esm/providers/cognito/types/index.d.ts +2 -2
  313. package/dist/esm/providers/cognito/types/inputs.d.ts +4 -0
  314. package/dist/esm/providers/cognito/types/models.d.ts +7 -1
  315. package/dist/esm/providers/cognito/types/options.d.ts +2 -1
  316. package/dist/esm/providers/cognito/types/outputs.d.ts +4 -0
  317. package/dist/esm/providers/cognito/utils/refreshAuthTokens.mjs +3 -0
  318. package/dist/esm/providers/cognito/utils/refreshAuthTokens.mjs.map +1 -1
  319. package/dist/esm/providers/cognito/utils/signInHelpers.d.ts +2 -1
  320. package/dist/esm/providers/cognito/utils/signInHelpers.mjs +56 -37
  321. package/dist/esm/providers/cognito/utils/signInHelpers.mjs.map +1 -1
  322. package/dist/esm/providers/cognito/utils/signUpHelpers.d.ts +0 -6
  323. package/dist/esm/providers/cognito/utils/signUpHelpers.mjs +5 -26
  324. package/dist/esm/providers/cognito/utils/signUpHelpers.mjs.map +1 -1
  325. package/dist/esm/types/inputs.d.ts +2 -2
  326. package/dist/esm/types/models.d.ts +9 -1
  327. package/package.json +104 -104
  328. package/src/client/apis/associateWebAuthnCredential.ts +94 -0
  329. package/src/client/apis/deleteWebAuthnCredential.ts +24 -0
  330. package/src/client/apis/index.ts +6 -0
  331. package/src/client/apis/listWebAuthnCredentials.ts +28 -0
  332. package/src/client/flows/shared/handlePasswordSRP.ts +123 -0
  333. package/src/client/flows/userAuth/handleSelectChallenge.ts +62 -0
  334. package/src/client/flows/userAuth/handleSelectChallengeWithPassword.ts +74 -0
  335. package/src/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.ts +105 -0
  336. package/src/client/flows/userAuth/handleUserAuthFlow.ts +125 -0
  337. package/src/client/flows/userAuth/handleWebAuthnSignInResult.ts +130 -0
  338. package/src/client/utils/index.ts +4 -0
  339. package/src/client/utils/passkey/errors.ts +214 -0
  340. package/src/client/utils/passkey/getIsPasskeySupported.native.ts +8 -0
  341. package/src/client/utils/passkey/getIsPasskeySupported.ts +18 -0
  342. package/src/client/utils/passkey/getPasskey.native.ts +8 -0
  343. package/src/client/utils/passkey/getPasskey.ts +40 -0
  344. package/src/client/utils/passkey/index.ts +5 -0
  345. package/src/client/utils/passkey/registerPasskey.native.ts +8 -0
  346. package/src/client/utils/passkey/registerPasskey.ts +48 -0
  347. package/src/client/utils/passkey/serde.ts +151 -0
  348. package/src/client/utils/passkey/types/index.ts +61 -0
  349. package/src/client/utils/passkey/types/shared.ts +131 -0
  350. package/src/client/utils/store/autoSignInStore.ts +64 -0
  351. package/src/client/utils/store/index.ts +5 -0
  352. package/src/{providers/cognito/utils → client/utils/store}/signInStore.ts +3 -8
  353. package/src/client/utils/store/types.ts +9 -0
  354. package/src/foundation/apis/deleteWebAuthnCredential.ts +45 -0
  355. package/src/foundation/apis/index.ts +5 -0
  356. package/src/foundation/apis/listWebAuthnCredentials.ts +68 -0
  357. package/src/foundation/convert/base64url/convertArrayBufferToBase64Url.ts +18 -0
  358. package/src/foundation/convert/base64url/convertBase64UrlToArrayBuffer.ts +18 -0
  359. package/src/foundation/convert/base64url/index.ts +5 -0
  360. package/src/foundation/convert/index.ts +7 -0
  361. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.ts +31 -0
  362. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.ts +31 -0
  363. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.ts +31 -0
  364. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.ts +44 -7
  365. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.ts +31 -0
  366. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/index.ts +4 -0
  367. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createUserPoolSerializer.ts +5 -1
  368. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.ts +43 -0
  369. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.ts +2 -0
  370. package/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/sdk.ts +141 -5
  371. package/src/foundation/types/index.ts +9 -0
  372. package/src/foundation/types/inputs.ts +14 -0
  373. package/src/foundation/types/models.ts +14 -0
  374. package/src/foundation/types/outputs.ts +12 -0
  375. package/src/index.ts +14 -0
  376. package/src/providers/cognito/apis/autoSignIn.ts +6 -2
  377. package/src/providers/cognito/apis/confirmSignIn.ts +1 -1
  378. package/src/providers/cognito/apis/confirmSignUp.ts +10 -9
  379. package/src/providers/cognito/apis/signIn.ts +10 -0
  380. package/src/providers/cognito/apis/signInWithCustomAuth.ts +1 -1
  381. package/src/providers/cognito/apis/signInWithCustomSRPAuth.ts +1 -1
  382. package/src/providers/cognito/apis/signInWithSRP.ts +6 -1
  383. package/src/providers/cognito/apis/signInWithUserAuth.ts +141 -0
  384. package/src/providers/cognito/apis/signInWithUserPassword.ts +7 -2
  385. package/src/providers/cognito/apis/signUp.ts +81 -72
  386. package/src/providers/cognito/types/index.ts +2 -0
  387. package/src/providers/cognito/types/inputs.ts +5 -0
  388. package/src/providers/cognito/types/models.ts +13 -0
  389. package/src/providers/cognito/types/options.ts +7 -1
  390. package/src/providers/cognito/types/outputs.ts +5 -0
  391. package/src/providers/cognito/utils/signInHelpers.ts +77 -55
  392. package/src/providers/cognito/utils/signUpHelpers.ts +6 -31
  393. package/src/types/inputs.ts +2 -2
  394. package/src/types/models.ts +13 -0
  395. package/dist/cjs/providers/cognito/utils/signInStore.js.map +0 -1
  396. package/dist/esm/providers/cognito/utils/signInStore.mjs.map +0 -1
  397. /package/dist/cjs/{providers/cognito/utils → client/utils/store}/signInStore.js +0 -0
  398. /package/dist/esm/{providers/cognito/utils → client/utils/store}/signInStore.mjs +0 -0
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.associateWebAuthnCredential = void 0;
7
+ const core_1 = require("@aws-amplify/core");
8
+ const utils_1 = require("@aws-amplify/core/internals/utils");
9
+ const types_1 = require("../../providers/cognito/utils/types");
10
+ const factories_1 = require("../../providers/cognito/factories");
11
+ const parsers_1 = require("../../foundation/parsers");
12
+ const utils_2 = require("../../utils");
13
+ const utils_3 = require("../utils");
14
+ const cognitoIdentityProvider_1 = require("../../foundation/factories/serviceClients/cognitoIdentityProvider");
15
+ const types_2 = require("../utils/passkey/types");
16
+ /**
17
+ * Registers a new passkey for an authenticated user
18
+ *
19
+ * @returns Promise<void>
20
+ * @throws - {@link PasskeyError}:
21
+ * - Thrown when intermediate state is invalid
22
+ * @throws - {@link AuthError}:
23
+ * - Thrown when user is unauthenticated
24
+ * @throws - {@link StartWebAuthnRegistrationException}
25
+ * - Thrown due to a service error retrieving WebAuthn registration options
26
+ * @throws - {@link CompleteWebAuthnRegistrationException}
27
+ * - Thrown due to a service error when verifying WebAuthn registration result
28
+ */
29
+ async function associateWebAuthnCredential() {
30
+ const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;
31
+ (0, utils_1.assertTokenProviderConfig)(authConfig);
32
+ const { userPoolEndpoint, userPoolId } = authConfig;
33
+ const { tokens } = await (0, core_1.fetchAuthSession)();
34
+ (0, types_1.assertAuthTokens)(tokens);
35
+ const startWebAuthnRegistration = (0, cognitoIdentityProvider_1.createStartWebAuthnRegistrationClient)({
36
+ endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({
37
+ endpointOverride: userPoolEndpoint,
38
+ }),
39
+ });
40
+ const { CredentialCreationOptions: credentialCreationOptions } = await startWebAuthnRegistration({
41
+ region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),
42
+ userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.StartWebAuthnRegistration),
43
+ }, {
44
+ AccessToken: tokens.accessToken.toString(),
45
+ });
46
+ (0, types_2.assertValidCredentialCreationOptions)(credentialCreationOptions);
47
+ const cred = await (0, utils_3.registerPasskey)(credentialCreationOptions);
48
+ const completeWebAuthnRegistration = (0, cognitoIdentityProvider_1.createCompleteWebAuthnRegistrationClient)({
49
+ endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({
50
+ endpointOverride: userPoolEndpoint,
51
+ }),
52
+ });
53
+ await completeWebAuthnRegistration({
54
+ region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),
55
+ userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.CompleteWebAuthnRegistration),
56
+ }, {
57
+ AccessToken: tokens.accessToken.toString(),
58
+ Credential: cred,
59
+ });
60
+ }
61
+ exports.associateWebAuthnCredential = associateWebAuthnCredential;
62
+ //# sourceMappingURL=associateWebAuthnCredential.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"associateWebAuthnCredential.js","sources":["../../../../src/client/apis/associateWebAuthnCredential.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.associateWebAuthnCredential = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst types_1 = require(\"../../providers/cognito/utils/types\");\nconst factories_1 = require(\"../../providers/cognito/factories\");\nconst parsers_1 = require(\"../../foundation/parsers\");\nconst utils_2 = require(\"../../utils\");\nconst utils_3 = require(\"../utils\");\nconst cognitoIdentityProvider_1 = require(\"../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst types_2 = require(\"../utils/passkey/types\");\n/**\n * Registers a new passkey for an authenticated user\n *\n * @returns Promise<void>\n * @throws - {@link PasskeyError}:\n * - Thrown when intermediate state is invalid\n * @throws - {@link AuthError}:\n * - Thrown when user is unauthenticated\n * @throws - {@link StartWebAuthnRegistrationException}\n * - Thrown due to a service error retrieving WebAuthn registration options\n * @throws - {@link CompleteWebAuthnRegistrationException}\n * - Thrown due to a service error when verifying WebAuthn registration result\n */\nasync function associateWebAuthnCredential() {\n const authConfig = core_1.Amplify.getConfig().Auth?.Cognito;\n (0, utils_1.assertTokenProviderConfig)(authConfig);\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { tokens } = await (0, core_1.fetchAuthSession)();\n (0, types_1.assertAuthTokens)(tokens);\n const startWebAuthnRegistration = (0, cognitoIdentityProvider_1.createStartWebAuthnRegistrationClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const { CredentialCreationOptions: credentialCreationOptions } = await startWebAuthnRegistration({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.StartWebAuthnRegistration),\n }, {\n AccessToken: tokens.accessToken.toString(),\n });\n (0, types_2.assertValidCredentialCreationOptions)(credentialCreationOptions);\n const cred = await (0, utils_3.registerPasskey)(credentialCreationOptions);\n const completeWebAuthnRegistration = (0, cognitoIdentityProvider_1.createCompleteWebAuthnRegistrationClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await completeWebAuthnRegistration({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.CompleteWebAuthnRegistration),\n }, {\n AccessToken: tokens.accessToken.toString(),\n Credential: cred,\n });\n}\nexports.associateWebAuthnCredential = associateWebAuthnCredential;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,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Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deleteWebAuthnCredential = void 0;
7
+ const core_1 = require("@aws-amplify/core");
8
+ const apis_1 = require("../../foundation/apis");
9
+ /**
10
+ * Delete a registered credential for an authenticated user by credentialId
11
+ * @param {DeleteWebAuthnCredentialInput} input The delete input parameters including the credentialId
12
+ * @returns Promise<void>
13
+ * @throws - {@link AuthError}:
14
+ * - Thrown when user is unauthenticated
15
+ * @throws - {@link DeleteWebAuthnCredentialException}
16
+ * - Thrown due to a service error when deleting a WebAuthn credential
17
+ */
18
+ async function deleteWebAuthnCredential(input) {
19
+ return (0, apis_1.deleteWebAuthnCredential)(core_1.Amplify, input);
20
+ }
21
+ exports.deleteWebAuthnCredential = deleteWebAuthnCredential;
22
+ //# sourceMappingURL=deleteWebAuthnCredential.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteWebAuthnCredential.js","sources":["../../../../src/client/apis/deleteWebAuthnCredential.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.deleteWebAuthnCredential = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst apis_1 = require(\"../../foundation/apis\");\n/**\n * Delete a registered credential for an authenticated user by credentialId\n * @param {DeleteWebAuthnCredentialInput} input The delete input parameters including the credentialId\n * @returns Promise<void>\n * @throws - {@link AuthError}:\n * - Thrown when user is unauthenticated\n * @throws - {@link DeleteWebAuthnCredentialException}\n * - Thrown due to a service error when deleting a WebAuthn credential\n */\nasync function deleteWebAuthnCredential(input) {\n return (0, apis_1.deleteWebAuthnCredential)(core_1.Amplify, input);\n}\nexports.deleteWebAuthnCredential = deleteWebAuthnCredential;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,wBAAwB,GAAG,KAAK,CAAC,CAAC;AAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,wBAAwB,CAAC,KAAK,EAAE;AAC/C,IAAI,OAAO,IAAI,MAAM,CAAC,wBAAwB,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC;AACD,OAAO,CAAC,wBAAwB,GAAG,wBAAwB;;"}
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deleteWebAuthnCredential = exports.listWebAuthnCredentials = exports.associateWebAuthnCredential = void 0;
7
+ var associateWebAuthnCredential_1 = require("./associateWebAuthnCredential");
8
+ Object.defineProperty(exports, "associateWebAuthnCredential", { enumerable: true, get: function () { return associateWebAuthnCredential_1.associateWebAuthnCredential; } });
9
+ var listWebAuthnCredentials_1 = require("./listWebAuthnCredentials");
10
+ Object.defineProperty(exports, "listWebAuthnCredentials", { enumerable: true, get: function () { return listWebAuthnCredentials_1.listWebAuthnCredentials; } });
11
+ var deleteWebAuthnCredential_1 = require("./deleteWebAuthnCredential");
12
+ Object.defineProperty(exports, "deleteWebAuthnCredential", { enumerable: true, get: function () { return deleteWebAuthnCredential_1.deleteWebAuthnCredential; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/client/apis/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.deleteWebAuthnCredential = exports.listWebAuthnCredentials = exports.associateWebAuthnCredential = void 0;\nvar associateWebAuthnCredential_1 = require(\"./associateWebAuthnCredential\");\nObject.defineProperty(exports, \"associateWebAuthnCredential\", { enumerable: true, get: function () { return associateWebAuthnCredential_1.associateWebAuthnCredential; } });\nvar listWebAuthnCredentials_1 = require(\"./listWebAuthnCredentials\");\nObject.defineProperty(exports, \"listWebAuthnCredentials\", { enumerable: true, get: function () { return listWebAuthnCredentials_1.listWebAuthnCredentials; } });\nvar deleteWebAuthnCredential_1 = require(\"./deleteWebAuthnCredential\");\nObject.defineProperty(exports, \"deleteWebAuthnCredential\", { enumerable: true, get: function () { return deleteWebAuthnCredential_1.deleteWebAuthnCredential; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,2BAA2B,GAAG,KAAK,CAAC,CAAC;AAClH,IAAI,6BAA6B,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAC7E,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,6BAA6B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,6BAA6B,CAAC,2BAA2B,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5K,IAAI,yBAAyB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACrE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,yBAAyB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,yBAAyB,CAAC,uBAAuB,CAAC,EAAE,EAAE,CAAC,CAAC;AAChK,IAAI,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AACvE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,0BAA0B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,0BAA0B,CAAC,wBAAwB,CAAC,EAAE,EAAE,CAAC;;"}
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.listWebAuthnCredentials = void 0;
7
+ const core_1 = require("@aws-amplify/core");
8
+ const apis_1 = require("../../foundation/apis");
9
+ /**
10
+ * Lists registered credentials for an authenticated user
11
+ *
12
+ * @param {ListWebAuthnCredentialsInput} input The list input parameters including page size and next token.
13
+ * @returns Promise<ListWebAuthnCredentialsOutput>
14
+ * @throws - {@link AuthError}:
15
+ * - Thrown when user is unauthenticated
16
+ * @throws - {@link ListWebAuthnCredentialsException}
17
+ * - Thrown due to a service error when listing WebAuthn credentials
18
+ */
19
+ async function listWebAuthnCredentials(input) {
20
+ return (0, apis_1.listWebAuthnCredentials)(core_1.Amplify, input);
21
+ }
22
+ exports.listWebAuthnCredentials = listWebAuthnCredentials;
23
+ //# sourceMappingURL=listWebAuthnCredentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listWebAuthnCredentials.js","sources":["../../../../src/client/apis/listWebAuthnCredentials.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.listWebAuthnCredentials = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst apis_1 = require(\"../../foundation/apis\");\n/**\n * Lists registered credentials for an authenticated user\n *\n * @param {ListWebAuthnCredentialsInput} input The list input parameters including page size and next token.\n * @returns Promise<ListWebAuthnCredentialsOutput>\n * @throws - {@link AuthError}:\n * - Thrown when user is unauthenticated\n * @throws - {@link ListWebAuthnCredentialsException}\n * - Thrown due to a service error when listing WebAuthn credentials\n */\nasync function listWebAuthnCredentials(input) {\n return (0, apis_1.listWebAuthnCredentials)(core_1.Amplify, input);\n}\nexports.listWebAuthnCredentials = listWebAuthnCredentials;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;AACzC,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,uBAAuB,CAAC,KAAK,EAAE;AAC9C,IAAI,OAAO,IAAI,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACtE,CAAC;AACD,OAAO,CAAC,uBAAuB,GAAG,uBAAuB;;"}
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handlePasswordSRP = void 0;
7
+ const utils_1 = require("@aws-amplify/core/internals/utils");
8
+ const userContextData_1 = require("../../../providers/cognito/utils/userContextData");
9
+ const srp_1 = require("../../../providers/cognito/utils/srp");
10
+ const signInHelpers_1 = require("../../../providers/cognito/utils/signInHelpers");
11
+ const cognitoIdentityProvider_1 = require("../../../foundation/factories/serviceClients/cognitoIdentityProvider");
12
+ const factories_1 = require("../../../providers/cognito/factories");
13
+ const parsers_1 = require("../../../foundation/parsers");
14
+ const utils_2 = require("../../../utils");
15
+ /**
16
+ * Handles the Password SRP (Secure Remote Password) authentication flow.
17
+ * This function can be used with both USER_SRP_AUTH and USER_AUTH flows.
18
+ *
19
+ * @param {Object} params - The parameters for the Password SRP authentication
20
+ * @param {string} params.username - The username for authentication
21
+ * @param {string} params.password - The user's password
22
+ * @param {ClientMetadata} [params.clientMetadata] - Optional metadata to be sent with auth requests
23
+ * @param {CognitoUserPoolConfig} params.config - Cognito User Pool configuration
24
+ * @param {AuthTokenOrchestrator} params.tokenOrchestrator - Token orchestrator for managing auth tokens
25
+ * @param {AuthFlowType} params.authFlow - The type of authentication flow ('USER_SRP_AUTH' or 'USER_AUTH')
26
+ * @param {AuthFactorType} [params.preferredChallenge] - Optional preferred challenge type when using USER_AUTH flow
27
+ *
28
+ * @returns {Promise<RespondToAuthChallengeCommandOutput>} The authentication response
29
+ */
30
+ async function handlePasswordSRP({ username, password, clientMetadata, config, tokenOrchestrator, authFlow, preferredChallenge, }) {
31
+ const { userPoolId, userPoolClientId, userPoolEndpoint } = config;
32
+ const userPoolName = userPoolId?.split('_')[1] || '';
33
+ const authenticationHelper = await (0, srp_1.getAuthenticationHelper)(userPoolName);
34
+ const authParameters = {
35
+ USERNAME: username,
36
+ SRP_A: authenticationHelper.A.toString(16),
37
+ };
38
+ if (authFlow === 'USER_AUTH' && preferredChallenge) {
39
+ authParameters.PREFERRED_CHALLENGE = preferredChallenge;
40
+ }
41
+ const UserContextData = (0, userContextData_1.getUserContextData)({
42
+ username,
43
+ userPoolId,
44
+ userPoolClientId,
45
+ });
46
+ const jsonReq = {
47
+ AuthFlow: authFlow,
48
+ AuthParameters: authParameters,
49
+ ClientMetadata: clientMetadata,
50
+ ClientId: userPoolClientId,
51
+ UserContextData,
52
+ };
53
+ const initiateAuth = (0, cognitoIdentityProvider_1.createInitiateAuthClient)({
54
+ endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({
55
+ endpointOverride: userPoolEndpoint,
56
+ }),
57
+ });
58
+ const resp = await initiateAuth({
59
+ region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),
60
+ userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignIn),
61
+ }, jsonReq);
62
+ const { ChallengeParameters: challengeParameters, Session: session } = resp;
63
+ const activeUsername = challengeParameters?.USERNAME ?? username;
64
+ (0, signInHelpers_1.setActiveSignInUsername)(activeUsername);
65
+ if (resp.ChallengeName === 'PASSWORD_VERIFIER') {
66
+ return (0, signInHelpers_1.retryOnResourceNotFoundException)(signInHelpers_1.handlePasswordVerifierChallenge, [
67
+ password,
68
+ challengeParameters,
69
+ clientMetadata,
70
+ session,
71
+ authenticationHelper,
72
+ config,
73
+ tokenOrchestrator,
74
+ ], activeUsername, tokenOrchestrator);
75
+ }
76
+ return resp;
77
+ }
78
+ exports.handlePasswordSRP = handlePasswordSRP;
79
+ //# sourceMappingURL=handlePasswordSRP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlePasswordSRP.js","sources":["../../../../../src/client/flows/shared/handlePasswordSRP.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handlePasswordSRP = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst userContextData_1 = require(\"../../../providers/cognito/utils/userContextData\");\nconst srp_1 = require(\"../../../providers/cognito/utils/srp\");\nconst signInHelpers_1 = require(\"../../../providers/cognito/utils/signInHelpers\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../../../providers/cognito/factories\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst utils_2 = require(\"../../../utils\");\n/**\n * Handles the Password SRP (Secure Remote Password) authentication flow.\n * This function can be used with both USER_SRP_AUTH and USER_AUTH flows.\n *\n * @param {Object} params - The parameters for the Password SRP authentication\n * @param {string} params.username - The username for authentication\n * @param {string} params.password - The user's password\n * @param {ClientMetadata} [params.clientMetadata] - Optional metadata to be sent with auth requests\n * @param {CognitoUserPoolConfig} params.config - Cognito User Pool configuration\n * @param {AuthTokenOrchestrator} params.tokenOrchestrator - Token orchestrator for managing auth tokens\n * @param {AuthFlowType} params.authFlow - The type of authentication flow ('USER_SRP_AUTH' or 'USER_AUTH')\n * @param {AuthFactorType} [params.preferredChallenge] - Optional preferred challenge type when using USER_AUTH flow\n *\n * @returns {Promise<RespondToAuthChallengeCommandOutput>} The authentication response\n */\nasync function handlePasswordSRP({ username, password, clientMetadata, config, tokenOrchestrator, authFlow, preferredChallenge, }) {\n const { userPoolId, userPoolClientId, userPoolEndpoint } = config;\n const userPoolName = userPoolId?.split('_')[1] || '';\n const authenticationHelper = await (0, srp_1.getAuthenticationHelper)(userPoolName);\n const authParameters = {\n USERNAME: username,\n SRP_A: authenticationHelper.A.toString(16),\n };\n if (authFlow === 'USER_AUTH' && preferredChallenge) {\n authParameters.PREFERRED_CHALLENGE = preferredChallenge;\n }\n const UserContextData = (0, userContextData_1.getUserContextData)({\n username,\n userPoolId,\n userPoolClientId,\n });\n const jsonReq = {\n AuthFlow: authFlow,\n AuthParameters: authParameters,\n ClientMetadata: clientMetadata,\n ClientId: userPoolClientId,\n UserContextData,\n };\n const initiateAuth = (0, cognitoIdentityProvider_1.createInitiateAuthClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const resp = await initiateAuth({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignIn),\n }, jsonReq);\n const { ChallengeParameters: challengeParameters, Session: session } = resp;\n const activeUsername = challengeParameters?.USERNAME ?? username;\n (0, signInHelpers_1.setActiveSignInUsername)(activeUsername);\n if (resp.ChallengeName === 'PASSWORD_VERIFIER') {\n return (0, signInHelpers_1.retryOnResourceNotFoundException)(signInHelpers_1.handlePasswordVerifierChallenge, [\n password,\n challengeParameters,\n clientMetadata,\n session,\n authenticationHelper,\n config,\n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CAAC,uBAAuB,EAAE,cAAc,CAAC,CAAC;AACjE,IAAI,IAAI,IAAI,CAAC,aAAa,KAAK,mBAAmB,EAAE;AACpD,QAAQ,OAAO,IAAI,eAAe,CAAC,gCAAgC,EAAE,eAAe,CAAC,+BAA+B,EAAE;AACtH,YAAY,QAAQ;AACpB,YAAY,mBAAmB;AAC/B,YAAY,cAAc;AAC1B,YAAY,OAAO;AACnB,YAAY,oBAAoB;AAChC,YAAY,MAAM;AAClB,YAAY,iBAAiB;AAC7B,SAAS,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAC9C,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,CAAC;AACD,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;;"}
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.initiateSelectedChallenge = void 0;
7
+ const utils_1 = require("@aws-amplify/core/internals/utils");
8
+ const cognitoIdentityProvider_1 = require("../../../foundation/factories/serviceClients/cognitoIdentityProvider");
9
+ const factories_1 = require("../../../providers/cognito/factories");
10
+ const parsers_1 = require("../../../foundation/parsers");
11
+ const utils_2 = require("../../../utils");
12
+ /**
13
+ * Handles the SELECT_CHALLENGE response for authentication.
14
+ * Initiates the selected authentication challenge based on user choice.
15
+ *
16
+ * @param {Object} params - The parameters for handling the selected challenge
17
+ * @param {string} params.username - The username for authentication
18
+ * @param {string} params.session - The current authentication session token
19
+ * @param {string} params.selectedChallenge - The challenge type selected by the user
20
+ * @param {CognitoUserPoolConfig} params.config - Cognito User Pool configuration
21
+ * @param {ClientMetadata} [params.clientMetadata] - Optional metadata to be sent with auth requests
22
+ *
23
+ * @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response
24
+ */
25
+ async function initiateSelectedChallenge({ username, session, selectedChallenge, config, clientMetadata, }) {
26
+ const respondToAuthChallenge = (0, cognitoIdentityProvider_1.createRespondToAuthChallengeClient)({
27
+ endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({
28
+ endpointOverride: config.userPoolEndpoint,
29
+ }),
30
+ });
31
+ return respondToAuthChallenge({
32
+ region: (0, parsers_1.getRegionFromUserPoolId)(config.userPoolId),
33
+ userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.ConfirmSignIn),
34
+ }, {
35
+ ChallengeName: 'SELECT_CHALLENGE',
36
+ ChallengeResponses: {
37
+ USERNAME: username,
38
+ ANSWER: selectedChallenge,
39
+ },
40
+ ClientId: config.userPoolClientId,
41
+ Session: session,
42
+ ClientMetadata: clientMetadata,
43
+ });
44
+ }
45
+ exports.initiateSelectedChallenge = initiateSelectedChallenge;
46
+ //# sourceMappingURL=handleSelectChallenge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleSelectChallenge.js","sources":["../../../../../src/client/flows/userAuth/handleSelectChallenge.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.initiateSelectedChallenge = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../../../providers/cognito/factories\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst utils_2 = require(\"../../../utils\");\n/**\n * Handles the SELECT_CHALLENGE response for authentication.\n * Initiates the selected authentication challenge based on user choice.\n *\n * @param {Object} params - The parameters for handling the selected challenge\n * @param {string} params.username - The username for authentication\n * @param {string} params.session - The current authentication session token\n * @param {string} params.selectedChallenge - The challenge type selected by the user\n * @param {CognitoUserPoolConfig} params.config - Cognito User Pool configuration\n * @param {ClientMetadata} [params.clientMetadata] - Optional metadata to be sent with auth requests\n *\n * @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response\n */\nasync function initiateSelectedChallenge({ username, session, selectedChallenge, config, clientMetadata, }) {\n const respondToAuthChallenge = (0, cognitoIdentityProvider_1.createRespondToAuthChallengeClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: config.userPoolEndpoint,\n }),\n });\n return respondToAuthChallenge({\n region: (0, parsers_1.getRegionFromUserPoolId)(config.userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.ConfirmSignIn),\n }, {\n ChallengeName: 'SELECT_CHALLENGE',\n ChallengeResponses: {\n USERNAME: username,\n ANSWER: selectedChallenge,\n },\n ClientId: config.userPoolClientId,\n Session: session,\n ClientMetadata: clientMetadata,\n });\n}\nexports.initiateSelectedChallenge = initiateSelectedChallenge;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,yBAAyB,GAAG,OAAO,CAAC,sEAAsE,CAAC,CAAC;AAClH,MAAM,WAAW,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAC;AACpE,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AACzD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,GAAG,EAAE;AAC5G,IAAI,MAAM,sBAAsB,GAAG,IAAI,yBAAyB,CAAC,kCAAkC,EAAE;AACrG,QAAQ,gBAAgB,EAAE,IAAI,WAAW,CAAC,qCAAqC,EAAE;AACjF,YAAY,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;AACrD,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,sBAAsB,CAAC;AAClC,QAAQ,MAAM,EAAE,IAAI,SAAS,CAAC,uBAAuB,EAAE,MAAM,CAAC,UAAU,CAAC;AACzE,QAAQ,cAAc,EAAE,IAAI,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;AAC5F,KAAK,EAAE;AACP,QAAQ,aAAa,EAAE,kBAAkB;AACzC,QAAQ,kBAAkB,EAAE;AAC5B,YAAY,QAAQ,EAAE,QAAQ;AAC9B,YAAY,MAAM,EAAE,iBAAiB;AACrC,SAAS;AACT,QAAQ,QAAQ,EAAE,MAAM,CAAC,gBAAgB;AACzC,QAAQ,OAAO,EAAE,OAAO;AACxB,QAAQ,cAAc,EAAE,cAAc;AACtC,KAAK,CAAC,CAAC;AACP,CAAC;AACD,OAAO,CAAC,yBAAyB,GAAG,yBAAyB;;"}
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleSelectChallengeWithPassword = void 0;
7
+ const utils_1 = require("@aws-amplify/core/internals/utils");
8
+ const cognitoIdentityProvider_1 = require("../../../foundation/factories/serviceClients/cognitoIdentityProvider");
9
+ const factories_1 = require("../../../providers/cognito/factories");
10
+ const parsers_1 = require("../../../foundation/parsers");
11
+ const utils_2 = require("../../../utils");
12
+ const userContextData_1 = require("../../../providers/cognito/utils/userContextData");
13
+ const signInHelpers_1 = require("../../../providers/cognito/utils/signInHelpers");
14
+ /**
15
+ * Handles the SELECT_CHALLENGE response specifically for Password authentication.
16
+ * This function combines the SELECT_CHALLENGE flow with standard password authentication.
17
+ *
18
+ * @param {string} username - The username for authentication
19
+ * @param {string} password - The user's password
20
+ * @param {ClientMetadata} [clientMetadata] - Optional metadata to be sent with auth requests
21
+ * @param {CognitoUserPoolConfig} config - Cognito User Pool configuration
22
+ * @param {string} session - The current authentication session token
23
+ *
24
+ * @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response
25
+ */
26
+ async function handleSelectChallengeWithPassword(username, password, clientMetadata, config, session) {
27
+ const { userPoolId, userPoolClientId, userPoolEndpoint } = config;
28
+ const authParameters = {
29
+ ANSWER: 'PASSWORD',
30
+ USERNAME: username,
31
+ PASSWORD: password,
32
+ };
33
+ const userContextData = (0, userContextData_1.getUserContextData)({
34
+ username,
35
+ userPoolId,
36
+ userPoolClientId,
37
+ });
38
+ const respondToAuthChallenge = (0, cognitoIdentityProvider_1.createRespondToAuthChallengeClient)({
39
+ endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({
40
+ endpointOverride: userPoolEndpoint,
41
+ }),
42
+ });
43
+ const response = await respondToAuthChallenge({
44
+ region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),
45
+ userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.ConfirmSignIn),
46
+ }, {
47
+ ChallengeName: 'SELECT_CHALLENGE',
48
+ ChallengeResponses: authParameters,
49
+ ClientId: userPoolClientId,
50
+ ClientMetadata: clientMetadata,
51
+ Session: session,
52
+ UserContextData: userContextData,
53
+ });
54
+ const activeUsername = response.ChallengeParameters?.USERNAME ?? username;
55
+ (0, signInHelpers_1.setActiveSignInUsername)(activeUsername);
56
+ return response;
57
+ }
58
+ exports.handleSelectChallengeWithPassword = handleSelectChallengeWithPassword;
59
+ //# sourceMappingURL=handleSelectChallengeWithPassword.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleSelectChallengeWithPassword.js","sources":["../../../../../src/client/flows/userAuth/handleSelectChallengeWithPassword.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSelectChallengeWithPassword = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../../../providers/cognito/factories\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst utils_2 = require(\"../../../utils\");\nconst userContextData_1 = require(\"../../../providers/cognito/utils/userContextData\");\nconst signInHelpers_1 = require(\"../../../providers/cognito/utils/signInHelpers\");\n/**\n * Handles the SELECT_CHALLENGE response specifically for Password authentication.\n * This function combines the SELECT_CHALLENGE flow with standard password authentication.\n *\n * @param {string} username - The username for authentication\n * @param {string} password - The user's password\n * @param {ClientMetadata} [clientMetadata] - Optional metadata to be sent with auth requests\n * @param {CognitoUserPoolConfig} config - Cognito User Pool configuration\n * @param {string} session - The current authentication session token\n *\n * @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response\n */\nasync function handleSelectChallengeWithPassword(username, password, clientMetadata, config, session) {\n const { userPoolId, userPoolClientId, userPoolEndpoint } = config;\n const authParameters = {\n ANSWER: 'PASSWORD',\n USERNAME: username,\n PASSWORD: password,\n };\n const userContextData = (0, userContextData_1.getUserContextData)({\n username,\n userPoolId,\n userPoolClientId,\n });\n const respondToAuthChallenge = (0, cognitoIdentityProvider_1.createRespondToAuthChallengeClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const response = await respondToAuthChallenge({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.ConfirmSignIn),\n }, {\n ChallengeName: 'SELECT_CHALLENGE',\n ChallengeResponses: authParameters,\n ClientId: userPoolClientId,\n ClientMetadata: clientMetadata,\n Session: session,\n UserContextData: userContextData,\n });\n const activeUsername = response.ChallengeParameters?.USERNAME ?? username;\n (0, signInHelpers_1.setActiveSignInUsername)(activeUsername);\n return response;\n}\nexports.handleSelectChallengeWithPassword = handleSelectChallengeWithPassword;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iCAAiC,GAAG,KAAK,CAAC,CAAC;AACnD,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,yBAAyB,GAAG,OAAO,CAAC,sEAAsE,CAAC,CAAC;AAClH,MAAM,WAAW,GAAG,OAAO,CAAC,sCAAsC,CAAC,CAAC;AACpE,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AACzD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,iBAAiB,GAAG,OAAO,CAAC,kDAAkD,CAAC,CAAC;AACtF,MAAM,eAAe,GAAG,OAAO,CAAC,gDAAgD,CAAC,CAAC;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iCAAiC,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE;AACtG,IAAI,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;AACtE,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,MAAM,EAAE,UAAU;AAC1B,QAAQ,QAAQ,EAAE,QAAQ;AAC1B,QAAQ,QAAQ,EAAE,QAAQ;AAC1B,KAAK,CAAC;AACN,IAAI,MAAM,eAAe,GAAG,IAAI,iBAAiB,CAAC,kBAAkB,EAAE;AACtE,QAAQ,QAAQ;AAChB,QAAQ,UAAU;AAClB,QAAQ,gBAAgB;AACxB,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,sBAAsB,GAAG,IAAI,yBAAyB,CAAC,kCAAkC,EAAE;AACrG,QAAQ,gBAAgB,EAAE,IAAI,WAAW,CAAC,qCAAqC,EAAE;AACjF,YAAY,gBAAgB,EAAE,gBAAgB;AAC9C,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC;AAClD,QAAQ,MAAM,EAAE,IAAI,SAAS,CAAC,uBAAuB,EAAE,UAAU,CAAC;AAClE,QAAQ,cAAc,EAAE,IAAI,OAAO,CAAC,qBAAqB,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;AAC5F,KAAK,EAAE;AACP,QAAQ,aAAa,EAAE,kBAAkB;AACzC,QAAQ,kBAAkB,EAAE,cAAc;AAC1C,QAAQ,QAAQ,EAAE,gBAAgB;AAClC,QAAQ,cAAc,EAAE,cAAc;AACtC,QAAQ,OAAO,EAAE,OAAO;AACxB,QAAQ,eAAe,EAAE,eAAe;AACxC,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,cAAc,GAAG,QAAQ,CAAC,mBAAmB,EAAE,QAAQ,IAAI,QAAQ,CAAC;AAC9E,IAAI,IAAI,eAAe,CAAC,uBAAuB,EAAE,cAAc,CAAC,CAAC;AACjE,IAAI,OAAO,QAAQ,CAAC;AACpB,CAAC;AACD,OAAO,CAAC,iCAAiC,GAAG,iCAAiC;;"}
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleSelectChallengeWithPasswordSRP = void 0;
7
+ const utils_1 = require("@aws-amplify/core/internals/utils");
8
+ const cognitoIdentityProvider_1 = require("../../../foundation/factories/serviceClients/cognitoIdentityProvider");
9
+ const factories_1 = require("../../../providers/cognito/factories");
10
+ const parsers_1 = require("../../../foundation/parsers");
11
+ const utils_2 = require("../../../utils");
12
+ const srp_1 = require("../../../providers/cognito/utils/srp");
13
+ const userContextData_1 = require("../../../providers/cognito/utils/userContextData");
14
+ const signInHelpers_1 = require("../../../providers/cognito/utils/signInHelpers");
15
+ /**
16
+ * Handles the SELECT_CHALLENGE response specifically for Password SRP authentication.
17
+ * This function combines the SELECT_CHALLENGE flow with Password SRP protocol.
18
+ *
19
+ * @param {string} username - The username for authentication
20
+ * @param {string} password - The user's password
21
+ * @param {ClientMetadata} [clientMetadata] - Optional metadata to be sent with auth requests
22
+ * @param {CognitoUserPoolConfig} config - Cognito User Pool configuration
23
+ * @param {string} session - The current authentication session token
24
+ * @param {AuthTokenOrchestrator} tokenOrchestrator - Token orchestrator for managing auth tokens
25
+ *
26
+ * @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response
27
+ */
28
+ async function handleSelectChallengeWithPasswordSRP(username, password, clientMetadata, config, session, tokenOrchestrator) {
29
+ const { userPoolId, userPoolClientId, userPoolEndpoint } = config;
30
+ const userPoolName = userPoolId.split('_')[1] || '';
31
+ const authenticationHelper = await (0, srp_1.getAuthenticationHelper)(userPoolName);
32
+ const authParameters = {
33
+ ANSWER: 'PASSWORD_SRP',
34
+ USERNAME: username,
35
+ SRP_A: authenticationHelper.A.toString(16),
36
+ };
37
+ const userContextData = (0, userContextData_1.getUserContextData)({
38
+ username,
39
+ userPoolId,
40
+ userPoolClientId,
41
+ });
42
+ const respondToAuthChallenge = (0, cognitoIdentityProvider_1.createRespondToAuthChallengeClient)({
43
+ endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({
44
+ endpointOverride: userPoolEndpoint,
45
+ }),
46
+ });
47
+ const response = await respondToAuthChallenge({
48
+ region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),
49
+ userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.ConfirmSignIn),
50
+ }, {
51
+ ChallengeName: 'SELECT_CHALLENGE',
52
+ ChallengeResponses: authParameters,
53
+ ClientId: userPoolClientId,
54
+ ClientMetadata: clientMetadata,
55
+ Session: session,
56
+ UserContextData: userContextData,
57
+ });
58
+ const activeUsername = response.ChallengeParameters?.USERNAME ?? username;
59
+ (0, signInHelpers_1.setActiveSignInUsername)(activeUsername);
60
+ if (response.ChallengeName === 'PASSWORD_VERIFIER') {
61
+ return (0, signInHelpers_1.retryOnResourceNotFoundException)(signInHelpers_1.handlePasswordVerifierChallenge, [
62
+ password,
63
+ response.ChallengeParameters,
64
+ clientMetadata,
65
+ response.Session,
66
+ authenticationHelper,
67
+ config,
68
+ tokenOrchestrator,
69
+ ], activeUsername, tokenOrchestrator);
70
+ }
71
+ return response;
72
+ }
73
+ exports.handleSelectChallengeWithPasswordSRP = handleSelectChallengeWithPasswordSRP;
74
+ //# sourceMappingURL=handleSelectChallengeWithPasswordSRP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleSelectChallengeWithPasswordSRP.js","sources":["../../../../../src/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSelectChallengeWithPasswordSRP = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../../../providers/cognito/factories\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst utils_2 = require(\"../../../utils\");\nconst srp_1 = require(\"../../../providers/cognito/utils/srp\");\nconst userContextData_1 = require(\"../../../providers/cognito/utils/userContextData\");\nconst signInHelpers_1 = require(\"../../../providers/cognito/utils/signInHelpers\");\n/**\n * Handles the SELECT_CHALLENGE response specifically for Password SRP authentication.\n * This function combines the SELECT_CHALLENGE flow with Password SRP protocol.\n *\n * @param {string} username - The username for authentication\n * @param {string} password - The user's password\n * @param {ClientMetadata} [clientMetadata] - Optional metadata to be sent with auth requests\n * @param {CognitoUserPoolConfig} config - Cognito User Pool configuration\n * @param {string} session - The current authentication session token\n * @param {AuthTokenOrchestrator} tokenOrchestrator - Token orchestrator for managing auth tokens\n *\n * @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response\n */\nasync function handleSelectChallengeWithPasswordSRP(username, password, clientMetadata, config, session, tokenOrchestrator) {\n const { userPoolId, userPoolClientId, userPoolEndpoint } = config;\n const userPoolName = userPoolId.split('_')[1] || '';\n const authenticationHelper = await (0, srp_1.getAuthenticationHelper)(userPoolName);\n const authParameters = {\n ANSWER: 'PASSWORD_SRP',\n USERNAME: username,\n SRP_A: authenticationHelper.A.toString(16),\n };\n const userContextData = (0, userContextData_1.getUserContextData)({\n username,\n userPoolId,\n userPoolClientId,\n });\n const respondToAuthChallenge = (0, cognitoIdentityProvider_1.createRespondToAuthChallengeClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const response = await respondToAuthChallenge({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.ConfirmSignIn),\n }, {\n ChallengeName: 'SELECT_CHALLENGE',\n ChallengeResponses: authParameters,\n ClientId: userPoolClientId,\n ClientMetadata: clientMetadata,\n Session: session,\n UserContextData: userContextData,\n });\n const activeUsername = response.ChallengeParameters?.USERNAME ?? username;\n (0, signInHelpers_1.setActiveSignInUsername)(activeUsername);\n if (response.ChallengeName === 'PASSWORD_VERIFIER') {\n return (0, signInHelpers_1.retryOnResourceNotFoundException)(signInHelpers_1.handlePasswordVerifierChallenge, [\n password,\n response.ChallengeParameters,\n clientMetadata,\n response.Session,\n authenticationHelper,\n config,\n tokenOrchestrator,\n ], activeUsername, tokenOrchestrator);\n }\n return response;\n}\nexports.handleSelectChallengeWithPasswordSRP = handleSelectChallengeWithPasswordSRP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;AAC5B,YAAY,oBAAoB;AAChC,YAAY,MAAM;AAClB,YAAY,iBAAiB;AAC7B,SAAS,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAC9C,KAAK;AACL,IAAI,OAAO,QAAQ,CAAC;AACpB,CAAC;AACD,OAAO,CAAC,oCAAoC,GAAG,oCAAoC;;"}
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.handleUserAuthFlow = void 0;
7
+ const utils_1 = require("@aws-amplify/core/internals/utils");
8
+ const userContextData_1 = require("../../../providers/cognito/utils/userContextData");
9
+ const cognitoIdentityProvider_1 = require("../../../foundation/factories/serviceClients/cognitoIdentityProvider");
10
+ const factories_1 = require("../../../providers/cognito/factories");
11
+ const parsers_1 = require("../../../foundation/parsers");
12
+ const utils_2 = require("../../../utils");
13
+ const handlePasswordSRP_1 = require("../shared/handlePasswordSRP");
14
+ const assertValidationError_1 = require("../../../errors/utils/assertValidationError");
15
+ const validation_1 = require("../../../errors/types/validation");
16
+ const signInHelpers_1 = require("../../../providers/cognito/utils/signInHelpers");
17
+ /**
18
+ * Handles user authentication flow with configurable challenge preferences.
19
+ * Supports AuthFactorType challenges through the USER_AUTH flow.
20
+ *
21
+ * @param {HandleUserAuthFlowInput} params - Authentication flow parameters
22
+ * @param {string} params.username - The username for authentication
23
+ * @param {Record<string, string>} [params.clientMetadata] - Optional metadata to pass to authentication service
24
+ * @param {CognitoUserPoolConfig} params.config - Cognito User Pool configuration
25
+ * @param {AuthTokenOrchestrator} params.tokenOrchestrator - Manages authentication tokens and device tracking
26
+ * @param {AuthFactorType} [params.preferredChallenge] - Optional preferred authentication method
27
+ * @param {string} [params.password] - Required when preferredChallenge is 'PASSWORD' or 'PASSWORD_SRP'
28
+ *
29
+ * @returns {Promise<InitiateAuthCommandOutput>} The authentication response from Cognito
30
+ */
31
+ async function handleUserAuthFlow({ username, clientMetadata, config, tokenOrchestrator, preferredChallenge, password, session, }) {
32
+ const { userPoolId, userPoolClientId, userPoolEndpoint } = config;
33
+ const UserContextData = (0, userContextData_1.getUserContextData)({
34
+ username,
35
+ userPoolId,
36
+ userPoolClientId,
37
+ });
38
+ const authParameters = { USERNAME: username };
39
+ if (preferredChallenge) {
40
+ if (preferredChallenge === 'PASSWORD_SRP') {
41
+ (0, assertValidationError_1.assertValidationError)(!!password, validation_1.AuthValidationErrorCode.EmptySignInPassword);
42
+ return (0, handlePasswordSRP_1.handlePasswordSRP)({
43
+ username,
44
+ password,
45
+ clientMetadata,
46
+ config,
47
+ tokenOrchestrator,
48
+ authFlow: 'USER_AUTH',
49
+ preferredChallenge,
50
+ });
51
+ }
52
+ if (preferredChallenge === 'PASSWORD') {
53
+ (0, assertValidationError_1.assertValidationError)(!!password, validation_1.AuthValidationErrorCode.EmptySignInPassword);
54
+ authParameters.PASSWORD = password;
55
+ }
56
+ authParameters.PREFERRED_CHALLENGE = preferredChallenge;
57
+ }
58
+ const jsonReq = {
59
+ AuthFlow: 'USER_AUTH',
60
+ AuthParameters: authParameters,
61
+ ClientMetadata: clientMetadata,
62
+ ClientId: userPoolClientId,
63
+ UserContextData,
64
+ };
65
+ if (session) {
66
+ jsonReq.Session = session;
67
+ }
68
+ const initiateAuth = (0, cognitoIdentityProvider_1.createInitiateAuthClient)({
69
+ endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({
70
+ endpointOverride: userPoolEndpoint,
71
+ }),
72
+ });
73
+ const response = await initiateAuth({
74
+ region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),
75
+ userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignIn),
76
+ }, jsonReq);
77
+ // Set the active username immediately after successful authentication attempt
78
+ // If a user starts a new sign-in while another sign-in is incomplete,
79
+ // this ensures we're tracking the correct user for subsequent auth challenges.
80
+ (0, signInHelpers_1.setActiveSignInUsername)(username);
81
+ return response;
82
+ }
83
+ exports.handleUserAuthFlow = handleUserAuthFlow;
84
+ //# sourceMappingURL=handleUserAuthFlow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleUserAuthFlow.js","sources":["../../../../../src/client/flows/userAuth/handleUserAuthFlow.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleUserAuthFlow = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst userContextData_1 = require(\"../../../providers/cognito/utils/userContextData\");\nconst cognitoIdentityProvider_1 = require(\"../../../foundation/factories/serviceClients/cognitoIdentityProvider\");\nconst factories_1 = require(\"../../../providers/cognito/factories\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst utils_2 = require(\"../../../utils\");\nconst handlePasswordSRP_1 = require(\"../shared/handlePasswordSRP\");\nconst assertValidationError_1 = require(\"../../../errors/utils/assertValidationError\");\nconst validation_1 = require(\"../../../errors/types/validation\");\nconst signInHelpers_1 = require(\"../../../providers/cognito/utils/signInHelpers\");\n/**\n * Handles user authentication flow with configurable challenge preferences.\n * Supports AuthFactorType challenges through the USER_AUTH flow.\n *\n * @param {HandleUserAuthFlowInput} params - Authentication flow parameters\n * @param {string} params.username - The username for authentication\n * @param {Record<string, string>} [params.clientMetadata] - Optional metadata to pass to authentication service\n * @param {CognitoUserPoolConfig} params.config - Cognito User Pool configuration\n * @param {AuthTokenOrchestrator} params.tokenOrchestrator - Manages authentication tokens and device tracking\n * @param {AuthFactorType} [params.preferredChallenge] - Optional preferred authentication method\n * @param {string} [params.password] - Required when preferredChallenge is 'PASSWORD' or 'PASSWORD_SRP'\n *\n * @returns {Promise<InitiateAuthCommandOutput>} The authentication response from Cognito\n */\nasync function handleUserAuthFlow({ username, clientMetadata, config, tokenOrchestrator, preferredChallenge, password, session, }) {\n const { userPoolId, userPoolClientId, userPoolEndpoint } = config;\n const UserContextData = (0, userContextData_1.getUserContextData)({\n username,\n userPoolId,\n userPoolClientId,\n });\n const authParameters = { USERNAME: username };\n if (preferredChallenge) {\n if (preferredChallenge === 'PASSWORD_SRP') {\n (0, assertValidationError_1.assertValidationError)(!!password, validation_1.AuthValidationErrorCode.EmptySignInPassword);\n return (0, handlePasswordSRP_1.handlePasswordSRP)({\n username,\n password,\n clientMetadata,\n config,\n tokenOrchestrator,\n authFlow: 'USER_AUTH',\n preferredChallenge,\n });\n }\n if (preferredChallenge === 'PASSWORD') {\n (0, assertValidationError_1.assertValidationError)(!!password, validation_1.AuthValidationErrorCode.EmptySignInPassword);\n authParameters.PASSWORD = password;\n }\n authParameters.PREFERRED_CHALLENGE = preferredChallenge;\n }\n const jsonReq = {\n AuthFlow: 'USER_AUTH',\n AuthParameters: authParameters,\n ClientMetadata: clientMetadata,\n ClientId: userPoolClientId,\n UserContextData,\n };\n if (session) {\n jsonReq.Session = session;\n }\n const initiateAuth = (0, cognitoIdentityProvider_1.createInitiateAuthClient)({\n endpointResolver: (0, factories_1.createCognitoUserPoolEndpointResolver)({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const response = await initiateAuth({\n region: (0, parsers_1.getRegionFromUserPoolId)(userPoolId),\n userAgentValue: (0, utils_2.getAuthUserAgentValue)(utils_1.AuthAction.SignIn),\n }, jsonReq);\n // Set the active username immediately after successful authentication attempt\n // If a user starts a new sign-in while another sign-in is incomplete,\n // this ensures we're tracking the correct user for subsequent auth challenges.\n (0, signInHelpers_1.setActiveSignInUsername)(username);\n return response;\n}\nexports.handleUserAuthFlow = handleUserAuthFlow;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,KAAK,CAAC,CAAC;AACpC,MAAM,OAAO,GAAG,O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