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.js"],"sourcesContent":["/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n *     http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Buffer } from 'buffer';\nimport CryptoJS from 'crypto-js/core';\nimport TypedArrays from 'crypto-js/lib-typedarrays'; // necessary for crypto js\n\nimport Base64 from 'crypto-js/enc-base64';\nimport HmacSHA256 from 'crypto-js/hmac-sha256';\nimport BigInteger from './BigInteger';\nimport AuthenticationHelper from './AuthenticationHelper';\nimport CognitoAccessToken from './CognitoAccessToken';\nimport CognitoIdToken from './CognitoIdToken';\nimport CognitoRefreshToken from './CognitoRefreshToken';\nimport CognitoUserSession from './CognitoUserSession';\nimport DateHelper from './DateHelper';\nimport CognitoUserAttribute from './CognitoUserAttribute';\nimport StorageHelper from './StorageHelper';\n/**\n * @callback nodeCallback\n * @template T result\n * @param {*} err The operation failure reason, or null.\n * @param {T} result The operation result.\n */\n\n/**\n * @callback onFailure\n * @param {*} err Failure reason.\n */\n\n/**\n * @callback onSuccess\n * @template T result\n * @param {T} result The operation result.\n */\n\n/**\n * @callback mfaRequired\n * @param {*} details MFA challenge details.\n */\n\n/**\n * @callback customChallenge\n * @param {*} details Custom challenge details.\n */\n\n/**\n * @callback inputVerificationCode\n * @param {*} data Server response.\n */\n\n/**\n * @callback authSuccess\n * @param {CognitoUserSession} session The new session.\n * @param {bool=} userConfirmationNecessary User must be confirmed.\n */\n\nvar isBrowser = typeof navigator !== 'undefined';\nvar userAgent = isBrowser ? navigator.userAgent : 'nodejs';\n/** @class */\n\nvar CognitoUser = /*#__PURE__*/function () {\n  /**\n   * Constructs a new CognitoUser object\n   * @param {object} data Creation options\n   * @param {string} data.Username The user's username.\n   * @param {CognitoUserPool} data.Pool Pool containing the user.\n   * @param {object} data.Storage Optional storage object.\n   */\n  function CognitoUser(data) {\n    if (data == null || data.Username == null || data.Pool == null) {\n      throw new Error('Username and Pool information are required.');\n    }\n\n    this.username = data.Username || '';\n    this.pool = data.Pool;\n    this.Session = null;\n    this.client = data.Pool.client;\n    this.signInUserSession = null;\n    this.authenticationFlowType = 'USER_SRP_AUTH';\n    this.storage = data.Storage || new StorageHelper().getStorage();\n    this.keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n    this.userDataKey = this.keyPrefix + \".\" + this.username + \".userData\";\n  }\n  /**\n   * Sets the session for this user\n   * @param {CognitoUserSession} signInUserSession the session\n   * @returns {void}\n   */\n\n\n  var _proto = CognitoUser.prototype;\n\n  _proto.setSignInUserSession = function setSignInUserSession(signInUserSession) {\n    this.clearCachedUserData();\n    this.signInUserSession = signInUserSession;\n    this.cacheTokens();\n  }\n  /**\n   * @returns {CognitoUserSession} the current session for this user\n   */\n  ;\n\n  _proto.getSignInUserSession = function getSignInUserSession() {\n    return this.signInUserSession;\n  }\n  /**\n   * @returns {string} the user's username\n   */\n  ;\n\n  _proto.getUsername = function getUsername() {\n    return this.username;\n  }\n  /**\n   * @returns {String} the authentication flow type\n   */\n  ;\n\n  _proto.getAuthenticationFlowType = function getAuthenticationFlowType() {\n    return this.authenticationFlowType;\n  }\n  /**\n   * sets authentication flow type\n   * @param {string} authenticationFlowType New value.\n   * @returns {void}\n   */\n  ;\n\n  _proto.setAuthenticationFlowType = function setAuthenticationFlowType(authenticationFlowType) {\n    this.authenticationFlowType = authenticationFlowType;\n  }\n  /**\n   * This is used for authenticating the user through the custom authentication flow.\n   * @param {AuthenticationDetails} authDetails Contains the authentication data\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {customChallenge} callback.customChallenge Custom challenge\n   *        response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n  ;\n\n  _proto.initiateAuth = function initiateAuth(authDetails, callback) {\n    var _this = this;\n\n    var authParameters = authDetails.getAuthParameters();\n    authParameters.USERNAME = this.username;\n    var clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n    var jsonReq = {\n      AuthFlow: 'CUSTOM_AUTH',\n      ClientId: this.pool.getClientId(),\n      AuthParameters: authParameters,\n      ClientMetadata: clientMetaData\n    };\n\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.request('InitiateAuth', jsonReq, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      var challengeName = data.ChallengeName;\n      var challengeParameters = data.ChallengeParameters;\n\n      if (challengeName === 'CUSTOM_CHALLENGE') {\n        _this.Session = data.Session;\n        return callback.customChallenge(challengeParameters);\n      }\n\n      _this.signInUserSession = _this.getCognitoUserSession(data.AuthenticationResult);\n\n      _this.cacheTokens();\n\n      return callback.onSuccess(_this.signInUserSession);\n    });\n  }\n  /**\n   * This is used for authenticating the user.\n   * stuff\n   * @param {AuthenticationDetails} authDetails Contains the authentication data\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {newPasswordRequired} callback.newPasswordRequired new\n   *        password and any required attributes are required to continue\n   * @param {mfaRequired} callback.mfaRequired MFA code\n   *        required to continue.\n   * @param {customChallenge} callback.customChallenge Custom challenge\n   *        response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n  ;\n\n  _proto.authenticateUser = function authenticateUser(authDetails, callback) {\n    if (this.authenticationFlowType === 'USER_PASSWORD_AUTH') {\n      return this.authenticateUserPlainUsernamePassword(authDetails, callback);\n    } else if (this.authenticationFlowType === 'USER_SRP_AUTH' || this.authenticationFlowType === 'CUSTOM_AUTH') {\n      return this.authenticateUserDefaultAuth(authDetails, callback);\n    }\n\n    return callback.onFailure(new Error('Authentication flow type is invalid.'));\n  }\n  /**\n   * PRIVATE ONLY: This is an internal only method and should not\n   * be directly called by the consumers.\n   * It calls the AuthenticationHelper for SRP related\n   * stuff\n   * @param {AuthenticationDetails} authDetails Contains the authentication data\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {newPasswordRequired} callback.newPasswordRequired new\n   *        password and any required attributes are required to continue\n   * @param {mfaRequired} callback.mfaRequired MFA code\n   *        required to continue.\n   * @param {customChallenge} callback.customChallenge Custom challenge\n   *        response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n  ;\n\n  _proto.authenticateUserDefaultAuth = function authenticateUserDefaultAuth(authDetails, callback) {\n    var _this2 = this;\n\n    var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n    var dateHelper = new DateHelper();\n    var serverBValue;\n    var salt;\n    var authParameters = {};\n\n    if (this.deviceKey != null) {\n      authParameters.DEVICE_KEY = this.deviceKey;\n    }\n\n    authParameters.USERNAME = this.username;\n    authenticationHelper.getLargeAValue(function (errOnAValue, aValue) {\n      // getLargeAValue callback start\n      if (errOnAValue) {\n        callback.onFailure(errOnAValue);\n      }\n\n      authParameters.SRP_A = aValue.toString(16);\n\n      if (_this2.authenticationFlowType === 'CUSTOM_AUTH') {\n        authParameters.CHALLENGE_NAME = 'SRP_A';\n      }\n\n      var clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n      var jsonReq = {\n        AuthFlow: _this2.authenticationFlowType,\n        ClientId: _this2.pool.getClientId(),\n        AuthParameters: authParameters,\n        ClientMetadata: clientMetaData\n      };\n\n      if (_this2.getUserContextData(_this2.username)) {\n        jsonReq.UserContextData = _this2.getUserContextData(_this2.username);\n      }\n\n      _this2.client.request('InitiateAuth', jsonReq, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        var challengeParameters = data.ChallengeParameters;\n        _this2.username = challengeParameters.USER_ID_FOR_SRP;\n        serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n        salt = new BigInteger(challengeParameters.SALT, 16);\n\n        _this2.getCachedDeviceKeyAndPassword();\n\n        authenticationHelper.getPasswordAuthenticationKey(_this2.username, authDetails.getPassword(), serverBValue, salt, function (errOnHkdf, hkdf) {\n          // getPasswordAuthenticationKey callback start\n          if (errOnHkdf) {\n            callback.onFailure(errOnHkdf);\n          }\n\n          var dateNow = dateHelper.getNowString();\n          var message = CryptoJS.lib.WordArray.create(Buffer.concat([Buffer.from(_this2.pool.getUserPoolId().split('_')[1], 'utf8'), Buffer.from(_this2.username, 'utf8'), Buffer.from(challengeParameters.SECRET_BLOCK, 'base64'), Buffer.from(dateNow, 'utf8')]));\n          var key = CryptoJS.lib.WordArray.create(hkdf);\n          var signatureString = Base64.stringify(HmacSHA256(message, key));\n          var challengeResponses = {};\n          challengeResponses.USERNAME = _this2.username;\n          challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n          challengeResponses.TIMESTAMP = dateNow;\n          challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\n          if (_this2.deviceKey != null) {\n            challengeResponses.DEVICE_KEY = _this2.deviceKey;\n          }\n\n          var respondToAuthChallenge = function respondToAuthChallenge(challenge, challengeCallback) {\n            return _this2.client.request('RespondToAuthChallenge', challenge, function (errChallenge, dataChallenge) {\n              if (errChallenge && errChallenge.code === 'ResourceNotFoundException' && errChallenge.message.toLowerCase().indexOf('device') !== -1) {\n                challengeResponses.DEVICE_KEY = null;\n                _this2.deviceKey = null;\n                _this2.randomPassword = null;\n                _this2.deviceGroupKey = null;\n\n                _this2.clearCachedDeviceKeyAndPassword();\n\n                return respondToAuthChallenge(challenge, challengeCallback);\n              }\n\n              return challengeCallback(errChallenge, dataChallenge);\n            });\n          };\n\n          var jsonReqResp = {\n            ChallengeName: 'PASSWORD_VERIFIER',\n            ClientId: _this2.pool.getClientId(),\n            ChallengeResponses: challengeResponses,\n            Session: data.Session,\n            ClientMetadata: clientMetaData\n          };\n\n          if (_this2.getUserContextData()) {\n            jsonReqResp.UserContextData = _this2.getUserContextData();\n          }\n\n          respondToAuthChallenge(jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n            if (errAuthenticate) {\n              return callback.onFailure(errAuthenticate);\n            }\n\n            return _this2.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n          });\n          return undefined; // getPasswordAuthenticationKey callback end\n        });\n        return undefined;\n      }); // getLargeAValue callback end\n\n    });\n  }\n  /**\n   * PRIVATE ONLY: This is an internal only method and should not\n   * be directly called by the consumers.\n   * @param {AuthenticationDetails} authDetails Contains the authentication data.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {mfaRequired} callback.mfaRequired MFA code\n   *        required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @returns {void}\n   */\n  ;\n\n  _proto.authenticateUserPlainUsernamePassword = function authenticateUserPlainUsernamePassword(authDetails, callback) {\n    var _this3 = this;\n\n    var authParameters = {};\n    authParameters.USERNAME = this.username;\n    authParameters.PASSWORD = authDetails.getPassword();\n\n    if (!authParameters.PASSWORD) {\n      callback.onFailure(new Error('PASSWORD parameter is required'));\n      return;\n    }\n\n    var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n    this.getCachedDeviceKeyAndPassword();\n\n    if (this.deviceKey != null) {\n      authParameters.DEVICE_KEY = this.deviceKey;\n    }\n\n    var clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n    var jsonReq = {\n      AuthFlow: 'USER_PASSWORD_AUTH',\n      ClientId: this.pool.getClientId(),\n      AuthParameters: authParameters,\n      ClientMetadata: clientMetaData\n    };\n\n    if (this.getUserContextData(this.username)) {\n      jsonReq.UserContextData = this.getUserContextData(this.username);\n    } // USER_PASSWORD_AUTH happens in a single round-trip: client sends userName and password,\n    // Cognito UserPools verifies password and returns tokens.\n\n\n    this.client.request('InitiateAuth', jsonReq, function (err, authResult) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return _this3.authenticateUserInternal(authResult, authenticationHelper, callback);\n    });\n  }\n  /**\n   * PRIVATE ONLY: This is an internal only method and should not\n   * be directly called by the consumers.\n   * @param {object} dataAuthenticate authentication data\n   * @param {object} authenticationHelper helper created\n   * @param {callback} callback passed on from caller\n   * @returns {void}\n   */\n  ;\n\n  _proto.authenticateUserInternal = function authenticateUserInternal(dataAuthenticate, authenticationHelper, callback) {\n    var _this4 = this;\n\n    var challengeName = dataAuthenticate.ChallengeName;\n    var challengeParameters = dataAuthenticate.ChallengeParameters;\n\n    if (challengeName === 'SMS_MFA') {\n      this.Session = dataAuthenticate.Session;\n      return callback.mfaRequired(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'SELECT_MFA_TYPE') {\n      this.Session = dataAuthenticate.Session;\n      return callback.selectMFAType(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'MFA_SETUP') {\n      this.Session = dataAuthenticate.Session;\n      return callback.mfaSetup(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'SOFTWARE_TOKEN_MFA') {\n      this.Session = dataAuthenticate.Session;\n      return callback.totpRequired(challengeName, challengeParameters);\n    }\n\n    if (challengeName === 'CUSTOM_CHALLENGE') {\n      this.Session = dataAuthenticate.Session;\n      return callback.customChallenge(challengeParameters);\n    }\n\n    if (challengeName === 'NEW_PASSWORD_REQUIRED') {\n      this.Session = dataAuthenticate.Session;\n      var userAttributes = null;\n      var rawRequiredAttributes = null;\n      var requiredAttributes = [];\n      var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\n      if (challengeParameters) {\n        userAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.userAttributes);\n        rawRequiredAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.requiredAttributes);\n      }\n\n      if (rawRequiredAttributes) {\n        for (var i = 0; i < rawRequiredAttributes.length; i++) {\n          requiredAttributes[i] = rawRequiredAttributes[i].substr(userAttributesPrefix.length);\n        }\n      }\n\n      return callback.newPasswordRequired(userAttributes, requiredAttributes);\n    }\n\n    if (challengeName === 'DEVICE_SRP_AUTH') {\n      this.getDeviceResponse(callback);\n      return undefined;\n    }\n\n    this.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n    this.challengeName = challengeName;\n    this.cacheTokens();\n    var newDeviceMetadata = dataAuthenticate.AuthenticationResult.NewDeviceMetadata;\n\n    if (newDeviceMetadata == null) {\n      return callback.onSuccess(this.signInUserSession);\n    }\n\n    authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n      if (errGenHash) {\n        return callback.onFailure(errGenHash);\n      }\n\n      var deviceSecretVerifierConfig = {\n        Salt: Buffer.from(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n        PasswordVerifier: Buffer.from(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n      };\n      _this4.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n      _this4.deviceGroupKey = newDeviceMetadata.DeviceGroupKey;\n      _this4.randomPassword = authenticationHelper.getRandomPassword();\n\n      _this4.client.request('ConfirmDevice', {\n        DeviceKey: newDeviceMetadata.DeviceKey,\n        AccessToken: _this4.signInUserSession.getAccessToken().getJwtToken(),\n        DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n        DeviceName: userAgent\n      }, function (errConfirm, dataConfirm) {\n        if (errConfirm) {\n          return callback.onFailure(errConfirm);\n        }\n\n        _this4.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\n        _this4.cacheDeviceKeyAndPassword();\n\n        if (dataConfirm.UserConfirmationNecessary === true) {\n          return callback.onSuccess(_this4.signInUserSession, dataConfirm.UserConfirmationNecessary);\n        }\n\n        return callback.onSuccess(_this4.signInUserSession);\n      });\n\n      return undefined;\n    });\n    return undefined;\n  }\n  /**\n   * This method is user to complete the NEW_PASSWORD_REQUIRED challenge.\n   * Pass the new password with any new user attributes to be updated.\n   * User attribute keys must be of format userAttributes.<attribute_name>.\n   * @param {string} newPassword new password for this user\n   * @param {object} requiredAttributeData map with values for all required attributes\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {mfaRequired} callback.mfaRequired MFA code required to continue.\n   * @param {customChallenge} callback.customChallenge Custom challenge\n   *         response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.completeNewPasswordChallenge = function completeNewPasswordChallenge(newPassword, requiredAttributeData, callback, clientMetadata) {\n    var _this5 = this;\n\n    if (!newPassword) {\n      return callback.onFailure(new Error('New password is required.'));\n    }\n\n    var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n    var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n    var finalUserAttributes = {};\n\n    if (requiredAttributeData) {\n      Object.keys(requiredAttributeData).forEach(function (key) {\n        finalUserAttributes[userAttributesPrefix + key] = requiredAttributeData[key];\n      });\n    }\n\n    finalUserAttributes.NEW_PASSWORD = newPassword;\n    finalUserAttributes.USERNAME = this.username;\n    var jsonReq = {\n      ChallengeName: 'NEW_PASSWORD_REQUIRED',\n      ClientId: this.pool.getClientId(),\n      ChallengeResponses: finalUserAttributes,\n      Session: this.Session,\n      ClientMetadata: clientMetadata\n    };\n\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.request('RespondToAuthChallenge', jsonReq, function (errAuthenticate, dataAuthenticate) {\n      if (errAuthenticate) {\n        return callback.onFailure(errAuthenticate);\n      }\n\n      return _this5.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n    });\n    return undefined;\n  }\n  /**\n   * This is used to get a session using device authentication. It is called at the end of user\n   * authentication\n   *\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   * @private\n   */\n  ;\n\n  _proto.getDeviceResponse = function getDeviceResponse(callback, clientMetadata) {\n    var _this6 = this;\n\n    var authenticationHelper = new AuthenticationHelper(this.deviceGroupKey);\n    var dateHelper = new DateHelper();\n    var authParameters = {};\n    authParameters.USERNAME = this.username;\n    authParameters.DEVICE_KEY = this.deviceKey;\n    authenticationHelper.getLargeAValue(function (errAValue, aValue) {\n      // getLargeAValue callback start\n      if (errAValue) {\n        callback.onFailure(errAValue);\n      }\n\n      authParameters.SRP_A = aValue.toString(16);\n      var jsonReq = {\n        ChallengeName: 'DEVICE_SRP_AUTH',\n        ClientId: _this6.pool.getClientId(),\n        ChallengeResponses: authParameters,\n        ClientMetadata: clientMetadata\n      };\n\n      if (_this6.getUserContextData()) {\n        jsonReq.UserContextData = _this6.getUserContextData();\n      }\n\n      _this6.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        var challengeParameters = data.ChallengeParameters;\n        var serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n        var salt = new BigInteger(challengeParameters.SALT, 16);\n        authenticationHelper.getPasswordAuthenticationKey(_this6.deviceKey, _this6.randomPassword, serverBValue, salt, function (errHkdf, hkdf) {\n          // getPasswordAuthenticationKey callback start\n          if (errHkdf) {\n            return callback.onFailure(errHkdf);\n          }\n\n          var dateNow = dateHelper.getNowString();\n          var message = CryptoJS.lib.WordArray.create(Buffer.concat([Buffer.from(_this6.deviceGroupKey, 'utf8'), Buffer.from(_this6.deviceKey, 'utf8'), Buffer.from(challengeParameters.SECRET_BLOCK, 'base64'), Buffer.from(dateNow, 'utf8')]));\n          var key = CryptoJS.lib.WordArray.create(hkdf);\n          var signatureString = Base64.stringify(HmacSHA256(message, key));\n          var challengeResponses = {};\n          challengeResponses.USERNAME = _this6.username;\n          challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n          challengeResponses.TIMESTAMP = dateNow;\n          challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n          challengeResponses.DEVICE_KEY = _this6.deviceKey;\n          var jsonReqResp = {\n            ChallengeName: 'DEVICE_PASSWORD_VERIFIER',\n            ClientId: _this6.pool.getClientId(),\n            ChallengeResponses: challengeResponses,\n            Session: data.Session\n          };\n\n          if (_this6.getUserContextData()) {\n            jsonReqResp.UserContextData = _this6.getUserContextData();\n          }\n\n          _this6.client.request('RespondToAuthChallenge', jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n            if (errAuthenticate) {\n              return callback.onFailure(errAuthenticate);\n            }\n\n            _this6.signInUserSession = _this6.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\n            _this6.cacheTokens();\n\n            return callback.onSuccess(_this6.signInUserSession);\n          });\n\n          return undefined; // getPasswordAuthenticationKey callback end\n        });\n        return undefined;\n      }); // getLargeAValue callback end\n\n    });\n  }\n  /**\n   * This is used for a certain user to confirm the registration by using a confirmation code\n   * @param {string} confirmationCode Code entered by user.\n   * @param {bool} forceAliasCreation Allow migrating from an existing email / phone number.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.confirmRegistration = function confirmRegistration(confirmationCode, forceAliasCreation, callback, clientMetadata) {\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      ConfirmationCode: confirmationCode,\n      Username: this.username,\n      ForceAliasCreation: forceAliasCreation,\n      ClientMetadata: clientMetadata\n    };\n\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.request('ConfirmSignUp', jsonReq, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, 'SUCCESS');\n    });\n  }\n  /**\n   * This is used by the user once he has the responses to a custom challenge\n   * @param {string} answerChallenge The custom challenge answer.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {customChallenge} callback.customChallenge\n   *    Custom challenge response required to continue.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.sendCustomChallengeAnswer = function sendCustomChallengeAnswer(answerChallenge, callback, clientMetadata) {\n    var _this7 = this;\n\n    var challengeResponses = {};\n    challengeResponses.USERNAME = this.username;\n    challengeResponses.ANSWER = answerChallenge;\n    var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n    this.getCachedDeviceKeyAndPassword();\n\n    if (this.deviceKey != null) {\n      challengeResponses.DEVICE_KEY = this.deviceKey;\n    }\n\n    var jsonReq = {\n      ChallengeName: 'CUSTOM_CHALLENGE',\n      ChallengeResponses: challengeResponses,\n      ClientId: this.pool.getClientId(),\n      Session: this.Session,\n      ClientMetadata: clientMetadata\n    };\n\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return _this7.authenticateUserInternal(data, authenticationHelper, callback);\n    });\n  }\n  /**\n   * This is used by the user once he has an MFA code\n   * @param {string} confirmationCode The MFA code entered by the user.\n   * @param {object} callback Result callback map.\n   * @param {string} mfaType The mfa we are replying to.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {authSuccess} callback.onSuccess Called on success with the new session.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.sendMFACode = function sendMFACode(confirmationCode, callback, mfaType, clientMetadata) {\n    var _this8 = this;\n\n    var challengeResponses = {};\n    challengeResponses.USERNAME = this.username;\n    challengeResponses.SMS_MFA_CODE = confirmationCode;\n    var mfaTypeSelection = mfaType || 'SMS_MFA';\n\n    if (mfaTypeSelection === 'SOFTWARE_TOKEN_MFA') {\n      challengeResponses.SOFTWARE_TOKEN_MFA_CODE = confirmationCode;\n    }\n\n    if (this.deviceKey != null) {\n      challengeResponses.DEVICE_KEY = this.deviceKey;\n    }\n\n    var jsonReq = {\n      ChallengeName: mfaTypeSelection,\n      ChallengeResponses: challengeResponses,\n      ClientId: this.pool.getClientId(),\n      Session: this.Session,\n      ClientMetadata: clientMetadata\n    };\n\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.request('RespondToAuthChallenge', jsonReq, function (err, dataAuthenticate) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      var challengeName = dataAuthenticate.ChallengeName;\n\n      if (challengeName === 'DEVICE_SRP_AUTH') {\n        _this8.getDeviceResponse(callback);\n\n        return undefined;\n      }\n\n      _this8.signInUserSession = _this8.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\n      _this8.cacheTokens();\n\n      if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {\n        return callback.onSuccess(_this8.signInUserSession);\n      }\n\n      var authenticationHelper = new AuthenticationHelper(_this8.pool.getUserPoolId().split('_')[1]);\n      authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n        if (errGenHash) {\n          return callback.onFailure(errGenHash);\n        }\n\n        var deviceSecretVerifierConfig = {\n          Salt: Buffer.from(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n          PasswordVerifier: Buffer.from(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n        };\n        _this8.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n        _this8.deviceGroupKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey;\n        _this8.randomPassword = authenticationHelper.getRandomPassword();\n\n        _this8.client.request('ConfirmDevice', {\n          DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n          AccessToken: _this8.signInUserSession.getAccessToken().getJwtToken(),\n          DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n          DeviceName: userAgent\n        }, function (errConfirm, dataConfirm) {\n          if (errConfirm) {\n            return callback.onFailure(errConfirm);\n          }\n\n          _this8.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\n          _this8.cacheDeviceKeyAndPassword();\n\n          if (dataConfirm.UserConfirmationNecessary === true) {\n            return callback.onSuccess(_this8.signInUserSession, dataConfirm.UserConfirmationNecessary);\n          }\n\n          return callback.onSuccess(_this8.signInUserSession);\n        });\n\n        return undefined;\n      });\n      return undefined;\n    });\n  }\n  /**\n   * This is used by an authenticated user to change the current password\n   * @param {string} oldUserPassword The current password.\n   * @param {string} newUserPassword The requested new password.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.changePassword = function changePassword(oldUserPassword, newUserPassword, callback, clientMetadata) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.request('ChangePassword', {\n      PreviousPassword: oldUserPassword,\n      ProposedPassword: newUserPassword,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      ClientMetadata: clientMetadata\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used by an authenticated user to enable MFA for itself\n   * @deprecated\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  ;\n\n  _proto.enableMFA = function enableMFA(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    var mfaOptions = [];\n    var mfaEnabled = {\n      DeliveryMedium: 'SMS',\n      AttributeName: 'phone_number'\n    };\n    mfaOptions.push(mfaEnabled);\n    this.client.request('SetUserSettings', {\n      MFAOptions: mfaOptions,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used by an authenticated user to enable MFA for itself\n   * @param {IMfaSettings} smsMfaSettings the sms mfa settings\n   * @param {IMFASettings} softwareTokenMfaSettings the software token mfa settings\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  ;\n\n  _proto.setUserMfaPreference = function setUserMfaPreference(smsMfaSettings, softwareTokenMfaSettings, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.request('SetUserMFAPreference', {\n      SMSMfaSettings: smsMfaSettings,\n      SoftwareTokenMfaSettings: softwareTokenMfaSettings,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used by an authenticated user to disable MFA for itself\n   * @deprecated\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  ;\n\n  _proto.disableMFA = function disableMFA(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    var mfaOptions = [];\n    this.client.request('SetUserSettings', {\n      MFAOptions: mfaOptions,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used by an authenticated user to delete itself\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.deleteUser = function deleteUser(callback, clientMetadata) {\n    var _this9 = this;\n\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.request('DeleteUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      ClientMetadata: clientMetadata\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      _this9.clearCachedUser();\n\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * @typedef {CognitoUserAttribute | { Name:string, Value:string }} AttributeArg\n   */\n\n  /**\n   * This is used by an authenticated user to change a list of attributes\n   * @param {AttributeArg[]} attributes A list of the new user attributes.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.updateAttributes = function updateAttributes(attributes, callback, clientMetadata) {\n    var _this10 = this;\n\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.request('UpdateUserAttributes', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      UserAttributes: attributes,\n      ClientMetadata: clientMetadata\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      } // update cached user\n\n\n      return _this10.getUserData(function () {\n        return callback(null, 'SUCCESS');\n      }, {\n        bypassCache: true\n      });\n    });\n    return undefined;\n  }\n  /**\n   * This is used by an authenticated user to get a list of attributes\n   * @param {nodeCallback<CognitoUserAttribute[]>} callback Called on success or error.\n   * @returns {void}\n   */\n  ;\n\n  _proto.getUserAttributes = function getUserAttributes(callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.request('GetUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err, userData) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      var attributeList = [];\n\n      for (var i = 0; i < userData.UserAttributes.length; i++) {\n        var attribute = {\n          Name: userData.UserAttributes[i].Name,\n          Value: userData.UserAttributes[i].Value\n        };\n        var userAttribute = new CognitoUserAttribute(attribute);\n        attributeList.push(userAttribute);\n      }\n\n      return callback(null, attributeList);\n    });\n    return undefined;\n  }\n  /**\n   * This is used by an authenticated user to get the MFAOptions\n   * @param {nodeCallback<MFAOptions>} callback Called on success or error.\n   * @returns {void}\n   */\n  ;\n\n  _proto.getMFAOptions = function getMFAOptions(callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.request('GetUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err, userData) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, userData.MFAOptions);\n    });\n    return undefined;\n  }\n  /**\n   * PRIVATE ONLY: This is an internal only method and should not\n   * be directly called by the consumers.\n   */\n  ;\n\n  _proto.createGetUserRequest = function createGetUserRequest() {\n    return this.client.promisifyRequest('GetUser', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    });\n  }\n  /**\n   * PRIVATE ONLY: This is an internal only method and should not\n   * be directly called by the consumers.\n   */\n  ;\n\n  _proto.refreshSessionIfPossible = function refreshSessionIfPossible(options) {\n    var _this11 = this;\n\n    if (options === void 0) {\n      options = {};\n    }\n\n    // best effort, if not possible\n    return new Promise(function (resolve) {\n      var refresh = _this11.signInUserSession.getRefreshToken();\n\n      if (refresh && refresh.getToken()) {\n        _this11.refreshSession(refresh, resolve, options.clientMetadata);\n      } else {\n        resolve();\n      }\n    });\n  }\n  /**\n   * @typedef {Object} GetUserDataOptions \n   * @property {boolean} bypassCache - force getting data from Cognito service\n   * @property {Record<string, string>} clientMetadata - clientMetadata for getSession\n  */\n\n  /**\n   * This is used by an authenticated users to get the userData\n   * @param {nodeCallback<UserData>} callback Called on success or error.\n   * @param {GetUserDataOptions} params\n   * @returns {void}\n   */\n  ;\n\n  _proto.getUserData = function getUserData(callback, params) {\n    var _this12 = this;\n\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      this.clearCachedUserData();\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    var userData = this.getUserDataFromCache();\n\n    if (!userData) {\n      this.fetchUserData().then(function (data) {\n        callback(null, data);\n      })[\"catch\"](callback);\n      return;\n    }\n\n    if (this.isFetchUserDataAndTokenRequired(params)) {\n      this.fetchUserData().then(function (data) {\n        return _this12.refreshSessionIfPossible(params).then(function () {\n          return data;\n        });\n      }).then(function (data) {\n        return callback(null, data);\n      })[\"catch\"](callback);\n      return;\n    }\n\n    try {\n      callback(null, JSON.parse(userData));\n      return;\n    } catch (err) {\n      this.clearCachedUserData();\n      callback(err, null);\n      return;\n    }\n  }\n  /**\n   *\n   * PRIVATE ONLY: This is an internal only method and should not\n   * be directly called by the consumers.\n   */\n  ;\n\n  _proto.getUserDataFromCache = function getUserDataFromCache() {\n    var userData = this.storage.getItem(this.userDataKey);\n    return userData;\n  }\n  /**\n   *\n   * PRIVATE ONLY: This is an internal only method and should not\n   * be directly called by the consumers.\n   */\n  ;\n\n  _proto.isFetchUserDataAndTokenRequired = function isFetchUserDataAndTokenRequired(params) {\n    var _ref = params || {},\n        _ref$bypassCache = _ref.bypassCache,\n        bypassCache = _ref$bypassCache === void 0 ? false : _ref$bypassCache;\n\n    return bypassCache;\n  }\n  /**\n   *\n   * PRIVATE ONLY: This is an internal only method and should not\n   * be directly called by the consumers.\n   */\n  ;\n\n  _proto.fetchUserData = function fetchUserData() {\n    var _this13 = this;\n\n    return this.createGetUserRequest().then(function (data) {\n      _this13.cacheUserData(data);\n\n      return data;\n    });\n  }\n  /**\n   * This is used by an authenticated user to delete a list of attributes\n   * @param {string[]} attributeList Names of the attributes to delete.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  ;\n\n  _proto.deleteAttributes = function deleteAttributes(attributeList, callback) {\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      return callback(new Error('User is not authenticated'), null);\n    }\n\n    this.client.request('DeleteUserAttributes', {\n      UserAttributeNames: attributeList,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, 'SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used by a user to resend a confirmation code\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.resendConfirmationCode = function resendConfirmationCode(callback, clientMetadata) {\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      Username: this.username,\n      ClientMetadata: clientMetadata\n    };\n    this.client.request('ResendConfirmationCode', jsonReq, function (err, result) {\n      if (err) {\n        return callback(err, null);\n      }\n\n      return callback(null, result);\n    });\n  }\n  /**\n   * @typedef {Object} GetSessionOptions \n   * @property {Record<string, string>} clientMetadata - clientMetadata for getSession\n  */\n\n  /**\n   * This is used to get a session, either from the session object\n   * or from  the local storage, or by using a refresh token\n   *\n   * @param {nodeCallback<CognitoUserSession>} callback Called on success or error.\n   * @param {GetSessionOptions} options\n   * @returns {void}\n   */\n  ;\n\n  _proto.getSession = function getSession(callback, options) {\n    if (options === void 0) {\n      options = {};\n    }\n\n    if (this.username == null) {\n      return callback(new Error('Username is null. Cannot retrieve a new session'), null);\n    }\n\n    if (this.signInUserSession != null && this.signInUserSession.isValid()) {\n      return callback(null, this.signInUserSession);\n    }\n\n    var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n    var idTokenKey = keyPrefix + \".idToken\";\n    var accessTokenKey = keyPrefix + \".accessToken\";\n    var refreshTokenKey = keyPrefix + \".refreshToken\";\n    var clockDriftKey = keyPrefix + \".clockDrift\";\n\n    if (this.storage.getItem(idTokenKey)) {\n      var idToken = new CognitoIdToken({\n        IdToken: this.storage.getItem(idTokenKey)\n      });\n      var accessToken = new CognitoAccessToken({\n        AccessToken: this.storage.getItem(accessTokenKey)\n      });\n      var refreshToken = new CognitoRefreshToken({\n        RefreshToken: this.storage.getItem(refreshTokenKey)\n      });\n      var clockDrift = parseInt(this.storage.getItem(clockDriftKey), 0) || 0;\n      var sessionData = {\n        IdToken: idToken,\n        AccessToken: accessToken,\n        RefreshToken: refreshToken,\n        ClockDrift: clockDrift\n      };\n      var cachedSession = new CognitoUserSession(sessionData);\n\n      if (cachedSession.isValid()) {\n        this.signInUserSession = cachedSession;\n        return callback(null, this.signInUserSession);\n      }\n\n      if (!refreshToken.getToken()) {\n        return callback(new Error('Cannot retrieve a new session. Please authenticate.'), null);\n      }\n\n      this.refreshSession(refreshToken, callback, options.clientMetadata);\n    } else {\n      callback(new Error('Local storage is missing an ID Token, Please authenticate'), null);\n    }\n\n    return undefined;\n  }\n  /**\n   * This uses the refreshToken to retrieve a new session\n   * @param {CognitoRefreshToken} refreshToken A previous session's refresh token.\n   * @param {nodeCallback<CognitoUserSession>} callback Called on success or error.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.refreshSession = function refreshSession(refreshToken, callback, clientMetadata) {\n    var _this14 = this;\n\n    var wrappedCallback = this.pool.wrapRefreshSessionCallback ? this.pool.wrapRefreshSessionCallback(callback) : callback;\n    var authParameters = {};\n    authParameters.REFRESH_TOKEN = refreshToken.getToken();\n    var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n    var lastUserKey = keyPrefix + \".LastAuthUser\";\n\n    if (this.storage.getItem(lastUserKey)) {\n      this.username = this.storage.getItem(lastUserKey);\n      var deviceKeyKey = keyPrefix + \".\" + this.username + \".deviceKey\";\n      this.deviceKey = this.storage.getItem(deviceKeyKey);\n      authParameters.DEVICE_KEY = this.deviceKey;\n    }\n\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      AuthFlow: 'REFRESH_TOKEN_AUTH',\n      AuthParameters: authParameters,\n      ClientMetadata: clientMetadata\n    };\n\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.request('InitiateAuth', jsonReq, function (err, authResult) {\n      if (err) {\n        if (err.code === 'NotAuthorizedException') {\n          _this14.clearCachedUser();\n        }\n\n        return wrappedCallback(err, null);\n      }\n\n      if (authResult) {\n        var authenticationResult = authResult.AuthenticationResult;\n\n        if (!Object.prototype.hasOwnProperty.call(authenticationResult, 'RefreshToken')) {\n          authenticationResult.RefreshToken = refreshToken.getToken();\n        }\n\n        _this14.signInUserSession = _this14.getCognitoUserSession(authenticationResult);\n\n        _this14.cacheTokens();\n\n        return wrappedCallback(null, _this14.signInUserSession);\n      }\n\n      return undefined;\n    });\n  }\n  /**\n   * This is used to save the session tokens to local storage\n   * @returns {void}\n   */\n  ;\n\n  _proto.cacheTokens = function cacheTokens() {\n    var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n    var idTokenKey = keyPrefix + \".\" + this.username + \".idToken\";\n    var accessTokenKey = keyPrefix + \".\" + this.username + \".accessToken\";\n    var refreshTokenKey = keyPrefix + \".\" + this.username + \".refreshToken\";\n    var clockDriftKey = keyPrefix + \".\" + this.username + \".clockDrift\";\n    var lastUserKey = keyPrefix + \".LastAuthUser\";\n    this.storage.setItem(idTokenKey, this.signInUserSession.getIdToken().getJwtToken());\n    this.storage.setItem(accessTokenKey, this.signInUserSession.getAccessToken().getJwtToken());\n    this.storage.setItem(refreshTokenKey, this.signInUserSession.getRefreshToken().getToken());\n    this.storage.setItem(clockDriftKey, \"\" + this.signInUserSession.getClockDrift());\n    this.storage.setItem(lastUserKey, this.username);\n  }\n  /**\n   * This is to cache user data\n   */\n  ;\n\n  _proto.cacheUserData = function cacheUserData(userData) {\n    this.storage.setItem(this.userDataKey, JSON.stringify(userData));\n  }\n  /**\n   * This is to remove cached user data\n   */\n  ;\n\n  _proto.clearCachedUserData = function clearCachedUserData() {\n    this.storage.removeItem(this.userDataKey);\n  };\n\n  _proto.clearCachedUser = function clearCachedUser() {\n    this.clearCachedTokens();\n    this.clearCachedUserData();\n  }\n  /**\n   * This is used to cache the device key and device group and device password\n   * @returns {void}\n   */\n  ;\n\n  _proto.cacheDeviceKeyAndPassword = function cacheDeviceKeyAndPassword() {\n    var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n    var deviceKeyKey = keyPrefix + \".deviceKey\";\n    var randomPasswordKey = keyPrefix + \".randomPasswordKey\";\n    var deviceGroupKeyKey = keyPrefix + \".deviceGroupKey\";\n    this.storage.setItem(deviceKeyKey, this.deviceKey);\n    this.storage.setItem(randomPasswordKey, this.randomPassword);\n    this.storage.setItem(deviceGroupKeyKey, this.deviceGroupKey);\n  }\n  /**\n   * This is used to get current device key and device group and device password\n   * @returns {void}\n   */\n  ;\n\n  _proto.getCachedDeviceKeyAndPassword = function getCachedDeviceKeyAndPassword() {\n    var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n    var deviceKeyKey = keyPrefix + \".deviceKey\";\n    var randomPasswordKey = keyPrefix + \".randomPasswordKey\";\n    var deviceGroupKeyKey = keyPrefix + \".deviceGroupKey\";\n\n    if (this.storage.getItem(deviceKeyKey)) {\n      this.deviceKey = this.storage.getItem(deviceKeyKey);\n      this.randomPassword = this.storage.getItem(randomPasswordKey);\n      this.deviceGroupKey = this.storage.getItem(deviceGroupKeyKey);\n    }\n  }\n  /**\n   * This is used to clear the device key info from local storage\n   * @returns {void}\n   */\n  ;\n\n  _proto.clearCachedDeviceKeyAndPassword = function clearCachedDeviceKeyAndPassword() {\n    var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n    var deviceKeyKey = keyPrefix + \".deviceKey\";\n    var randomPasswordKey = keyPrefix + \".randomPasswordKey\";\n    var deviceGroupKeyKey = keyPrefix + \".deviceGroupKey\";\n    this.storage.removeItem(deviceKeyKey);\n    this.storage.removeItem(randomPasswordKey);\n    this.storage.removeItem(deviceGroupKeyKey);\n  }\n  /**\n   * This is used to clear the session tokens from local storage\n   * @returns {void}\n   */\n  ;\n\n  _proto.clearCachedTokens = function clearCachedTokens() {\n    var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n    var idTokenKey = keyPrefix + \".\" + this.username + \".idToken\";\n    var accessTokenKey = keyPrefix + \".\" + this.username + \".accessToken\";\n    var refreshTokenKey = keyPrefix + \".\" + this.username + \".refreshToken\";\n    var lastUserKey = keyPrefix + \".LastAuthUser\";\n    var clockDriftKey = keyPrefix + \".\" + this.username + \".clockDrift\";\n    this.storage.removeItem(idTokenKey);\n    this.storage.removeItem(accessTokenKey);\n    this.storage.removeItem(refreshTokenKey);\n    this.storage.removeItem(lastUserKey);\n    this.storage.removeItem(clockDriftKey);\n  }\n  /**\n   * This is used to build a user session from tokens retrieved in the authentication result\n   * @param {object} authResult Successful auth response from server.\n   * @returns {CognitoUserSession} The new user session.\n   * @private\n   */\n  ;\n\n  _proto.getCognitoUserSession = function getCognitoUserSession(authResult) {\n    var idToken = new CognitoIdToken(authResult);\n    var accessToken = new CognitoAccessToken(authResult);\n    var refreshToken = new CognitoRefreshToken(authResult);\n    var sessionData = {\n      IdToken: idToken,\n      AccessToken: accessToken,\n      RefreshToken: refreshToken\n    };\n    return new CognitoUserSession(sessionData);\n  }\n  /**\n   * This is used to initiate a forgot password request\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {inputVerificationCode?} callback.inputVerificationCode\n   *    Optional callback raised instead of onSuccess with response data.\n   * @param {onSuccess} callback.onSuccess Called on success.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.forgotPassword = function forgotPassword(callback, clientMetadata) {\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      Username: this.username,\n      ClientMetadata: clientMetadata\n    };\n\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.request('ForgotPassword', jsonReq, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      if (typeof callback.inputVerificationCode === 'function') {\n        return callback.inputVerificationCode(data);\n      }\n\n      return callback.onSuccess(data);\n    });\n  }\n  /**\n   * This is used to confirm a new password using a confirmationCode\n   * @param {string} confirmationCode Code entered by user.\n   * @param {string} newPassword Confirm new password.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<void>} callback.onSuccess Called on success.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.confirmPassword = function confirmPassword(confirmationCode, newPassword, callback, clientMetadata) {\n    var jsonReq = {\n      ClientId: this.pool.getClientId(),\n      Username: this.username,\n      ConfirmationCode: confirmationCode,\n      Password: newPassword,\n      ClientMetadata: clientMetadata\n    };\n\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.request('ConfirmForgotPassword', jsonReq, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return callback.onSuccess();\n    });\n  }\n  /**\n   * This is used to initiate an attribute confirmation request\n   * @param {string} attributeName User attribute that needs confirmation.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {inputVerificationCode} callback.inputVerificationCode Called on success.\n   * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n   * @returns {void}\n   */\n  ;\n\n  _proto.getAttributeVerificationCode = function getAttributeVerificationCode(attributeName, callback, clientMetadata) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.request('GetUserAttributeVerificationCode', {\n      AttributeName: attributeName,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      ClientMetadata: clientMetadata\n    }, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      if (typeof callback.inputVerificationCode === 'function') {\n        return callback.inputVerificationCode(data);\n      }\n\n      return callback.onSuccess();\n    });\n    return undefined;\n  }\n  /**\n   * This is used to confirm an attribute using a confirmation code\n   * @param {string} attributeName Attribute being confirmed.\n   * @param {string} confirmationCode Code entered by user.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  ;\n\n  _proto.verifyAttribute = function verifyAttribute(attributeName, confirmationCode, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.request('VerifyUserAttribute', {\n      AttributeName: attributeName,\n      Code: confirmationCode,\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used to get the device information using the current device key\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<*>} callback.onSuccess Called on success with device data.\n   * @returns {void}\n   */\n  ;\n\n  _proto.getDevice = function getDevice(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.request('GetDevice', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: this.deviceKey\n    }, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return callback.onSuccess(data);\n    });\n    return undefined;\n  }\n  /**\n   * This is used to forget a specific device\n   * @param {string} deviceKey Device key.\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  ;\n\n  _proto.forgetSpecificDevice = function forgetSpecificDevice(deviceKey, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.request('ForgetDevice', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: deviceKey\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used to forget the current device\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  ;\n\n  _proto.forgetDevice = function forgetDevice(callback) {\n    var _this15 = this;\n\n    this.forgetSpecificDevice(this.deviceKey, {\n      onFailure: callback.onFailure,\n      onSuccess: function onSuccess(result) {\n        _this15.deviceKey = null;\n        _this15.deviceGroupKey = null;\n        _this15.randomPassword = null;\n\n        _this15.clearCachedDeviceKeyAndPassword();\n\n        return callback.onSuccess(result);\n      }\n    });\n  }\n  /**\n   * This is used to set the device status as remembered\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  ;\n\n  _proto.setDeviceStatusRemembered = function setDeviceStatusRemembered(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.request('UpdateDeviceStatus', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: this.deviceKey,\n      DeviceRememberedStatus: 'remembered'\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used to set the device status as not remembered\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  ;\n\n  _proto.setDeviceStatusNotRemembered = function setDeviceStatusNotRemembered(callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.request('UpdateDeviceStatus', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      DeviceKey: this.deviceKey,\n      DeviceRememberedStatus: 'not_remembered'\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used to list all devices for a user\n   *\n   * @param {int} limit the number of devices returned in a call\n   * @param {string | null} paginationToken the pagination token in case any was returned before\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<*>} callback.onSuccess Called on success with device list.\n   * @returns {void}\n   */\n  ;\n\n  _proto.listDevices = function listDevices(limit, paginationToken, callback) {\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    var requestParams = {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n      Limit: limit\n    };\n\n    if (paginationToken) {\n      requestParams.PaginationToken = paginationToken;\n    }\n\n    this.client.request('ListDevices', requestParams, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      return callback.onSuccess(data);\n    });\n    return undefined;\n  }\n  /**\n   * This is used to globally revoke all tokens issued to a user\n   * @param {object} callback Result callback map.\n   * @param {onFailure} callback.onFailure Called on any error.\n   * @param {onSuccess<string>} callback.onSuccess Called on success.\n   * @returns {void}\n   */\n  ;\n\n  _proto.globalSignOut = function globalSignOut(callback) {\n    var _this16 = this;\n\n    if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n      return callback.onFailure(new Error('User is not authenticated'));\n    }\n\n    this.client.request('GlobalSignOut', {\n      AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n    }, function (err) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      _this16.clearCachedUser();\n\n      return callback.onSuccess('SUCCESS');\n    });\n    return undefined;\n  }\n  /**\n   * This is used for the user to signOut of the application and clear the cached tokens.\n   * @returns {void}\n   */\n  ;\n\n  _proto.signOut = function signOut() {\n    this.signInUserSession = null;\n    this.clearCachedUser();\n  }\n  /**\n   * This is used by a user trying to select a given MFA\n   * @param {string} answerChallenge the mfa the user wants\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  ;\n\n  _proto.sendMFASelectionAnswer = function sendMFASelectionAnswer(answerChallenge, callback) {\n    var _this17 = this;\n\n    var challengeResponses = {};\n    challengeResponses.USERNAME = this.username;\n    challengeResponses.ANSWER = answerChallenge;\n    var jsonReq = {\n      ChallengeName: 'SELECT_MFA_TYPE',\n      ChallengeResponses: challengeResponses,\n      ClientId: this.pool.getClientId(),\n      Session: this.Session\n    };\n\n    if (this.getUserContextData()) {\n      jsonReq.UserContextData = this.getUserContextData();\n    }\n\n    this.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n      if (err) {\n        return callback.onFailure(err);\n      }\n\n      _this17.Session = data.Session;\n\n      if (answerChallenge === 'SMS_MFA') {\n        return callback.mfaRequired(data.ChallengeName, data.ChallengeParameters);\n      }\n\n      if (answerChallenge === 'SOFTWARE_TOKEN_MFA') {\n        return callback.totpRequired(data.ChallengeName, data.ChallengeParameters);\n      }\n\n      return undefined;\n    });\n  }\n  /**\n   * This returns the user context data for advanced security feature.\n   * @returns {void}\n   */\n  ;\n\n  _proto.getUserContextData = function getUserContextData() {\n    var pool = this.pool;\n    return pool.getUserContextData(this.username);\n  }\n  /**\n   * This is used by an authenticated or a user trying to authenticate to associate a TOTP MFA\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  ;\n\n  _proto.associateSoftwareToken = function associateSoftwareToken(callback) {\n    var _this18 = this;\n\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      this.client.request('AssociateSoftwareToken', {\n        Session: this.Session\n      }, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        _this18.Session = data.Session;\n        return callback.associateSecretCode(data.SecretCode);\n      });\n    } else {\n      this.client.request('AssociateSoftwareToken', {\n        AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n      }, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        return callback.associateSecretCode(data.SecretCode);\n      });\n    }\n  }\n  /**\n   * This is used by an authenticated or a user trying to authenticate to verify a TOTP MFA\n   * @param {string} totpCode The MFA code entered by the user.\n   * @param {string} friendlyDeviceName The device name we are assigning to the device.\n   * @param {nodeCallback<string>} callback Called on success or error.\n   * @returns {void}\n   */\n  ;\n\n  _proto.verifySoftwareToken = function verifySoftwareToken(totpCode, friendlyDeviceName, callback) {\n    var _this19 = this;\n\n    if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n      this.client.request('VerifySoftwareToken', {\n        Session: this.Session,\n        UserCode: totpCode,\n        FriendlyDeviceName: friendlyDeviceName\n      }, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        _this19.Session = data.Session;\n        var challengeResponses = {};\n        challengeResponses.USERNAME = _this19.username;\n        var jsonReq = {\n          ChallengeName: 'MFA_SETUP',\n          ClientId: _this19.pool.getClientId(),\n          ChallengeResponses: challengeResponses,\n          Session: _this19.Session\n        };\n\n        if (_this19.getUserContextData()) {\n          jsonReq.UserContextData = _this19.getUserContextData();\n        }\n\n        _this19.client.request('RespondToAuthChallenge', jsonReq, function (errRespond, dataRespond) {\n          if (errRespond) {\n            return callback.onFailure(errRespond);\n          }\n\n          _this19.signInUserSession = _this19.getCognitoUserSession(dataRespond.AuthenticationResult);\n\n          _this19.cacheTokens();\n\n          return callback.onSuccess(_this19.signInUserSession);\n        });\n\n        return undefined;\n      });\n    } else {\n      this.client.request('VerifySoftwareToken', {\n        AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n        UserCode: totpCode,\n        FriendlyDeviceName: friendlyDeviceName\n      }, function (err, data) {\n        if (err) {\n          return callback.onFailure(err);\n        }\n\n        return callback.onSuccess(data);\n      });\n    }\n  };\n\n  return CognitoUser;\n}();\n\nexport { CognitoUser as default };"],"names":["userAgent","navigator","CognitoUser","data","Username","Pool","Error","this","username","pool","Session","client","signInUserSession","authenticationFlowType","storage","Storage","getStorage","keyPrefix","getClientId","userDataKey","_proto","prototype","setSignInUserSession","clearCachedUserData","cacheTokens","getSignInUserSession","getUsername","getAuthenticationFlowType","setAuthenticationFlowType","initiateAuth","authDetails","callback","_this","authParameters","getAuthParameters","USERNAME","clientMetaData","Object","keys","getValidationData","length","getClientMetadata","jsonReq","AuthFlow","ClientId","AuthParameters","ClientMetadata","getUserContextData","UserContextData","request","err","onFailure","challengeParameters","ChallengeParameters","ChallengeName","customChallenge","getCognitoUserSession","AuthenticationResult","onSuccess","authenticateUser","authenticateUserPlainUsernamePassword","authenticateUserDefaultAuth","serverBValue","salt","_this2","authenticationHelper","getUserPoolId","split","dateHelper","deviceKey","DEVICE_KEY","getLargeAValue","errOnAValue","aValue","SRP_A","toString","CHALLENGE_NAME","USER_ID_FOR_SRP","SRP_B","SALT","getCachedDeviceKeyAndPassword","getPasswordAuthenticationKey","getPassword","errOnHkdf","hkdf","dateNow","getNowString","message","SECRET_BLOCK","key","signatureString","challengeResponses","PASSWORD_CLAIM_SECRET_BLOCK","TIMESTAMP","PASSWORD_CLAIM_SIGNATURE","jsonReqResp","ChallengeResponses","respondToAuthChallenge","challenge","challengeCallback","errChallenge","dataChallenge","code","toLowerCase","indexOf","randomPassword","deviceGroupKey","clearCachedDeviceKeyAndPassword","errAuthenticate","dataAuthenticate","authenticateUserInternal","_this3","PASSWORD","authResult","_this4","challengeName","mfaRequired","selectMFAType","mfaSetup","totpRequired","userAttributes","rawRequiredAttributes","requiredAttributes","userAttributesPrefix","getNewPasswordRequiredChallengeUserAttributePrefix","JSON","parse","i","substr","newPasswordRequired","newDeviceMetadata","NewDeviceMetadata","generateHashDevice","DeviceGroupKey","DeviceKey","errGenHash","deviceSecretVerifierConfig","Salt","getSaltDevices","PasswordVerifier","getVerifierDevices","verifierDevices","getRandomPassword","AccessToken","getAccessToken","getJwtToken","DeviceSecretVerifierConfig","DeviceName","errConfirm","dataConfirm","cacheDeviceKeyAndPassword","UserConfirmationNecessary","getDeviceResponse","completeNewPasswordChallenge","newPassword","requiredAttributeData","clientMetadata","_this5","finalUserAttributes","forEach","NEW_PASSWORD","_this6","errAValue","errHkdf","confirmRegistration","confirmationCode","forceAliasCreation","ConfirmationCode","ForceAliasCreation","sendCustomChallengeAnswer","answerChallenge","_this7","ANSWER","sendMFACode","mfaType","_this8","SMS_MFA_CODE","mfaTypeSelection","SOFTWARE_TOKEN_MFA_CODE","changePassword","oldUserPassword","newUserPassword","isValid","PreviousPassword","ProposedPassword","enableMFA","mfaOptions","push","DeliveryMedium","AttributeName","MFAOptions","setUserMfaPreference","smsMfaSettings","softwareTokenMfaSettings","SMSMfaSettings","SoftwareTokenMfaSettings","disableMFA","deleteUser","_this9","clearCachedUser","updateAttributes","attributes","_this10","UserAttributes","getUserData","bypassCache","getUserAttributes","userData","attributeList","userAttribute","Name","Value","getMFAOptions","createGetUserRequest","promisifyRequest","refreshSessionIfPossible","options","_this11","Promise","resolve","refresh","getRefreshToken","getToken","refreshSession","params","_this12","getUserDataFromCache","isFetchUserDataAndTokenRequired","fetchUserData","then","getItem","_ref$bypassCache","_this13","cacheUserData","deleteAttributes","UserAttributeNames","resendConfirmationCode","result","getSession","idTokenKey","accessTokenKey","refreshTokenKey","clockDriftKey","idToken","IdToken","accessToken","refreshToken","RefreshToken","clockDrift","parseInt","cachedSession","ClockDrift","_this14","wrappedCallback","wrapRefreshSessionCallback","REFRESH_TOKEN","lastUserKey","authenticationResult","hasOwnProperty","call","setItem","getIdToken","getClockDrift","stringify","removeItem","clearCachedTokens","randomPasswordKey","deviceGroupKeyKey","deviceKeyKey","forgotPassword","inputVerificationCode","confirmPassword","Password","getAttributeVerificationCode","attributeName","verifyAttribute","Code","getDevice","forgetSpecificDevice","forgetDevice","_this15","setDeviceStatusRemembered","DeviceRememberedStatus","setDeviceStatusNotRemembered","listDevices","limit","paginationToken","requestParams","Limit","PaginationToken","globalSignOut","_this16","signOut","sendMFASelectionAnswer","_this17","associateSoftwareToken","_this18","associateSecretCode","SecretCode","verifySoftwareToken","totpCode","friendlyDeviceName","_this19","UserCode","FriendlyDeviceName","errRespond","dataRespond"],"sourceRoot":""}