@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
@@ -7,16 +7,21 @@ import { MetadataBearer as __MetadataBearer } from '@aws-sdk/types';
7
7
 
8
8
  export type ChallengeName =
9
9
  | 'SMS_MFA'
10
+ | 'SMS_OTP'
10
11
  | 'SOFTWARE_TOKEN_MFA'
11
12
  | 'EMAIL_OTP'
12
13
  | 'SELECT_MFA_TYPE'
14
+ | 'SELECT_CHALLENGE'
13
15
  | 'MFA_SETUP'
16
+ | 'PASSWORD'
17
+ | 'PASSWORD_SRP'
14
18
  | 'PASSWORD_VERIFIER'
15
19
  | 'CUSTOM_CHALLENGE'
16
20
  | 'DEVICE_SRP_AUTH'
17
21
  | 'DEVICE_PASSWORD_VERIFIER'
18
22
  | 'ADMIN_NO_SRP_AUTH'
19
- | 'NEW_PASSWORD_REQUIRED';
23
+ | 'NEW_PASSWORD_REQUIRED'
24
+ | 'WEB_AUTHN';
20
25
 
21
26
  export type ChallengeParameters = {
22
27
  CODE_DELIVERY_DESTINATION?: string;
@@ -27,6 +32,7 @@ export type ChallengeParameters = {
27
32
  PASSWORD_CLAIM_SIGNATURE?: string;
28
33
  MFAS_CAN_CHOOSE?: string;
29
34
  MFAS_CAN_SETUP?: string;
35
+ CREDENTIAL_REQUEST_OPTIONS?: string;
30
36
  } & Record<string, unknown>;
31
37
 
32
38
  export type CognitoMFAType = 'SMS_MFA' | 'SOFTWARE_TOKEN_MFA' | 'EMAIL_OTP';
@@ -56,6 +62,10 @@ declare enum ChallengeNameType {
56
62
  SELECT_MFA_TYPE = 'SELECT_MFA_TYPE',
57
63
  SMS_MFA = 'SMS_MFA',
58
64
  SOFTWARE_TOKEN_MFA = 'SOFTWARE_TOKEN_MFA',
65
+ PASSWORD = 'PASSWORD',
66
+ PASSWORD_SRP = 'PASSWORD_SRP',
67
+ WEB_AUTHN = 'WEB_AUTHN',
68
+ SMS_OTP = 'SMS_OTP',
59
69
  EMAIL_OTP = 'EMAIL_OTP',
60
70
  }
61
71
  declare enum DeliveryMediumType {
@@ -696,7 +706,15 @@ export interface ConfirmSignUpRequest {
696
706
  /**
697
707
  * <p>Represents the response from the server for the registration confirmation.</p>
698
708
  */
699
- export type ConfirmSignUpResponse = Record<never, never>;
709
+ export interface ConfirmSignUpResponse {
710
+ /**
711
+ * <p>Your <code>ConfirmSignUp</code> request might produce a challenge that your user must
712
+ * respond to, for example a one-time code. The <code>Session</code> parameter tracks the
713
+ * session in the flow of challenge responses and requests. Include this parameter in
714
+ * <code>RespondToAuthChallenge</code> API requests.</p>
715
+ */
716
+ Session?: string;
717
+ }
700
718
  export type DeleteUserCommandInput = DeleteUserRequest;
701
719
  export interface DeleteUserCommandOutput
702
720
  extends DeleteUserResponse,
@@ -1083,6 +1101,13 @@ export interface InitiateAuthRequest {
1083
1101
  * <p>Contextual data such as the user's device fingerprint, IP address, or location used for evaluating the risk of an unexpected event by Amazon Cognito advanced security.</p>
1084
1102
  */
1085
1103
  UserContextData?: UserContextDataType;
1104
+
1105
+ /**
1106
+ * <p>The optional session ID from a <code>ConfirmSignUp</code> API
1107
+ * request. You can sign in a user directly from the sign-up process with the
1108
+ * <code>USER_AUTH</code> authentication flow.</p>
1109
+ */
1110
+ Session?: string;
1086
1111
  }
1087
1112
  /**
1088
1113
  * <p>Initiates the authentication response.</p>
@@ -1133,8 +1158,10 @@ export interface InitiateAuthResponse {
1133
1158
  */
1134
1159
  ChallengeName?: ChallengeNameType | string;
1135
1160
  /**
1136
- * <p>The session that should pass both ways in challenge-response calls to the service. If the caller must pass another challenge, they return a session with other challenge parameters. This session
1137
- * should be passed as it is to the next <code>RespondToAuthChallenge</code> API call.</p>
1161
+ * <p>The session that should pass both ways in challenge-response calls to the service. If
1162
+ * the caller must pass another challenge, they return a session with other challenge
1163
+ * parameters. Include this session identifier in a <code>RespondToAuthChallenge</code> API
1164
+ * request.</p>
1138
1165
  */
1139
1166
  Session?: string;
1140
1167
  /**
@@ -1145,9 +1172,15 @@ export interface InitiateAuthResponse {
1145
1172
  ChallengeParameters?: Record<string, string>;
1146
1173
  /**
1147
1174
  * <p>The result of the authentication response. This result is only returned if the caller doesn't need to pass another challenge. If the caller does need to pass another challenge before it gets
1148
- * tokens, <code>ChallengeName</code>, <code>ChallengeParameters</code>, and <code>Session</code> are returned.</p>
1175
+ * tokens, <code>ChallengeName</code>, <code>ChallengeParameters</code>, <code>AvailableChallenges</code>, and <code>Session</code> are returned.</p>
1149
1176
  */
1150
1177
  AuthenticationResult?: AuthenticationResultType;
1178
+ /**
1179
+ * <p>This response parameter prompts a user to select from multiple available challenges
1180
+ * that they can complete authentication with. For example, they might be able to continue
1181
+ * with passwordless authentication or with a one-time password from an SMS message.</p>
1182
+ */
1183
+ AvailableChallenges?: ChallengeNameType[];
1151
1184
  }
1152
1185
  export type ListDevicesCommandInput = ListDevicesRequest;
1153
1186
  export interface ListDevicesCommandOutput
@@ -1527,6 +1560,13 @@ export interface SignUpResponse {
1527
1560
  * <p>The UUID of the authenticated user. This isn't the same as <code>username</code>.</p>
1528
1561
  */
1529
1562
  UserSub: string | undefined;
1563
+
1564
+ /**
1565
+ * <p>A session Id that you can pass to <code>ConfirmSignUp</code> when you want to
1566
+ * immediately sign in your user with the <code>USER_AUTH</code> flow after they complete
1567
+ * sign-up.</p>
1568
+ */
1569
+ Session?: string;
1530
1570
  }
1531
1571
  /**
1532
1572
  * <p>The type used for enabling software token MFA at the user level. If an MFA type is activated for a user, the user will be prompted for MFA during all sign-in attempts, unless device tracking
@@ -1732,3 +1772,99 @@ export interface DeleteUserAttributesRequest {
1732
1772
  */
1733
1773
  export type DeleteUserAttributesResponse = Record<never, never>;
1734
1774
  export {};
1775
+
1776
+ export interface StartWebAuthnRegistrationRequest {
1777
+ /**
1778
+ * A valid access token that Amazon Cognito issued to the user whose passkey metadata you want to
1779
+ * generate.
1780
+ */
1781
+ AccessToken: string | undefined;
1782
+ }
1783
+
1784
+ export interface StartWebAuthnRegistrationResponse {
1785
+ /**
1786
+ * The information that a user can provide in their request to register with their
1787
+ * passkey provider.
1788
+ */
1789
+ CredentialCreationOptions: Record<never, never> | undefined;
1790
+ }
1791
+
1792
+ export type StartWebAuthnRegistrationCommandInput =
1793
+ StartWebAuthnRegistrationRequest;
1794
+
1795
+ export interface StartWebAuthnRegistrationCommandOutput
1796
+ extends StartWebAuthnRegistrationResponse,
1797
+ __MetadataBearer {}
1798
+
1799
+ export interface CompleteWebAuthnRegistrationRequest {
1800
+ /**
1801
+ * A valid access token that Amazon Cognito issued to the user whose passkey registration you want
1802
+ * to verify. This information informs your user pool of the details of the user's
1803
+ * successful registration with their passkey provider.
1804
+ */
1805
+ AccessToken: string | undefined;
1806
+
1807
+ /**
1808
+ * A <a href="https://www.w3.org/TR/webauthn-3/#dictdef-registrationresponsejson">RegistrationResponseJSON</a> public-key credential response from the
1809
+ * user's passkey provider.
1810
+ */
1811
+ Credential: Record<never, never> | undefined;
1812
+ }
1813
+
1814
+ export type CompleteWebAuthnRegistrationResponse = Record<never, never>;
1815
+
1816
+ export type CompleteWebAuthnRegistrationCommandInput =
1817
+ CompleteWebAuthnRegistrationRequest;
1818
+
1819
+ export interface CompleteWebAuthnRegistrationCommandOutput
1820
+ extends CompleteWebAuthnRegistrationResponse,
1821
+ __MetadataBearer {}
1822
+
1823
+ /**
1824
+ * <p>The request to list WebAuthN credentials.</p>
1825
+ */
1826
+ export interface ListWebAuthnCredentialsInput {
1827
+ AccessToken: string | undefined;
1828
+ NextToken?: string;
1829
+ MaxResults?: number;
1830
+ }
1831
+
1832
+ export interface WebAuthnCredentialDescription {
1833
+ CredentialId: string | undefined;
1834
+ FriendlyCredentialName: string | undefined;
1835
+ RelyingPartyId: string | undefined;
1836
+ AuthenticatorAttachment?: string;
1837
+ AuthenticatorTransports: string[] | undefined;
1838
+ CreatedAt: number | undefined;
1839
+ }
1840
+
1841
+ /**
1842
+ * <p>The response containing the list of WebAuthN credentials.</p>
1843
+ */
1844
+ export interface ListWebAuthnCredentialsOutput {
1845
+ Credentials: WebAuthnCredentialDescription[] | undefined;
1846
+ NextToken?: string;
1847
+ }
1848
+
1849
+ export type ListWebAuthnCredentialsCommandInput = ListWebAuthnCredentialsInput;
1850
+
1851
+ export interface ListWebAuthnCredentialsCommandOutput
1852
+ extends ListWebAuthnCredentialsOutput,
1853
+ __MetadataBearer {}
1854
+
1855
+ /**
1856
+ * The request to delete a WebAuthN credential.
1857
+ */
1858
+ export interface DeleteWebAuthnCredentialInput {
1859
+ AccessToken: string | undefined;
1860
+ CredentialId: string | undefined;
1861
+ }
1862
+
1863
+ export type DeleteWebAuthnCredentialOutput = Record<never, never>;
1864
+
1865
+ export type DeleteWebAuthnCredentialCommandInput =
1866
+ DeleteWebAuthnCredentialInput;
1867
+
1868
+ export interface DeleteWebAuthnCredentialCommandOutput
1869
+ extends DeleteWebAuthnCredentialOutput,
1870
+ __MetadataBearer {}
@@ -0,0 +1,9 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export {
5
+ ListWebAuthnCredentialsInput,
6
+ DeleteWebAuthnCredentialInput,
7
+ } from './inputs';
8
+ export { ListWebAuthnCredentialsOutput } from './outputs';
9
+ export { AuthWebAuthnCredential } from './models';
@@ -0,0 +1,14 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * Input type for Cognito listWebAuthnCredentials API.
6
+ */
7
+ export interface ListWebAuthnCredentialsInput {
8
+ pageSize?: number;
9
+ nextToken?: string;
10
+ }
11
+
12
+ export interface DeleteWebAuthnCredentialInput {
13
+ credentialId: string;
14
+ }
@@ -0,0 +1,14 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * Shape of a WebAuthn credential
6
+ */
7
+ export interface AuthWebAuthnCredential {
8
+ credentialId: string | undefined;
9
+ friendlyCredentialName: string | undefined;
10
+ relyingPartyId: string | undefined;
11
+ authenticatorAttachment?: string;
12
+ authenticatorTransports: string[] | undefined;
13
+ createdAt: Date | undefined;
14
+ }
@@ -0,0 +1,12 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { AuthWebAuthnCredential } from './models';
5
+
6
+ /**
7
+ * Output type for Cognito listWebAuthnCredentials API.
8
+ */
9
+ export interface ListWebAuthnCredentialsOutput {
10
+ credentials: AuthWebAuthnCredential[];
11
+ nextToken?: string;
12
+ }
package/src/index.ts CHANGED
@@ -87,3 +87,17 @@ export {
87
87
  AuthTokens,
88
88
  JWT,
89
89
  } from '@aws-amplify/core';
90
+
91
+ export { associateWebAuthnCredential } from './client/apis';
92
+
93
+ export {
94
+ listWebAuthnCredentials,
95
+ deleteWebAuthnCredential,
96
+ } from './client/apis';
97
+
98
+ export {
99
+ AuthWebAuthnCredential,
100
+ DeleteWebAuthnCredentialInput,
101
+ ListWebAuthnCredentialsInput,
102
+ ListWebAuthnCredentialsOutput,
103
+ } from './foundation/types';
@@ -1,6 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import { autoSignInStore } from '../../../client/utils/store';
4
5
  import { AuthError } from '../../../errors/AuthError';
5
6
  import { AUTO_SIGN_IN_EXCEPTION } from '../../../errors/constants';
6
7
  import { AutoSignInCallback } from '../../../types/models';
@@ -114,6 +115,9 @@ export function setAutoSignIn(callback: AutoSignInCallback) {
114
115
  *
115
116
  * @internal
116
117
  */
117
- export function resetAutoSignIn() {
118
- autoSignIn = initialAutoSignIn;
118
+ export function resetAutoSignIn(resetCallback = true) {
119
+ if (resetCallback) {
120
+ autoSignIn = initialAutoSignIn;
121
+ }
122
+ autoSignInStore.dispatch({ type: 'RESET' });
119
123
  }
@@ -14,7 +14,7 @@ import {
14
14
  cleanActiveSignInState,
15
15
  setActiveSignInState,
16
16
  signInStore,
17
- } from '../utils/signInStore';
17
+ } from '../../../client/utils/store';
18
18
  import { AuthError } from '../../../errors/AuthError';
19
19
  import {
20
20
  getNewDeviceMetadata,
@@ -14,15 +14,13 @@ import { AuthValidationErrorCode } from '../../../errors/types/validation';
14
14
  import { ConfirmSignUpException } from '../types/errors';
15
15
  import { getRegionFromUserPoolId } from '../../../foundation/parsers';
16
16
  import { AutoSignInEventData } from '../types/models';
17
- import {
18
- isAutoSignInStarted,
19
- isAutoSignInUserUsingConfirmSignUp,
20
- setAutoSignInStarted,
21
- } from '../utils/signUpHelpers';
22
17
  import { getAuthUserAgentValue } from '../../../utils';
23
18
  import { getUserContextData } from '../utils/userContextData';
24
19
  import { createConfirmSignUpClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';
25
20
  import { createCognitoUserPoolEndpointResolver } from '../factories';
21
+ import { autoSignInStore } from '../../../client/utils/store';
22
+
23
+ import { resetAutoSignIn } from './autoSignIn';
26
24
 
27
25
  /**
28
26
  * Confirms a new user account.
@@ -65,7 +63,7 @@ export async function confirmSignUp(
65
63
  }),
66
64
  });
67
65
 
68
- await confirmSignUpClient(
66
+ const { Session: session } = await confirmSignUpClient(
69
67
  {
70
68
  region: getRegionFromUserPoolId(authConfig.userPoolId),
71
69
  userAgentValue: getAuthUserAgentValue(AuthAction.ConfirmSignUp),
@@ -88,16 +86,20 @@ export async function confirmSignUp(
88
86
  signUpStep: 'DONE',
89
87
  },
90
88
  };
89
+ const autoSignInStoreState = autoSignInStore.getState();
91
90
 
92
91
  if (
93
- !isAutoSignInStarted() ||
94
- !isAutoSignInUserUsingConfirmSignUp(username)
92
+ !autoSignInStoreState.active ||
93
+ autoSignInStoreState.username !== username
95
94
  ) {
96
95
  resolve(signUpOut);
96
+ resetAutoSignIn();
97
97
 
98
98
  return;
99
99
  }
100
100
 
101
+ autoSignInStore.dispatch({ type: 'SET_SESSION', value: session });
102
+
101
103
  const stopListener = HubInternal.listen<AutoSignInEventData>(
102
104
  'auth-internal',
103
105
  ({ payload }) => {
@@ -109,7 +111,6 @@ export async function confirmSignUp(
109
111
  signUpStep: 'COMPLETE_AUTO_SIGN_IN',
110
112
  },
111
113
  });
112
- setAutoSignInStarted(false);
113
114
  stopListener();
114
115
  }
115
116
  },
@@ -13,6 +13,8 @@ import { signInWithCustomAuth } from './signInWithCustomAuth';
13
13
  import { signInWithCustomSRPAuth } from './signInWithCustomSRPAuth';
14
14
  import { signInWithSRP } from './signInWithSRP';
15
15
  import { signInWithUserPassword } from './signInWithUserPassword';
16
+ import { signInWithUserAuth } from './signInWithUserAuth';
17
+ import { resetAutoSignIn } from './autoSignIn';
16
18
 
17
19
  /**
18
20
  * Signs a user in
@@ -26,6 +28,12 @@ import { signInWithUserPassword } from './signInWithUserPassword';
26
28
  * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.
27
29
  */
28
30
  export async function signIn(input: SignInInput): Promise<SignInOutput> {
31
+ // Here we want to reset the store but not reassign the callback.
32
+ // The callback is reset when the underlying promise resolves or rejects.
33
+ // With the advent of session based sign in, this guarantees that the signIn API initiates a new auth flow,
34
+ // regardless of whether it is called for a user currently engaged in an active auto sign in session.
35
+ resetAutoSignIn(false);
36
+
29
37
  const authFlowType = input.options?.authFlowType;
30
38
  await assertUserNotAuthenticated();
31
39
  switch (authFlowType) {
@@ -37,6 +45,8 @@ export async function signIn(input: SignInInput): Promise<SignInOutput> {
37
45
  return signInWithCustomAuth(input);
38
46
  case 'CUSTOM_WITH_SRP':
39
47
  return signInWithCustomSRPAuth(input);
48
+ case 'USER_AUTH':
49
+ return signInWithUserAuth(input);
40
50
  default:
41
51
  return signInWithSRP(input);
42
52
  }
@@ -24,7 +24,7 @@ import {
24
24
  import {
25
25
  cleanActiveSignInState,
26
26
  setActiveSignInState,
27
- } from '../utils/signInStore';
27
+ } from '../../../client/utils/store';
28
28
  import { cacheCognitoTokens } from '../tokenProvider/cacheTokens';
29
29
  import {
30
30
  ChallengeName,
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  cleanActiveSignInState,
28
28
  setActiveSignInState,
29
- } from '../utils/signInStore';
29
+ } from '../../../client/utils/store';
30
30
  import { cacheCognitoTokens } from '../tokenProvider/cacheTokens';
31
31
  import {
32
32
  ChallengeName,
@@ -30,11 +30,13 @@ import {
30
30
  import {
31
31
  cleanActiveSignInState,
32
32
  setActiveSignInState,
33
- } from '../utils/signInStore';
33
+ } from '../../../client/utils/store';
34
34
  import { cacheCognitoTokens } from '../tokenProvider/cacheTokens';
35
35
  import { tokenOrchestrator } from '../tokenProvider';
36
36
  import { dispatchSignedInHubEvent } from '../utils/dispatchSignedInHubEvent';
37
37
 
38
+ import { resetAutoSignIn } from './autoSignIn';
39
+
38
40
  /**
39
41
  * Signs a user in
40
42
  *
@@ -104,6 +106,8 @@ export async function signInWithSRP(
104
106
 
105
107
  await dispatchSignedInHubEvent();
106
108
 
109
+ resetAutoSignIn();
110
+
107
111
  return {
108
112
  isSignedIn: true,
109
113
  nextStep: { signInStep: 'DONE' },
@@ -116,6 +120,7 @@ export async function signInWithSRP(
116
120
  });
117
121
  } catch (error) {
118
122
  cleanActiveSignInState();
123
+ resetAutoSignIn();
119
124
  assertServiceError(error);
120
125
  const result = getSignInResultFromError(error.name);
121
126
  if (result) return result;
@@ -0,0 +1,141 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { Amplify } from '@aws-amplify/core';
5
+ import { assertTokenProviderConfig } from '@aws-amplify/core/internals/utils';
6
+
7
+ import { AuthValidationErrorCode } from '../../../errors/types/validation';
8
+ import { assertValidationError } from '../../../errors/utils/assertValidationError';
9
+ import { assertServiceError } from '../../../errors/utils/assertServiceError';
10
+ import {
11
+ ChallengeName,
12
+ ChallengeParameters,
13
+ } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types';
14
+ import {
15
+ InitiateAuthException,
16
+ RespondToAuthChallengeException,
17
+ } from '../types/errors';
18
+ import {
19
+ getActiveSignInUsername,
20
+ getNewDeviceMetadata,
21
+ getSignInResult,
22
+ getSignInResultFromError,
23
+ } from '../utils/signInHelpers';
24
+ import {
25
+ CognitoAuthSignInDetails,
26
+ SignInWithUserAuthInput,
27
+ SignInWithUserAuthOutput,
28
+ } from '../types';
29
+ import {
30
+ autoSignInStore,
31
+ cleanActiveSignInState,
32
+ setActiveSignInState,
33
+ } from '../../../client/utils/store';
34
+ import { cacheCognitoTokens } from '../tokenProvider/cacheTokens';
35
+ import { dispatchSignedInHubEvent } from '../utils/dispatchSignedInHubEvent';
36
+ import { tokenOrchestrator } from '../tokenProvider';
37
+ import {
38
+ HandleUserAuthFlowInput,
39
+ handleUserAuthFlow,
40
+ } from '../../../client/flows/userAuth/handleUserAuthFlow';
41
+
42
+ import { resetAutoSignIn } from './autoSignIn';
43
+
44
+ /**
45
+ * Signs a user in through a registered email or phone number without a password by by receiving and entering an OTP.
46
+ *
47
+ * @param input - The SignInWithUserAuthInput object
48
+ * @returns SignInWithUserAuthOutput
49
+ * @throws service: {@link InitiateAuthException }, {@link RespondToAuthChallengeException } - Cognito service errors
50
+ * thrown during the sign-in process.
51
+ * @throws validation: {@link AuthValidationErrorCode } - Validation errors thrown when either username or password -- needs to change
52
+ * are not defined.
53
+ * @throws AuthTokenConfigException - Thrown when the token provider config is invalid.
54
+ */
55
+ export async function signInWithUserAuth(
56
+ input: SignInWithUserAuthInput,
57
+ ): Promise<SignInWithUserAuthOutput> {
58
+ const { username, password, options } = input;
59
+ const authConfig = Amplify.getConfig().Auth?.Cognito;
60
+ const signInDetails: CognitoAuthSignInDetails = {
61
+ loginId: username,
62
+ authFlowType: 'USER_AUTH',
63
+ };
64
+ assertTokenProviderConfig(authConfig);
65
+ const clientMetaData = options?.clientMetadata;
66
+ const preferredChallenge = options?.preferredChallenge;
67
+
68
+ assertValidationError(
69
+ !!username,
70
+ AuthValidationErrorCode.EmptySignInUsername,
71
+ );
72
+
73
+ try {
74
+ const handleUserAuthFlowInput: HandleUserAuthFlowInput = {
75
+ username,
76
+ config: authConfig,
77
+ tokenOrchestrator,
78
+ clientMetadata: clientMetaData,
79
+ preferredChallenge,
80
+ password,
81
+ };
82
+
83
+ const autoSignInStoreState = autoSignInStore.getState();
84
+ if (
85
+ autoSignInStoreState.active &&
86
+ autoSignInStoreState.username === username
87
+ ) {
88
+ handleUserAuthFlowInput.session = autoSignInStoreState.session;
89
+ }
90
+
91
+ const response = await handleUserAuthFlow(handleUserAuthFlowInput);
92
+
93
+ const activeUsername = getActiveSignInUsername(username);
94
+
95
+ setActiveSignInState({
96
+ signInSession: response.Session,
97
+ username: activeUsername,
98
+ challengeName: response.ChallengeName as ChallengeName,
99
+ signInDetails,
100
+ });
101
+
102
+ if (response.AuthenticationResult) {
103
+ cleanActiveSignInState();
104
+ await cacheCognitoTokens({
105
+ username: activeUsername,
106
+ ...response.AuthenticationResult,
107
+ NewDeviceMetadata: await getNewDeviceMetadata({
108
+ userPoolId: authConfig.userPoolId,
109
+ userPoolEndpoint: authConfig.userPoolEndpoint,
110
+ newDeviceMetadata: response.AuthenticationResult.NewDeviceMetadata,
111
+ accessToken: response.AuthenticationResult.AccessToken,
112
+ }),
113
+ signInDetails,
114
+ });
115
+ await dispatchSignedInHubEvent();
116
+
117
+ resetAutoSignIn();
118
+
119
+ return {
120
+ isSignedIn: true,
121
+ nextStep: { signInStep: 'DONE' },
122
+ };
123
+ }
124
+
125
+ return getSignInResult({
126
+ challengeName: response.ChallengeName as ChallengeName,
127
+ challengeParameters: response.ChallengeParameters as ChallengeParameters,
128
+ availableChallenges:
129
+ 'AvailableChallenges' in response
130
+ ? (response.AvailableChallenges as ChallengeName[])
131
+ : undefined,
132
+ });
133
+ } catch (error) {
134
+ cleanActiveSignInState();
135
+ resetAutoSignIn();
136
+ assertServiceError(error);
137
+ const result = getSignInResultFromError(error.name);
138
+ if (result) return result;
139
+ throw error;
140
+ }
141
+ }
@@ -28,11 +28,13 @@ import {
28
28
  import {
29
29
  cleanActiveSignInState,
30
30
  setActiveSignInState,
31
- } from '../utils/signInStore';
31
+ } from '../../../client/utils/store';
32
32
  import { cacheCognitoTokens } from '../tokenProvider/cacheTokens';
33
33
  import { tokenOrchestrator } from '../tokenProvider';
34
34
  import { dispatchSignedInHubEvent } from '../utils/dispatchSignedInHubEvent';
35
35
 
36
+ import { resetAutoSignIn } from './autoSignIn';
37
+
36
38
  /**
37
39
  * Signs a user in using USER_PASSWORD_AUTH AuthFlowType
38
40
  *
@@ -84,6 +86,7 @@ export async function signInWithUserPassword(
84
86
  signInDetails,
85
87
  });
86
88
  if (AuthenticationResult) {
89
+ cleanActiveSignInState();
87
90
  await cacheCognitoTokens({
88
91
  ...AuthenticationResult,
89
92
  username: activeUsername,
@@ -95,10 +98,11 @@ export async function signInWithUserPassword(
95
98
  }),
96
99
  signInDetails,
97
100
  });
98
- cleanActiveSignInState();
99
101
 
100
102
  await dispatchSignedInHubEvent();
101
103
 
104
+ resetAutoSignIn();
105
+
102
106
  return {
103
107
  isSignedIn: true,
104
108
  nextStep: { signInStep: 'DONE' },
@@ -111,6 +115,7 @@ export async function signInWithUserPassword(
111
115
  });
112
116
  } catch (error) {
113
117
  cleanActiveSignInState();
118
+ resetAutoSignIn();
114
119
  assertServiceError(error);
115
120
  const result = getSignInResultFromError(error.name);
116
121
  if (result) return result;