@aws-amplify/auth 6.12.4 → 6.12.5-unstable.3c4d29e.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 (173) 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 +1 -2
  96. package/dist/cjs/providers/cognito/credentialsProvider/IdentityIdProvider.js.map +1 -1
  97. package/dist/cjs/providers/cognito/credentialsProvider/utils.js +1 -2
  98. package/dist/cjs/providers/cognito/credentialsProvider/utils.js.map +1 -1
  99. package/dist/cjs/providers/cognito/tokenProvider/TokenStore.js +2 -2
  100. package/dist/cjs/providers/cognito/tokenProvider/TokenStore.js.map +1 -1
  101. package/dist/cjs/providers/cognito/tokenProvider/cacheTokens.js +1 -2
  102. package/dist/cjs/providers/cognito/tokenProvider/cacheTokens.js.map +1 -1
  103. package/dist/cjs/providers/cognito/tokenProvider/errorHelpers.js +1 -1
  104. package/dist/cjs/providers/cognito/tokenProvider/errorHelpers.js.map +1 -1
  105. package/dist/cjs/providers/cognito/types/errors.js +48 -24
  106. package/dist/cjs/providers/cognito/types/errors.js.map +1 -1
  107. package/dist/cjs/providers/cognito/utils/apiHelpers.js +2 -3
  108. package/dist/cjs/providers/cognito/utils/apiHelpers.js.map +1 -1
  109. package/dist/cjs/providers/cognito/utils/getNewDeviceMetadata.js +1 -2
  110. package/dist/cjs/providers/cognito/utils/getNewDeviceMetadata.js.map +1 -1
  111. package/dist/cjs/providers/cognito/utils/handleDeviceSRPAuth.js +1 -2
  112. package/dist/cjs/providers/cognito/utils/handleDeviceSRPAuth.js.map +1 -1
  113. package/dist/cjs/providers/cognito/utils/handlePasswordVerifierChallenge.js +1 -2
  114. package/dist/cjs/providers/cognito/utils/handlePasswordVerifierChallenge.js.map +1 -1
  115. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.js +2 -5
  116. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.js.map +1 -1
  117. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.native.js +1 -2
  118. package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.native.js.map +1 -1
  119. package/dist/cjs/providers/cognito/utils/retryOnResourceNotFoundException.js +1 -2
  120. package/dist/cjs/providers/cognito/utils/retryOnResourceNotFoundException.js.map +1 -1
  121. package/dist/cjs/providers/cognito/utils/setActiveSignInUsername.js +1 -2
  122. package/dist/cjs/providers/cognito/utils/setActiveSignInUsername.js.map +1 -1
  123. package/dist/cjs/providers/cognito/utils/signInHelpers.js +22 -23
  124. package/dist/cjs/providers/cognito/utils/signInHelpers.js.map +1 -1
  125. package/dist/cjs/providers/cognito/utils/signUpHelpers.js +3 -3
  126. package/dist/cjs/providers/cognito/utils/signUpHelpers.js.map +1 -1
  127. package/dist/cjs/providers/cognito/utils/types.js +6 -6
  128. package/dist/cjs/providers/cognito/utils/types.js.map +1 -1
  129. package/dist/cjs/providers/cognito/utils/userContextData.js +1 -2
  130. package/dist/cjs/providers/cognito/utils/userContextData.js.map +1 -1
  131. package/dist/cjs/providers/cognito/utils/userContextData.native.js +1 -2
  132. package/dist/cjs/providers/cognito/utils/userContextData.native.js.map +1 -1
  133. package/dist/cjs/types/Auth.js +2 -1
  134. package/dist/cjs/types/Auth.js.map +1 -1
  135. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/constants.d.ts +1 -1
  136. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createAssociateSoftwareTokenClient.d.ts +2 -2
  137. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createChangePasswordClient.d.ts +2 -2
  138. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createCompleteWebAuthnRegistrationClient.d.ts +2 -2
  139. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmDeviceClient.d.ts +2 -2
  140. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmForgotPasswordClient.d.ts +2 -2
  141. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createConfirmSignUpClient.d.ts +2 -2
  142. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserAttributesClient.d.ts +2 -2
  143. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteUserClient.d.ts +2 -2
  144. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createDeleteWebAuthnCredentialClient.d.ts +2 -2
  145. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createForgetDeviceClient.d.ts +2 -2
  146. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createForgotPasswordClient.d.ts +2 -2
  147. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserAttributeVerificationCodeClient.d.ts +2 -2
  148. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createGetUserClient.d.ts +2 -2
  149. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createGlobalSignOutClient.d.ts +2 -2
  150. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createInitiateAuthClient.d.ts +2 -2
  151. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListDevicesClient.d.ts +2 -2
  152. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createListWebAuthnCredentialsClient.d.ts +2 -2
  153. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createResendConfirmationCodeClient.d.ts +2 -2
  154. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createRespondToAuthChallengeClient.d.ts +2 -2
  155. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createRevokeTokenClient.d.ts +2 -2
  156. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSetUserMFAPreferenceClient.d.ts +2 -2
  157. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createSignUpClient.d.ts +3 -3
  158. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createStartWebAuthnRegistrationClient.d.ts +2 -2
  159. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateDeviceStatusClient.d.ts +2 -2
  160. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createUpdateUserAttributesClient.d.ts +2 -2
  161. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifySoftwareTokenClient.d.ts +2 -2
  162. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/createVerifyUserAttributeClient.d.ts +2 -2
  163. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createEmptyResponseDeserializer.d.ts +1 -1
  164. package/dist/esm/foundation/factories/serviceClients/cognitoIdentityProvider/shared/serde/createUserPoolDeserializer.d.ts +1 -1
  165. package/dist/esm/providers/cognito/utils/oauth/attemptCompleteOAuthFlow.d.ts +1 -1
  166. package/dist/esm/providers/cognito/utils/oauth/completeOAuthFlow.d.ts +1 -1
  167. package/dist/esm/providers/cognito/utils/oauth/generateCodeVerifier.d.ts +1 -1
  168. package/dist/esm/providers/cognito/utils/oauth/getRedirectUrl.mjs +1 -3
  169. package/dist/esm/providers/cognito/utils/oauth/getRedirectUrl.mjs.map +1 -1
  170. package/dist/esm/providers/cognito/utils/refreshAuthTokens.d.ts +1 -1
  171. package/dist/esm/providers/cognito/utils/signInHelpers.d.ts +1 -1
  172. package/package.json +105 -106
  173. package/src/providers/cognito/utils/oauth/getRedirectUrl.ts +1 -2
@@ -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;AACnC,YAAY,MAAM,IAAI,WAAW,CAAC,SAAS,CAAC;AAC5C,gBAAgB,IAAI,EAAE,kCAAkC;AACxD,gBAAgB,OAAO,EAA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AAkB,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,CAAC;AAChD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;AAC1C,MAAM,iBAAiB,CAAC;AACxB,IAAI,kBAAkB,GAAG;A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,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,IAAI,oBAAoB,CAAC,WAAW,EAAE;AAC1C,QAAQ,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC,WAA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C;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":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,O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AAa,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