@aws-amplify/auth 6.12.4 → 6.12.5-local-stack.00864ae.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 (217) hide show
  1. package/dist/cjs/client/apis/associateWebAuthnCredential.js +1 -2
  2. package/dist/cjs/client/apis/associateWebAuthnCredential.js.map +1 -1
  3. package/dist/cjs/client/apis/deleteWebAuthnCredential.js +1 -2
  4. package/dist/cjs/client/apis/deleteWebAuthnCredential.js.map +1 -1
  5. package/dist/cjs/client/apis/listWebAuthnCredentials.js +1 -2
  6. package/dist/cjs/client/apis/listWebAuthnCredentials.js.map +1 -1
  7. package/dist/cjs/client/flows/shared/handlePasswordSRP.js +1 -2
  8. package/dist/cjs/client/flows/shared/handlePasswordSRP.js.map +1 -1
  9. package/dist/cjs/client/flows/userAuth/handleSelectChallenge.js +1 -2
  10. package/dist/cjs/client/flows/userAuth/handleSelectChallenge.js.map +1 -1
  11. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPassword.js +1 -2
  12. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPassword.js.map +1 -1
  13. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.js +1 -2
  14. package/dist/cjs/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.js.map +1 -1
  15. package/dist/cjs/client/flows/userAuth/handleUserAuthFlow.js +1 -2
  16. package/dist/cjs/client/flows/userAuth/handleUserAuthFlow.js.map +1 -1
  17. package/dist/cjs/client/flows/userAuth/handleWebAuthnSignInResult.js +1 -2
  18. package/dist/cjs/client/flows/userAuth/handleWebAuthnSignInResult.js.map +1 -1
  19. package/dist/cjs/client/utils/passkey/errors.js +1 -1
  20. package/dist/cjs/client/utils/passkey/errors.js.map +1 -1
  21. package/dist/cjs/client/utils/passkey/types/index.js +3 -3
  22. package/dist/cjs/client/utils/passkey/types/index.js.map +1 -1
  23. package/dist/cjs/client/utils/passkey/types/shared.js +1 -2
  24. package/dist/cjs/client/utils/passkey/types/shared.js.map +1 -1
  25. package/dist/cjs/client/utils/store/signInStore.js +2 -2
  26. package/dist/cjs/client/utils/store/signInStore.js.map +1 -1
  27. package/dist/cjs/common/AuthErrorStrings.js +5 -2
  28. package/dist/cjs/common/AuthErrorStrings.js.map +1 -1
  29. package/dist/cjs/errors/types/validation.js +2 -1
  30. package/dist/cjs/errors/types/validation.js.map +1 -1
  31. package/dist/cjs/errors/utils/assertServiceError.js +1 -2
  32. package/dist/cjs/errors/utils/assertServiceError.js.map +1 -1
  33. package/dist/cjs/errors/utils/assertValidationError.js +1 -2
  34. package/dist/cjs/errors/utils/assertValidationError.js.map +1 -1
  35. package/dist/cjs/foundation/apis/deleteWebAuthnCredential.js +1 -2
  36. package/dist/cjs/foundation/apis/deleteWebAuthnCredential.js.map +1 -1
  37. package/dist/cjs/foundation/apis/listWebAuthnCredentials.js +1 -2
  38. package/dist/cjs/foundation/apis/listWebAuthnCredentials.js.map +1 -1
  39. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.js +8 -4
  40. package/dist/cjs/foundation/factories/serviceClients/cognitoIdentityProvider/types/errors.js.map +1 -1
  41. package/dist/cjs/foundation/parsers/regionParsers.js +2 -3
  42. package/dist/cjs/foundation/parsers/regionParsers.js.map +1 -1
  43. package/dist/cjs/providers/cognito/apis/autoSignIn.js +3 -3
  44. package/dist/cjs/providers/cognito/apis/autoSignIn.js.map +1 -1
  45. package/dist/cjs/providers/cognito/apis/confirmResetPassword.js +1 -2
  46. package/dist/cjs/providers/cognito/apis/confirmResetPassword.js.map +1 -1
  47. package/dist/cjs/providers/cognito/apis/confirmSignIn.js +1 -2
  48. package/dist/cjs/providers/cognito/apis/confirmSignIn.js.map +1 -1
  49. package/dist/cjs/providers/cognito/apis/confirmSignUp.js +1 -2
  50. package/dist/cjs/providers/cognito/apis/confirmSignUp.js.map +1 -1
  51. package/dist/cjs/providers/cognito/apis/confirmUserAttribute.js +1 -2
  52. package/dist/cjs/providers/cognito/apis/confirmUserAttribute.js.map +1 -1
  53. package/dist/cjs/providers/cognito/apis/deleteUser.js +1 -2
  54. package/dist/cjs/providers/cognito/apis/deleteUser.js.map +1 -1
  55. package/dist/cjs/providers/cognito/apis/deleteUserAttributes.js +1 -2
  56. package/dist/cjs/providers/cognito/apis/deleteUserAttributes.js.map +1 -1
  57. package/dist/cjs/providers/cognito/apis/fetchDevices.js +1 -2
  58. package/dist/cjs/providers/cognito/apis/fetchDevices.js.map +1 -1
  59. package/dist/cjs/providers/cognito/apis/fetchMFAPreference.js +1 -2
  60. package/dist/cjs/providers/cognito/apis/fetchMFAPreference.js.map +1 -1
  61. package/dist/cjs/providers/cognito/apis/forgetDevice.js +1 -2
  62. package/dist/cjs/providers/cognito/apis/forgetDevice.js.map +1 -1
  63. package/dist/cjs/providers/cognito/apis/rememberDevice.js +1 -2
  64. package/dist/cjs/providers/cognito/apis/rememberDevice.js.map +1 -1
  65. package/dist/cjs/providers/cognito/apis/resendSignUpCode.js +1 -2
  66. package/dist/cjs/providers/cognito/apis/resendSignUpCode.js.map +1 -1
  67. package/dist/cjs/providers/cognito/apis/resetPassword.js +1 -2
  68. package/dist/cjs/providers/cognito/apis/resetPassword.js.map +1 -1
  69. package/dist/cjs/providers/cognito/apis/setUpTOTP.js +1 -2
  70. package/dist/cjs/providers/cognito/apis/setUpTOTP.js.map +1 -1
  71. package/dist/cjs/providers/cognito/apis/signIn.js +1 -2
  72. package/dist/cjs/providers/cognito/apis/signIn.js.map +1 -1
  73. package/dist/cjs/providers/cognito/apis/signInWithCustomAuth.js +1 -2
  74. package/dist/cjs/providers/cognito/apis/signInWithCustomAuth.js.map +1 -1
  75. package/dist/cjs/providers/cognito/apis/signInWithCustomSRPAuth.js +1 -2
  76. package/dist/cjs/providers/cognito/apis/signInWithCustomSRPAuth.js.map +1 -1
  77. package/dist/cjs/providers/cognito/apis/signInWithRedirect.js +1 -2
  78. package/dist/cjs/providers/cognito/apis/signInWithRedirect.js.map +1 -1
  79. package/dist/cjs/providers/cognito/apis/signInWithSRP.js +1 -2
  80. package/dist/cjs/providers/cognito/apis/signInWithSRP.js.map +1 -1
  81. package/dist/cjs/providers/cognito/apis/signInWithUserAuth.js +1 -2
  82. package/dist/cjs/providers/cognito/apis/signInWithUserAuth.js.map +1 -1
  83. package/dist/cjs/providers/cognito/apis/signInWithUserPassword.js +1 -2
  84. package/dist/cjs/providers/cognito/apis/signInWithUserPassword.js.map +1 -1
  85. package/dist/cjs/providers/cognito/apis/signOut.js +1 -2
  86. package/dist/cjs/providers/cognito/apis/signOut.js.map +1 -1
  87. package/dist/cjs/providers/cognito/apis/signUp.js +1 -2
  88. package/dist/cjs/providers/cognito/apis/signUp.js.map +1 -1
  89. package/dist/cjs/providers/cognito/apis/updateMFAPreference.js +2 -3
  90. package/dist/cjs/providers/cognito/apis/updateMFAPreference.js.map +1 -1
  91. package/dist/cjs/providers/cognito/apis/updatePassword.js +1 -2
  92. package/dist/cjs/providers/cognito/apis/updatePassword.js.map +1 -1
  93. package/dist/cjs/providers/cognito/apis/verifyTOTPSetup.js +1 -2
  94. package/dist/cjs/providers/cognito/apis/verifyTOTPSetup.js.map +1 -1
  95. package/dist/cjs/providers/cognito/credentialsProvider/IdentityIdProvider.js +8 -3
  96. package/dist/cjs/providers/cognito/credentialsProvider/IdentityIdProvider.js.map +1 -1
  97. package/dist/cjs/providers/cognito/credentialsProvider/credentialsProvider.js +13 -2
  98. package/dist/cjs/providers/cognito/credentialsProvider/credentialsProvider.js.map +1 -1
  99. package/dist/cjs/providers/cognito/credentialsProvider/utils.js +1 -2
  100. package/dist/cjs/providers/cognito/credentialsProvider/utils.js.map +1 -1
  101. package/dist/cjs/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.js +16 -0
  102. package/dist/cjs/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.js.map +1 -0
  103. package/dist/cjs/providers/cognito/factories/index.js +3 -1
  104. package/dist/cjs/providers/cognito/factories/index.js.map +1 -1
  105. package/dist/cjs/providers/cognito/tokenProvider/TokenStore.js +2 -2
  106. package/dist/cjs/providers/cognito/tokenProvider/TokenStore.js.map +1 -1
  107. package/dist/cjs/providers/cognito/tokenProvider/cacheTokens.js +1 -2
  108. package/dist/cjs/providers/cognito/tokenProvider/cacheTokens.js.map +1 -1
  109. package/dist/cjs/providers/cognito/tokenProvider/errorHelpers.js +1 -1
  110. package/dist/cjs/providers/cognito/tokenProvider/errorHelpers.js.map +1 -1
  111. package/dist/cjs/providers/cognito/types/errors.js +48 -24
  112. package/dist/cjs/providers/cognito/types/errors.js.map +1 -1
  113. package/dist/cjs/providers/cognito/utils/apiHelpers.js +2 -3
  114. package/dist/cjs/providers/cognito/utils/apiHelpers.js.map +1 -1
  115. package/dist/cjs/providers/cognito/utils/getNewDeviceMetadata.js +1 -2
  116. package/dist/cjs/providers/cognito/utils/getNewDeviceMetadata.js.map +1 -1
  117. package/dist/cjs/providers/cognito/utils/handleDeviceSRPAuth.js +1 -2
  118. package/dist/cjs/providers/cognito/utils/handleDeviceSRPAuth.js.map +1 -1
  119. package/dist/cjs/providers/cognito/utils/handlePasswordVerifierChallenge.js +1 -2
  120. package/dist/cjs/providers/cognito/utils/handlePasswordVerifierChallenge.js.map +1 -1
  121. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.js +2 -5
  122. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.js.map +1 -1
  123. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.native.js +1 -2
  124. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.native.js.map +1 -1
  125. package/dist/cjs/providers/cognito/utils/retryOnResourceNotFoundException.js +1 -2
  126. package/dist/cjs/providers/cognito/utils/retryOnResourceNotFoundException.js.map +1 -1
  127. package/dist/cjs/providers/cognito/utils/setActiveSignInUsername.js +1 -2
  128. package/dist/cjs/providers/cognito/utils/setActiveSignInUsername.js.map +1 -1
  129. package/dist/cjs/providers/cognito/utils/signInHelpers.js +22 -23
  130. package/dist/cjs/providers/cognito/utils/signInHelpers.js.map +1 -1
  131. package/dist/cjs/providers/cognito/utils/signUpHelpers.js +3 -3
  132. package/dist/cjs/providers/cognito/utils/signUpHelpers.js.map +1 -1
  133. package/dist/cjs/providers/cognito/utils/types.js +6 -6
  134. package/dist/cjs/providers/cognito/utils/types.js.map +1 -1
  135. package/dist/cjs/providers/cognito/utils/userContextData.js +1 -2
  136. package/dist/cjs/providers/cognito/utils/userContextData.js.map +1 -1
  137. package/dist/cjs/providers/cognito/utils/userContextData.native.js +1 -2
  138. package/dist/cjs/providers/cognito/utils/userContextData.native.js.map +1 -1
  139. package/dist/cjs/types/Auth.js +2 -1
  140. package/dist/cjs/types/Auth.js.map +1 -1
  141. package/dist/esm/client/flows/shared/handlePasswordSRP.mjs +1 -0
  142. package/dist/esm/client/flows/shared/handlePasswordSRP.mjs.map +1 -1
  143. package/dist/esm/client/flows/userAuth/handleSelectChallenge.mjs +1 -0
  144. package/dist/esm/client/flows/userAuth/handleSelectChallenge.mjs.map +1 -1
  145. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.mjs +1 -0
  146. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPassword.mjs.map +1 -1
  147. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.mjs +1 -0
  148. package/dist/esm/client/flows/userAuth/handleSelectChallengeWithPasswordSRP.mjs.map +1 -1
  149. package/dist/esm/client/flows/userAuth/handleUserAuthFlow.mjs +1 -0
  150. package/dist/esm/client/flows/userAuth/handleUserAuthFlow.mjs.map +1 -1
  151. package/dist/esm/foundation/apis/deleteWebAuthnCredential.mjs +1 -0
  152. package/dist/esm/foundation/apis/deleteWebAuthnCredential.mjs.map +1 -1
  153. package/dist/esm/foundation/apis/listWebAuthnCredentials.mjs +1 -0
  154. package/dist/esm/foundation/apis/listWebAuthnCredentials.mjs.map +1 -1
  155. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/constants.d.ts +1 -1
  156. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createAssociateSoftwareTokenClient.d.ts +2 -2
  157. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createChangePasswordClient.d.ts +2 -2
  158. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.d.ts +2 -2
  159. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmDeviceClient.d.ts +2 -2
  160. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmForgotPasswordClient.d.ts +2 -2
  161. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmSignUpClient.d.ts +2 -2
  162. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserAttributesClient.d.ts +2 -2
  163. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserClient.d.ts +2 -2
  164. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.d.ts +2 -2
  165. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createForgetDeviceClient.d.ts +2 -2
  166. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createForgotPasswordClient.d.ts +2 -2
  167. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserAttributeVerificationCodeClient.d.ts +2 -2
  168. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserClient.d.ts +2 -2
  169. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createGlobalSignOutClient.d.ts +2 -2
  170. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createInitiateAuthClient.d.ts +2 -2
  171. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListDevicesClient.d.ts +2 -2
  172. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.d.ts +2 -2
  173. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createResendConfirmationCodeClient.d.ts +2 -2
  174. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createRespondToAuthChallengeClient.d.ts +2 -2
  175. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createRevokeTokenClient.d.ts +2 -2
  176. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSetUserMFAPreferenceClient.d.ts +2 -2
  177. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.d.ts +3 -3
  178. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.d.ts +2 -2
  179. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateDeviceStatusClient.d.ts +2 -2
  180. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateUserAttributesClient.d.ts +2 -2
  181. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifySoftwareTokenClient.d.ts +2 -2
  182. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifyUserAttributeClient.d.ts +2 -2
  183. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createEmptyResponseDeserializer.d.ts +1 -1
  184. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createUserPoolDeserializer.d.ts +1 -1
  185. package/dist/esm/providers/cognito/apis/internal/fetchUserAttributes.mjs +1 -0
  186. package/dist/esm/providers/cognito/apis/internal/fetchUserAttributes.mjs.map +1 -1
  187. package/dist/esm/providers/cognito/credentialsProvider/IdentityIdProvider.mjs +9 -1
  188. package/dist/esm/providers/cognito/credentialsProvider/IdentityIdProvider.mjs.map +1 -1
  189. package/dist/esm/providers/cognito/credentialsProvider/credentialsProvider.mjs +13 -1
  190. package/dist/esm/providers/cognito/credentialsProvider/credentialsProvider.mjs.map +1 -1
  191. package/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.d.ts +6 -0
  192. package/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.mjs +14 -0
  193. package/dist/esm/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.mjs.map +1 -0
  194. package/dist/esm/providers/cognito/factories/index.d.ts +1 -0
  195. package/dist/esm/providers/cognito/factories/index.mjs +1 -0
  196. package/dist/esm/providers/cognito/factories/index.mjs.map +1 -1
  197. package/dist/esm/providers/cognito/utils/getNewDeviceMetadata.mjs +1 -0
  198. package/dist/esm/providers/cognito/utils/getNewDeviceMetadata.mjs.map +1 -1
  199. package/dist/esm/providers/cognito/utils/handleDeviceSRPAuth.mjs +1 -0
  200. package/dist/esm/providers/cognito/utils/handleDeviceSRPAuth.mjs.map +1 -1
  201. package/dist/esm/providers/cognito/utils/handlePasswordVerifierChallenge.mjs +1 -0
  202. package/dist/esm/providers/cognito/utils/handlePasswordVerifierChallenge.mjs.map +1 -1
  203. package/dist/esm/providers/cognito/utils/oauth/attemptCompleteOAuthFlow.d.ts +1 -1
  204. package/dist/esm/providers/cognito/utils/oauth/completeOAuthFlow.d.ts +1 -1
  205. package/dist/esm/providers/cognito/utils/oauth/generateCodeVerifier.d.ts +1 -1
  206. package/dist/esm/providers/cognito/utils/oauth/getRedirectUrl.mjs +1 -3
  207. package/dist/esm/providers/cognito/utils/oauth/getRedirectUrl.mjs.map +1 -1
  208. package/dist/esm/providers/cognito/utils/refreshAuthTokens.d.ts +1 -1
  209. package/dist/esm/providers/cognito/utils/refreshAuthTokens.mjs +1 -0
  210. package/dist/esm/providers/cognito/utils/refreshAuthTokens.mjs.map +1 -1
  211. package/dist/esm/providers/cognito/utils/signInHelpers.d.ts +1 -1
  212. package/package.json +105 -106
  213. package/src/providers/cognito/credentialsProvider/IdentityIdProvider.ts +8 -1
  214. package/src/providers/cognito/credentialsProvider/credentialsProvider.ts +14 -1
  215. package/src/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.ts +15 -0
  216. package/src/providers/cognito/factories/index.ts +1 -0
  217. package/src/providers/cognito/utils/oauth/getRedirectUrl.ts +1 -2
@@ -10,6 +10,7 @@ const AuthError_1 = require("../../../errors/AuthError");
10
10
  const assertServiceError_1 = require("../../../errors/utils/assertServiceError");
11
11
  const parsers_1 = require("../../../foundation/parsers");
12
12
  const types_1 = require("../utils/types");
13
+ const factories_1 = require("../factories");
13
14
  const IdentityIdProvider_1 = require("./IdentityIdProvider");
14
15
  const utils_2 = require("./utils");
15
16
  const logger = new core_1.ConsoleLogger('CognitoCredentialsProvider');
@@ -73,13 +74,18 @@ class CognitoAWSCredentialsAndIdentityIdProvider {
73
74
  // Clear to discard if any authenticated credentials are set and start with a clean slate
74
75
  this.clearCredentials();
75
76
  const region = (0, parsers_1.getRegionFromIdentityPoolId)(authConfig.identityPoolId);
77
+ const getCredentialsForIdentity = (0, core_1.createGetCredentialsForIdentityClient)({
78
+ endpointResolver: (0, factories_1.createCognitoIdentityPoolEndpointResolver)({
79
+ endpointOverride: authConfig.identityPoolEndpoint,
80
+ }),
81
+ });
76
82
  // use identityId to obtain guest credentials
77
83
  // save credentials in-memory
78
84
  // No logins params should be passed for guest creds:
79
85
  // https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_GetCredentialsForIdentity.html
80
86
  let clientResult;
81
87
  try {
82
- clientResult = await (0, core_1.getCredentialsForIdentity)({ region }, {
88
+ clientResult = await getCredentialsForIdentity({ region }, {
83
89
  IdentityId: identityId,
84
90
  });
85
91
  }
@@ -132,9 +138,14 @@ class CognitoAWSCredentialsAndIdentityIdProvider {
132
138
  ? (0, utils_2.formLoginsMap)(authTokens.idToken.toString())
133
139
  : {};
134
140
  const region = (0, parsers_1.getRegionFromIdentityPoolId)(authConfig.identityPoolId);
141
+ const getCredentialsForIdentity = (0, core_1.createGetCredentialsForIdentityClient)({
142
+ endpointResolver: (0, factories_1.createCognitoIdentityPoolEndpointResolver)({
143
+ endpointOverride: authConfig.identityPoolEndpoint,
144
+ }),
145
+ });
135
146
  let clientResult;
136
147
  try {
137
- clientResult = await (0, core_1.getCredentialsForIdentity)({ region }, {
148
+ clientResult = await getCredentialsForIdentity({ region }, {
138
149
  IdentityId: identityId,
139
150
  Logins: logins,
140
151
  });
@@ -1 +1 @@
1
- {"version":3,"file":"credentialsProvider.js","sources":["../../../../../src/providers/cognito/credentialsProvider/credentialsProvider.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.CognitoAWSCredentialsAndIdentityIdProvider = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst IdentityIdProvider_1 = require(\"./IdentityIdProvider\");\nconst utils_2 = require(\"./utils\");\nconst logger = new core_1.ConsoleLogger('CognitoCredentialsProvider');\nconst CREDENTIALS_TTL = 50 * 60 * 1000; // 50 min, can be modified on config if required in the future\nclass CognitoAWSCredentialsAndIdentityIdProvider {\n constructor(identityIdStore) {\n this._nextCredentialsRefresh = 0;\n this._identityIdStore = identityIdStore;\n }\n async clearCredentialsAndIdentityId() {\n logger.debug('Clearing out credentials and identityId');\n this._credentialsAndIdentityId = undefined;\n await this._identityIdStore.clearIdentityId();\n }\n async clearCredentials() {\n logger.debug('Clearing out in-memory credentials');\n this._credentialsAndIdentityId = undefined;\n }\n async getCredentialsAndIdentityId(getCredentialsOptions) {\n const isAuthenticated = getCredentialsOptions.authenticated;\n const { tokens } = getCredentialsOptions;\n const { authConfig } = getCredentialsOptions;\n try {\n (0, utils_1.assertIdentityPoolIdConfig)(authConfig?.Cognito);\n }\n catch {\n // No identity pool configured, skipping\n return;\n }\n if (!isAuthenticated && !authConfig.Cognito.allowGuestAccess) {\n // TODO(V6): return partial result like Native platforms\n return;\n }\n const { forceRefresh } = getCredentialsOptions;\n const tokenHasChanged = this.hasTokenChanged(tokens);\n const identityId = await (0, IdentityIdProvider_1.cognitoIdentityIdProvider)({\n tokens,\n authConfig: authConfig.Cognito,\n identityIdStore: this._identityIdStore,\n });\n // Clear cached credentials when forceRefresh is true OR the cache token has changed\n if (forceRefresh || tokenHasChanged) {\n this.clearCredentials();\n }\n if (!isAuthenticated) {\n return this.getGuestCredentials(identityId, authConfig.Cognito);\n }\n else {\n (0, types_1.assertIdTokenInAuthTokens)(tokens);\n return this.credsForOIDCTokens(authConfig.Cognito, tokens, identityId);\n }\n }\n async getGuestCredentials(identityId, authConfig) {\n // Return existing in-memory cached credentials only if it exists, is not past it's lifetime and is unauthenticated credentials\n if (this._credentialsAndIdentityId &&\n !this.isPastTTL() &&\n this._credentialsAndIdentityId.isAuthenticatedCreds === false) {\n logger.info('returning stored credentials as they neither past TTL nor expired.');\n return this._credentialsAndIdentityId;\n }\n // Clear to discard if any authenticated credentials are set and start with a clean slate\n this.clearCredentials();\n const region = (0, parsers_1.getRegionFromIdentityPoolId)(authConfig.identityPoolId);\n // use identityId to obtain guest credentials\n // save credentials in-memory\n // No logins params should be passed for guest creds:\n // https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_GetCredentialsForIdentity.html\n let clientResult;\n try {\n clientResult = await (0, core_1.getCredentialsForIdentity)({ region }, {\n IdentityId: identityId,\n });\n }\n catch (e) {\n (0, assertServiceError_1.assertServiceError)(e);\n throw new AuthError_1.AuthError(e);\n }\n if (clientResult?.Credentials?.AccessKeyId &&\n clientResult?.Credentials?.SecretKey) {\n this._nextCredentialsRefresh = new Date().getTime() + CREDENTIALS_TTL;\n const res = {\n credentials: {\n accessKeyId: clientResult.Credentials.AccessKeyId,\n secretAccessKey: clientResult.Credentials.SecretKey,\n sessionToken: clientResult.Credentials.SessionToken,\n expiration: clientResult.Credentials.Expiration,\n },\n identityId,\n };\n if (clientResult.IdentityId) {\n res.identityId = clientResult.IdentityId;\n this._identityIdStore.storeIdentityId({\n id: clientResult.IdentityId,\n type: 'guest',\n });\n }\n this._credentialsAndIdentityId = {\n ...res,\n isAuthenticatedCreds: false,\n };\n return res;\n }\n else {\n throw new AuthError_1.AuthError({\n name: 'CredentialsNotFoundException',\n message: `Cognito did not respond with either Credentials, AccessKeyId or SecretKey.`,\n });\n }\n }\n async credsForOIDCTokens(authConfig, authTokens, identityId) {\n if (this._credentialsAndIdentityId &&\n !this.isPastTTL() &&\n this._credentialsAndIdentityId.isAuthenticatedCreds === true) {\n logger.debug('returning stored credentials as they neither past TTL nor expired.');\n return this._credentialsAndIdentityId;\n }\n // Clear to discard if any unauthenticated credentials are set and start with a clean slate\n this.clearCredentials();\n const logins = authTokens.idToken\n ? (0, utils_2.formLoginsMap)(authTokens.idToken.toString())\n : {};\n const region = (0, parsers_1.getRegionFromIdentityPoolId)(authConfig.identityPoolId);\n let clientResult;\n try {\n clientResult = await (0, core_1.getCredentialsForIdentity)({ region }, {\n IdentityId: identityId,\n Logins: logins,\n });\n }\n catch (e) {\n (0, assertServiceError_1.assertServiceError)(e);\n throw new AuthError_1.AuthError(e);\n }\n if (clientResult?.Credentials?.AccessKeyId &&\n clientResult?.Credentials?.SecretKey) {\n this._nextCredentialsRefresh = new Date().getTime() + CREDENTIALS_TTL;\n const res = {\n credentials: {\n accessKeyId: clientResult.Credentials.AccessKeyId,\n secretAccessKey: clientResult.Credentials.SecretKey,\n sessionToken: clientResult.Credentials.SessionToken,\n expiration: clientResult.Credentials.Expiration,\n },\n identityId,\n };\n if (clientResult.IdentityId) {\n res.identityId = clientResult.IdentityId;\n // note: the following call removes guest identityId from the persistent store (localStorage)\n this._identityIdStore.storeIdentityId({\n id: clientResult.IdentityId,\n type: 'primary',\n });\n }\n // Store the credentials in-memory along with the expiration\n this._credentialsAndIdentityId = {\n ...res,\n isAuthenticatedCreds: true,\n associatedIdToken: authTokens.idToken?.toString(),\n };\n return res;\n }\n else {\n throw new AuthError_1.AuthError({\n name: 'CredentialsException',\n message: `Cognito did not respond with either Credentials, AccessKeyId or SecretKey.`,\n });\n }\n }\n isPastTTL() {\n return this._nextCredentialsRefresh === undefined\n ? true\n : this._nextCredentialsRefresh <= Date.now();\n }\n hasTokenChanged(tokens) {\n return (!!tokens &&\n !!this._credentialsAndIdentityId?.associatedIdToken &&\n tokens.idToken?.toString() !==\n this._credentialsAndIdentityId.associatedIdToken);\n }\n}\nexports.CognitoAWSCredentialsAndIdentityIdProvider = CognitoAWSCredentialsAndIdentityIdProvider;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0CAA0C,GAAG,MAAM;AAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAChF,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;AAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,4BAA4B,CAAC;AACrE,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACvC,MAAM,0CAA0C,CAAC;AACjD,IAAI,WAAW,CAAC,eAAe,EAAE;AACjC,QAAQ,IAAI,CAAC,uBAAuB,GAAG,CAAC;AACxC,QAAQ,IAAI,CAAC,gBAAgB,GAAG,eAAe;AAC/C;AACA,IAAI,MAAM,6BAA6B,GAAG;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Y,CAAC,UAAU;AACxD;AACA,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC;AACtD,oBAAoB,EAAE,EAAE,YAAY,CAAC,UAAU;AAC/C,oBAAoB,IAAI,EAAE,SAAS;AACnC,iBAAiB,CAAC;AAClB;AACA;AACA,YAAY,IAAI,CAAC,yBAAyB,GAAG;AAC7C,gBAAgB,GAAG,GAAG;AACtB,gBAAgB,oBAAoB,EAAE,IAAI;AAC1C,gBAAgB,iBAAiB,EAAE,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE;AACjE,aAAa;AACb,YAAY,OAAO,GAAG;AACtB;AACA,aAAa;AACb,YAAY,MAAM,IAAI,WAAW,CAAC,SAAS,CAAC;AAC5C,gBAAgB,IAAI,EAAE,sBAAsB;AAC5C,gBAAgB,OAAO,EAAE,CAAC,0EAA0E,CAAC;AACrG,aAAa,CAAC;AACd;AACA;AACA,IAAI,SAAS,GAAG;AAChB,QAAQ,OAAO,IAAI,CAAC,uBAAuB,KAAK;AAChD,cAAc;AACd,cAAc,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC,GAAG,EAAE;AACxD;AACA,IAAI,eAAe,CAAC,MAAM,EAAE;AAC5B,QAAQ,QAAQ,CAAC,CAAC,MAAM;AACxB,YAAY,CAAC,CAAC,IAAI,CAAC,yBAAyB,EAAE,iBAAiB;AAC/D,YAAY,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE;AACtC,gBAAgB,IAAI,CAAC,yBAAyB,CAAC,iBAAiB;AAChE;AACA;AACA,OAAO,CAAC,0CAA0C,GAAG,0CAA0C;;"}
1
+ {"version":3,"file":"credentialsProvider.js","sources":["../../../../../src/providers/cognito/credentialsProvider/credentialsProvider.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.CognitoAWSCredentialsAndIdentityIdProvider = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst assertServiceError_1 = require(\"../../../errors/utils/assertServiceError\");\nconst parsers_1 = require(\"../../../foundation/parsers\");\nconst types_1 = require(\"../utils/types\");\nconst factories_1 = require(\"../factories\");\nconst IdentityIdProvider_1 = require(\"./IdentityIdProvider\");\nconst utils_2 = require(\"./utils\");\nconst logger = new core_1.ConsoleLogger('CognitoCredentialsProvider');\nconst CREDENTIALS_TTL = 50 * 60 * 1000; // 50 min, can be modified on config if required in the future\nclass CognitoAWSCredentialsAndIdentityIdProvider {\n constructor(identityIdStore) {\n this._nextCredentialsRefresh = 0;\n this._identityIdStore = identityIdStore;\n }\n async clearCredentialsAndIdentityId() {\n logger.debug('Clearing out credentials and identityId');\n this._credentialsAndIdentityId = undefined;\n await this._identityIdStore.clearIdentityId();\n }\n async clearCredentials() {\n logger.debug('Clearing out in-memory credentials');\n this._credentialsAndIdentityId = undefined;\n }\n async getCredentialsAndIdentityId(getCredentialsOptions) {\n const isAuthenticated = getCredentialsOptions.authenticated;\n const { tokens } = getCredentialsOptions;\n const { authConfig } = getCredentialsOptions;\n try {\n (0, utils_1.assertIdentityPoolIdConfig)(authConfig?.Cognito);\n }\n catch {\n // No identity pool configured, skipping\n return;\n }\n if (!isAuthenticated && !authConfig.Cognito.allowGuestAccess) {\n // TODO(V6): return partial result like Native platforms\n return;\n }\n const { forceRefresh } = getCredentialsOptions;\n const tokenHasChanged = this.hasTokenChanged(tokens);\n const identityId = await (0, IdentityIdProvider_1.cognitoIdentityIdProvider)({\n tokens,\n authConfig: authConfig.Cognito,\n identityIdStore: this._identityIdStore,\n });\n // Clear cached credentials when forceRefresh is true OR the cache token has changed\n if (forceRefresh || tokenHasChanged) {\n this.clearCredentials();\n }\n if (!isAuthenticated) {\n return this.getGuestCredentials(identityId, authConfig.Cognito);\n }\n else {\n (0, types_1.assertIdTokenInAuthTokens)(tokens);\n return this.credsForOIDCTokens(authConfig.Cognito, tokens, identityId);\n }\n }\n async getGuestCredentials(identityId, authConfig) {\n // Return existing in-memory cached credentials only if it exists, is not past it's lifetime and is unauthenticated credentials\n if (this._credentialsAndIdentityId &&\n !this.isPastTTL() &&\n this._credentialsAndIdentityId.isAuthenticatedCreds === false) {\n logger.info('returning stored credentials as they neither past TTL nor expired.');\n return this._credentialsAndIdentityId;\n }\n // Clear to discard if any authenticated credentials are set and start with a clean slate\n this.clearCredentials();\n const region = (0, parsers_1.getRegionFromIdentityPoolId)(authConfig.identityPoolId);\n const getCredentialsForIdentity = (0, core_1.createGetCredentialsForIdentityClient)({\n endpointResolver: (0, factories_1.createCognitoIdentityPoolEndpointResolver)({\n endpointOverride: authConfig.identityPoolEndpoint,\n }),\n });\n // use identityId to obtain guest credentials\n // save credentials in-memory\n // No logins params should be passed for guest creds:\n // https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_GetCredentialsForIdentity.html\n let clientResult;\n try {\n clientResult = await getCredentialsForIdentity({ region }, {\n IdentityId: identityId,\n });\n }\n catch (e) {\n (0, assertServiceError_1.assertServiceError)(e);\n throw new AuthError_1.AuthError(e);\n }\n if (clientResult?.Credentials?.AccessKeyId &&\n clientResult?.Credentials?.SecretKey) {\n this._nextCredentialsRefresh = new Date().getTime() + CREDENTIALS_TTL;\n const res = {\n credentials: {\n accessKeyId: clientResult.Credentials.AccessKeyId,\n secretAccessKey: clientResult.Credentials.SecretKey,\n sessionToken: clientResult.Credentials.SessionToken,\n expiration: clientResult.Credentials.Expiration,\n },\n identityId,\n };\n if (clientResult.IdentityId) {\n res.identityId = clientResult.IdentityId;\n this._identityIdStore.storeIdentityId({\n id: clientResult.IdentityId,\n type: 'guest',\n });\n }\n this._credentialsAndIdentityId = {\n ...res,\n isAuthenticatedCreds: false,\n };\n return res;\n }\n else {\n throw new AuthError_1.AuthError({\n name: 'CredentialsNotFoundException',\n message: `Cognito did not respond with either Credentials, AccessKeyId or SecretKey.`,\n });\n }\n }\n async credsForOIDCTokens(authConfig, authTokens, identityId) {\n if (this._credentialsAndIdentityId &&\n !this.isPastTTL() &&\n this._credentialsAndIdentityId.isAuthenticatedCreds === true) {\n logger.debug('returning stored credentials as they neither past TTL nor expired.');\n return this._credentialsAndIdentityId;\n }\n // Clear to discard if any unauthenticated credentials are set and start with a clean slate\n this.clearCredentials();\n const logins = authTokens.idToken\n ? (0, utils_2.formLoginsMap)(authTokens.idToken.toString())\n : {};\n const region = (0, parsers_1.getRegionFromIdentityPoolId)(authConfig.identityPoolId);\n const getCredentialsForIdentity = (0, core_1.createGetCredentialsForIdentityClient)({\n endpointResolver: (0, factories_1.createCognitoIdentityPoolEndpointResolver)({\n endpointOverride: authConfig.identityPoolEndpoint,\n }),\n });\n let clientResult;\n try {\n clientResult = await getCredentialsForIdentity({ region }, {\n IdentityId: identityId,\n Logins: logins,\n });\n }\n catch (e) {\n (0, assertServiceError_1.assertServiceError)(e);\n throw new AuthError_1.AuthError(e);\n }\n if (clientResult?.Credentials?.AccessKeyId &&\n clientResult?.Credentials?.SecretKey) {\n this._nextCredentialsRefresh = new Date().getTime() + CREDENTIALS_TTL;\n const res = {\n credentials: {\n accessKeyId: clientResult.Credentials.AccessKeyId,\n secretAccessKey: clientResult.Credentials.SecretKey,\n sessionToken: clientResult.Credentials.SessionToken,\n expiration: clientResult.Credentials.Expiration,\n },\n identityId,\n };\n if (clientResult.IdentityId) {\n res.identityId = clientResult.IdentityId;\n // note: the following call removes guest identityId from the persistent store (localStorage)\n this._identityIdStore.storeIdentityId({\n id: clientResult.IdentityId,\n type: 'primary',\n });\n }\n // Store the credentials in-memory along with the expiration\n this._credentialsAndIdentityId = {\n ...res,\n isAuthenticatedCreds: true,\n associatedIdToken: authTokens.idToken?.toString(),\n };\n return res;\n }\n else {\n throw new AuthError_1.AuthError({\n name: 'CredentialsException',\n message: `Cognito did not respond with either Credentials, AccessKeyId or SecretKey.`,\n });\n }\n }\n isPastTTL() {\n return this._nextCredentialsRefresh === undefined\n ? true\n : this._nextCredentialsRefresh <= Date.now();\n }\n hasTokenChanged(tokens) {\n return (!!tokens &&\n !!this._credentialsAndIdentityId?.associatedIdToken &&\n tokens.idToken?.toString() !==\n this._credentialsAndIdentityId.associatedIdToken);\n }\n}\nexports.CognitoAWSCredentialsAndIdentityIdProvider = CognitoAWSCredentialsAndIdentityIdProvider;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0CAA0C,GAAG,MAAM;AAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,CAAC;AAChF,MAAM,SAAS,GAAG,OAAO,CAAC,6BAA6B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;AAC3C,MAAM,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;AAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,4BAA4B,CAAC;AACrE,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACvC,MAAM,0CAA0C,CAAC;AACjD,IAAI,WAAW,CAAC,eAAe,EAAE;AACjC,QAAQ,IAAI,CAAC,uBAAuB,GAAG,CAAC;AACxC,QAAQ,IAAI,CAAC,gBAAgB,GAAG,eAAe;AAC/C;AACA,IAAI,MAAM,6BAA6B,GAAG;AAC1C,QAAQ,MAAM,CAAC,KAAK,CAAC,yCAAyC,CAA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B,CAAC,iBAAiB;AAChE;AACA;AACA,OAAO,CAAC,0CAA0C,GAAG,0CAA0C;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.formLoginsMap = void 0;
6
+ exports.formLoginsMap = formLoginsMap;
7
7
  const utils_1 = require("@aws-amplify/core/internals/utils");
8
8
  const AuthError_1 = require("../../../errors/AuthError");
9
9
  function formLoginsMap(idToken) {
@@ -19,5 +19,4 @@ function formLoginsMap(idToken) {
19
19
  res[domainName] = idToken;
20
20
  return res;
21
21
  }
22
- exports.formLoginsMap = formLoginsMap;
23
22
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/providers/cognito/credentialsProvider/utils.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.formLoginsMap = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nfunction formLoginsMap(idToken) {\n const issuer = (0, utils_1.decodeJWT)(idToken).payload.iss;\n const res = {};\n if (!issuer) {\n throw new AuthError_1.AuthError({\n name: 'InvalidIdTokenException',\n message: 'Invalid Idtoken.',\n });\n }\n const domainName = issuer.replace(/(^\\w+:|^)\\/\\//, '');\n res[domainName] = idToken;\n return res;\n}\nexports.formLoginsMap = formLoginsMap;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,MAAM;AAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,SAAS,aAAa,CAAC,OAAO,EAAE;AAChC,IAAI,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG;AAC9D,IAAI,MAAM,GAAG,GAAG,EAAE;AAClB,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,QAAQ,MAAM,IAAI,WAAW,CAAC,SAAS,CAAC;AACxC,YAAY,IAAI,EAAE,yBAAyB;AAC3C,YAAY,OAAO,EAAE,kBAAkB;AACvC,SAAS,CAAC;AACV;AACA,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;AAC1D,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,OAAO;AAC7B,IAAI,OAAO,GAAG;AACd;AACA,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/providers/cognito/credentialsProvider/utils.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.formLoginsMap = formLoginsMap;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nfunction formLoginsMap(idToken) {\n const issuer = (0, utils_1.decodeJWT)(idToken).payload.iss;\n const res = {};\n if (!issuer) {\n throw new AuthError_1.AuthError({\n name: 'InvalidIdTokenException',\n message: 'Invalid Idtoken.',\n });\n }\n const domainName = issuer.replace(/(^\\w+:|^)\\/\\//, '');\n res[domainName] = idToken;\n return res;\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,aAAa;AACrC,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,SAAS,aAAa,CAAC,OAAO,EAAE;AAChC,IAAI,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG;AAC9D,IAAI,MAAM,GAAG,GAAG,EAAE;AAClB,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,QAAQ,MAAM,IAAI,WAAW,CAAC,SAAS,CAAC;AACxC,YAAY,IAAI,EAAE,yBAAyB;AAC3C,YAAY,OAAO,EAAE,kBAAkB;AACvC,SAAS,CAAC;AACV;AACA,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;AAC1D,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,OAAO;AAC7B,IAAI,OAAO,GAAG;AACd;;"}
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.createCognitoIdentityPoolEndpointResolver = void 0;
5
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
+ // SPDX-License-Identifier: Apache-2.0
7
+ const core_1 = require("@aws-amplify/core");
8
+ const utils_1 = require("@aws-amplify/core/internals/utils");
9
+ const createCognitoIdentityPoolEndpointResolver = ({ endpointOverride }) => (input) => {
10
+ if (endpointOverride) {
11
+ return { url: new utils_1.AmplifyUrl(endpointOverride) };
12
+ }
13
+ return (0, core_1.cognitoIdentityPoolEndpointResolver)(input);
14
+ };
15
+ exports.createCognitoIdentityPoolEndpointResolver = createCognitoIdentityPoolEndpointResolver;
16
+ //# sourceMappingURL=createCognitoIdentityPoolEndpointResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCognitoIdentityPoolEndpointResolver.js","sources":["../../../../../src/providers/cognito/factories/createCognitoIdentityPoolEndpointResolver.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createCognitoIdentityPoolEndpointResolver = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst createCognitoIdentityPoolEndpointResolver = ({ endpointOverride }) => (input) => {\n if (endpointOverride) {\n return { url: new utils_1.AmplifyUrl(endpointOverride) };\n }\n return (0, core_1.cognitoIdentityPoolEndpointResolver)(input);\n};\nexports.createCognitoIdentityPoolEndpointResolver = createCognitoIdentityPoolEndpointResolver;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,yCAAyC,GAAG,MAAM;AAC1D;AACA;AACA,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,yCAAyC,GAAG,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,KAAK,KAAK;AACvF,IAAI,IAAI,gBAAgB,EAAE;AAC1B,QAAQ,OAAO,EAAE,GAAG,EAAE,IAAI,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;AAChE;AACA,IAAI,OAAO,IAAI,MAAM,CAAC,mCAAmC,EAAE,KAAK,CAAC;AACjE,CAAC;AACD,OAAO,CAAC,yCAAyC,GAAG,yCAAyC;;"}
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.createCognitoUserPoolEndpointResolver = void 0;
4
+ exports.createCognitoIdentityPoolEndpointResolver = exports.createCognitoUserPoolEndpointResolver = void 0;
5
5
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
6
  // SPDX-License-Identifier: Apache-2.0
7
7
  var createCognitoUserPoolEndpointResolver_1 = require("./createCognitoUserPoolEndpointResolver");
8
8
  Object.defineProperty(exports, "createCognitoUserPoolEndpointResolver", { enumerable: true, get: function () { return createCognitoUserPoolEndpointResolver_1.createCognitoUserPoolEndpointResolver; } });
9
+ var createCognitoIdentityPoolEndpointResolver_1 = require("./createCognitoIdentityPoolEndpointResolver");
10
+ Object.defineProperty(exports, "createCognitoIdentityPoolEndpointResolver", { enumerable: true, get: function () { return createCognitoIdentityPoolEndpointResolver_1.createCognitoIdentityPoolEndpointResolver; } });
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/providers/cognito/factories/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createCognitoUserPoolEndpointResolver = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar createCognitoUserPoolEndpointResolver_1 = require(\"./createCognitoUserPoolEndpointResolver\");\nObject.defineProperty(exports, \"createCognitoUserPoolEndpointResolver\", { enumerable: true, get: function () { return createCognitoUserPoolEndpointResolver_1.createCognitoUserPoolEndpointResolver; } });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qCAAqC,GAAG,MAAM;AACtD;AACA;AACA,IAAI,uCAAuC,GAAG,OAAO,CAAC,yCAAyC,CAAC;AAChG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,uCAAuC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,uCAAuC,CAAC,qCAAqC,CAAC,EAAE,EAAE,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/providers/cognito/factories/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createCognitoIdentityPoolEndpointResolver = exports.createCognitoUserPoolEndpointResolver = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar createCognitoUserPoolEndpointResolver_1 = require(\"./createCognitoUserPoolEndpointResolver\");\nObject.defineProperty(exports, \"createCognitoUserPoolEndpointResolver\", { enumerable: true, get: function () { return createCognitoUserPoolEndpointResolver_1.createCognitoUserPoolEndpointResolver; } });\nvar createCognitoIdentityPoolEndpointResolver_1 = require(\"./createCognitoIdentityPoolEndpointResolver\");\nObject.defineProperty(exports, \"createCognitoIdentityPoolEndpointResolver\", { enumerable: true, get: function () { return createCognitoIdentityPoolEndpointResolver_1.createCognitoIdentityPoolEndpointResolver; } });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,yCAAyC,GAAG,OAAO,CAAC,qCAAqC,GAAG,MAAM;AAC1G;AACA;AACA,IAAI,uCAAuC,GAAG,OAAO,CAAC,yCAAyC,CAAC;AAChG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,uCAAuC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,uCAAuC,CAAC,qCAAqC,CAAC,EAAE,EAAE,CAAC;AACzM,IAAI,2CAA2C,GAAG,OAAO,CAAC,6CAA6C,CAAC;AACxG,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,2CAA2C,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,2CAA2C,CAAC,yCAAyC,CAAC,EAAE,EAAE,CAAC;;"}
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getAuthStorageKeys = exports.createKeysForAuthStorage = exports.DefaultTokenStore = void 0;
4
+ exports.createKeysForAuthStorage = exports.DefaultTokenStore = void 0;
5
+ exports.getAuthStorageKeys = getAuthStorageKeys;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  const AuthError_1 = require("../../../errors/AuthError");
7
8
  const types_1 = require("./types");
@@ -166,5 +167,4 @@ function getAuthStorageKeys(authKeys) {
166
167
  [authKey]: `${prefix}.${identifier}.${authKey}`,
167
168
  }), {});
168
169
  }
169
- exports.getAuthStorageKeys = getAuthStorageKeys;
170
170
  //# sourceMappingURL=TokenStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TokenStore.js","sources":["../../../../../src/providers/cognito/tokenProvider/TokenStore.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getAuthStorageKeys = exports.createKeysForAuthStorage = exports.DefaultTokenStore = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst types_1 = require(\"./types\");\nconst errorHelpers_1 = require(\"./errorHelpers\");\nconst constants_1 = require(\"./constants\");\nclass DefaultTokenStore {\n getKeyValueStorage() {\n if (!this.keyValueStorage) {\n throw new AuthError_1.AuthError({\n name: 'KeyValueStorageNotFoundException',\n message: 'KeyValueStorage was not found in TokenStore',\n });\n }\n return this.keyValueStorage;\n }\n setKeyValueStorage(keyValueStorage) {\n this.keyValueStorage = keyValueStorage;\n }\n setAuthConfig(authConfig) {\n this.authConfig = authConfig;\n }\n async loadTokens() {\n // TODO(v6): migration logic should be here\n // Reading V5 tokens old format\n try {\n const authKeys = await this.getAuthKeys();\n const accessTokenString = await this.getKeyValueStorage().getItem(authKeys.accessToken);\n if (!accessTokenString) {\n throw new AuthError_1.AuthError({\n name: 'NoSessionFoundException',\n message: 'Auth session was not found. Make sure to call signIn.',\n });\n }\n const accessToken = (0, utils_1.decodeJWT)(accessTokenString);\n const itString = await this.getKeyValueStorage().getItem(authKeys.idToken);\n const idToken = itString ? (0, utils_1.decodeJWT)(itString) : undefined;\n const refreshToken = (await this.getKeyValueStorage().getItem(authKeys.refreshToken)) ??\n undefined;\n const clockDriftString = (await this.getKeyValueStorage().getItem(authKeys.clockDrift)) ?? '0';\n const clockDrift = Number.parseInt(clockDriftString);\n const signInDetails = await this.getKeyValueStorage().getItem(authKeys.signInDetails);\n const tokens = {\n accessToken,\n idToken,\n refreshToken,\n deviceMetadata: (await this.getDeviceMetadata()) ?? undefined,\n clockDrift,\n username: await this.getLastAuthUser(),\n };\n if (signInDetails) {\n tokens.signInDetails = JSON.parse(signInDetails);\n }\n return tokens;\n }\n catch (err) {\n return null;\n }\n }\n async storeTokens(tokens) {\n (0, errorHelpers_1.assert)(tokens !== undefined, errorHelpers_1.TokenProviderErrorCode.InvalidAuthTokens);\n const lastAuthUser = tokens.username;\n await this.getKeyValueStorage().setItem(this.getLastAuthUserKey(), lastAuthUser);\n const authKeys = await this.getAuthKeys();\n await this.getKeyValueStorage().setItem(authKeys.accessToken, tokens.accessToken.toString());\n if (tokens.idToken) {\n await this.getKeyValueStorage().setItem(authKeys.idToken, tokens.idToken.toString());\n }\n else {\n await this.getKeyValueStorage().removeItem(authKeys.idToken);\n }\n if (tokens.refreshToken) {\n await this.getKeyValueStorage().setItem(authKeys.refreshToken, tokens.refreshToken);\n }\n else {\n await this.getKeyValueStorage().removeItem(authKeys.refreshToken);\n }\n if (tokens.deviceMetadata) {\n if (tokens.deviceMetadata.deviceKey) {\n await this.getKeyValueStorage().setItem(authKeys.deviceKey, tokens.deviceMetadata.deviceKey);\n }\n if (tokens.deviceMetadata.deviceGroupKey) {\n await this.getKeyValueStorage().setItem(authKeys.deviceGroupKey, tokens.deviceMetadata.deviceGroupKey);\n }\n await this.getKeyValueStorage().setItem(authKeys.randomPasswordKey, tokens.deviceMetadata.randomPassword);\n }\n if (tokens.signInDetails) {\n await this.getKeyValueStorage().setItem(authKeys.signInDetails, JSON.stringify(tokens.signInDetails));\n }\n else {\n await this.getKeyValueStorage().removeItem(authKeys.signInDetails);\n }\n await this.getKeyValueStorage().setItem(authKeys.clockDrift, `${tokens.clockDrift}`);\n }\n async clearTokens() {\n const authKeys = await this.getAuthKeys();\n // Not calling clear because it can remove data that is not managed by AuthTokenStore\n await Promise.all([\n this.getKeyValueStorage().removeItem(authKeys.accessToken),\n this.getKeyValueStorage().removeItem(authKeys.idToken),\n this.getKeyValueStorage().removeItem(authKeys.clockDrift),\n this.getKeyValueStorage().removeItem(authKeys.refreshToken),\n this.getKeyValueStorage().removeItem(authKeys.signInDetails),\n this.getKeyValueStorage().removeItem(this.getLastAuthUserKey()),\n this.getKeyValueStorage().removeItem(authKeys.oauthMetadata),\n ]);\n }\n async getDeviceMetadata(username) {\n const authKeys = await this.getAuthKeys(username);\n const deviceKey = await this.getKeyValueStorage().getItem(authKeys.deviceKey);\n const deviceGroupKey = await this.getKeyValueStorage().getItem(authKeys.deviceGroupKey);\n const randomPassword = await this.getKeyValueStorage().getItem(authKeys.randomPasswordKey);\n return randomPassword && deviceGroupKey && deviceKey\n ? {\n deviceKey,\n deviceGroupKey,\n randomPassword,\n }\n : null;\n }\n async clearDeviceMetadata(username) {\n const authKeys = await this.getAuthKeys(username);\n await Promise.all([\n this.getKeyValueStorage().removeItem(authKeys.deviceKey),\n this.getKeyValueStorage().removeItem(authKeys.deviceGroupKey),\n this.getKeyValueStorage().removeItem(authKeys.randomPasswordKey),\n ]);\n }\n async getAuthKeys(username) {\n (0, utils_1.assertTokenProviderConfig)(this.authConfig?.Cognito);\n const lastAuthUser = username ?? (await this.getLastAuthUser());\n return (0, exports.createKeysForAuthStorage)(constants_1.AUTH_KEY_PREFIX, `${this.authConfig.Cognito.userPoolClientId}.${lastAuthUser}`);\n }\n getLastAuthUserKey() {\n (0, utils_1.assertTokenProviderConfig)(this.authConfig?.Cognito);\n const identifier = this.authConfig.Cognito.userPoolClientId;\n return `${constants_1.AUTH_KEY_PREFIX}.${identifier}.LastAuthUser`;\n }\n async getLastAuthUser() {\n const lastAuthUser = (await this.getKeyValueStorage().getItem(this.getLastAuthUserKey())) ??\n 'username';\n return lastAuthUser;\n }\n async setOAuthMetadata(metadata) {\n const { oauthMetadata: oauthMetadataKey } = await this.getAuthKeys();\n await this.getKeyValueStorage().setItem(oauthMetadataKey, JSON.stringify(metadata));\n }\n async getOAuthMetadata() {\n const { oauthMetadata: oauthMetadataKey } = await this.getAuthKeys();\n const oauthMetadata = await this.getKeyValueStorage().getItem(oauthMetadataKey);\n return oauthMetadata && JSON.parse(oauthMetadata);\n }\n}\nexports.DefaultTokenStore = DefaultTokenStore;\nconst createKeysForAuthStorage = (provider, identifier) => {\n return getAuthStorageKeys(types_1.AuthTokenStorageKeys)(`${provider}`, identifier);\n};\nexports.createKeysForAuthStorage = createKeysForAuthStorage;\nfunction getAuthStorageKeys(authKeys) {\n const keys = Object.values({ ...authKeys });\n return (prefix, identifier) => keys.reduce((acc, authKey) => ({\n ...acc,\n [authKey]: `${prefix}.${identifier}.${authKey}`,\n }), {});\n}\nexports.getAuthStorageKeys = getAuthStorageKeys;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,GAAG,MAAM;AAClG,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAChD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;AAC1C,MAAM,iBAAiB,CAAC;AACxB,IAAI,kBAAkB,GAAG;AACzB,QAAQ,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE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AAE,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC;AACtF,CAAC;AACD,OAAO,CAAC,wBAAwB,GAAG,wBAAwB;AAC3D,SAAS,kBAAkB,CAAC,QAAQ,EAAE;AACtC,IAAI,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC;AAC/C,IAAI,OAAO,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,MAAM;AAClE,QAAQ,GAAG,GAAG;AACd,QAAQ,CAAC,OAAO,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACvD,KAAK,CAAC,EAAE,EAAE,CAAC;AACX;AACA,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
1
+ {"version":3,"file":"TokenStore.js","sources":["../../../../../src/providers/cognito/tokenProvider/TokenStore.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createKeysForAuthStorage = exports.DefaultTokenStore = void 0;\nexports.getAuthStorageKeys = getAuthStorageKeys;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst AuthError_1 = require(\"../../../errors/AuthError\");\nconst types_1 = require(\"./types\");\nconst errorHelpers_1 = require(\"./errorHelpers\");\nconst constants_1 = require(\"./constants\");\nclass DefaultTokenStore {\n getKeyValueStorage() {\n if (!this.keyValueStorage) {\n throw new AuthError_1.AuthError({\n name: 'KeyValueStorageNotFoundException',\n message: 'KeyValueStorage was not found in TokenStore',\n });\n }\n return this.keyValueStorage;\n }\n setKeyValueStorage(keyValueStorage) {\n this.keyValueStorage = keyValueStorage;\n }\n setAuthConfig(authConfig) {\n this.authConfig = authConfig;\n }\n async loadTokens() {\n // TODO(v6): migration logic should be here\n // Reading V5 tokens old format\n try {\n const authKeys = await this.getAuthKeys();\n const accessTokenString = await this.getKeyValueStorage().getItem(authKeys.accessToken);\n if (!accessTokenString) {\n throw new AuthError_1.AuthError({\n name: 'NoSessionFoundException',\n message: 'Auth session was not found. Make sure to call signIn.',\n });\n }\n const accessToken = (0, utils_1.decodeJWT)(accessTokenString);\n const itString = await this.getKeyValueStorage().getItem(authKeys.idToken);\n const idToken = itString ? (0, utils_1.decodeJWT)(itString) : undefined;\n const refreshToken = (await this.getKeyValueStorage().getItem(authKeys.refreshToken)) ??\n undefined;\n const clockDriftString = (await this.getKeyValueStorage().getItem(authKeys.clockDrift)) ?? '0';\n const clockDrift = Number.parseInt(clockDriftString);\n const signInDetails = await this.getKeyValueStorage().getItem(authKeys.signInDetails);\n const tokens = {\n accessToken,\n idToken,\n refreshToken,\n deviceMetadata: (await this.getDeviceMetadata()) ?? undefined,\n clockDrift,\n username: await this.getLastAuthUser(),\n };\n if (signInDetails) {\n tokens.signInDetails = JSON.parse(signInDetails);\n }\n return tokens;\n }\n catch (err) {\n return null;\n }\n }\n async storeTokens(tokens) {\n (0, errorHelpers_1.assert)(tokens !== undefined, errorHelpers_1.TokenProviderErrorCode.InvalidAuthTokens);\n const lastAuthUser = tokens.username;\n await this.getKeyValueStorage().setItem(this.getLastAuthUserKey(), lastAuthUser);\n const authKeys = await this.getAuthKeys();\n await this.getKeyValueStorage().setItem(authKeys.accessToken, tokens.accessToken.toString());\n if (tokens.idToken) {\n await this.getKeyValueStorage().setItem(authKeys.idToken, tokens.idToken.toString());\n }\n else {\n await this.getKeyValueStorage().removeItem(authKeys.idToken);\n }\n if (tokens.refreshToken) {\n await this.getKeyValueStorage().setItem(authKeys.refreshToken, tokens.refreshToken);\n }\n else {\n await this.getKeyValueStorage().removeItem(authKeys.refreshToken);\n }\n if (tokens.deviceMetadata) {\n if (tokens.deviceMetadata.deviceKey) {\n await this.getKeyValueStorage().setItem(authKeys.deviceKey, tokens.deviceMetadata.deviceKey);\n }\n if (tokens.deviceMetadata.deviceGroupKey) {\n await this.getKeyValueStorage().setItem(authKeys.deviceGroupKey, tokens.deviceMetadata.deviceGroupKey);\n }\n await this.getKeyValueStorage().setItem(authKeys.randomPasswordKey, tokens.deviceMetadata.randomPassword);\n }\n if (tokens.signInDetails) {\n await this.getKeyValueStorage().setItem(authKeys.signInDetails, JSON.stringify(tokens.signInDetails));\n }\n else {\n await this.getKeyValueStorage().removeItem(authKeys.signInDetails);\n }\n await this.getKeyValueStorage().setItem(authKeys.clockDrift, `${tokens.clockDrift}`);\n }\n async clearTokens() {\n const authKeys = await this.getAuthKeys();\n // Not calling clear because it can remove data that is not managed by AuthTokenStore\n await Promise.all([\n this.getKeyValueStorage().removeItem(authKeys.accessToken),\n this.getKeyValueStorage().removeItem(authKeys.idToken),\n this.getKeyValueStorage().removeItem(authKeys.clockDrift),\n this.getKeyValueStorage().removeItem(authKeys.refreshToken),\n this.getKeyValueStorage().removeItem(authKeys.signInDetails),\n this.getKeyValueStorage().removeItem(this.getLastAuthUserKey()),\n this.getKeyValueStorage().removeItem(authKeys.oauthMetadata),\n ]);\n }\n async getDeviceMetadata(username) {\n const authKeys = await this.getAuthKeys(username);\n const deviceKey = await this.getKeyValueStorage().getItem(authKeys.deviceKey);\n const deviceGroupKey = await this.getKeyValueStorage().getItem(authKeys.deviceGroupKey);\n const randomPassword = await this.getKeyValueStorage().getItem(authKeys.randomPasswordKey);\n return randomPassword && deviceGroupKey && deviceKey\n ? {\n deviceKey,\n deviceGroupKey,\n randomPassword,\n }\n : null;\n }\n async clearDeviceMetadata(username) {\n const authKeys = await this.getAuthKeys(username);\n await Promise.all([\n this.getKeyValueStorage().removeItem(authKeys.deviceKey),\n this.getKeyValueStorage().removeItem(authKeys.deviceGroupKey),\n this.getKeyValueStorage().removeItem(authKeys.randomPasswordKey),\n ]);\n }\n async getAuthKeys(username) {\n (0, utils_1.assertTokenProviderConfig)(this.authConfig?.Cognito);\n const lastAuthUser = username ?? (await this.getLastAuthUser());\n return (0, exports.createKeysForAuthStorage)(constants_1.AUTH_KEY_PREFIX, `${this.authConfig.Cognito.userPoolClientId}.${lastAuthUser}`);\n }\n getLastAuthUserKey() {\n (0, utils_1.assertTokenProviderConfig)(this.authConfig?.Cognito);\n const identifier = this.authConfig.Cognito.userPoolClientId;\n return `${constants_1.AUTH_KEY_PREFIX}.${identifier}.LastAuthUser`;\n }\n async getLastAuthUser() {\n const lastAuthUser = (await this.getKeyValueStorage().getItem(this.getLastAuthUserKey())) ??\n 'username';\n return lastAuthUser;\n }\n async setOAuthMetadata(metadata) {\n const { oauthMetadata: oauthMetadataKey } = await this.getAuthKeys();\n await this.getKeyValueStorage().setItem(oauthMetadataKey, JSON.stringify(metadata));\n }\n async getOAuthMetadata() {\n const { oauthMetadata: oauthMetadataKey } = await this.getAuthKeys();\n const oauthMetadata = await this.getKeyValueStorage().getItem(oauthMetadataKey);\n return oauthMetadata && JSON.parse(oauthMetadata);\n }\n}\nexports.DefaultTokenStore = DefaultTokenStore;\nconst createKeysForAuthStorage = (provider, identifier) => {\n return getAuthStorageKeys(types_1.AuthTokenStorageKeys)(`${provider}`, identifier);\n};\nexports.createKeysForAuthStorage = createKeysForAuthStorage;\nfunction getAuthStorageKeys(authKeys) {\n const keys = Object.values({ ...authKeys });\n return (prefix, identifier) => keys.reduce((acc, authKey) => ({\n ...acc,\n [authKey]: `${prefix}.${identifier}.${authKey}`,\n }), {});\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,GAAG,MAAM;AACrE,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;AAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,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,iBAAiB,GAAG,iBAAiB;AAC7C,MAAM,wBAAwB,GAAG,CAAC,QAAQ,EAAE,UAAU,KAAK;AAC3D,IAAI,OAAO,kBAAkB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC;AACtF,CAAC;AACD,OAAO,CAAC,wBAAwB,GAAG,wBAAwB;AAC3D,SAAS,kBAAkB,CAAC,QAAQ,EAAE;AACtC,IAAI,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC;AAC/C,IAAI,OAAO,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,MAAM;AAClE,QAAQ,GAAG,GAAG;AACd,QAAQ,CAAC,OAAO,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACvD,KAAK,CAAC,EAAE,EAAE,CAAC;AACX;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.cacheCognitoTokens = void 0;
4
+ exports.cacheCognitoTokens = cacheCognitoTokens;
5
5
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6
6
  // SPDX-License-Identifier: Apache-2.0
7
7
  const utils_1 = require("@aws-amplify/core/internals/utils");
@@ -50,5 +50,4 @@ async function cacheCognitoTokens(AuthenticationResult) {
50
50
  });
51
51
  }
52
52
  }
53
- exports.cacheCognitoTokens = cacheCognitoTokens;
54
53
  //# sourceMappingURL=cacheTokens.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cacheTokens.js","sources":["../../../../../src/providers/cognito/tokenProvider/cacheTokens.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cacheCognitoTokens = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst tokenProvider_1 = require(\"./tokenProvider\");\nasync function cacheCognitoTokens(AuthenticationResult) {\n if (AuthenticationResult.AccessToken) {\n const accessToken = (0, utils_1.decodeJWT)(AuthenticationResult.AccessToken);\n const accessTokenIssuedAtInMillis = (accessToken.payload.iat || 0) * 1000;\n const currentTime = new Date().getTime();\n const clockDrift = accessTokenIssuedAtInMillis > 0\n ? accessTokenIssuedAtInMillis - currentTime\n : 0;\n let idToken;\n let refreshToken;\n let deviceMetadata;\n if (AuthenticationResult.RefreshToken) {\n refreshToken = AuthenticationResult.RefreshToken;\n }\n if (AuthenticationResult.IdToken) {\n idToken = (0, utils_1.decodeJWT)(AuthenticationResult.IdToken);\n }\n if (AuthenticationResult?.NewDeviceMetadata) {\n deviceMetadata = AuthenticationResult.NewDeviceMetadata;\n }\n const tokens = {\n accessToken,\n idToken,\n refreshToken,\n clockDrift,\n deviceMetadata,\n username: AuthenticationResult.username,\n };\n if (AuthenticationResult?.signInDetails) {\n tokens.signInDetails = AuthenticationResult.signInDetails;\n }\n await tokenProvider_1.tokenOrchestrator.setTokens({\n tokens,\n });\n }\n else {\n // This would be a service error\n throw new utils_1.AmplifyError({\n message: 'Invalid tokens',\n name: 'InvalidTokens',\n recoverySuggestion: 'Check Cognito UserPool settings',\n });\n }\n}\nexports.cacheCognitoTokens = cacheCognitoTokens;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,MAAM;AACnC;AACA;AACA,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAClD,eAAe,kBAAkB,CAAC,oBAAoB,EAAE;AACxD,IAAI,IAA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C,YAAY,OAAO,EAAE,gBAAgB;AACrC,YAAY,IAAI,EAAE,eAAe;AACjC,YAAY,kBAAkB,EAAE,iCAAiC;AACjE,SAAS,CAAC;AACV;AACA;AACA,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
1
+ {"version":3,"file":"cacheTokens.js","sources":["../../../../../src/providers/cognito/tokenProvider/cacheTokens.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cacheCognitoTokens = cacheCognitoTokens;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst tokenProvider_1 = require(\"./tokenProvider\");\nasync function cacheCognitoTokens(AuthenticationResult) {\n if (AuthenticationResult.AccessToken) {\n const accessToken = (0, utils_1.decodeJWT)(AuthenticationResult.AccessToken);\n const accessTokenIssuedAtInMillis = (accessToken.payload.iat || 0) * 1000;\n const currentTime = new Date().getTime();\n const clockDrift = accessTokenIssuedAtInMillis > 0\n ? accessTokenIssuedAtInMillis - currentTime\n : 0;\n let idToken;\n let refreshToken;\n let deviceMetadata;\n if (AuthenticationResult.RefreshToken) {\n refreshToken = AuthenticationResult.RefreshToken;\n }\n if (AuthenticationResult.IdToken) {\n idToken = (0, utils_1.decodeJWT)(AuthenticationResult.IdToken);\n }\n if (AuthenticationResult?.NewDeviceMetadata) {\n deviceMetadata = AuthenticationResult.NewDeviceMetadata;\n }\n const tokens = {\n accessToken,\n idToken,\n refreshToken,\n clockDrift,\n deviceMetadata,\n username: AuthenticationResult.username,\n };\n if (AuthenticationResult?.signInDetails) {\n tokens.signInDetails = AuthenticationResult.signInDetails;\n }\n await tokenProvider_1.tokenOrchestrator.setTokens({\n tokens,\n });\n }\n else {\n // This would be a service error\n throw new utils_1.AmplifyError({\n message: 'Invalid tokens',\n name: 'InvalidTokens',\n recoverySuggestion: 'Check Cognito UserPool settings',\n });\n }\n}\n"],"names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EAAE,oBAAoB,CAAC,QAAQ;AACnD,SAAS;AACT,QAAQ,IAAI,oBAAoB,EAAE,aAAa,EAAE;AACjD,YAAY,MAAM,CAAC,aAAa,GAAG,oBAAoB,CAAC,aAAa;AACrE;AACA,QAAQ,MAAM,eAAe,CAAC,iBAAiB,CAAC,SAAS,CAAC;AAC1D,YAAY,MAAM;AAClB,SAAS,CAAC;AACV;AACA,SAAS;AACT;AACA,QAAQ,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;AACvC,YAAY,OAAO,EAAE,gBAAgB;AACrC,YAAY,IAAI,EAAE,eAAe;AACjC,YAAY,kBAAkB,EAAE,iCAAiC;AACjE,SAAS,CAAC;AACV;AACA;;"}
@@ -8,7 +8,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
8
8
  var TokenProviderErrorCode;
9
9
  (function (TokenProviderErrorCode) {
10
10
  TokenProviderErrorCode["InvalidAuthTokens"] = "InvalidAuthTokens";
11
- })(TokenProviderErrorCode = exports.TokenProviderErrorCode || (exports.TokenProviderErrorCode = {}));
11
+ })(TokenProviderErrorCode || (exports.TokenProviderErrorCode = TokenProviderErrorCode = {}));
12
12
  const tokenValidationErrorMap = {
13
13
  [TokenProviderErrorCode.InvalidAuthTokens]: {
14
14
  message: 'Invalid tokens.',
@@ -1 +1 @@
1
- {"version":3,"file":"errorHelpers.js","sources":["../../../../../src/providers/cognito/tokenProvider/errorHelpers.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.assert = exports.TokenProviderErrorCode = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nvar TokenProviderErrorCode;\n(function (TokenProviderErrorCode) {\n TokenProviderErrorCode[\"InvalidAuthTokens\"] = \"InvalidAuthTokens\";\n})(TokenProviderErrorCode = exports.TokenProviderErrorCode || (exports.TokenProviderErrorCode = {}));\nconst tokenValidationErrorMap = {\n [TokenProviderErrorCode.InvalidAuthTokens]: {\n message: 'Invalid tokens.',\n recoverySuggestion: 'Make sure the tokens are valid.',\n },\n};\nexports.assert = (0, utils_1.createAssertionFunction)(tokenValidationErrorMap);\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,MAAM;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,IAAI,sBAAsB;AAC1B,CAAC,UAAU,sBAAsB,EAAE;AACnC,IAAI,sBAAsB,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AACrE,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAC;AACpG,MAAM,uBAAuB,GAAG;AAChC,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,GAAG;AAChD,QAAQ,OAAO,EAAE,iBAAiB;AAClC,QAAQ,kBAAkB,EAAE,iCAAiC;AAC7D,KAAK;AACL,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;;"}
1
+ {"version":3,"file":"errorHelpers.js","sources":["../../../../../src/providers/cognito/tokenProvider/errorHelpers.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.assert = exports.TokenProviderErrorCode = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nvar TokenProviderErrorCode;\n(function (TokenProviderErrorCode) {\n TokenProviderErrorCode[\"InvalidAuthTokens\"] = \"InvalidAuthTokens\";\n})(TokenProviderErrorCode || (exports.TokenProviderErrorCode = TokenProviderErrorCode = {}));\nconst tokenValidationErrorMap = {\n [TokenProviderErrorCode.InvalidAuthTokens]: {\n message: 'Invalid tokens.',\n recoverySuggestion: 'Make sure the tokens are valid.',\n },\n};\nexports.assert = (0, utils_1.createAssertionFunction)(tokenValidationErrorMap);\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,MAAM;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,IAAI,sBAAsB;AAC1B,CAAC,UAAU,sBAAsB,EAAE;AACnC,IAAI,sBAAsB,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AACrE,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC,sBAAsB,GAAG,sBAAsB,GAAG,EAAE,CAAC,CAAC;AAC5F,MAAM,uBAAuB,GAAG;AAChC,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,GAAG;AAChD,QAAQ,OAAO,EAAE,iBAAiB;AAClC,QAAQ,kBAAkB,EAAE,iCAAiC;AAC7D,KAAK;AACL,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;;"}
@@ -4,6 +4,7 @@
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDeviceStatusException = exports.VerifyUserAttributeException = exports.VerifySoftwareTokenException = exports.UpdateUserAttributesException = exports.SignUpException = exports.SetUserMFAPreferenceException = exports.RespondToAuthChallengeException = exports.ResendConfirmationException = exports.InitiateAuthException = exports.GlobalSignOutException = exports.GetUserAttributeVerificationException = exports.GetCredentialsForIdentityException = exports.GetIdException = exports.GetUserException = exports.ForgotPasswordException = exports.ForgetDeviceException = exports.DeleteUserException = exports.DeleteUserAttributesException = exports.ConfirmSignUpException = exports.ConfirmForgotPasswordException = exports.ConfirmDeviceException = exports.ChangePasswordException = exports.AssociateSoftwareTokenException = void 0;
7
+ var AssociateSoftwareTokenException;
7
8
  (function (AssociateSoftwareTokenException) {
8
9
  AssociateSoftwareTokenException["ConcurrentModificationException"] = "ConcurrentModificationException";
9
10
  AssociateSoftwareTokenException["ForbiddenException"] = "ForbiddenException";
@@ -12,7 +13,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
12
13
  AssociateSoftwareTokenException["NotAuthorizedException"] = "NotAuthorizedException";
13
14
  AssociateSoftwareTokenException["ResourceNotFoundException"] = "ResourceNotFoundException";
14
15
  AssociateSoftwareTokenException["SoftwareTokenMFANotFoundException"] = "SoftwareTokenMFANotFoundException";
15
- })(exports.AssociateSoftwareTokenException || (exports.AssociateSoftwareTokenException = {}));
16
+ })(AssociateSoftwareTokenException || (exports.AssociateSoftwareTokenException = AssociateSoftwareTokenException = {}));
17
+ var ChangePasswordException;
16
18
  (function (ChangePasswordException) {
17
19
  ChangePasswordException["ForbiddenException"] = "ForbiddenException";
18
20
  ChangePasswordException["InternalErrorException"] = "InternalErrorException";
@@ -25,7 +27,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
25
27
  ChangePasswordException["TooManyRequestsException"] = "TooManyRequestsException";
26
28
  ChangePasswordException["UserNotConfirmedException"] = "UserNotConfirmedException";
27
29
  ChangePasswordException["UserNotFoundException"] = "UserNotFoundException";
28
- })(exports.ChangePasswordException || (exports.ChangePasswordException = {}));
30
+ })(ChangePasswordException || (exports.ChangePasswordException = ChangePasswordException = {}));
31
+ var ConfirmDeviceException;
29
32
  (function (ConfirmDeviceException) {
30
33
  ConfirmDeviceException["ForbiddenException"] = "ForbiddenException";
31
34
  ConfirmDeviceException["InternalErrorException"] = "InternalErrorException";
@@ -40,7 +43,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
40
43
  ConfirmDeviceException["UsernameExistsException"] = "UsernameExistsException";
41
44
  ConfirmDeviceException["UserNotConfirmedException"] = "UserNotConfirmedException";
42
45
  ConfirmDeviceException["UserNotFoundException"] = "UserNotFoundException";
43
- })(exports.ConfirmDeviceException || (exports.ConfirmDeviceException = {}));
46
+ })(ConfirmDeviceException || (exports.ConfirmDeviceException = ConfirmDeviceException = {}));
47
+ var ConfirmForgotPasswordException;
44
48
  (function (ConfirmForgotPasswordException) {
45
49
  ConfirmForgotPasswordException["CodeMismatchException"] = "CodeMismatchException";
46
50
  ConfirmForgotPasswordException["ExpiredCodeException"] = "ExpiredCodeException";
@@ -58,7 +62,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
58
62
  ConfirmForgotPasswordException["UserLambdaValidationException"] = "UserLambdaValidationException";
59
63
  ConfirmForgotPasswordException["UserNotConfirmedException"] = "UserNotConfirmedException";
60
64
  ConfirmForgotPasswordException["UserNotFoundException"] = "UserNotFoundException";
61
- })(exports.ConfirmForgotPasswordException || (exports.ConfirmForgotPasswordException = {}));
65
+ })(ConfirmForgotPasswordException || (exports.ConfirmForgotPasswordException = ConfirmForgotPasswordException = {}));
66
+ var ConfirmSignUpException;
62
67
  (function (ConfirmSignUpException) {
63
68
  ConfirmSignUpException["AliasExistsException"] = "AliasExistsException";
64
69
  ConfirmSignUpException["CodeMismatchException"] = "CodeMismatchException";
@@ -75,7 +80,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
75
80
  ConfirmSignUpException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
76
81
  ConfirmSignUpException["UserLambdaValidationException"] = "UserLambdaValidationException";
77
82
  ConfirmSignUpException["UserNotFoundException"] = "UserNotFoundException";
78
- })(exports.ConfirmSignUpException || (exports.ConfirmSignUpException = {}));
83
+ })(ConfirmSignUpException || (exports.ConfirmSignUpException = ConfirmSignUpException = {}));
84
+ var DeleteUserAttributesException;
79
85
  (function (DeleteUserAttributesException) {
80
86
  DeleteUserAttributesException["ForbiddenException"] = "ForbiddenException";
81
87
  DeleteUserAttributesException["InternalErrorException"] = "InternalErrorException";
@@ -86,7 +92,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
86
92
  DeleteUserAttributesException["TooManyRequestsException"] = "TooManyRequestsException";
87
93
  DeleteUserAttributesException["UserNotConfirmedException"] = "UserNotConfirmedException";
88
94
  DeleteUserAttributesException["UserNotFoundException"] = "UserNotFoundException";
89
- })(exports.DeleteUserAttributesException || (exports.DeleteUserAttributesException = {}));
95
+ })(DeleteUserAttributesException || (exports.DeleteUserAttributesException = DeleteUserAttributesException = {}));
96
+ var DeleteUserException;
90
97
  (function (DeleteUserException) {
91
98
  DeleteUserException["ForbiddenException"] = "ForbiddenException";
92
99
  DeleteUserException["InternalErrorException"] = "InternalErrorException";
@@ -97,7 +104,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
97
104
  DeleteUserException["TooManyRequestsException"] = "TooManyRequestsException";
98
105
  DeleteUserException["UserNotConfirmedException"] = "UserNotConfirmedException";
99
106
  DeleteUserException["UserNotFoundException"] = "UserNotFoundException";
100
- })(exports.DeleteUserException || (exports.DeleteUserException = {}));
107
+ })(DeleteUserException || (exports.DeleteUserException = DeleteUserException = {}));
108
+ var ForgetDeviceException;
101
109
  (function (ForgetDeviceException) {
102
110
  ForgetDeviceException["ForbiddenException"] = "ForbiddenException";
103
111
  ForgetDeviceException["InternalErrorException"] = "InternalErrorException";
@@ -109,7 +117,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
109
117
  ForgetDeviceException["TooManyRequestsException"] = "TooManyRequestsException";
110
118
  ForgetDeviceException["UserNotConfirmedException"] = "UserNotConfirmedException";
111
119
  ForgetDeviceException["UserNotFoundException"] = "UserNotFoundException";
112
- })(exports.ForgetDeviceException || (exports.ForgetDeviceException = {}));
120
+ })(ForgetDeviceException || (exports.ForgetDeviceException = ForgetDeviceException = {}));
121
+ var ForgotPasswordException;
113
122
  (function (ForgotPasswordException) {
114
123
  ForgotPasswordException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
115
124
  ForgotPasswordException["ForbiddenException"] = "ForbiddenException";
@@ -126,7 +135,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
126
135
  ForgotPasswordException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
127
136
  ForgotPasswordException["UserLambdaValidationException"] = "UserLambdaValidationException";
128
137
  ForgotPasswordException["UserNotFoundException"] = "UserNotFoundException";
129
- })(exports.ForgotPasswordException || (exports.ForgotPasswordException = {}));
138
+ })(ForgotPasswordException || (exports.ForgotPasswordException = ForgotPasswordException = {}));
139
+ var GetUserException;
130
140
  (function (GetUserException) {
131
141
  GetUserException["ForbiddenException"] = "ForbiddenException";
132
142
  GetUserException["InternalErrorException"] = "InternalErrorException";
@@ -137,7 +147,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
137
147
  GetUserException["TooManyRequestsException"] = "TooManyRequestsException";
138
148
  GetUserException["UserNotConfirmedException"] = "UserNotConfirmedException";
139
149
  GetUserException["UserNotFoundException"] = "UserNotFoundException";
140
- })(exports.GetUserException || (exports.GetUserException = {}));
150
+ })(GetUserException || (exports.GetUserException = GetUserException = {}));
151
+ var GetIdException;
141
152
  (function (GetIdException) {
142
153
  GetIdException["ExternalServiceException"] = "ExternalServiceException";
143
154
  GetIdException["InternalErrorException"] = "InternalErrorException";
@@ -147,7 +158,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
147
158
  GetIdException["ResourceConflictException"] = "ResourceConflictException";
148
159
  GetIdException["ResourceNotFoundException"] = "ResourceNotFoundException";
149
160
  GetIdException["TooManyRequestsException"] = "TooManyRequestsException";
150
- })(exports.GetIdException || (exports.GetIdException = {}));
161
+ })(GetIdException || (exports.GetIdException = GetIdException = {}));
162
+ var GetCredentialsForIdentityException;
151
163
  (function (GetCredentialsForIdentityException) {
152
164
  GetCredentialsForIdentityException["ExternalServiceException"] = "ExternalServiceException";
153
165
  GetCredentialsForIdentityException["InternalErrorException"] = "InternalErrorException";
@@ -157,7 +169,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
157
169
  GetCredentialsForIdentityException["ResourceConflictException"] = "ResourceConflictException";
158
170
  GetCredentialsForIdentityException["ResourceNotFoundException"] = "ResourceNotFoundException";
159
171
  GetCredentialsForIdentityException["TooManyRequestsException"] = "TooManyRequestsException";
160
- })(exports.GetCredentialsForIdentityException || (exports.GetCredentialsForIdentityException = {}));
172
+ })(GetCredentialsForIdentityException || (exports.GetCredentialsForIdentityException = GetCredentialsForIdentityException = {}));
173
+ var GetUserAttributeVerificationException;
161
174
  (function (GetUserAttributeVerificationException) {
162
175
  GetUserAttributeVerificationException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
163
176
  GetUserAttributeVerificationException["ForbiddenException"] = "ForbiddenException";
@@ -176,7 +189,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
176
189
  GetUserAttributeVerificationException["UserLambdaValidationException"] = "UserLambdaValidationException";
177
190
  GetUserAttributeVerificationException["UserNotConfirmedException"] = "UserNotConfirmedException";
178
191
  GetUserAttributeVerificationException["UserNotFoundException"] = "UserNotFoundException";
179
- })(exports.GetUserAttributeVerificationException || (exports.GetUserAttributeVerificationException = {}));
192
+ })(GetUserAttributeVerificationException || (exports.GetUserAttributeVerificationException = GetUserAttributeVerificationException = {}));
193
+ var GlobalSignOutException;
180
194
  (function (GlobalSignOutException) {
181
195
  GlobalSignOutException["ForbiddenException"] = "ForbiddenException";
182
196
  GlobalSignOutException["InternalErrorException"] = "InternalErrorException";
@@ -186,7 +200,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
186
200
  GlobalSignOutException["ResourceNotFoundException"] = "ResourceNotFoundException";
187
201
  GlobalSignOutException["TooManyRequestsException"] = "TooManyRequestsException";
188
202
  GlobalSignOutException["UserNotConfirmedException"] = "UserNotConfirmedException";
189
- })(exports.GlobalSignOutException || (exports.GlobalSignOutException = {}));
203
+ })(GlobalSignOutException || (exports.GlobalSignOutException = GlobalSignOutException = {}));
204
+ var InitiateAuthException;
190
205
  (function (InitiateAuthException) {
191
206
  InitiateAuthException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
192
207
  InitiateAuthException["ForbiddenException"] = "ForbiddenException";
@@ -203,7 +218,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
203
218
  InitiateAuthException["UserLambdaValidationException"] = "UserLambdaValidationException";
204
219
  InitiateAuthException["UserNotConfirmedException"] = "UserNotConfirmedException";
205
220
  InitiateAuthException["UserNotFoundException"] = "UserNotFoundException";
206
- })(exports.InitiateAuthException || (exports.InitiateAuthException = {}));
221
+ })(InitiateAuthException || (exports.InitiateAuthException = InitiateAuthException = {}));
222
+ var ResendConfirmationException;
207
223
  (function (ResendConfirmationException) {
208
224
  ResendConfirmationException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
209
225
  ResendConfirmationException["ForbiddenException"] = "ForbiddenException";
@@ -220,7 +236,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
220
236
  ResendConfirmationException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
221
237
  ResendConfirmationException["UserLambdaValidationException"] = "UserLambdaValidationException";
222
238
  ResendConfirmationException["UserNotFoundException"] = "UserNotFoundException";
223
- })(exports.ResendConfirmationException || (exports.ResendConfirmationException = {}));
239
+ })(ResendConfirmationException || (exports.ResendConfirmationException = ResendConfirmationException = {}));
240
+ var RespondToAuthChallengeException;
224
241
  (function (RespondToAuthChallengeException) {
225
242
  RespondToAuthChallengeException["AliasExistsException"] = "AliasExistsException";
226
243
  RespondToAuthChallengeException["CodeMismatchException"] = "CodeMismatchException";
@@ -243,7 +260,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
243
260
  RespondToAuthChallengeException["UserLambdaValidationException"] = "UserLambdaValidationException";
244
261
  RespondToAuthChallengeException["UserNotConfirmedException"] = "UserNotConfirmedException";
245
262
  RespondToAuthChallengeException["UserNotFoundException"] = "UserNotFoundException";
246
- })(exports.RespondToAuthChallengeException || (exports.RespondToAuthChallengeException = {}));
263
+ })(RespondToAuthChallengeException || (exports.RespondToAuthChallengeException = RespondToAuthChallengeException = {}));
264
+ var SetUserMFAPreferenceException;
247
265
  (function (SetUserMFAPreferenceException) {
248
266
  SetUserMFAPreferenceException["ForbiddenException"] = "ForbiddenException";
249
267
  SetUserMFAPreferenceException["InternalErrorException"] = "InternalErrorException";
@@ -253,7 +271,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
253
271
  SetUserMFAPreferenceException["ResourceNotFoundException"] = "ResourceNotFoundException";
254
272
  SetUserMFAPreferenceException["UserNotConfirmedException"] = "UserNotConfirmedException";
255
273
  SetUserMFAPreferenceException["UserNotFoundException"] = "UserNotFoundException";
256
- })(exports.SetUserMFAPreferenceException || (exports.SetUserMFAPreferenceException = {}));
274
+ })(SetUserMFAPreferenceException || (exports.SetUserMFAPreferenceException = SetUserMFAPreferenceException = {}));
275
+ var SignUpException;
257
276
  (function (SignUpException) {
258
277
  SignUpException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
259
278
  SignUpException["InternalErrorException"] = "InternalErrorException";
@@ -269,7 +288,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
269
288
  SignUpException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
270
289
  SignUpException["UserLambdaValidationException"] = "UserLambdaValidationException";
271
290
  SignUpException["UsernameExistsException"] = "UsernameExistsException";
272
- })(exports.SignUpException || (exports.SignUpException = {}));
291
+ })(SignUpException || (exports.SignUpException = SignUpException = {}));
292
+ var UpdateUserAttributesException;
273
293
  (function (UpdateUserAttributesException) {
274
294
  UpdateUserAttributesException["AliasExistsException"] = "AliasExistsException";
275
295
  UpdateUserAttributesException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
@@ -290,7 +310,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
290
310
  UpdateUserAttributesException["UserLambdaValidationException"] = "UserLambdaValidationException";
291
311
  UpdateUserAttributesException["UserNotConfirmedException"] = "UserNotConfirmedException";
292
312
  UpdateUserAttributesException["UserNotFoundException"] = "UserNotFoundException";
293
- })(exports.UpdateUserAttributesException || (exports.UpdateUserAttributesException = {}));
313
+ })(UpdateUserAttributesException || (exports.UpdateUserAttributesException = UpdateUserAttributesException = {}));
314
+ var VerifySoftwareTokenException;
294
315
  (function (VerifySoftwareTokenException) {
295
316
  VerifySoftwareTokenException["CodeMismatchException"] = "CodeMismatchException";
296
317
  VerifySoftwareTokenException["EnableSoftwareTokenMFAException"] = "EnableSoftwareTokenMFAException";
@@ -305,7 +326,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
305
326
  VerifySoftwareTokenException["TooManyRequestsException"] = "TooManyRequestsException";
306
327
  VerifySoftwareTokenException["UserNotConfirmedException"] = "UserNotConfirmedException";
307
328
  VerifySoftwareTokenException["UserNotFoundException"] = "UserNotFoundException";
308
- })(exports.VerifySoftwareTokenException || (exports.VerifySoftwareTokenException = {}));
329
+ })(VerifySoftwareTokenException || (exports.VerifySoftwareTokenException = VerifySoftwareTokenException = {}));
330
+ var VerifyUserAttributeException;
309
331
  (function (VerifyUserAttributeException) {
310
332
  VerifyUserAttributeException["AliasExistsException"] = "AliasExistsException";
311
333
  VerifyUserAttributeException["CodeMismatchException"] = "CodeMismatchException";
@@ -320,7 +342,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
320
342
  VerifyUserAttributeException["TooManyRequestsException"] = "TooManyRequestsException";
321
343
  VerifyUserAttributeException["UserNotConfirmedException"] = "UserNotConfirmedException";
322
344
  VerifyUserAttributeException["UserNotFoundException"] = "UserNotFoundException";
323
- })(exports.VerifyUserAttributeException || (exports.VerifyUserAttributeException = {}));
345
+ })(VerifyUserAttributeException || (exports.VerifyUserAttributeException = VerifyUserAttributeException = {}));
346
+ var UpdateDeviceStatusException;
324
347
  (function (UpdateDeviceStatusException) {
325
348
  UpdateDeviceStatusException["ForbiddenException"] = "ForbiddenException";
326
349
  UpdateDeviceStatusException["InternalErrorException"] = "InternalErrorException";
@@ -332,7 +355,8 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
332
355
  UpdateDeviceStatusException["TooManyRequestsException"] = "TooManyRequestsException";
333
356
  UpdateDeviceStatusException["UserNotConfirmedException"] = "UserNotConfirmedException";
334
357
  UpdateDeviceStatusException["UserNotFoundException"] = "UserNotFoundException";
335
- })(exports.UpdateDeviceStatusException || (exports.UpdateDeviceStatusException = {}));
358
+ })(UpdateDeviceStatusException || (exports.UpdateDeviceStatusException = UpdateDeviceStatusException = {}));
359
+ var ListDevicesException;
336
360
  (function (ListDevicesException) {
337
361
  ListDevicesException["ForbiddenException"] = "ForbiddenException";
338
362
  ListDevicesException["InternalErrorException"] = "InternalErrorException";
@@ -344,6 +368,6 @@ exports.SETUP_TOTP_EXCEPTION = exports.ListDevicesException = exports.UpdateDevi
344
368
  ListDevicesException["TooManyRequestsException"] = "TooManyRequestsException";
345
369
  ListDevicesException["UserNotConfirmedException"] = "UserNotConfirmedException";
346
370
  ListDevicesException["UserNotFoundException"] = "UserNotFoundException";
347
- })(exports.ListDevicesException || (exports.ListDevicesException = {}));
371
+ })(ListDevicesException || (exports.ListDevicesException = ListDevicesException = {}));
348
372
  exports.SETUP_TOTP_EXCEPTION = 'SetUpTOTPException';
349
373
  //# sourceMappingURL=errors.js.map