@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.
- package/dist/cjs/client/apis/associateWebAuthnCredential.js +62 -0
- package/dist/cjs/client/apis/associateWebAuthnCredential.js.map +1 -0
- package/dist/cjs/client/apis/deleteWebAuthnCredential.js +22 -0
- package/dist/cjs/client/apis/deleteWebAuthnCredential.js.map +1 -0
- package/dist/cjs/client/apis/index.js +13 -0
- package/dist/cjs/client/apis/index.js.map +1 -0
- package/dist/cjs/client/apis/listWebAuthnCredentials.js +23 -0
- package/dist/cjs/client/apis/listWebAuthnCredentials.js.map +1 -0
- package/dist/cjs/client/flows/shared/handlePasswordSRP.js +79 -0
- package/dist/cjs/client/flows/shared/handlePasswordSRP.js.map +1 -0
- package/dist/cjs/client/flows/userAuth/handleSelectChallenge.js +46 -0
- package/dist/cjs/client/flows/userAuth/handleSelectChallenge.js.map +1 -0
- package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPassword.js +59 -0
- package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPassword.js.map +1 -0
- package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.js +74 -0
- package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.js.map +1 -0
- package/dist/cjs/client/flows/userAuth/handleUserAuthFlow.js +84 -0
- package/dist/cjs/client/flows/userAuth/handleUserAuthFlow.js.map +1 -0
- package/dist/cjs/client/flows/userAuth/handleWebAuthnSignInResult.js +88 -0
- package/dist/cjs/client/flows/userAuth/handleWebAuthnSignInResult.js.map +1 -0
- package/dist/cjs/client/utils/index.js +9 -0
- package/dist/cjs/client/utils/index.js.map +1 -0
- package/dist/cjs/client/utils/passkey/errors.js +180 -0
- package/dist/cjs/client/utils/passkey/errors.js.map +1 -0
- package/dist/cjs/client/utils/passkey/getIsPasskeySupported.js +20 -0
- package/dist/cjs/client/utils/passkey/getIsPasskeySupported.js.map +1 -0
- package/dist/cjs/client/utils/passkey/getIsPasskeySupported.native.js +12 -0
- package/dist/cjs/client/utils/passkey/getIsPasskeySupported.native.js.map +1 -0
- package/dist/cjs/client/utils/passkey/getPasskey.js +27 -0
- package/dist/cjs/client/utils/passkey/getPasskey.js.map +1 -0
- package/dist/cjs/client/utils/passkey/getPasskey.native.js +12 -0
- package/dist/cjs/client/utils/passkey/getPasskey.native.js.map +1 -0
- package/dist/cjs/client/utils/passkey/index.js +11 -0
- package/dist/cjs/client/utils/passkey/index.js.map +1 -0
- package/dist/cjs/client/utils/passkey/registerPasskey.js +32 -0
- package/dist/cjs/client/utils/passkey/registerPasskey.js.map +1 -0
- package/dist/cjs/client/utils/passkey/registerPasskey.native.js +12 -0
- package/dist/cjs/client/utils/passkey/registerPasskey.native.js.map +1 -0
- package/dist/cjs/client/utils/passkey/serde.js +106 -0
- package/dist/cjs/client/utils/passkey/serde.js.map +1 -0
- package/dist/cjs/client/utils/passkey/types/index.js +25 -0
- package/dist/cjs/client/utils/passkey/types/index.js.map +1 -0
- package/dist/cjs/client/utils/passkey/types/shared.js +18 -0
- package/dist/cjs/client/utils/passkey/types/shared.js.map +1 -0
- package/dist/cjs/client/utils/store/autoSignInStore.js +45 -0
- package/dist/cjs/client/utils/store/autoSignInStore.js.map +1 -0
- package/dist/cjs/client/utils/store/index.js +9 -0
- package/dist/cjs/client/utils/store/index.js.map +1 -0
- package/dist/cjs/client/utils/store/signInStore.js.map +1 -0
- package/dist/cjs/client/utils/store/types.js +6 -0
- package/dist/cjs/client/utils/store/types.js.map +1 -0
- package/dist/cjs/foundation/apis/deleteWebAuthnCredential.js +33 -0
- package/dist/cjs/foundation/apis/deleteWebAuthnCredential.js.map +1 -0
- package/dist/cjs/foundation/apis/index.js +11 -0
- package/dist/cjs/foundation/apis/index.js.map +1 -0
- package/dist/cjs/foundation/apis/listWebAuthnCredentials.js +46 -0
- package/dist/cjs/foundation/apis/listWebAuthnCredentials.js.map +1 -0
- package/dist/cjs/foundation/convert/base64url/convertArrayBufferToBase64Url.js +21 -0
- package/dist/cjs/foundation/convert/base64url/convertArrayBufferToBase64Url.js.map +1 -0
- package/dist/cjs/foundation/convert/base64url/convertBase64UrlToArrayBuffer.js +17 -0
- package/dist/cjs/foundation/convert/base64url/convertBase64UrlToArrayBuffer.js.map +1 -0
- package/dist/cjs/foundation/convert/base64url/index.js +11 -0
- package/dist/cjs/foundation/convert/base64url/index.js.map +1 -0
- package/dist/cjs/foundation/convert/index.js +10 -0
- package/dist/cjs/foundation/convert/index.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.js +16 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.js +16 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.js +16 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.js +33 -4
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.js.map +1 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.js +16 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/index.js +9 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/index.js.map +1 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.js +44 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.js +3 -2
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.js.map +1 -1
- package/dist/cjs/foundation/types/index.js +6 -0
- package/dist/cjs/foundation/types/index.js.map +1 -0
- package/dist/cjs/foundation/types/inputs.js +6 -0
- package/dist/cjs/foundation/types/inputs.js.map +1 -0
- package/dist/cjs/foundation/types/models.js +6 -0
- package/dist/cjs/foundation/types/models.js.map +1 -0
- package/dist/cjs/foundation/types/outputs.js +6 -0
- package/dist/cjs/foundation/types/outputs.js.map +1 -0
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/providers/cognito/apis/autoSignIn.js +6 -2
- package/dist/cjs/providers/cognito/apis/autoSignIn.js.map +1 -1
- package/dist/cjs/providers/cognito/apis/confirmSignIn.js +4 -4
- package/dist/cjs/providers/cognito/apis/confirmSignIn.js.map +1 -1
- package/dist/cjs/providers/cognito/apis/confirmSignUp.js +8 -5
- package/dist/cjs/providers/cognito/apis/confirmSignUp.js.map +1 -1
- package/dist/cjs/providers/cognito/apis/signIn.js +9 -0
- package/dist/cjs/providers/cognito/apis/signIn.js.map +1 -1
- package/dist/cjs/providers/cognito/apis/signInWithCustomAuth.js +4 -4
- package/dist/cjs/providers/cognito/apis/signInWithCustomAuth.js.map +1 -1
- package/dist/cjs/providers/cognito/apis/signInWithCustomSRPAuth.js +4 -4
- package/dist/cjs/providers/cognito/apis/signInWithCustomSRPAuth.js.map +1 -1
- package/dist/cjs/providers/cognito/apis/signInWithSRP.js +7 -4
- package/dist/cjs/providers/cognito/apis/signInWithSRP.js.map +1 -1
- package/dist/cjs/providers/cognito/apis/signInWithUserAuth.js +102 -0
- package/dist/cjs/providers/cognito/apis/signInWithUserAuth.js.map +1 -0
- package/dist/cjs/providers/cognito/apis/signInWithUserPassword.js +7 -4
- package/dist/cjs/providers/cognito/apis/signInWithUserPassword.js.map +1 -1
- package/dist/cjs/providers/cognito/apis/signUp.js +56 -49
- package/dist/cjs/providers/cognito/apis/signUp.js.map +1 -1
- package/dist/cjs/providers/cognito/utils/signInHelpers.js +60 -42
- package/dist/cjs/providers/cognito/utils/signInHelpers.js.map +1 -1
- package/dist/cjs/providers/cognito/utils/signUpHelpers.js +5 -31
- package/dist/cjs/providers/cognito/utils/signUpHelpers.js.map +1 -1
- package/dist/esm/client/apis/associateWebAuthnCredential.d.ts +14 -0
- package/dist/esm/client/apis/associateWebAuthnCredential.mjs +69 -0
- package/dist/esm/client/apis/associateWebAuthnCredential.mjs.map +1 -0
- package/dist/esm/client/apis/deleteWebAuthnCredential.d.ts +11 -0
- package/dist/esm/client/apis/deleteWebAuthnCredential.mjs +29 -0
- package/dist/esm/client/apis/deleteWebAuthnCredential.mjs.map +1 -0
- package/dist/esm/client/apis/index.d.ts +3 -0
- package/dist/esm/client/apis/index.mjs +4 -0
- package/dist/esm/client/apis/index.mjs.map +1 -0
- package/dist/esm/client/apis/listWebAuthnCredentials.d.ts +12 -0
- package/dist/esm/client/apis/listWebAuthnCredentials.mjs +30 -0
- package/dist/esm/client/apis/listWebAuthnCredentials.mjs.map +1 -0
- package/dist/esm/client/flows/shared/handlePasswordSRP.d.ts +31 -0
- package/dist/esm/client/flows/shared/handlePasswordSRP.mjs +86 -0
- package/dist/esm/client/flows/shared/handlePasswordSRP.mjs.map +1 -0
- package/dist/esm/client/flows/userAuth/handleSelectChallenge.d.ts +23 -0
- package/dist/esm/client/flows/userAuth/handleSelectChallenge.mjs +51 -0
- package/dist/esm/client/flows/userAuth/handleSelectChallenge.mjs.map +1 -0
- package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.d.ts +16 -0
- package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.mjs +64 -0
- package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.mjs.map +1 -0
- package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.d.ts +18 -0
- package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.mjs +81 -0
- package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.mjs.map +1 -0
- package/dist/esm/client/flows/userAuth/handleUserAuthFlow.d.ts +27 -0
- package/dist/esm/client/flows/userAuth/handleUserAuthFlow.mjs +88 -0
- package/dist/esm/client/flows/userAuth/handleUserAuthFlow.mjs.map +1 -0
- package/dist/esm/client/flows/userAuth/handleWebAuthnSignInResult.d.ts +3 -0
- package/dist/esm/client/flows/userAuth/handleWebAuthnSignInResult.mjs +93 -0
- package/dist/esm/client/flows/userAuth/handleWebAuthnSignInResult.mjs.map +1 -0
- package/dist/esm/client/utils/index.d.ts +1 -0
- package/dist/esm/client/utils/index.mjs +4 -0
- package/dist/esm/client/utils/index.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/errors.d.ts +33 -0
- package/dist/esm/client/utils/passkey/errors.mjs +176 -0
- package/dist/esm/client/utils/passkey/errors.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/getIsPasskeySupported.d.ts +6 -0
- package/dist/esm/client/utils/passkey/getIsPasskeySupported.mjs +18 -0
- package/dist/esm/client/utils/passkey/getIsPasskeySupported.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/getIsPasskeySupported.native.d.ts +1 -0
- package/dist/esm/client/utils/passkey/getIsPasskeySupported.native.mjs +10 -0
- package/dist/esm/client/utils/passkey/getIsPasskeySupported.native.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/getPasskey.d.ts +2 -0
- package/dist/esm/client/utils/passkey/getPasskey.mjs +25 -0
- package/dist/esm/client/utils/passkey/getPasskey.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/getPasskey.native.d.ts +1 -0
- package/dist/esm/client/utils/passkey/getPasskey.native.mjs +10 -0
- package/dist/esm/client/utils/passkey/getPasskey.native.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/index.d.ts +2 -0
- package/dist/esm/client/utils/passkey/index.mjs +3 -0
- package/dist/esm/client/utils/passkey/index.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/registerPasskey.d.ts +7 -0
- package/dist/esm/client/utils/passkey/registerPasskey.mjs +30 -0
- package/dist/esm/client/utils/passkey/registerPasskey.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/registerPasskey.native.d.ts +1 -0
- package/dist/esm/client/utils/passkey/registerPasskey.native.mjs +10 -0
- package/dist/esm/client/utils/passkey/registerPasskey.native.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/serde.d.ts +25 -0
- package/dist/esm/client/utils/passkey/serde.mjs +102 -0
- package/dist/esm/client/utils/passkey/serde.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/types/index.d.ts +16 -0
- package/dist/esm/client/utils/passkey/types/index.mjs +18 -0
- package/dist/esm/client/utils/passkey/types/index.mjs.map +1 -0
- package/dist/esm/client/utils/passkey/types/shared.d.ts +106 -0
- package/dist/esm/client/utils/passkey/types/shared.mjs +16 -0
- package/dist/esm/client/utils/passkey/types/shared.mjs.map +1 -0
- package/dist/esm/client/utils/store/autoSignInStore.d.ts +21 -0
- package/dist/esm/client/utils/store/autoSignInStore.mjs +43 -0
- package/dist/esm/client/utils/store/autoSignInStore.mjs.map +1 -0
- package/dist/esm/client/utils/store/index.d.ts +2 -0
- package/dist/esm/client/utils/store/index.mjs +3 -0
- package/dist/esm/client/utils/store/index.mjs.map +1 -0
- package/dist/esm/{providers/cognito/utils → client/utils/store}/signInStore.d.ts +1 -1
- package/dist/esm/client/utils/store/signInStore.mjs.map +1 -0
- package/dist/esm/client/utils/store/types.d.ts +5 -0
- package/dist/esm/client/utils/store/types.mjs +2 -0
- package/dist/esm/client/utils/store/types.mjs.map +1 -0
- package/dist/esm/foundation/apis/deleteWebAuthnCredential.d.ts +3 -0
- package/dist/esm/foundation/apis/deleteWebAuthnCredential.mjs +38 -0
- package/dist/esm/foundation/apis/deleteWebAuthnCredential.mjs.map +1 -0
- package/dist/esm/foundation/apis/index.d.ts +2 -0
- package/dist/esm/foundation/apis/index.mjs +3 -0
- package/dist/esm/foundation/apis/index.mjs.map +1 -0
- package/dist/esm/foundation/apis/listWebAuthnCredentials.d.ts +3 -0
- package/dist/esm/foundation/apis/listWebAuthnCredentials.mjs +51 -0
- package/dist/esm/foundation/apis/listWebAuthnCredentials.mjs.map +1 -0
- package/dist/esm/foundation/convert/base64url/convertArrayBufferToBase64Url.d.ts +6 -0
- package/dist/esm/foundation/convert/base64url/convertArrayBufferToBase64Url.mjs +19 -0
- package/dist/esm/foundation/convert/base64url/convertArrayBufferToBase64Url.mjs.map +1 -0
- package/dist/esm/foundation/convert/base64url/convertBase64UrlToArrayBuffer.d.ts +6 -0
- package/dist/esm/foundation/convert/base64url/convertBase64UrlToArrayBuffer.mjs +15 -0
- package/dist/esm/foundation/convert/base64url/convertBase64UrlToArrayBuffer.mjs.map +1 -0
- package/dist/esm/foundation/convert/base64url/index.d.ts +2 -0
- package/dist/esm/foundation/convert/base64url/index.mjs +3 -0
- package/dist/esm/foundation/convert/base64url/index.mjs.map +1 -0
- package/dist/esm/foundation/convert/index.d.ts +1 -0
- package/dist/esm/foundation/convert/index.mjs +3 -0
- package/dist/esm/foundation/convert/index.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.d.ts +13 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.mjs +17 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.d.ts +13 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.mjs +17 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.d.ts +13 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.mjs +17 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.d.ts +3 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.mjs +32 -7
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.mjs.map +1 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.d.ts +13 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.mjs +17 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/index.d.ts +4 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/index.mjs +4 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/index.mjs.map +1 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createUserPoolSerializer.d.ts +1 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.d.ts +37 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.mjs +46 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.d.ts +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.mjs +1 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/types/sdk.d.ts +109 -5
- package/dist/esm/foundation/types/index.d.ts +3 -0
- package/dist/esm/foundation/types/index.mjs +2 -0
- package/dist/esm/foundation/types/index.mjs.map +1 -0
- package/dist/esm/foundation/types/inputs.d.ts +10 -0
- package/dist/esm/foundation/types/inputs.mjs +2 -0
- package/dist/esm/foundation/types/inputs.mjs.map +1 -0
- package/dist/esm/foundation/types/models.d.ts +11 -0
- package/dist/esm/foundation/types/models.mjs +2 -0
- package/dist/esm/foundation/types/models.mjs.map +1 -0
- package/dist/esm/foundation/types/outputs.d.ts +8 -0
- package/dist/esm/foundation/types/outputs.mjs +2 -0
- package/dist/esm/foundation/types/outputs.mjs.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/autoSignIn.d.ts +1 -1
- package/dist/esm/providers/cognito/apis/autoSignIn.mjs +7 -2
- package/dist/esm/providers/cognito/apis/autoSignIn.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/confirmResetPassword.mjs +2 -0
- package/dist/esm/providers/cognito/apis/confirmResetPassword.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/confirmSignIn.mjs +2 -1
- package/dist/esm/providers/cognito/apis/confirmSignIn.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/confirmSignUp.mjs +11 -5
- package/dist/esm/providers/cognito/apis/confirmSignUp.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/confirmUserAttribute.mjs +2 -0
- package/dist/esm/providers/cognito/apis/confirmUserAttribute.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/deleteUser.mjs +3 -0
- package/dist/esm/providers/cognito/apis/deleteUser.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/deleteUserAttributes.mjs +3 -0
- package/dist/esm/providers/cognito/apis/deleteUserAttributes.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/fetchDevices.mjs +3 -0
- package/dist/esm/providers/cognito/apis/fetchDevices.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/fetchMFAPreference.mjs +3 -0
- package/dist/esm/providers/cognito/apis/fetchMFAPreference.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/forgetDevice.mjs +3 -0
- package/dist/esm/providers/cognito/apis/forgetDevice.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/internal/fetchUserAttributes.mjs +3 -0
- package/dist/esm/providers/cognito/apis/internal/fetchUserAttributes.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/rememberDevice.mjs +3 -0
- package/dist/esm/providers/cognito/apis/rememberDevice.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/resendSignUpCode.mjs +2 -0
- package/dist/esm/providers/cognito/apis/resendSignUpCode.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/resetPassword.mjs +2 -0
- package/dist/esm/providers/cognito/apis/resetPassword.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/sendUserAttributeVerificationCode.mjs +3 -0
- package/dist/esm/providers/cognito/apis/sendUserAttributeVerificationCode.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/setUpTOTP.mjs +2 -0
- package/dist/esm/providers/cognito/apis/setUpTOTP.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/signIn.mjs +9 -0
- package/dist/esm/providers/cognito/apis/signIn.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/signInWithCustomAuth.mjs +2 -1
- package/dist/esm/providers/cognito/apis/signInWithCustomAuth.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/signInWithCustomSRPAuth.mjs +2 -1
- package/dist/esm/providers/cognito/apis/signInWithCustomSRPAuth.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/signInWithSRP.mjs +5 -1
- package/dist/esm/providers/cognito/apis/signInWithSRP.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/signInWithUserAuth.d.ts +13 -0
- package/dist/esm/providers/cognito/apis/signInWithUserAuth.mjs +104 -0
- package/dist/esm/providers/cognito/apis/signInWithUserAuth.mjs.map +1 -0
- package/dist/esm/providers/cognito/apis/signInWithUserPassword.mjs +6 -2
- package/dist/esm/providers/cognito/apis/signInWithUserPassword.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/signOut.mjs +2 -0
- package/dist/esm/providers/cognito/apis/signOut.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/signUp.mjs +58 -50
- package/dist/esm/providers/cognito/apis/signUp.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/updateMFAPreference.mjs +3 -0
- package/dist/esm/providers/cognito/apis/updateMFAPreference.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/updatePassword.mjs +2 -0
- package/dist/esm/providers/cognito/apis/updatePassword.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/updateUserAttributes.mjs +3 -0
- package/dist/esm/providers/cognito/apis/updateUserAttributes.mjs.map +1 -1
- package/dist/esm/providers/cognito/apis/verifyTOTPSetup.mjs +2 -0
- package/dist/esm/providers/cognito/apis/verifyTOTPSetup.mjs.map +1 -1
- package/dist/esm/providers/cognito/types/index.d.ts +2 -2
- package/dist/esm/providers/cognito/types/inputs.d.ts +4 -0
- package/dist/esm/providers/cognito/types/models.d.ts +7 -1
- package/dist/esm/providers/cognito/types/options.d.ts +2 -1
- package/dist/esm/providers/cognito/types/outputs.d.ts +4 -0
- package/dist/esm/providers/cognito/utils/refreshAuthTokens.mjs +3 -0
- package/dist/esm/providers/cognito/utils/refreshAuthTokens.mjs.map +1 -1
- package/dist/esm/providers/cognito/utils/signInHelpers.d.ts +2 -1
- package/dist/esm/providers/cognito/utils/signInHelpers.mjs +56 -37
- package/dist/esm/providers/cognito/utils/signInHelpers.mjs.map +1 -1
- package/dist/esm/providers/cognito/utils/signUpHelpers.d.ts +0 -6
- package/dist/esm/providers/cognito/utils/signUpHelpers.mjs +5 -26
- package/dist/esm/providers/cognito/utils/signUpHelpers.mjs.map +1 -1
- package/dist/esm/types/inputs.d.ts +2 -2
- package/dist/esm/types/models.d.ts +9 -1
- package/package.json +104 -104
- package/src/client/apis/associateWebAuthnCredential.ts +94 -0
- package/src/client/apis/deleteWebAuthnCredential.ts +24 -0
- package/src/client/apis/index.ts +6 -0
- package/src/client/apis/listWebAuthnCredentials.ts +28 -0
- package/src/client/flows/shared/handlePasswordSRP.ts +123 -0
- package/src/client/flows/userAuth/handleSelectChallenge.ts +62 -0
- package/src/client/flows/userAuth/handleSelectChallengeWithPassword.ts +74 -0
- package/src/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.ts +105 -0
- package/src/client/flows/userAuth/handleUserAuthFlow.ts +125 -0
- package/src/client/flows/userAuth/handleWebAuthnSignInResult.ts +130 -0
- package/src/client/utils/index.ts +4 -0
- package/src/client/utils/passkey/errors.ts +214 -0
- package/src/client/utils/passkey/getIsPasskeySupported.native.ts +8 -0
- package/src/client/utils/passkey/getIsPasskeySupported.ts +18 -0
- package/src/client/utils/passkey/getPasskey.native.ts +8 -0
- package/src/client/utils/passkey/getPasskey.ts +40 -0
- package/src/client/utils/passkey/index.ts +5 -0
- package/src/client/utils/passkey/registerPasskey.native.ts +8 -0
- package/src/client/utils/passkey/registerPasskey.ts +48 -0
- package/src/client/utils/passkey/serde.ts +151 -0
- package/src/client/utils/passkey/types/index.ts +61 -0
- package/src/client/utils/passkey/types/shared.ts +131 -0
- package/src/client/utils/store/autoSignInStore.ts +64 -0
- package/src/client/utils/store/index.ts +5 -0
- package/src/{providers/cognito/utils → client/utils/store}/signInStore.ts +3 -8
- package/src/client/utils/store/types.ts +9 -0
- package/src/foundation/apis/deleteWebAuthnCredential.ts +45 -0
- package/src/foundation/apis/index.ts +5 -0
- package/src/foundation/apis/listWebAuthnCredentials.ts +68 -0
- package/src/foundation/convert/base64url/convertArrayBufferToBase64Url.ts +18 -0
- package/src/foundation/convert/base64url/convertBase64UrlToArrayBuffer.ts +18 -0
- package/src/foundation/convert/base64url/index.ts +5 -0
- package/src/foundation/convert/index.ts +7 -0
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.ts +31 -0
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.ts +31 -0
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.ts +31 -0
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.ts +44 -7
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.ts +31 -0
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/index.ts +4 -0
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createUserPoolSerializer.ts +5 -1
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.ts +43 -0
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/index.ts +2 -0
- package/src/foundation/factories/serviceClients/cognitoIdentityProvider/types/sdk.ts +141 -5
- package/src/foundation/types/index.ts +9 -0
- package/src/foundation/types/inputs.ts +14 -0
- package/src/foundation/types/models.ts +14 -0
- package/src/foundation/types/outputs.ts +12 -0
- package/src/index.ts +14 -0
- package/src/providers/cognito/apis/autoSignIn.ts +6 -2
- package/src/providers/cognito/apis/confirmSignIn.ts +1 -1
- package/src/providers/cognito/apis/confirmSignUp.ts +10 -9
- package/src/providers/cognito/apis/signIn.ts +10 -0
- package/src/providers/cognito/apis/signInWithCustomAuth.ts +1 -1
- package/src/providers/cognito/apis/signInWithCustomSRPAuth.ts +1 -1
- package/src/providers/cognito/apis/signInWithSRP.ts +6 -1
- package/src/providers/cognito/apis/signInWithUserAuth.ts +141 -0
- package/src/providers/cognito/apis/signInWithUserPassword.ts +7 -2
- package/src/providers/cognito/apis/signUp.ts +81 -72
- package/src/providers/cognito/types/index.ts +2 -0
- package/src/providers/cognito/types/inputs.ts +5 -0
- package/src/providers/cognito/types/models.ts +13 -0
- package/src/providers/cognito/types/options.ts +7 -1
- package/src/providers/cognito/types/outputs.ts +5 -0
- package/src/providers/cognito/utils/signInHelpers.ts +77 -55
- package/src/providers/cognito/utils/signUpHelpers.ts +6 -31
- package/src/types/inputs.ts +2 -2
- package/src/types/models.ts +13 -0
- package/dist/cjs/providers/cognito/utils/signInStore.js.map +0 -1
- package/dist/esm/providers/cognito/utils/signInStore.mjs.map +0 -1
- /package/dist/cjs/{providers/cognito/utils → client/utils/store}/signInStore.js +0 -0
- /package/dist/esm/{providers/cognito/utils → client/utils/store}/signInStore.mjs +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signUpHelpers.js","sources":["../../../../../src/providers/cognito/utils/signUpHelpers.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.autoSignInUserConfirmed = exports.autoSignInWhenUserIsConfirmedWithLink = exports.isSignUpComplete = exports.setAutoSignInStarted = exports.isAutoSignInStarted = exports.isAutoSignInUserUsingConfirmSignUp = exports.setUsernameUsedForAutoSignIn = exports.handleCodeAutoSignIn = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst signIn_1 = require(\"../apis/signIn\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst autoSignIn_1 = require(\"../apis/autoSignIn\");\nconst constants_1 = require(\"../../../errors/constants\");\nconst MAX_AUTOSIGNIN_POLLING_MS = 3 * 60 * 1000;\nfunction handleCodeAutoSignIn(signInInput) {\n const stopHubListener = utils_1.HubInternal.listen('auth-internal', async ({ payload }) => {\n switch (payload.event) {\n case 'confirmSignUp': {\n const response = payload.data;\n if (response?.isSignUpComplete) {\n utils_1.HubInternal.dispatch('auth-internal', {\n event: 'autoSignIn',\n });\n (0, autoSignIn_1.setAutoSignIn)(autoSignInWithCode(signInInput));\n stopHubListener();\n }\n }\n }\n });\n // This will stop the listener if confirmSignUp is not resolved.\n const timeOutId = setTimeout(() => {\n stopHubListener();\n setAutoSignInStarted(false);\n clearTimeout(timeOutId);\n (0, autoSignIn_1.resetAutoSignIn)();\n }, MAX_AUTOSIGNIN_POLLING_MS);\n}\nexports.handleCodeAutoSignIn = handleCodeAutoSignIn;\nfunction debounce(fun, delay) {\n let timer;\n return (args) => {\n if (!timer) {\n fun(...args);\n }\n clearTimeout(timer);\n timer = setTimeout(() => {\n timer = undefined;\n }, delay);\n };\n}\nfunction handleAutoSignInWithLink(signInInput, resolve, reject) {\n const start = Date.now();\n const autoSignInPollingIntervalId = setInterval(async () => {\n const elapsedTime = Date.now() - start;\n const maxTime = MAX_AUTOSIGNIN_POLLING_MS;\n if (elapsedTime > maxTime) {\n clearInterval(autoSignInPollingIntervalId);\n setAutoSignInStarted(false);\n reject(new AuthError_1.AuthError({\n name: constants_1.AUTO_SIGN_IN_EXCEPTION,\n message: 'The account was not confirmed on time.',\n recoverySuggestion: 'Try to verify your account by clicking the link sent your email or phone and then login manually.',\n }));\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n else {\n try {\n const signInOutput = await (0, signIn_1.signIn)(signInInput);\n if (signInOutput.nextStep.signInStep !== 'CONFIRM_SIGN_UP') {\n resolve(signInOutput);\n clearInterval(autoSignInPollingIntervalId);\n setAutoSignInStarted(false);\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n }\n catch (error) {\n clearInterval(autoSignInPollingIntervalId);\n setAutoSignInStarted(false);\n reject(error);\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n }\n }, 5000);\n}\nconst debouncedAutoSignInWithLink = debounce(handleAutoSignInWithLink, 300);\nconst debouncedAutoSignWithCodeOrUserConfirmed = debounce(handleAutoSignInWithCodeOrUserConfirmed, 300);\nlet autoSignInStarted = false;\nlet usernameUsedForAutoSignIn;\nfunction setUsernameUsedForAutoSignIn(username) {\n usernameUsedForAutoSignIn = username;\n}\nexports.setUsernameUsedForAutoSignIn = setUsernameUsedForAutoSignIn;\nfunction isAutoSignInUserUsingConfirmSignUp(username) {\n return usernameUsedForAutoSignIn === username;\n}\nexports.isAutoSignInUserUsingConfirmSignUp = isAutoSignInUserUsingConfirmSignUp;\nfunction isAutoSignInStarted() {\n return autoSignInStarted;\n}\nexports.isAutoSignInStarted = isAutoSignInStarted;\nfunction setAutoSignInStarted(value) {\n if (value === false) {\n setUsernameUsedForAutoSignIn(undefined);\n }\n autoSignInStarted = value;\n}\nexports.setAutoSignInStarted = setAutoSignInStarted;\nfunction isSignUpComplete(output) {\n return !!output.UserConfirmed;\n}\nexports.isSignUpComplete = isSignUpComplete;\nfunction autoSignInWhenUserIsConfirmedWithLink(signInInput) {\n return async () => {\n return new Promise((resolve, reject) => {\n debouncedAutoSignInWithLink([signInInput, resolve, reject]);\n });\n };\n}\nexports.autoSignInWhenUserIsConfirmedWithLink = autoSignInWhenUserIsConfirmedWithLink;\nasync function handleAutoSignInWithCodeOrUserConfirmed(signInInput, resolve, reject) {\n try {\n const output = await (0, signIn_1.signIn)(signInInput);\n resolve(output);\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n catch (error) {\n reject(error);\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n}\nfunction autoSignInWithCode(signInInput) {\n return async () => {\n return new Promise((resolve, reject) => {\n debouncedAutoSignWithCodeOrUserConfirmed([signInInput, resolve, reject]);\n });\n };\n}\nexports.autoSignInUserConfirmed = autoSignInWithCode;\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,OAAO,CAAC,qCAAqC,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,kCAAkC,GAAG,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,oBAAoB,GAAG,KAAK,CAAC,CAAC;AACpS,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;A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K;AAChD,YAAY,wCAAwC,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACrF,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,CAAC;AACD,OAAO,CAAC,uBAAuB,GAAG,kBAAkB;;"}
|
|
1
|
+
{"version":3,"file":"signUpHelpers.js","sources":["../../../../../src/providers/cognito/utils/signUpHelpers.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.autoSignInUserConfirmed = exports.autoSignInWhenUserIsConfirmedWithLink = exports.handleCodeAutoSignIn = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst signIn_1 = require(\"../apis/signIn\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst autoSignIn_1 = require(\"../apis/autoSignIn\");\nconst constants_1 = require(\"../../../errors/constants\");\nconst signInWithUserAuth_1 = require(\"../apis/signInWithUserAuth\");\nconst MAX_AUTOSIGNIN_POLLING_MS = 3 * 60 * 1000;\nfunction handleCodeAutoSignIn(signInInput) {\n const stopHubListener = utils_1.HubInternal.listen('auth-internal', async ({ payload }) => {\n switch (payload.event) {\n case 'confirmSignUp': {\n const response = payload.data;\n if (response?.isSignUpComplete) {\n utils_1.HubInternal.dispatch('auth-internal', {\n event: 'autoSignIn',\n });\n (0, autoSignIn_1.setAutoSignIn)(autoSignInWithCode(signInInput));\n stopHubListener();\n }\n }\n }\n });\n // This will stop the listener if confirmSignUp is not resolved.\n const timeOutId = setTimeout(() => {\n stopHubListener();\n clearTimeout(timeOutId);\n (0, autoSignIn_1.resetAutoSignIn)();\n }, MAX_AUTOSIGNIN_POLLING_MS);\n}\nexports.handleCodeAutoSignIn = handleCodeAutoSignIn;\nfunction debounce(fun, delay) {\n let timer;\n return (args) => {\n if (!timer) {\n fun(...args);\n }\n clearTimeout(timer);\n timer = setTimeout(() => {\n timer = undefined;\n }, delay);\n };\n}\nfunction handleAutoSignInWithLink(signInInput, resolve, reject) {\n const start = Date.now();\n const autoSignInPollingIntervalId = setInterval(async () => {\n const elapsedTime = Date.now() - start;\n const maxTime = MAX_AUTOSIGNIN_POLLING_MS;\n if (elapsedTime > maxTime) {\n clearInterval(autoSignInPollingIntervalId);\n reject(new AuthError_1.AuthError({\n name: constants_1.AUTO_SIGN_IN_EXCEPTION,\n message: 'The account was not confirmed on time.',\n recoverySuggestion: 'Try to verify your account by clicking the link sent your email or phone and then login manually.',\n }));\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n else {\n try {\n const signInOutput = await (0, signIn_1.signIn)(signInInput);\n if (signInOutput.nextStep.signInStep !== 'CONFIRM_SIGN_UP') {\n resolve(signInOutput);\n clearInterval(autoSignInPollingIntervalId);\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n }\n catch (error) {\n clearInterval(autoSignInPollingIntervalId);\n reject(error);\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n }\n }, 5000);\n}\nconst debouncedAutoSignInWithLink = debounce(handleAutoSignInWithLink, 300);\nconst debouncedAutoSignWithCodeOrUserConfirmed = debounce(handleAutoSignInWithCodeOrUserConfirmed, 300);\nfunction autoSignInWhenUserIsConfirmedWithLink(signInInput) {\n return async () => {\n return new Promise((resolve, reject) => {\n debouncedAutoSignInWithLink([signInInput, resolve, reject]);\n });\n };\n}\nexports.autoSignInWhenUserIsConfirmedWithLink = autoSignInWhenUserIsConfirmedWithLink;\nasync function handleAutoSignInWithCodeOrUserConfirmed(signInInput, resolve, reject) {\n try {\n const output = signInInput?.options?.authFlowType === 'USER_AUTH'\n ? await (0, signInWithUserAuth_1.signInWithUserAuth)(signInInput)\n : await (0, signIn_1.signIn)(signInInput);\n resolve(output);\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n catch (error) {\n reject(error);\n (0, autoSignIn_1.resetAutoSignIn)();\n }\n}\nfunction autoSignInWithCode(signInInput) {\n return async () => {\n return new Promise((resolve, reject) => {\n debouncedAutoSignWithCodeOrUserConfirmed([signInInput, resolve, reject]);\n });\n };\n}\nexports.autoSignInUserConfirmed = autoSignInWithCode;\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,OAAO,CAAC,qCAAqC,GAAG,OAAO,CAAC,oBAAoB,GAAG,KAAK,CAAC,CAAC;AACxH,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACzD,MAAM,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AACnD,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACzD,MAAM,oBAAoB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AACnE,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAChD,SAAS,oBAAoB,CAAC,WAAW,EAAE;AAC3C,IAAI,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK;AAC/F,QAAQ,QAAQ,OAAO,CAAC,KAAK;AAC7B,YAAY,KAAK,eAAe,EAAE;AAClC,gBAAgB,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;AAC9C,gBAAgB,IAAI,QAAQ,EAAE,gBAAgB,EAAE;AAChD,oBAAoB,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,EAAE;AAClE,wBAAwB,KAAK,EAAE,YAAY;AAC3C,qBAAqB,CAAC,CAAC;AACvB,oBAAoB,IAAI,YAAY,CA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,CAAC,CAAC;AACX,KAAK,CAAC;AACN,CAAC;AACD,OAAO,CAAC,qCAAqC,GAAG,qCAAqC,CAAC;AACtF,eAAe,uCAAuC,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE;AACrF,IAAI,IAAI;AACR,QAAQ,MAAM,MAAM,GAAG,WAAW,EAAE,OAAO,EAAE,YAAY,KAAK,WAAW;AACzE,cAAc,MAAM,CAAC,CAAC,EAAE,oBAAoB,CAAC,kBAAkB,EAAE,WAAW,CAAC;AAC7E,cAAc,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACtD,QAAQ,OAAO,CAAC,MAAM,CAAC,CAAC;AACxB,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,eAAe,GAAG,CAAC;AAC5C,KAAK;AACL,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,MAAM,CAAC,KAAK,CAAC,CAAC;AACtB,QAAQ,IAAI,YAAY,CAAC,eAAe,GAAG,CAAC;AAC5C,KAAK;AACL,CAAC;AACD,SAAS,kBAAkB,CAAC,WAAW,EAAE;AACzC,IAAI,OAAO,YAAY;AACvB,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAChD,YAAY,wCAAwC,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACrF,SAAS,CAAC,CAAC;AACX,KAAK,CAAC;AACN,CAAC;AACD,OAAO,CAAC,uBAAuB,GAAG,kBAAkB;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers a new passkey for an authenticated user
|
|
3
|
+
*
|
|
4
|
+
* @returns Promise<void>
|
|
5
|
+
* @throws - {@link PasskeyError}:
|
|
6
|
+
* - Thrown when intermediate state is invalid
|
|
7
|
+
* @throws - {@link AuthError}:
|
|
8
|
+
* - Thrown when user is unauthenticated
|
|
9
|
+
* @throws - {@link StartWebAuthnRegistrationException}
|
|
10
|
+
* - Thrown due to a service error retrieving WebAuthn registration options
|
|
11
|
+
* @throws - {@link CompleteWebAuthnRegistrationException}
|
|
12
|
+
* - Thrown due to a service error when verifying WebAuthn registration result
|
|
13
|
+
*/
|
|
14
|
+
export declare function associateWebAuthnCredential(): Promise<void>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Amplify, fetchAuthSession } from '@aws-amplify/core';
|
|
2
|
+
import { assertTokenProviderConfig, AuthAction } from '@aws-amplify/core/internals/utils';
|
|
3
|
+
import { assertAuthTokens } from '../../providers/cognito/utils/types.mjs';
|
|
4
|
+
import { createCognitoUserPoolEndpointResolver } from '../../providers/cognito/factories/createCognitoUserPoolEndpointResolver.mjs';
|
|
5
|
+
import { getRegionFromUserPoolId } from '../../foundation/parsers/regionParsers.mjs';
|
|
6
|
+
import { getAuthUserAgentValue } from '../../utils/getAuthUserAgentValue.mjs';
|
|
7
|
+
import { registerPasskey } from '../utils/passkey/registerPasskey.mjs';
|
|
8
|
+
import '../utils/passkey/errors.mjs';
|
|
9
|
+
import { assertValidCredentialCreationOptions } from '../utils/passkey/types/shared.mjs';
|
|
10
|
+
import '@aws-amplify/core/internals/aws-client-utils/composers';
|
|
11
|
+
import '@aws-amplify/core/internals/aws-client-utils';
|
|
12
|
+
import '../../foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.mjs';
|
|
13
|
+
import '../../foundation/factories/serviceClients/cognitoIdentityProvider/constants.mjs';
|
|
14
|
+
import '../../common/AuthErrorStrings.mjs';
|
|
15
|
+
import '../../errors/types/validation.mjs';
|
|
16
|
+
import '../../providers/cognito/types/errors.mjs';
|
|
17
|
+
import { createStartWebAuthnRegistrationClient } from '../../foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.mjs';
|
|
18
|
+
import { createCompleteWebAuthnRegistrationClient } from '../../foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.mjs';
|
|
19
|
+
|
|
20
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
21
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
22
|
+
/**
|
|
23
|
+
* Registers a new passkey for an authenticated user
|
|
24
|
+
*
|
|
25
|
+
* @returns Promise<void>
|
|
26
|
+
* @throws - {@link PasskeyError}:
|
|
27
|
+
* - Thrown when intermediate state is invalid
|
|
28
|
+
* @throws - {@link AuthError}:
|
|
29
|
+
* - Thrown when user is unauthenticated
|
|
30
|
+
* @throws - {@link StartWebAuthnRegistrationException}
|
|
31
|
+
* - Thrown due to a service error retrieving WebAuthn registration options
|
|
32
|
+
* @throws - {@link CompleteWebAuthnRegistrationException}
|
|
33
|
+
* - Thrown due to a service error when verifying WebAuthn registration result
|
|
34
|
+
*/
|
|
35
|
+
async function associateWebAuthnCredential() {
|
|
36
|
+
const authConfig = Amplify.getConfig().Auth?.Cognito;
|
|
37
|
+
assertTokenProviderConfig(authConfig);
|
|
38
|
+
const { userPoolEndpoint, userPoolId } = authConfig;
|
|
39
|
+
const { tokens } = await fetchAuthSession();
|
|
40
|
+
assertAuthTokens(tokens);
|
|
41
|
+
const startWebAuthnRegistration = createStartWebAuthnRegistrationClient({
|
|
42
|
+
endpointResolver: createCognitoUserPoolEndpointResolver({
|
|
43
|
+
endpointOverride: userPoolEndpoint,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
const { CredentialCreationOptions: credentialCreationOptions } = await startWebAuthnRegistration({
|
|
47
|
+
region: getRegionFromUserPoolId(userPoolId),
|
|
48
|
+
userAgentValue: getAuthUserAgentValue(AuthAction.StartWebAuthnRegistration),
|
|
49
|
+
}, {
|
|
50
|
+
AccessToken: tokens.accessToken.toString(),
|
|
51
|
+
});
|
|
52
|
+
assertValidCredentialCreationOptions(credentialCreationOptions);
|
|
53
|
+
const cred = await registerPasskey(credentialCreationOptions);
|
|
54
|
+
const completeWebAuthnRegistration = createCompleteWebAuthnRegistrationClient({
|
|
55
|
+
endpointResolver: createCognitoUserPoolEndpointResolver({
|
|
56
|
+
endpointOverride: userPoolEndpoint,
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
await completeWebAuthnRegistration({
|
|
60
|
+
region: getRegionFromUserPoolId(userPoolId),
|
|
61
|
+
userAgentValue: getAuthUserAgentValue(AuthAction.CompleteWebAuthnRegistration),
|
|
62
|
+
}, {
|
|
63
|
+
AccessToken: tokens.accessToken.toString(),
|
|
64
|
+
Credential: cred,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { associateWebAuthnCredential };
|
|
69
|
+
//# sourceMappingURL=associateWebAuthnCredential.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"associateWebAuthnCredential.mjs","sources":["../../../../src/client/apis/associateWebAuthnCredential.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify, fetchAuthSession } from '@aws-amplify/core';\nimport { AuthAction, assertTokenProviderConfig, } from '@aws-amplify/core/internals/utils';\nimport { assertAuthTokens } from '../../providers/cognito/utils/types';\nimport { createCognitoUserPoolEndpointResolver } from '../../providers/cognito/factories';\nimport { getRegionFromUserPoolId } from '../../foundation/parsers';\nimport { getAuthUserAgentValue } from '../../utils';\nimport { registerPasskey } from '../utils';\nimport { createCompleteWebAuthnRegistrationClient, createStartWebAuthnRegistrationClient, } from '../../foundation/factories/serviceClients/cognitoIdentityProvider';\nimport { assertValidCredentialCreationOptions } from '../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 */\nexport async function associateWebAuthnCredential() {\n const authConfig = Amplify.getConfig().Auth?.Cognito;\n assertTokenProviderConfig(authConfig);\n const { userPoolEndpoint, userPoolId } = authConfig;\n const { tokens } = await fetchAuthSession();\n assertAuthTokens(tokens);\n const startWebAuthnRegistration = createStartWebAuthnRegistrationClient({\n endpointResolver: createCognitoUserPoolEndpointResolver({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const { CredentialCreationOptions: credentialCreationOptions } = await startWebAuthnRegistration({\n region: getRegionFromUserPoolId(userPoolId),\n userAgentValue: getAuthUserAgentValue(AuthAction.StartWebAuthnRegistration),\n }, {\n AccessToken: tokens.accessToken.toString(),\n });\n assertValidCredentialCreationOptions(credentialCreationOptions);\n const cred = await registerPasskey(credentialCreationOptions);\n const completeWebAuthnRegistration = createCompleteWebAuthnRegistrationClient({\n endpointResolver: createCognitoUserPoolEndpointResolver({\n endpointOverride: userPoolEndpoint,\n }),\n });\n await completeWebAuthnRegistration({\n region: getRegionFromUserPoolId(userPoolId),\n userAgentValue: getAuthUserAgentValue(AuthAction.CompleteWebAuthnRegistration),\n }, {\n AccessToken: tokens.accessToken.toString(),\n Credential: cred,\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,2BAA2B,GAAG;AACpD,IAAI,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC;AACzD,IAAI,yBAAyB,CAAC,UAAU,CAAC,CAAC;AAC1C,IAAI,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;AACxD,IAAI,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,EAAE,CAAC;AAChD,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAI,MAAM,yBAAyB,GAAG,qCAAqC,CAAC;AAC5E,QAAQ,gBAAgB,EAAE,qCAAqC,CAAC;AAChE,YAAY,gBAAgB,EAAE,gBAAgB;AAC9C,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,GAAG,MAAM,yBAAyB,CAAC;AACrG,QAAQ,MAAM,EAAE,uBAAuB,CAAC,UAAU,CAAC;AACnD,QAAQ,cAAc,EAAE,qBAAqB,CAAC,UAAU,CAAC,yBAAyB,CAAC;AACnF,KAAK,EAAE;AACP,QAAQ,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;AAClD,KAAK,CAAC,CAAC;AACP,IAAI,oCAAoC,CAAC,yBAAyB,CAAC,CAAC;AACpE,IAAI,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,yBAAyB,CAAC,CAAC;AAClE,IAAI,MAAM,4BAA4B,GAAG,wCAAwC,CAAC;AAClF,QAAQ,gBAAgB,EAAE,qCAAqC,CAAC;AAChE,YAAY,gBAAgB,EAAE,gBAAgB;AAC9C,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,4BAA4B,CAAC;AACvC,QAAQ,MAAM,EAAE,uBAAuB,CAAC,UAAU,CAAC;AACnD,QAAQ,cAAc,EAAE,qBAAqB,CAAC,UAAU,CAAC,4BAA4B,CAAC;AACtF,KAAK,EAAE;AACP,QAAQ,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;AAClD,QAAQ,UAAU,EAAE,IAAI;AACxB,KAAK,CAAC,CAAC;AACP;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DeleteWebAuthnCredentialInput } from '../../foundation/types';
|
|
2
|
+
/**
|
|
3
|
+
* Delete a registered credential for an authenticated user by credentialId
|
|
4
|
+
* @param {DeleteWebAuthnCredentialInput} input The delete input parameters including the credentialId
|
|
5
|
+
* @returns Promise<void>
|
|
6
|
+
* @throws - {@link AuthError}:
|
|
7
|
+
* - Thrown when user is unauthenticated
|
|
8
|
+
* @throws - {@link DeleteWebAuthnCredentialException}
|
|
9
|
+
* - Thrown due to a service error when deleting a WebAuthn credential
|
|
10
|
+
*/
|
|
11
|
+
export declare function deleteWebAuthnCredential(input: DeleteWebAuthnCredentialInput): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Amplify } from '@aws-amplify/core';
|
|
2
|
+
import '@aws-amplify/core/internals/utils';
|
|
3
|
+
import '../../providers/cognito/utils/types.mjs';
|
|
4
|
+
import '@aws-amplify/core/internals/aws-client-utils';
|
|
5
|
+
import '@aws-amplify/core/internals/aws-client-utils/composers';
|
|
6
|
+
import '../../foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.mjs';
|
|
7
|
+
import '../../foundation/factories/serviceClients/cognitoIdentityProvider/constants.mjs';
|
|
8
|
+
import '../../common/AuthErrorStrings.mjs';
|
|
9
|
+
import '../../errors/types/validation.mjs';
|
|
10
|
+
import '../../providers/cognito/types/errors.mjs';
|
|
11
|
+
import { deleteWebAuthnCredential as deleteWebAuthnCredential$1 } from '../../foundation/apis/deleteWebAuthnCredential.mjs';
|
|
12
|
+
|
|
13
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
14
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
15
|
+
/**
|
|
16
|
+
* Delete a registered credential for an authenticated user by credentialId
|
|
17
|
+
* @param {DeleteWebAuthnCredentialInput} input The delete input parameters including the credentialId
|
|
18
|
+
* @returns Promise<void>
|
|
19
|
+
* @throws - {@link AuthError}:
|
|
20
|
+
* - Thrown when user is unauthenticated
|
|
21
|
+
* @throws - {@link DeleteWebAuthnCredentialException}
|
|
22
|
+
* - Thrown due to a service error when deleting a WebAuthn credential
|
|
23
|
+
*/
|
|
24
|
+
async function deleteWebAuthnCredential(input) {
|
|
25
|
+
return deleteWebAuthnCredential$1(Amplify, input);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { deleteWebAuthnCredential };
|
|
29
|
+
//# sourceMappingURL=deleteWebAuthnCredential.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteWebAuthnCredential.mjs","sources":["../../../../src/client/apis/deleteWebAuthnCredential.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { deleteWebAuthnCredential as deleteWebAuthnCredentialFoundation } from '../../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 */\nexport async function deleteWebAuthnCredential(input) {\n return deleteWebAuthnCredentialFoundation(Amplify, input);\n}\n"],"names":["deleteWebAuthnCredentialFoundation"],"mappings":";;;;;;;;;;;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,wBAAwB,CAAC,KAAK,EAAE;AACtD,IAAI,OAAOA,0BAAkC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC9D;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ListWebAuthnCredentialsInput, ListWebAuthnCredentialsOutput } from '../../foundation/types';
|
|
2
|
+
/**
|
|
3
|
+
* Lists registered credentials for an authenticated user
|
|
4
|
+
*
|
|
5
|
+
* @param {ListWebAuthnCredentialsInput} input The list input parameters including page size and next token.
|
|
6
|
+
* @returns Promise<ListWebAuthnCredentialsOutput>
|
|
7
|
+
* @throws - {@link AuthError}:
|
|
8
|
+
* - Thrown when user is unauthenticated
|
|
9
|
+
* @throws - {@link ListWebAuthnCredentialsException}
|
|
10
|
+
* - Thrown due to a service error when listing WebAuthn credentials
|
|
11
|
+
*/
|
|
12
|
+
export declare function listWebAuthnCredentials(input?: ListWebAuthnCredentialsInput): Promise<ListWebAuthnCredentialsOutput>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Amplify } from '@aws-amplify/core';
|
|
2
|
+
import { listWebAuthnCredentials as listWebAuthnCredentials$1 } from '../../foundation/apis/listWebAuthnCredentials.mjs';
|
|
3
|
+
import '@aws-amplify/core/internals/utils';
|
|
4
|
+
import '../../providers/cognito/utils/types.mjs';
|
|
5
|
+
import '@aws-amplify/core/internals/aws-client-utils';
|
|
6
|
+
import '@aws-amplify/core/internals/aws-client-utils/composers';
|
|
7
|
+
import '../../foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.mjs';
|
|
8
|
+
import '../../foundation/factories/serviceClients/cognitoIdentityProvider/constants.mjs';
|
|
9
|
+
import '../../common/AuthErrorStrings.mjs';
|
|
10
|
+
import '../../errors/types/validation.mjs';
|
|
11
|
+
import '../../providers/cognito/types/errors.mjs';
|
|
12
|
+
|
|
13
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
14
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
15
|
+
/**
|
|
16
|
+
* Lists registered credentials for an authenticated user
|
|
17
|
+
*
|
|
18
|
+
* @param {ListWebAuthnCredentialsInput} input The list input parameters including page size and next token.
|
|
19
|
+
* @returns Promise<ListWebAuthnCredentialsOutput>
|
|
20
|
+
* @throws - {@link AuthError}:
|
|
21
|
+
* - Thrown when user is unauthenticated
|
|
22
|
+
* @throws - {@link ListWebAuthnCredentialsException}
|
|
23
|
+
* - Thrown due to a service error when listing WebAuthn credentials
|
|
24
|
+
*/
|
|
25
|
+
async function listWebAuthnCredentials(input) {
|
|
26
|
+
return listWebAuthnCredentials$1(Amplify, input);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { listWebAuthnCredentials };
|
|
30
|
+
//# sourceMappingURL=listWebAuthnCredentials.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listWebAuthnCredentials.mjs","sources":["../../../../src/client/apis/listWebAuthnCredentials.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { listWebAuthnCredentials as listWebAuthnCredentialsFoundation } from '../../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 */\nexport async function listWebAuthnCredentials(input) {\n return listWebAuthnCredentialsFoundation(Amplify, input);\n}\n"],"names":["listWebAuthnCredentialsFoundation"],"mappings":";;;;;;;;;;;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,uBAAuB,CAAC,KAAK,EAAE;AACrD,IAAI,OAAOA,yBAAiC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7D;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CognitoUserPoolConfig } from '@aws-amplify/core';
|
|
2
|
+
import { AuthTokenOrchestrator } from '../../../providers/cognito/tokenProvider/types';
|
|
3
|
+
import { AuthFlowType, ClientMetadata } from '../../../providers/cognito/types';
|
|
4
|
+
import { RespondToAuthChallengeCommandOutput } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types';
|
|
5
|
+
import { AuthFactorType } from '../../../providers/cognito/types/models';
|
|
6
|
+
interface HandlePasswordSRPInput {
|
|
7
|
+
username: string;
|
|
8
|
+
password: string;
|
|
9
|
+
clientMetadata: ClientMetadata | undefined;
|
|
10
|
+
config: CognitoUserPoolConfig;
|
|
11
|
+
tokenOrchestrator: AuthTokenOrchestrator;
|
|
12
|
+
authFlow: AuthFlowType;
|
|
13
|
+
preferredChallenge?: AuthFactorType;
|
|
14
|
+
}
|
|
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
|
+
export declare function handlePasswordSRP({ username, password, clientMetadata, config, tokenOrchestrator, authFlow, preferredChallenge, }: HandlePasswordSRPInput): Promise<RespondToAuthChallengeCommandOutput>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { AuthAction } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
import { getUserContextData } from '../../../providers/cognito/utils/userContextData.mjs';
|
|
3
|
+
import { getAuthenticationHelper } from '../../../providers/cognito/utils/srp/getAuthenticationHelper.mjs';
|
|
4
|
+
import '../../../providers/cognito/utils/srp/constants.mjs';
|
|
5
|
+
import '@aws-crypto/sha256-js';
|
|
6
|
+
import { setActiveSignInUsername, retryOnResourceNotFoundException, handlePasswordVerifierChallenge } from '../../../providers/cognito/utils/signInHelpers.mjs';
|
|
7
|
+
import { createInitiateAuthClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/createInitiateAuthClient.mjs';
|
|
8
|
+
import '@aws-amplify/core/internals/aws-client-utils/composers';
|
|
9
|
+
import '../../../foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.mjs';
|
|
10
|
+
import '@aws-amplify/core/internals/aws-client-utils';
|
|
11
|
+
import '../../../foundation/factories/serviceClients/cognitoIdentityProvider/constants.mjs';
|
|
12
|
+
import '../../../common/AuthErrorStrings.mjs';
|
|
13
|
+
import '../../../errors/types/validation.mjs';
|
|
14
|
+
import '../../../providers/cognito/types/errors.mjs';
|
|
15
|
+
import { createCognitoUserPoolEndpointResolver } from '../../../providers/cognito/factories/createCognitoUserPoolEndpointResolver.mjs';
|
|
16
|
+
import { getRegionFromUserPoolId } from '../../../foundation/parsers/regionParsers.mjs';
|
|
17
|
+
import { getAuthUserAgentValue } from '../../../utils/getAuthUserAgentValue.mjs';
|
|
18
|
+
|
|
19
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
20
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
21
|
+
/**
|
|
22
|
+
* Handles the Password SRP (Secure Remote Password) authentication flow.
|
|
23
|
+
* This function can be used with both USER_SRP_AUTH and USER_AUTH flows.
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} params - The parameters for the Password SRP authentication
|
|
26
|
+
* @param {string} params.username - The username for authentication
|
|
27
|
+
* @param {string} params.password - The user's password
|
|
28
|
+
* @param {ClientMetadata} [params.clientMetadata] - Optional metadata to be sent with auth requests
|
|
29
|
+
* @param {CognitoUserPoolConfig} params.config - Cognito User Pool configuration
|
|
30
|
+
* @param {AuthTokenOrchestrator} params.tokenOrchestrator - Token orchestrator for managing auth tokens
|
|
31
|
+
* @param {AuthFlowType} params.authFlow - The type of authentication flow ('USER_SRP_AUTH' or 'USER_AUTH')
|
|
32
|
+
* @param {AuthFactorType} [params.preferredChallenge] - Optional preferred challenge type when using USER_AUTH flow
|
|
33
|
+
*
|
|
34
|
+
* @returns {Promise<RespondToAuthChallengeCommandOutput>} The authentication response
|
|
35
|
+
*/
|
|
36
|
+
async function handlePasswordSRP({ username, password, clientMetadata, config, tokenOrchestrator, authFlow, preferredChallenge, }) {
|
|
37
|
+
const { userPoolId, userPoolClientId, userPoolEndpoint } = config;
|
|
38
|
+
const userPoolName = userPoolId?.split('_')[1] || '';
|
|
39
|
+
const authenticationHelper = await getAuthenticationHelper(userPoolName);
|
|
40
|
+
const authParameters = {
|
|
41
|
+
USERNAME: username,
|
|
42
|
+
SRP_A: authenticationHelper.A.toString(16),
|
|
43
|
+
};
|
|
44
|
+
if (authFlow === 'USER_AUTH' && preferredChallenge) {
|
|
45
|
+
authParameters.PREFERRED_CHALLENGE = preferredChallenge;
|
|
46
|
+
}
|
|
47
|
+
const UserContextData = getUserContextData({
|
|
48
|
+
username,
|
|
49
|
+
userPoolId,
|
|
50
|
+
userPoolClientId,
|
|
51
|
+
});
|
|
52
|
+
const jsonReq = {
|
|
53
|
+
AuthFlow: authFlow,
|
|
54
|
+
AuthParameters: authParameters,
|
|
55
|
+
ClientMetadata: clientMetadata,
|
|
56
|
+
ClientId: userPoolClientId,
|
|
57
|
+
UserContextData,
|
|
58
|
+
};
|
|
59
|
+
const initiateAuth = createInitiateAuthClient({
|
|
60
|
+
endpointResolver: createCognitoUserPoolEndpointResolver({
|
|
61
|
+
endpointOverride: userPoolEndpoint,
|
|
62
|
+
}),
|
|
63
|
+
});
|
|
64
|
+
const resp = await initiateAuth({
|
|
65
|
+
region: getRegionFromUserPoolId(userPoolId),
|
|
66
|
+
userAgentValue: getAuthUserAgentValue(AuthAction.SignIn),
|
|
67
|
+
}, jsonReq);
|
|
68
|
+
const { ChallengeParameters: challengeParameters, Session: session } = resp;
|
|
69
|
+
const activeUsername = challengeParameters?.USERNAME ?? username;
|
|
70
|
+
setActiveSignInUsername(activeUsername);
|
|
71
|
+
if (resp.ChallengeName === 'PASSWORD_VERIFIER') {
|
|
72
|
+
return retryOnResourceNotFoundException(handlePasswordVerifierChallenge, [
|
|
73
|
+
password,
|
|
74
|
+
challengeParameters,
|
|
75
|
+
clientMetadata,
|
|
76
|
+
session,
|
|
77
|
+
authenticationHelper,
|
|
78
|
+
config,
|
|
79
|
+
tokenOrchestrator,
|
|
80
|
+
], activeUsername, tokenOrchestrator);
|
|
81
|
+
}
|
|
82
|
+
return resp;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { handlePasswordSRP };
|
|
86
|
+
//# sourceMappingURL=handlePasswordSRP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlePasswordSRP.mjs","sources":["../../../../../src/client/flows/shared/handlePasswordSRP.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AuthAction } from '@aws-amplify/core/internals/utils';\nimport { getUserContextData } from '../../../providers/cognito/utils/userContextData';\nimport { getAuthenticationHelper } from '../../../providers/cognito/utils/srp';\nimport { handlePasswordVerifierChallenge, retryOnResourceNotFoundException, setActiveSignInUsername, } from '../../../providers/cognito/utils/signInHelpers';\nimport { createInitiateAuthClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';\nimport { createCognitoUserPoolEndpointResolver } from '../../../providers/cognito/factories';\nimport { getRegionFromUserPoolId } from '../../../foundation/parsers';\nimport { getAuthUserAgentValue } from '../../../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 */\nexport async 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 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 = 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 = createInitiateAuthClient({\n endpointResolver: createCognitoUserPoolEndpointResolver({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const resp = await initiateAuth({\n region: getRegionFromUserPoolId(userPoolId),\n userAgentValue: getAuthUserAgentValue(AuthAction.SignIn),\n }, jsonReq);\n const { ChallengeParameters: challengeParameters, Session: session } = resp;\n const activeUsername = challengeParameters?.USERNAME ?? username;\n setActiveSignInUsername(activeUsername);\n if (resp.ChallengeName === 'PASSWORD_VERIFIER') {\n return retryOnResourceNotFoundException(handlePasswordVerifierChallenge, [\n password,\n challengeParameters,\n clientMetadata,\n session,\n authenticationHelper,\n config,\n tokenOrchestrator,\n ], activeUsername, tokenOrchestrator);\n }\n return resp;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AASA;AACA;AACA;AACA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M,IAAI,GAAG,MAAM,YAAY,CAAC;AACpC,QAAQ,MAAM,EAAE,uBAAuB,CAAC,UAAU,CAAC;AACnD,QAAQ,cAAc,EAAE,qBAAqB,CAAC,UAAU,CAAC,MAAM,CAAC;AAChE,KAAK,EAAE,OAAO,CAAC,CAAC;AAChB,IAAI,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;AAChF,IAAI,MAAM,cAAc,GAAG,mBAAmB,EAAE,QAAQ,IAAI,QAAQ,CAAC;AACrE,IAAI,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAC5C,IAAI,IAAI,IAAI,CAAC,aAAa,KAAK,mBAAmB,EAAE;AACpD,QAAQ,OAAO,gCAAgC,CAAC,+BAA+B,EAAE;AACjF,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;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CognitoUserPoolConfig } from '@aws-amplify/core';
|
|
2
|
+
import { ClientMetadata } from '../../../providers/cognito/types';
|
|
3
|
+
import { RespondToAuthChallengeCommandOutput } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types';
|
|
4
|
+
/**
|
|
5
|
+
* Handles the SELECT_CHALLENGE response for authentication.
|
|
6
|
+
* Initiates the selected authentication challenge based on user choice.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} params - The parameters for handling the selected challenge
|
|
9
|
+
* @param {string} params.username - The username for authentication
|
|
10
|
+
* @param {string} params.session - The current authentication session token
|
|
11
|
+
* @param {string} params.selectedChallenge - The challenge type selected by the user
|
|
12
|
+
* @param {CognitoUserPoolConfig} params.config - Cognito User Pool configuration
|
|
13
|
+
* @param {ClientMetadata} [params.clientMetadata] - Optional metadata to be sent with auth requests
|
|
14
|
+
*
|
|
15
|
+
* @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response
|
|
16
|
+
*/
|
|
17
|
+
export declare function initiateSelectedChallenge({ username, session, selectedChallenge, config, clientMetadata, }: {
|
|
18
|
+
username: string;
|
|
19
|
+
session: string;
|
|
20
|
+
selectedChallenge: string;
|
|
21
|
+
config: CognitoUserPoolConfig;
|
|
22
|
+
clientMetadata?: ClientMetadata;
|
|
23
|
+
}): Promise<RespondToAuthChallengeCommandOutput>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AuthAction } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
import '@aws-amplify/core/internals/aws-client-utils/composers';
|
|
3
|
+
import '@aws-amplify/core/internals/aws-client-utils';
|
|
4
|
+
import '../../../foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.mjs';
|
|
5
|
+
import '../../../foundation/factories/serviceClients/cognitoIdentityProvider/constants.mjs';
|
|
6
|
+
import '../../../common/AuthErrorStrings.mjs';
|
|
7
|
+
import '../../../errors/types/validation.mjs';
|
|
8
|
+
import '../../../providers/cognito/types/errors.mjs';
|
|
9
|
+
import { createRespondToAuthChallengeClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/createRespondToAuthChallengeClient.mjs';
|
|
10
|
+
import { createCognitoUserPoolEndpointResolver } from '../../../providers/cognito/factories/createCognitoUserPoolEndpointResolver.mjs';
|
|
11
|
+
import { getRegionFromUserPoolId } from '../../../foundation/parsers/regionParsers.mjs';
|
|
12
|
+
import { getAuthUserAgentValue } from '../../../utils/getAuthUserAgentValue.mjs';
|
|
13
|
+
|
|
14
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
15
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
/**
|
|
17
|
+
* Handles the SELECT_CHALLENGE response for authentication.
|
|
18
|
+
* Initiates the selected authentication challenge based on user choice.
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} params - The parameters for handling the selected challenge
|
|
21
|
+
* @param {string} params.username - The username for authentication
|
|
22
|
+
* @param {string} params.session - The current authentication session token
|
|
23
|
+
* @param {string} params.selectedChallenge - The challenge type selected by the user
|
|
24
|
+
* @param {CognitoUserPoolConfig} params.config - Cognito User Pool configuration
|
|
25
|
+
* @param {ClientMetadata} [params.clientMetadata] - Optional metadata to be sent with auth requests
|
|
26
|
+
*
|
|
27
|
+
* @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response
|
|
28
|
+
*/
|
|
29
|
+
async function initiateSelectedChallenge({ username, session, selectedChallenge, config, clientMetadata, }) {
|
|
30
|
+
const respondToAuthChallenge = createRespondToAuthChallengeClient({
|
|
31
|
+
endpointResolver: createCognitoUserPoolEndpointResolver({
|
|
32
|
+
endpointOverride: config.userPoolEndpoint,
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
return respondToAuthChallenge({
|
|
36
|
+
region: getRegionFromUserPoolId(config.userPoolId),
|
|
37
|
+
userAgentValue: getAuthUserAgentValue(AuthAction.ConfirmSignIn),
|
|
38
|
+
}, {
|
|
39
|
+
ChallengeName: 'SELECT_CHALLENGE',
|
|
40
|
+
ChallengeResponses: {
|
|
41
|
+
USERNAME: username,
|
|
42
|
+
ANSWER: selectedChallenge,
|
|
43
|
+
},
|
|
44
|
+
ClientId: config.userPoolClientId,
|
|
45
|
+
Session: session,
|
|
46
|
+
ClientMetadata: clientMetadata,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { initiateSelectedChallenge };
|
|
51
|
+
//# sourceMappingURL=handleSelectChallenge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleSelectChallenge.mjs","sources":["../../../../../src/client/flows/userAuth/handleSelectChallenge.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AuthAction } from '@aws-amplify/core/internals/utils';\nimport { createRespondToAuthChallengeClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';\nimport { createCognitoUserPoolEndpointResolver } from '../../../providers/cognito/factories';\nimport { getRegionFromUserPoolId } from '../../../foundation/parsers';\nimport { getAuthUserAgentValue } from '../../../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 */\nexport async function initiateSelectedChallenge({ username, session, selectedChallenge, config, clientMetadata, }) {\n const respondToAuthChallenge = createRespondToAuthChallengeClient({\n endpointResolver: createCognitoUserPoolEndpointResolver({\n endpointOverride: config.userPoolEndpoint,\n }),\n });\n return respondToAuthChallenge({\n region: getRegionFromUserPoolId(config.userPoolId),\n userAgentValue: getAuthUserAgentValue(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}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAe,yBAAyB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,GAAG,EAAE;AACnH,IAAI,MAAM,sBAAsB,GAAG,kCAAkC,CAAC;AACtE,QAAQ,gBAAgB,EAAE,qCAAqC,CAAC;AAChE,YAAY,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;AACrD,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,sBAAsB,CAAC;AAClC,QAAQ,MAAM,EAAE,uBAAuB,CAAC,MAAM,CAAC,UAAU,CAAC;AAC1D,QAAQ,cAAc,EAAE,qBAAqB,CAAC,UAAU,CAAC,aAAa,CAAC;AACvE,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;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CognitoUserPoolConfig } from '@aws-amplify/core';
|
|
2
|
+
import { ClientMetadata } from '../../../providers/cognito/types';
|
|
3
|
+
import { RespondToAuthChallengeCommandOutput } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types';
|
|
4
|
+
/**
|
|
5
|
+
* Handles the SELECT_CHALLENGE response specifically for Password authentication.
|
|
6
|
+
* This function combines the SELECT_CHALLENGE flow with standard password authentication.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} username - The username for authentication
|
|
9
|
+
* @param {string} password - The user's password
|
|
10
|
+
* @param {ClientMetadata} [clientMetadata] - Optional metadata to be sent with auth requests
|
|
11
|
+
* @param {CognitoUserPoolConfig} config - Cognito User Pool configuration
|
|
12
|
+
* @param {string} session - The current authentication session token
|
|
13
|
+
*
|
|
14
|
+
* @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response
|
|
15
|
+
*/
|
|
16
|
+
export declare function handleSelectChallengeWithPassword(username: string, password: string, clientMetadata: ClientMetadata | undefined, config: CognitoUserPoolConfig, session: string): Promise<RespondToAuthChallengeCommandOutput>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AuthAction } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
import '@aws-amplify/core/internals/aws-client-utils/composers';
|
|
3
|
+
import '@aws-amplify/core/internals/aws-client-utils';
|
|
4
|
+
import '../../../foundation/factories/serviceClients/cognitoIdentityProvider/shared/handler/cognitoUserPoolTransferHandler.mjs';
|
|
5
|
+
import '../../../foundation/factories/serviceClients/cognitoIdentityProvider/constants.mjs';
|
|
6
|
+
import '../../../common/AuthErrorStrings.mjs';
|
|
7
|
+
import '../../../errors/types/validation.mjs';
|
|
8
|
+
import '../../../providers/cognito/types/errors.mjs';
|
|
9
|
+
import { createRespondToAuthChallengeClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/createRespondToAuthChallengeClient.mjs';
|
|
10
|
+
import { createCognitoUserPoolEndpointResolver } from '../../../providers/cognito/factories/createCognitoUserPoolEndpointResolver.mjs';
|
|
11
|
+
import { getRegionFromUserPoolId } from '../../../foundation/parsers/regionParsers.mjs';
|
|
12
|
+
import { getAuthUserAgentValue } from '../../../utils/getAuthUserAgentValue.mjs';
|
|
13
|
+
import { getUserContextData } from '../../../providers/cognito/utils/userContextData.mjs';
|
|
14
|
+
import { setActiveSignInUsername } from '../../../providers/cognito/utils/signInHelpers.mjs';
|
|
15
|
+
|
|
16
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
17
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
18
|
+
/**
|
|
19
|
+
* Handles the SELECT_CHALLENGE response specifically for Password authentication.
|
|
20
|
+
* This function combines the SELECT_CHALLENGE flow with standard password authentication.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} username - The username for authentication
|
|
23
|
+
* @param {string} password - The user's password
|
|
24
|
+
* @param {ClientMetadata} [clientMetadata] - Optional metadata to be sent with auth requests
|
|
25
|
+
* @param {CognitoUserPoolConfig} config - Cognito User Pool configuration
|
|
26
|
+
* @param {string} session - The current authentication session token
|
|
27
|
+
*
|
|
28
|
+
* @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response
|
|
29
|
+
*/
|
|
30
|
+
async function handleSelectChallengeWithPassword(username, password, clientMetadata, config, session) {
|
|
31
|
+
const { userPoolId, userPoolClientId, userPoolEndpoint } = config;
|
|
32
|
+
const authParameters = {
|
|
33
|
+
ANSWER: 'PASSWORD',
|
|
34
|
+
USERNAME: username,
|
|
35
|
+
PASSWORD: password,
|
|
36
|
+
};
|
|
37
|
+
const userContextData = getUserContextData({
|
|
38
|
+
username,
|
|
39
|
+
userPoolId,
|
|
40
|
+
userPoolClientId,
|
|
41
|
+
});
|
|
42
|
+
const respondToAuthChallenge = createRespondToAuthChallengeClient({
|
|
43
|
+
endpointResolver: createCognitoUserPoolEndpointResolver({
|
|
44
|
+
endpointOverride: userPoolEndpoint,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
const response = await respondToAuthChallenge({
|
|
48
|
+
region: getRegionFromUserPoolId(userPoolId),
|
|
49
|
+
userAgentValue: getAuthUserAgentValue(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
|
+
setActiveSignInUsername(activeUsername);
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { handleSelectChallengeWithPassword };
|
|
64
|
+
//# sourceMappingURL=handleSelectChallengeWithPassword.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleSelectChallengeWithPassword.mjs","sources":["../../../../../src/client/flows/userAuth/handleSelectChallengeWithPassword.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AuthAction } from '@aws-amplify/core/internals/utils';\nimport { createRespondToAuthChallengeClient } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider';\nimport { createCognitoUserPoolEndpointResolver } from '../../../providers/cognito/factories';\nimport { getRegionFromUserPoolId } from '../../../foundation/parsers';\nimport { getAuthUserAgentValue } from '../../../utils';\nimport { getUserContextData } from '../../../providers/cognito/utils/userContextData';\nimport { setActiveSignInUsername } from '../../../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 */\nexport async 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 = getUserContextData({\n username,\n userPoolId,\n userPoolClientId,\n });\n const respondToAuthChallenge = createRespondToAuthChallengeClient({\n endpointResolver: createCognitoUserPoolEndpointResolver({\n endpointOverride: userPoolEndpoint,\n }),\n });\n const response = await respondToAuthChallenge({\n region: getRegionFromUserPoolId(userPoolId),\n userAgentValue: getAuthUserAgentValue(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 setActiveSignInUsername(activeUsername);\n return response;\n}\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AAC,cAAc,CAAC,CAAC;AAC5C,IAAI,OAAO,QAAQ,CAAC;AACpB;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CognitoUserPoolConfig } from '@aws-amplify/core';
|
|
2
|
+
import { AuthTokenOrchestrator } from '../../../providers/cognito/tokenProvider/types';
|
|
3
|
+
import { RespondToAuthChallengeCommandOutput } from '../../../foundation/factories/serviceClients/cognitoIdentityProvider/types';
|
|
4
|
+
import { ClientMetadata } from '../../../providers/cognito/types';
|
|
5
|
+
/**
|
|
6
|
+
* Handles the SELECT_CHALLENGE response specifically for Password SRP authentication.
|
|
7
|
+
* This function combines the SELECT_CHALLENGE flow with Password SRP protocol.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} username - The username for authentication
|
|
10
|
+
* @param {string} password - The user's password
|
|
11
|
+
* @param {ClientMetadata} [clientMetadata] - Optional metadata to be sent with auth requests
|
|
12
|
+
* @param {CognitoUserPoolConfig} config - Cognito User Pool configuration
|
|
13
|
+
* @param {string} session - The current authentication session token
|
|
14
|
+
* @param {AuthTokenOrchestrator} tokenOrchestrator - Token orchestrator for managing auth tokens
|
|
15
|
+
*
|
|
16
|
+
* @returns {Promise<RespondToAuthChallengeCommandOutput>} The challenge response
|
|
17
|
+
*/
|
|
18
|
+
export declare function handleSelectChallengeWithPasswordSRP(username: string, password: string, clientMetadata: ClientMetadata | undefined, config: CognitoUserPoolConfig, session: string, tokenOrchestrator: AuthTokenOrchestrator): Promise<RespondToAuthChallengeCommandOutput>;
|