{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///amazon-cognito-identity.min.js","webpack:///webpack/bootstrap 03508c239c5db8678652","webpack:///./enhance.js","webpack:///external {\"root\":[\"AWSCognito\"],\"commonjs2\":\"aws-sdk/global\",\"commonjs\":\"aws-sdk/global\",\"amd\":\"aws-sdk/global\"}","webpack:///./src/AuthenticationHelper.js","webpack:///./src/CognitoAccessToken.js","webpack:///./src/CognitoIdToken.js","webpack:///./src/CognitoRefreshToken.js","webpack:///./src/CognitoUser.js","webpack:///./src/CognitoUserAttribute.js","webpack:///./src/CognitoUserSession.js","webpack:///./src/DateHelper.js","webpack:///./src/StorageHelper.js","webpack:///external {\"root\":[\"AWSCognito\",\"CognitoIdentityServiceProvider\"],\"commonjs2\":\"aws-sdk/clients/cognitoidentityserviceprovider\",\"commonjs\":\"aws-sdk/clients/cognitoidentityserviceprovider\",\"amd\":\"aws-sdk/clients/cognitoidentityserviceprovider\"}","webpack:///external {\"root\":[],\"commonjs2\":\"jsbn\",\"commonjs\":\"jsbn\",\"amd\":\"jsbn\"}","webpack:///./src/AuthenticationDetails.js","webpack:///./src/CognitoUserPool.js","webpack:///./src/index.js"],"names":["root","factory","exports","module","require","define","amd","AmazonCognitoIdentity","AWSCognito","CognitoIdentityServiceProvider","this","__WEBPACK_EXTERNAL_MODULE_1__","__WEBPACK_EXTERNAL_MODULE_11__","__WEBPACK_EXTERNAL_MODULE_12__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireWildcard","obj","__esModule","newObj","key","Object","prototype","hasOwnProperty","default","_interopRequireDefault","defineProperty","value","_src","keys","forEach","enumerable","get","_cognitoidentityserviceprovider","_cognitoidentityserviceprovider2","enhancements","window","crypto","msCrypto","_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","i","length","descriptor","configurable","writable","protoProps","staticProps","_global","_jsbn","initN","newPasswordRequiredChallengeUserAttributePrefix","AuthenticationHelper","PoolName","N","BigInteger","g","k","hexHash","toString","smallAValue","generateRandomSmallA","largeAValue","calculateA","infoBits","util","Buffer","poolName","hexRandom","lib","randomBytes","randomBigInt","smallABigInt","mod","randomPassword","SaltToHashDevices","verifierDevices","deviceGroupKey","username","generateRandomString","combinedString","hashedString","hash","padHex","verifierDevicesNotPadded","modPow","a","A","Error","B","UHexHash","finalU","buf","hashHex","sha256","Array","join","hexStr","ikm","salt","prk","hmac","infoBitsUpdate","buffer","concat","String","fromCharCode","slice","password","serverBValue","equals","UValue","calculateU","usernamePassword","usernamePasswordHash","xValue","gModPowXN","intValue2","subtract","multiply","sValue","add","hkdf","computehkdf","bigInt","hashStr","indexOf","CognitoAccessToken","_ref","arguments","undefined","AccessToken","jwtToken","payload","split","expiration","JSON","parse","base64","decode","exp","CognitoIdToken","IdToken","CognitoRefreshToken","RefreshToken","token","_AuthenticationHelper","_AuthenticationHelper2","_CognitoAccessToken","_CognitoAccessToken2","_CognitoIdToken","_CognitoIdToken2","_CognitoRefreshToken","_CognitoRefreshToken2","_CognitoUserSession","_CognitoUserSession2","_DateHelper","_DateHelper2","_CognitoUserAttribute","_CognitoUserAttribute2","_StorageHelper","_StorageHelper2","CognitoUser","data","Username","Pool","pool","Session","client","signInUserSession","authenticationFlowType","storage","getStorage","authDetails","callback","_this","authenticationHelper","getUserPoolId","dateHelper","authParameters","deviceKey","DEVICE_KEY","USERNAME","SRP_A","getLargeAValue","CHALLENGE_NAME","makeUnauthenticatedRequest","AuthFlow","ClientId","getClientId","AuthParameters","ClientMetadata","getValidationData","err","onFailure","challengeParameters","ChallengeParameters","USER_ID_FOR_SRP","SRP_B","SALT","getCachedDeviceKeyAndPassword","getPasswordAuthenticationKey","getPassword","dateNow","getNowString","signatureString","SECRET_BLOCK","challengeResponses","PASSWORD_CLAIM_SECRET_BLOCK","TIMESTAMP","PASSWORD_CLAIM_SIGNATURE","respondToAuthChallenge","challenge","challengeCallback","errChallenge","dataChallenge","code","message","toLowerCase","clearCachedDeviceKeyAndPassword","ChallengeName","ChallengeResponses","errAuthenticate","dataAuthenticate","challengeName","userAttributes","rawRequiredAttributes","requiredAttributes","userAttributesPrefix","getNewPasswordRequiredChallengeUserAttributePrefix","substr","newPasswordRequired","authenticateUserInternal","_this2","mfaRequired","customChallenge","getDeviceResponse","getCognitoUserSession","AuthenticationResult","cacheTokens","newDeviceMetadata","NewDeviceMetadata","onSuccess","generateHashDevice","DeviceGroupKey","DeviceKey","deviceSecretVerifierConfig","Salt","getSaltDevices","PasswordVerifier","getVerifierDevices","getRandomPassword","getAccessToken","getJwtToken","DeviceSecretVerifierConfig","DeviceName","navigator","userAgent","errConfirm","dataConfirm","cacheDeviceKeyAndPassword","UserConfirmationNecessary","newPassword","requiredAttributeData","_this3","finalUserAttributes","NEW_PASSWORD","_this4","confirmationCode","forceAliasCreation","ConfirmationCode","ForceAliasCreation","answerChallenge","_this5","ANSWER","_this6","SMS_MFA_CODE","oldUserPassword","newUserPassword","isValid","PreviousPassword","ProposedPassword","mfaOptions","mfaEnabled","DeliveryMedium","AttributeName","push","MFAOptions","_this7","clearCachedTokens","attributes","UserAttributes","userData","attributeList","attribute","Name","Value","userAttribute","UserAttributeNames","keyPrefix","idTokenKey","accessTokenKey","refreshTokenKey","getItem","idToken","accessToken","refreshToken","sessionData","cachedSession","getToken","refreshSession","_this8","REFRESH_TOKEN","lastUserKey","deviceKeyKey","authResult","authenticationResult","setItem","getIdToken","getRefreshToken","randomPasswordKey","deviceGroupKeyKey","removeItem","inputVerificationCode","Password","attributeName","Code","_this9","forgetSpecificDevice","result","DeviceRememberedStatus","limit","paginationToken","Limit","PaginationToken","_this10","CognitoUserAttribute","name","stringify","CognitoUserSession","now","Math","floor","Date","getExpiration","monthNames","weekNames","DateHelper","weekDay","getUTCDay","month","getUTCMonth","day","getUTCDate","hours","getUTCHours","minutes","getUTCMinutes","seconds","getUTCSeconds","year","getUTCFullYear","dataMemory","MemoryStorage","StorageHelper","storageWindow","localStorage","exception","AuthenticationDetails","ValidationData","validationData","_CognitoUser","_CognitoUser2","CognitoUserPool","UserPoolId","test","region","userPoolId","clientId","apiVersion","cognitoUser","returnData","user","userConfirmed","UserConfirmed","lastAuthUser","_AuthenticationDetails","_CognitoUserPool"],"mappings":";;;;;;;;;;;;;;;;CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,kBAAAA,QAAA,kDAAAA,QAAA,SACA,kBAAAC,gBAAAC,IACAD,QAAA,0EAAAJ,GACA,gBAAAC,SACAA,QAAAK,sBAAAN,EAAAG,QAAA,kBAAAA,QAAA,kDAAAA,QAAA,SAEAJ,EAAAO,sBAAAN,EAAAD,EAAAQ,WAAAR,EAAAQ,WAAAC,+BAAAT,IACCU,KAAA,SAAAC,EAAAC,EAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAd,OAGA,IAAAC,GAAAc,EAAAD,IACAd,WACAgB,GAAAF,EACAG,UAUA,OANAL,GAAAE,GAAAI,KAAAjB,EAAAD,QAAAC,IAAAD,QAAAa,GAGAZ,EAAAgB,UAGAhB,EAAAD,QAvBA,GAAAe,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASZ,EAAQD,EAASa,GAE/B,YAwBA,SAASS,GAAwBC,GAAO,GAAIA,GAAOA,EAAIC,WAAc,MAAOD,EAAc,IAAIE,KAAa,IAAW,MAAPF,EAAe,IAAK,GAAIG,KAAOH,GAAWI,OAAOC,UAAUC,eAAeX,KAAKK,EAAKG,KAAMD,EAAOC,GAAOH,EAAIG,GAAgC,OAAtBD,GAAOK,QAAUP,EAAYE,EAElQ,QAASM,GAAuBR,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQO,QAASP,GAxBvFI,OAAOK,eAAehC,EAAS,cAC7BiC,UE1DH,IAAAC,GAAArB,EAAA,GAEAc,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BlwF1BtI,UjBswFR,IAAIiW,GAAelX,EAAoB,EAEvCc,QAAOK,eAAehC,EAAS,eAC7BqC,cACAC,IAAK,WACH,MAAOP,GAAuBgW,GiB1wF1BjW,UjB8wFR,IAAI4I,GAAwB7J,EAAoB,EAEhDc,QAAOK,eAAehC,EAAS,wBAC7BqC,cACAC,IAAK,WACH,MAAOP,GAAuB2I,GiBlxF1B5I,UjBsxFR,IAAIiX,GAAmBlY,EAAoB,GAE3Cc,QAAOK,eAAehC,EAAS,mBAC7BqC,cACAC,IAAK,WACH,MAAOP,GAAuBgX,GiB1xF1BjX,UjB8xFR,IAAIwI,GAAsBzJ,EAAoB,EAE9Cc,QAAOK,eAAehC,EAAS,sBAC7BqC,cACAC,IAAK,WACH,MAAOP,GAAuBuI,GiBlyF1BxI,UjBsyFR,IAAI0I,GAAc3J,EAAoB,EAEtCc,QAAOK,eAAehC,EAAS,cAC7BqC,cACAC,IAAK,WACH,MAAOP,GAAuByI,GiB1yF1B1I","file":"amazon-cognito-identity.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"aws-sdk/global\"), require(\"aws-sdk/clients/cognitoidentityserviceprovider\"), require(\"jsbn\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"aws-sdk/global\", \"aws-sdk/clients/cognitoidentityserviceprovider\", \"jsbn\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"AmazonCognitoIdentity\"] = factory(require(\"aws-sdk/global\"), require(\"aws-sdk/clients/cognitoidentityserviceprovider\"), require(\"jsbn\"));\n\telse\n\t\troot[\"AmazonCognitoIdentity\"] = factory(root[\"AWSCognito\"], root[\"AWSCognito\"][\"CognitoIdentityServiceProvider\"], root);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_11__, __WEBPACK_EXTERNAL_MODULE_12__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"aws-sdk/global\"), require(\"aws-sdk/clients/cognitoidentityserviceprovider\"), require(\"jsbn\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"aws-sdk/global\", \"aws-sdk/clients/cognitoidentityserviceprovider\", \"jsbn\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"AmazonCognitoIdentity\"] = factory(require(\"aws-sdk/global\"), require(\"aws-sdk/clients/cognitoidentityserviceprovider\"), require(\"jsbn\"));\n\telse\n\t\troot[\"AmazonCognitoIdentity\"] = factory(root[\"AWSCognito\"], root[\"AWSCognito\"][\"CognitoIdentityServiceProvider\"], root);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_11__, __WEBPACK_EXTERNAL_MODULE_12__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _src = __webpack_require__(15);\n\t\n\tObject.keys(_src).forEach(function (key) {\n\t if (key === \"default\" || key === \"__esModule\") return;\n\t Object.defineProperty(exports, key, {\n\t enumerable: true,\n\t get: function get() {\n\t return _src[key];\n\t }\n\t });\n\t});\n\t\n\tvar _cognitoidentityserviceprovider = __webpack_require__(11);\n\t\n\tvar _cognitoidentityserviceprovider2 = _interopRequireDefault(_cognitoidentityserviceprovider);\n\t\n\tvar enhancements = _interopRequireWildcard(_src);\n\t\n\tfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tObject.keys(enhancements).forEach(function (key) {\n\t _cognitoidentityserviceprovider2.default[key] = enhancements[key];\n\t});\n\t\n\t// The version of crypto-browserify included by aws-sdk only\n\t// checks for window.crypto, not window.msCrypto as used by\n\t// IE 11 – so we set it explicitly here\n\tif (typeof window !== 'undefined' && !window.crypto && window.msCrypto) {\n\t window.crypto = window.msCrypto;\n\t}\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\tvar _global = __webpack_require__(1);\n\t\n\tvar _jsbn = __webpack_require__(12);\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\tvar initN = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1' + '29024E088A67CC74020BBEA63B139B22514A08798E3404DD' + 'EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245' + 'E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D' + 'C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F' + '83655D23DCA3AD961C62F356208552BB9ED529077096966D' + '670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9' + 'DE2BCBF6955817183995497CEA956AE515D2261898FA0510' + '15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64' + 'ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' + 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B' + 'F12FFA06D98A0864D87602733EC86A64521F2B18177B200C' + 'BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31' + '43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF';\n\t\n\tvar newPasswordRequiredChallengeUserAttributePrefix = 'userAttributes.';\n\t\n\t/** @class */\n\t\n\tvar AuthenticationHelper = function () {\n\t /**\n\t * Constructs a new AuthenticationHelper object\n\t * @param {string} PoolName Cognito user pool name.\n\t */\n\t function AuthenticationHelper(PoolName) {\n\t _classCallCheck(this, AuthenticationHelper);\n\t\n\t this.N = new _jsbn.BigInteger(initN, 16);\n\t this.g = new _jsbn.BigInteger('2');\n\t this.k = new _jsbn.BigInteger(this.hexHash('00' + this.N.toString(16) + '0' + this.g.toString(16)), 16);\n\t\n\t this.smallAValue = this.generateRandomSmallA();\n\t this.largeAValue = this.calculateA(this.smallAValue);\n\t\n\t this.infoBits = new _global.util.Buffer('Caldera Derived Key', 'utf8');\n\t\n\t this.poolName = PoolName;\n\t }\n\t\n\t /**\n\t * @returns {BigInteger} small A, a random number\n\t */\n\t\n\t\n\t _createClass(AuthenticationHelper, [{\n\t key: 'getSmallAValue',\n\t value: function getSmallAValue() {\n\t return this.smallAValue;\n\t }\n\t\n\t /**\n\t * @returns {BigInteger} large A, a value generated from small A\n\t */\n\t\n\t }, {\n\t key: 'getLargeAValue',\n\t value: function getLargeAValue() {\n\t return this.largeAValue;\n\t }\n\t\n\t /**\n\t * helper function to generate a random big integer\n\t * @returns {BigInteger} a random value.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: 'generateRandomSmallA',\n\t value: function generateRandomSmallA() {\n\t var hexRandom = _global.util.crypto.lib.randomBytes(128).toString('hex');\n\t\n\t var randomBigInt = new _jsbn.BigInteger(hexRandom, 16);\n\t var smallABigInt = randomBigInt.mod(this.N);\n\t\n\t return smallABigInt;\n\t }\n\t\n\t /**\n\t * helper function to generate a random string\n\t * @returns {string} a random value.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: 'generateRandomString',\n\t value: function generateRandomString() {\n\t return _global.util.crypto.lib.randomBytes(40).toString('base64');\n\t }\n\t\n\t /**\n\t * @returns {string} Generated random value included in password hash.\n\t */\n\t\n\t }, {\n\t key: 'getRandomPassword',\n\t value: function getRandomPassword() {\n\t return this.randomPassword;\n\t }\n\t\n\t /**\n\t * @returns {string} Generated random value included in devices hash.\n\t */\n\t\n\t }, {\n\t key: 'getSaltDevices',\n\t value: function getSaltDevices() {\n\t return this.SaltToHashDevices;\n\t }\n\t\n\t /**\n\t * @returns {string} Value used to verify devices.\n\t */\n\t\n\t }, {\n\t key: 'getVerifierDevices',\n\t value: function getVerifierDevices() {\n\t return this.verifierDevices;\n\t }\n\t\n\t /**\n\t * Generate salts and compute verifier.\n\t * @param {string} deviceGroupKey Devices to generate verifier for.\n\t * @param {string} username User to generate verifier for.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'generateHashDevice',\n\t value: function generateHashDevice(deviceGroupKey, username) {\n\t this.randomPassword = this.generateRandomString();\n\t var combinedString = '' + deviceGroupKey + username + ':' + this.randomPassword;\n\t var hashedString = this.hash(combinedString);\n\t\n\t var hexRandom = _global.util.crypto.lib.randomBytes(16).toString('hex');\n\t this.SaltToHashDevices = this.padHex(new _jsbn.BigInteger(hexRandom, 16));\n\t\n\t var verifierDevicesNotPadded = this.g.modPow(new _jsbn.BigInteger(this.hexHash(this.SaltToHashDevices + hashedString), 16), this.N);\n\t\n\t this.verifierDevices = this.padHex(verifierDevicesNotPadded);\n\t }\n\t\n\t /**\n\t * Calculate the client's public value A = g^a%N\n\t * with the generated random number a\n\t * @param {BigInteger} a Randomly generated small A.\n\t * @returns {BigInteger} Computed large A.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: 'calculateA',\n\t value: function calculateA(a) {\n\t var A = this.g.modPow(a, this.N);\n\t\n\t if (A.mod(this.N).toString() === '0') {\n\t throw new Error('Illegal paramater. A mod N cannot be 0.');\n\t }\n\t return A;\n\t }\n\t\n\t /**\n\t * Calculate the client's value U which is the hash of A and B\n\t * @param {BigInteger} A Large A value.\n\t * @param {BigInteger} B Server B value.\n\t * @returns {BigInteger} Computed U value.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: 'calculateU',\n\t value: function calculateU(A, B) {\n\t this.UHexHash = this.hexHash(this.padHex(A) + this.padHex(B));\n\t var finalU = new _jsbn.BigInteger(this.UHexHash, 16);\n\t\n\t return finalU;\n\t }\n\t\n\t /**\n\t * Calculate a hash from a bitArray\n\t * @param {Buffer} buf Value to hash.\n\t * @returns {String} Hex-encoded hash.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: 'hash',\n\t value: function hash(buf) {\n\t var hashHex = _global.util.crypto.sha256(buf, 'hex');\n\t return new Array(64 - hashHex.length).join('0') + hashHex;\n\t }\n\t\n\t /**\n\t * Calculate a hash from a hex string\n\t * @param {String} hexStr Value to hash.\n\t * @returns {String} Hex-encoded hash.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: 'hexHash',\n\t value: function hexHash(hexStr) {\n\t return this.hash(new _global.util.Buffer(hexStr, 'hex'));\n\t }\n\t\n\t /**\n\t * Standard hkdf algorithm\n\t * @param {Buffer} ikm Input key material.\n\t * @param {Buffer} salt Salt value.\n\t * @returns {Buffer} Strong key material.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: 'computehkdf',\n\t value: function computehkdf(ikm, salt) {\n\t var prk = _global.util.crypto.hmac(salt, ikm, 'buffer', 'sha256');\n\t var infoBitsUpdate = _global.util.buffer.concat([this.infoBits, new _global.util.Buffer(String.fromCharCode(1), 'utf8')]);\n\t var hmac = _global.util.crypto.hmac(prk, infoBitsUpdate, 'buffer', 'sha256');\n\t return hmac.slice(0, 16);\n\t }\n\t\n\t /**\n\t * Calculates the final hkdf based on computed S value, and computed U value and the key\n\t * @param {String} username Username.\n\t * @param {String} password Password.\n\t * @param {BigInteger} serverBValue Server B value.\n\t * @param {BigInteger} salt Generated salt.\n\t * @returns {Buffer} Computed HKDF value.\n\t */\n\t\n\t }, {\n\t key: 'getPasswordAuthenticationKey',\n\t value: function getPasswordAuthenticationKey(username, password, serverBValue, salt) {\n\t if (serverBValue.mod(this.N).equals(new _jsbn.BigInteger('0', 16))) {\n\t throw new Error('B cannot be zero.');\n\t }\n\t\n\t this.UValue = this.calculateU(this.largeAValue, serverBValue);\n\t\n\t if (this.UValue.equals(new _jsbn.BigInteger('0', 16))) {\n\t throw new Error('U cannot be zero.');\n\t }\n\t\n\t var usernamePassword = '' + this.poolName + username + ':' + password;\n\t var usernamePasswordHash = this.hash(usernamePassword);\n\t\n\t var xValue = new _jsbn.BigInteger(this.hexHash(this.padHex(salt) + usernamePasswordHash), 16);\n\t\n\t var gModPowXN = this.g.modPow(xValue, this.N);\n\t var intValue2 = serverBValue.subtract(this.k.multiply(gModPowXN));\n\t var sValue = intValue2.modPow(this.smallAValue.add(this.UValue.multiply(xValue)), this.N).mod(this.N);\n\t\n\t var hkdf = this.computehkdf(new _global.util.Buffer(this.padHex(sValue), 'hex'), new _global.util.Buffer(this.padHex(this.UValue.toString(16)), 'hex'));\n\t\n\t return hkdf;\n\t }\n\t\n\t /**\n\t * Return constant newPasswordRequiredChallengeUserAttributePrefix\n\t * @return {newPasswordRequiredChallengeUserAttributePrefix} constant prefix value\n\t */\n\t\n\t }, {\n\t key: 'getNewPasswordRequiredChallengeUserAttributePrefix',\n\t value: function getNewPasswordRequiredChallengeUserAttributePrefix() {\n\t return newPasswordRequiredChallengeUserAttributePrefix;\n\t }\n\t\n\t /**\n\t * Converts a BigInteger (or hex string) to hex format padded with zeroes for hashing\n\t * @param {BigInteger|String} bigInt Number or string to pad.\n\t * @returns {String} Padded hex string.\n\t */\n\t\n\t }, {\n\t key: 'padHex',\n\t value: function padHex(bigInt) {\n\t var hashStr = bigInt.toString(16);\n\t if (hashStr.length % 2 === 1) {\n\t hashStr = '0' + hashStr;\n\t } else if ('89ABCDEFabcdef'.indexOf(hashStr[0]) !== -1) {\n\t hashStr = '00' + hashStr;\n\t }\n\t return hashStr;\n\t }\n\t }]);\n\t\n\t return AuthenticationHelper;\n\t}();\n\t\n\texports.default = AuthenticationHelper;\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\tvar _global = __webpack_require__(1);\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/** @class */\n\tvar CognitoAccessToken = function () {\n\t /**\n\t * Constructs a new CognitoAccessToken object\n\t * @param {string=} AccessToken The JWT access token.\n\t */\n\t function CognitoAccessToken() {\n\t var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t AccessToken = _ref.AccessToken;\n\t\n\t _classCallCheck(this, CognitoAccessToken);\n\t\n\t // Assign object\n\t this.jwtToken = AccessToken || '';\n\t }\n\t\n\t /**\n\t * @returns {string} the record's token.\n\t */\n\t\n\t\n\t _createClass(CognitoAccessToken, [{\n\t key: 'getJwtToken',\n\t value: function getJwtToken() {\n\t return this.jwtToken;\n\t }\n\t\n\t /**\n\t * @returns {int} the token's expiration (exp member).\n\t */\n\t\n\t }, {\n\t key: 'getExpiration',\n\t value: function getExpiration() {\n\t var payload = this.jwtToken.split('.')[1];\n\t var expiration = JSON.parse(_global.util.base64.decode(payload).toString('utf8'));\n\t return expiration.exp;\n\t }\n\t }]);\n\t\n\t return CognitoAccessToken;\n\t}();\n\t\n\texports.default = CognitoAccessToken;\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\tvar _global = __webpack_require__(1);\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/** @class */\n\tvar CognitoIdToken = function () {\n\t /**\n\t * Constructs a new CognitoIdToken object\n\t * @param {string=} IdToken The JWT Id token\n\t */\n\t function CognitoIdToken() {\n\t var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t IdToken = _ref.IdToken;\n\t\n\t _classCallCheck(this, CognitoIdToken);\n\t\n\t // Assign object\n\t this.jwtToken = IdToken || '';\n\t }\n\t\n\t /**\n\t * @returns {string} the record's token.\n\t */\n\t\n\t\n\t _createClass(CognitoIdToken, [{\n\t key: 'getJwtToken',\n\t value: function getJwtToken() {\n\t return this.jwtToken;\n\t }\n\t\n\t /**\n\t * @returns {int} the token's expiration (exp member).\n\t */\n\t\n\t }, {\n\t key: 'getExpiration',\n\t value: function getExpiration() {\n\t var payload = this.jwtToken.split('.')[1];\n\t var expiration = JSON.parse(_global.util.base64.decode(payload).toString('utf8'));\n\t return expiration.exp;\n\t }\n\t }]);\n\t\n\t return CognitoIdToken;\n\t}();\n\t\n\texports.default = CognitoIdToken;\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\t/** @class */\n\tvar CognitoRefreshToken = function () {\n\t /**\n\t * Constructs a new CognitoRefreshToken object\n\t * @param {string=} RefreshToken The JWT refresh token.\n\t */\n\t function CognitoRefreshToken() {\n\t var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t RefreshToken = _ref.RefreshToken;\n\t\n\t _classCallCheck(this, CognitoRefreshToken);\n\t\n\t // Assign object\n\t this.token = RefreshToken || '';\n\t }\n\t\n\t /**\n\t * @returns {string} the record's token.\n\t */\n\t\n\t\n\t _createClass(CognitoRefreshToken, [{\n\t key: 'getToken',\n\t value: function getToken() {\n\t return this.token;\n\t }\n\t }]);\n\t\n\t return CognitoRefreshToken;\n\t}();\n\t\n\texports.default = CognitoRefreshToken;\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\tvar _global = __webpack_require__(1);\n\t\n\tvar _jsbn = __webpack_require__(12);\n\t\n\tvar _AuthenticationHelper = __webpack_require__(2);\n\t\n\tvar _AuthenticationHelper2 = _interopRequireDefault(_AuthenticationHelper);\n\t\n\tvar _CognitoAccessToken = __webpack_require__(3);\n\t\n\tvar _CognitoAccessToken2 = _interopRequireDefault(_CognitoAccessToken);\n\t\n\tvar _CognitoIdToken = __webpack_require__(4);\n\t\n\tvar _CognitoIdToken2 = _interopRequireDefault(_CognitoIdToken);\n\t\n\tvar _CognitoRefreshToken = __webpack_require__(5);\n\t\n\tvar _CognitoRefreshToken2 = _interopRequireDefault(_CognitoRefreshToken);\n\t\n\tvar _CognitoUserSession = __webpack_require__(8);\n\t\n\tvar _CognitoUserSession2 = _interopRequireDefault(_CognitoUserSession);\n\t\n\tvar _DateHelper = __webpack_require__(9);\n\t\n\tvar _DateHelper2 = _interopRequireDefault(_DateHelper);\n\t\n\tvar _CognitoUserAttribute = __webpack_require__(7);\n\t\n\tvar _CognitoUserAttribute2 = _interopRequireDefault(_CognitoUserAttribute);\n\t\n\tvar _StorageHelper = __webpack_require__(10);\n\t\n\tvar _StorageHelper2 = _interopRequireDefault(_StorageHelper);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/**\n\t * @callback nodeCallback\n\t * @template T result\n\t * @param {*} err The operation failure reason, or null.\n\t * @param {T} result The operation result.\n\t */\n\t\n\t/**\n\t * @callback onFailure\n\t * @param {*} err Failure reason.\n\t */\n\t\n\t/**\n\t * @callback onSuccess\n\t * @template T result\n\t * @param {T} result The operation result.\n\t */\n\t\n\t/**\n\t * @callback mfaRequired\n\t * @param {*} details MFA challenge details.\n\t */\n\t\n\t/**\n\t * @callback customChallenge\n\t * @param {*} details Custom challenge details.\n\t */\n\t\n\t/**\n\t * @callback inputVerificationCode\n\t * @param {*} data Server response.\n\t */\n\t\n\t/**\n\t * @callback authSuccess\n\t * @param {CognitoUserSession} session The new session.\n\t * @param {bool=} userConfirmationNecessary User must be confirmed.\n\t */\n\t\n\t/** @class */\n\tvar CognitoUser = function () {\n\t /**\n\t * Constructs a new CognitoUser object\n\t * @param {object} data Creation options\n\t * @param {string} data.Username The user's username.\n\t * @param {CognitoUserPool} data.Pool Pool containing the user.\n\t */\n\t function CognitoUser(data) {\n\t _classCallCheck(this, CognitoUser);\n\t\n\t if (data == null || data.Username == null || data.Pool == null) {\n\t throw new Error('Username and pool information are required.');\n\t }\n\t\n\t this.username = data.Username || '';\n\t this.pool = data.Pool;\n\t this.Session = null;\n\t\n\t this.client = data.Pool.client;\n\t\n\t this.signInUserSession = null;\n\t this.authenticationFlowType = 'USER_SRP_AUTH';\n\t\n\t this.storage = new _StorageHelper2.default().getStorage();\n\t }\n\t\n\t /**\n\t * @returns {CognitoUserSession} the current session for this user\n\t */\n\t\n\t\n\t _createClass(CognitoUser, [{\n\t key: 'getSignInUserSession',\n\t value: function getSignInUserSession() {\n\t return this.signInUserSession;\n\t }\n\t\n\t /**\n\t * @returns {string} the user's username\n\t */\n\t\n\t }, {\n\t key: 'getUsername',\n\t value: function getUsername() {\n\t return this.username;\n\t }\n\t\n\t /**\n\t * @returns {String} the authentication flow type\n\t */\n\t\n\t }, {\n\t key: 'getAuthenticationFlowType',\n\t value: function getAuthenticationFlowType() {\n\t return this.authenticationFlowType;\n\t }\n\t\n\t /**\n\t * sets authentication flow type\n\t * @param {string} authenticationFlowType New value.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'setAuthenticationFlowType',\n\t value: function setAuthenticationFlowType(authenticationFlowType) {\n\t this.authenticationFlowType = authenticationFlowType;\n\t }\n\t\n\t /**\n\t * This is used for authenticating the user. it calls the AuthenticationHelper for SRP related\n\t * stuff\n\t * @param {AuthenticationDetails} authDetails Contains the authentication data\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {newPasswordRequired} callback.newPasswordRequired new\n\t * password and any required attributes are required to continue\n\t * @param {mfaRequired} callback.mfaRequired MFA code\n\t * required to continue.\n\t * @param {customChallenge} callback.customChallenge Custom challenge\n\t * response required to continue.\n\t * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'authenticateUser',\n\t value: function authenticateUser(authDetails, callback) {\n\t var _this = this;\n\t\n\t var authenticationHelper = new _AuthenticationHelper2.default(this.pool.getUserPoolId().split('_')[1]);\n\t var dateHelper = new _DateHelper2.default();\n\t\n\t var serverBValue = void 0;\n\t var salt = void 0;\n\t var authParameters = {};\n\t\n\t if (this.deviceKey != null) {\n\t authParameters.DEVICE_KEY = this.deviceKey;\n\t }\n\t\n\t authParameters.USERNAME = this.username;\n\t authParameters.SRP_A = authenticationHelper.getLargeAValue().toString(16);\n\t\n\t if (this.authenticationFlowType === 'CUSTOM_AUTH') {\n\t authParameters.CHALLENGE_NAME = 'SRP_A';\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('initiateAuth', {\n\t AuthFlow: this.authenticationFlowType,\n\t ClientId: this.pool.getClientId(),\n\t AuthParameters: authParameters,\n\t ClientMetadata: authDetails.getValidationData()\n\t }, function (err, data) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t\n\t var challengeParameters = data.ChallengeParameters;\n\t\n\t _this.username = challengeParameters.USER_ID_FOR_SRP;\n\t serverBValue = new _jsbn.BigInteger(challengeParameters.SRP_B, 16);\n\t salt = new _jsbn.BigInteger(challengeParameters.SALT, 16);\n\t _this.getCachedDeviceKeyAndPassword();\n\t\n\t var hkdf = authenticationHelper.getPasswordAuthenticationKey(_this.username, authDetails.getPassword(), serverBValue, salt);\n\t\n\t var dateNow = dateHelper.getNowString();\n\t\n\t var signatureString = _global.util.crypto.hmac(hkdf, _global.util.buffer.concat([new _global.util.Buffer(_this.pool.getUserPoolId().split('_')[1], 'utf8'), new _global.util.Buffer(_this.username, 'utf8'), new _global.util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'), new _global.util.Buffer(dateNow, 'utf8')]), 'base64', 'sha256');\n\t\n\t var challengeResponses = {};\n\t\n\t challengeResponses.USERNAME = _this.username;\n\t challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n\t challengeResponses.TIMESTAMP = dateNow;\n\t challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\t\n\t if (_this.deviceKey != null) {\n\t challengeResponses.DEVICE_KEY = _this.deviceKey;\n\t }\n\t\n\t var respondToAuthChallenge = function respondToAuthChallenge(challenge, challengeCallback) {\n\t return _this.client.makeUnauthenticatedRequest('respondToAuthChallenge', challenge, function (errChallenge, dataChallenge) {\n\t if (errChallenge && errChallenge.code === 'ResourceNotFoundException' && errChallenge.message.toLowerCase().indexOf('device') !== -1) {\n\t challengeResponses.DEVICE_KEY = null;\n\t _this.deviceKey = null;\n\t _this.randomPassword = null;\n\t _this.deviceGroupKey = null;\n\t _this.clearCachedDeviceKeyAndPassword();\n\t return respondToAuthChallenge(challenge, challengeCallback);\n\t }\n\t return challengeCallback(errChallenge, dataChallenge);\n\t });\n\t };\n\t\n\t respondToAuthChallenge({\n\t ChallengeName: 'PASSWORD_VERIFIER',\n\t ClientId: _this.pool.getClientId(),\n\t ChallengeResponses: challengeResponses,\n\t Session: data.Session\n\t }, function (errAuthenticate, dataAuthenticate) {\n\t if (errAuthenticate) {\n\t return callback.onFailure(errAuthenticate);\n\t }\n\t\n\t var challengeName = dataAuthenticate.ChallengeName;\n\t if (challengeName === 'NEW_PASSWORD_REQUIRED') {\n\t _this.Session = dataAuthenticate.Session;\n\t var userAttributes = null;\n\t var rawRequiredAttributes = null;\n\t var requiredAttributes = [];\n\t var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\t\n\t if (dataAuthenticate.ChallengeParameters) {\n\t userAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.userAttributes);\n\t rawRequiredAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.requiredAttributes);\n\t }\n\t\n\t if (rawRequiredAttributes) {\n\t for (var i = 0; i < rawRequiredAttributes.length; i++) {\n\t requiredAttributes[i] = rawRequiredAttributes[i].substr(userAttributesPrefix.length);\n\t }\n\t }\n\t return callback.newPasswordRequired(userAttributes, requiredAttributes);\n\t }\n\t return _this.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n\t });\n\t return undefined;\n\t });\n\t }\n\t\n\t /**\n\t * PRIVATE ONLY: This is an internal only method and should not\n\t * be directly called by the consumers.\n\t * @param {object} dataAuthenticate authentication data\n\t * @param {object} authenticationHelper helper created\n\t * @param {callback} callback passed on from caller\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'authenticateUserInternal',\n\t value: function authenticateUserInternal(dataAuthenticate, authenticationHelper, callback) {\n\t var _this2 = this;\n\t\n\t var challengeName = dataAuthenticate.ChallengeName;\n\t var challengeParameters = dataAuthenticate.ChallengeParameters;\n\t\n\t if (challengeName === 'SMS_MFA') {\n\t this.Session = dataAuthenticate.Session;\n\t return callback.mfaRequired(challengeName, challengeParameters);\n\t }\n\t\n\t if (challengeName === 'CUSTOM_CHALLENGE') {\n\t this.Session = dataAuthenticate.Session;\n\t return callback.customChallenge(challengeParameters);\n\t }\n\t\n\t if (challengeName === 'DEVICE_SRP_AUTH') {\n\t this.getDeviceResponse(callback);\n\t return undefined;\n\t }\n\t\n\t this.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\t this.cacheTokens();\n\t\n\t var newDeviceMetadata = dataAuthenticate.AuthenticationResult.NewDeviceMetadata;\n\t if (newDeviceMetadata == null) {\n\t return callback.onSuccess(this.signInUserSession);\n\t }\n\t\n\t authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey);\n\t\n\t var deviceSecretVerifierConfig = {\n\t Salt: new _global.util.Buffer(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n\t PasswordVerifier: new _global.util.Buffer(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n\t };\n\t\n\t this.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n\t this.deviceGroupKey = newDeviceMetadata.DeviceGroupKey;\n\t this.randomPassword = authenticationHelper.getRandomPassword();\n\t\n\t this.client.makeUnauthenticatedRequest('confirmDevice', {\n\t DeviceKey: newDeviceMetadata.DeviceKey,\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n\t DeviceName: navigator.userAgent\n\t }, function (errConfirm, dataConfirm) {\n\t if (errConfirm) {\n\t return callback.onFailure(errConfirm);\n\t }\n\t\n\t _this2.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\t _this2.cacheDeviceKeyAndPassword();\n\t if (dataConfirm.UserConfirmationNecessary === true) {\n\t return callback.onSuccess(_this2.signInUserSession, dataConfirm.UserConfirmationNecessary);\n\t }\n\t return callback.onSuccess(_this2.signInUserSession);\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This method is user to complete the NEW_PASSWORD_REQUIRED challenge.\n\t * Pass the new password with any new user attributes to be updated.\n\t * User attribute keys must be of format userAttributes..\n\t * @param {string} newPassword new password for this user\n\t * @param {object} requiredAttributeData map with values for all required attributes\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {mfaRequired} callback.mfaRequired MFA code required to continue.\n\t * @param {customChallenge} callback.customChallenge Custom challenge\n\t * response required to continue.\n\t * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'completeNewPasswordChallenge',\n\t value: function completeNewPasswordChallenge(newPassword, requiredAttributeData, callback) {\n\t var _this3 = this;\n\t\n\t if (!newPassword) {\n\t return callback.onFailure(new Error('New password is required.'));\n\t }\n\t var authenticationHelper = new _AuthenticationHelper2.default(this.pool.getUserPoolId().split('_')[1]);\n\t var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\t\n\t var finalUserAttributes = {};\n\t if (requiredAttributeData) {\n\t Object.keys(requiredAttributeData).forEach(function (key) {\n\t finalUserAttributes[userAttributesPrefix + key] = requiredAttributeData[key];\n\t });\n\t }\n\t\n\t finalUserAttributes.NEW_PASSWORD = newPassword;\n\t finalUserAttributes.USERNAME = this.username;\n\t this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n\t ChallengeName: 'NEW_PASSWORD_REQUIRED',\n\t ClientId: this.pool.getClientId(),\n\t ChallengeResponses: finalUserAttributes,\n\t Session: this.Session\n\t }, function (errAuthenticate, dataAuthenticate) {\n\t if (errAuthenticate) {\n\t return callback.onFailure(errAuthenticate);\n\t }\n\t return _this3.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used to get a session using device authentication. It is called at the end of user\n\t * authentication\n\t *\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t * @returns {void}\n\t * @private\n\t */\n\t\n\t }, {\n\t key: 'getDeviceResponse',\n\t value: function getDeviceResponse(callback) {\n\t var _this4 = this;\n\t\n\t var authenticationHelper = new _AuthenticationHelper2.default(this.deviceGroupKey);\n\t var dateHelper = new _DateHelper2.default();\n\t\n\t var authParameters = {};\n\t\n\t authParameters.USERNAME = this.username;\n\t authParameters.DEVICE_KEY = this.deviceKey;\n\t authParameters.SRP_A = authenticationHelper.getLargeAValue().toString(16);\n\t\n\t this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n\t ChallengeName: 'DEVICE_SRP_AUTH',\n\t ClientId: this.pool.getClientId(),\n\t ChallengeResponses: authParameters\n\t }, function (err, data) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t\n\t var challengeParameters = data.ChallengeParameters;\n\t\n\t var serverBValue = new _jsbn.BigInteger(challengeParameters.SRP_B, 16);\n\t var salt = new _jsbn.BigInteger(challengeParameters.SALT, 16);\n\t\n\t var hkdf = authenticationHelper.getPasswordAuthenticationKey(_this4.deviceKey, _this4.randomPassword, serverBValue, salt);\n\t\n\t var dateNow = dateHelper.getNowString();\n\t\n\t var signatureString = _global.util.crypto.hmac(hkdf, _global.util.buffer.concat([new _global.util.Buffer(_this4.deviceGroupKey, 'utf8'), new _global.util.Buffer(_this4.deviceKey, 'utf8'), new _global.util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'), new _global.util.Buffer(dateNow, 'utf8')]), 'base64', 'sha256');\n\t\n\t var challengeResponses = {};\n\t\n\t challengeResponses.USERNAME = _this4.username;\n\t challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n\t challengeResponses.TIMESTAMP = dateNow;\n\t challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\t challengeResponses.DEVICE_KEY = _this4.deviceKey;\n\t\n\t _this4.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n\t ChallengeName: 'DEVICE_PASSWORD_VERIFIER',\n\t ClientId: _this4.pool.getClientId(),\n\t ChallengeResponses: challengeResponses,\n\t Session: data.Session\n\t }, function (errAuthenticate, dataAuthenticate) {\n\t if (errAuthenticate) {\n\t return callback.onFailure(errAuthenticate);\n\t }\n\t\n\t _this4.signInUserSession = _this4.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\t _this4.cacheTokens();\n\t\n\t return callback.onSuccess(_this4.signInUserSession);\n\t });\n\t return undefined;\n\t });\n\t }\n\t\n\t /**\n\t * This is used for a certain user to confirm the registration by using a confirmation code\n\t * @param {string} confirmationCode Code entered by user.\n\t * @param {bool} forceAliasCreation Allow migrating from an existing email / phone number.\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'confirmRegistration',\n\t value: function confirmRegistration(confirmationCode, forceAliasCreation, callback) {\n\t this.client.makeUnauthenticatedRequest('confirmSignUp', {\n\t ClientId: this.pool.getClientId(),\n\t ConfirmationCode: confirmationCode,\n\t Username: this.username,\n\t ForceAliasCreation: forceAliasCreation\n\t }, function (err) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t return callback(null, 'SUCCESS');\n\t });\n\t }\n\t\n\t /**\n\t * This is used by the user once he has the responses to a custom challenge\n\t * @param {string} answerChallenge The custom challange answer.\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {customChallenge} callback.customChallenge\n\t * Custom challenge response required to continue.\n\t * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'sendCustomChallengeAnswer',\n\t value: function sendCustomChallengeAnswer(answerChallenge, callback) {\n\t var _this5 = this;\n\t\n\t var challengeResponses = {};\n\t challengeResponses.USERNAME = this.username;\n\t challengeResponses.ANSWER = answerChallenge;\n\t\n\t this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n\t ChallengeName: 'CUSTOM_CHALLENGE',\n\t ChallengeResponses: challengeResponses,\n\t ClientId: this.pool.getClientId(),\n\t Session: this.Session\n\t }, function (err, data) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t\n\t var challengeName = data.ChallengeName;\n\t\n\t if (challengeName === 'CUSTOM_CHALLENGE') {\n\t _this5.Session = data.Session;\n\t return callback.customChallenge(data.ChallengeParameters);\n\t }\n\t\n\t _this5.signInUserSession = _this5.getCognitoUserSession(data.AuthenticationResult);\n\t _this5.cacheTokens();\n\t return callback.onSuccess(_this5.signInUserSession);\n\t });\n\t }\n\t\n\t /**\n\t * This is used by the user once he has an MFA code\n\t * @param {string} confirmationCode The MFA code entered by the user.\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {authSuccess} callback.onSuccess Called on success with the new session.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'sendMFACode',\n\t value: function sendMFACode(confirmationCode, callback) {\n\t var _this6 = this;\n\t\n\t var challengeResponses = {};\n\t challengeResponses.USERNAME = this.username;\n\t challengeResponses.SMS_MFA_CODE = confirmationCode;\n\t\n\t if (this.deviceKey != null) {\n\t challengeResponses.DEVICE_KEY = this.deviceKey;\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n\t ChallengeName: 'SMS_MFA',\n\t ChallengeResponses: challengeResponses,\n\t ClientId: this.pool.getClientId(),\n\t Session: this.Session\n\t }, function (err, dataAuthenticate) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t\n\t var challengeName = dataAuthenticate.ChallengeName;\n\t\n\t if (challengeName === 'DEVICE_SRP_AUTH') {\n\t _this6.getDeviceResponse(callback);\n\t return undefined;\n\t }\n\t\n\t _this6.signInUserSession = _this6.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\t _this6.cacheTokens();\n\t\n\t if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {\n\t return callback.onSuccess(_this6.signInUserSession);\n\t }\n\t\n\t var authenticationHelper = new _AuthenticationHelper2.default(_this6.pool.getUserPoolId().split('_')[1]);\n\t authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey);\n\t\n\t var deviceSecretVerifierConfig = {\n\t Salt: new _global.util.Buffer(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n\t PasswordVerifier: new _global.util.Buffer(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n\t };\n\t\n\t _this6.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n\t _this6.deviceGroupKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey;\n\t _this6.randomPassword = authenticationHelper.getRandomPassword();\n\t\n\t _this6.client.makeUnauthenticatedRequest('confirmDevice', {\n\t DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n\t AccessToken: _this6.signInUserSession.getAccessToken().getJwtToken(),\n\t DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n\t DeviceName: navigator.userAgent\n\t }, function (errConfirm, dataConfirm) {\n\t if (errConfirm) {\n\t return callback.onFailure(errConfirm);\n\t }\n\t\n\t _this6.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\t _this6.cacheDeviceKeyAndPassword();\n\t if (dataConfirm.UserConfirmationNecessary === true) {\n\t return callback.onSuccess(_this6.signInUserSession, dataConfirm.UserConfirmationNecessary);\n\t }\n\t return callback.onSuccess(_this6.signInUserSession);\n\t });\n\t return undefined;\n\t });\n\t }\n\t\n\t /**\n\t * This is used by an authenticated user to change the current password\n\t * @param {string} oldUserPassword The current password.\n\t * @param {string} newUserPassword The requested new password.\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'changePassword',\n\t value: function changePassword(oldUserPassword, newUserPassword, callback) {\n\t if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t return callback(new Error('User is not authenticated'), null);\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('changePassword', {\n\t PreviousPassword: oldUserPassword,\n\t ProposedPassword: newUserPassword,\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t return callback(null, 'SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used by an authenticated user to enable MFA for himself\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'enableMFA',\n\t value: function enableMFA(callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback(new Error('User is not authenticated'), null);\n\t }\n\t\n\t var mfaOptions = [];\n\t var mfaEnabled = {\n\t DeliveryMedium: 'SMS',\n\t AttributeName: 'phone_number'\n\t };\n\t mfaOptions.push(mfaEnabled);\n\t\n\t this.client.makeUnauthenticatedRequest('setUserSettings', {\n\t MFAOptions: mfaOptions,\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t return callback(null, 'SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used by an authenticated user to disable MFA for himself\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'disableMFA',\n\t value: function disableMFA(callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback(new Error('User is not authenticated'), null);\n\t }\n\t\n\t var mfaOptions = [];\n\t\n\t this.client.makeUnauthenticatedRequest('setUserSettings', {\n\t MFAOptions: mfaOptions,\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t return callback(null, 'SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used by an authenticated user to delete himself\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'deleteUser',\n\t value: function deleteUser(callback) {\n\t var _this7 = this;\n\t\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback(new Error('User is not authenticated'), null);\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('deleteUser', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t _this7.clearCachedTokens();\n\t return callback(null, 'SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * @typedef {CognitoUserAttribute | { Name:string, Value:string }} AttributeArg\n\t */\n\t /**\n\t * This is used by an authenticated user to change a list of attributes\n\t * @param {AttributeArg[]} attributes A list of the new user attributes.\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'updateAttributes',\n\t value: function updateAttributes(attributes, callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback(new Error('User is not authenticated'), null);\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('updateUserAttributes', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t UserAttributes: attributes\n\t }, function (err) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t return callback(null, 'SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used by an authenticated user to get a list of attributes\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'getUserAttributes',\n\t value: function getUserAttributes(callback) {\n\t if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t return callback(new Error('User is not authenticated'), null);\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('getUser', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err, userData) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t\n\t var attributeList = [];\n\t\n\t for (var i = 0; i < userData.UserAttributes.length; i++) {\n\t var attribute = {\n\t Name: userData.UserAttributes[i].Name,\n\t Value: userData.UserAttributes[i].Value\n\t };\n\t var userAttribute = new _CognitoUserAttribute2.default(attribute);\n\t attributeList.push(userAttribute);\n\t }\n\t\n\t return callback(null, attributeList);\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used by an authenticated user to get the MFAOptions\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'getMFAOptions',\n\t value: function getMFAOptions(callback) {\n\t if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t return callback(new Error('User is not authenticated'), null);\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('getUser', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err, userData) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t\n\t return callback(null, userData.MFAOptions);\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used by an authenticated user to delete a list of attributes\n\t * @param {string[]} attributeList Names of the attributes to delete.\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'deleteAttributes',\n\t value: function deleteAttributes(attributeList, callback) {\n\t if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t return callback(new Error('User is not authenticated'), null);\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('deleteUserAttributes', {\n\t UserAttributeNames: attributeList,\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t return callback(null, 'SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used by a user to resend a confirmation code\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'resendConfirmationCode',\n\t value: function resendConfirmationCode(callback) {\n\t this.client.makeUnauthenticatedRequest('resendConfirmationCode', {\n\t ClientId: this.pool.getClientId(),\n\t Username: this.username\n\t }, function (err) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t return callback(null, 'SUCCESS');\n\t });\n\t }\n\t\n\t /**\n\t * This is used to get a session, either from the session object\n\t * or from the local storage, or by using a refresh token\n\t *\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'getSession',\n\t value: function getSession(callback) {\n\t if (this.username == null) {\n\t return callback(new Error('Username is null. Cannot retrieve a new session'), null);\n\t }\n\t\n\t if (this.signInUserSession != null && this.signInUserSession.isValid()) {\n\t return callback(null, this.signInUserSession);\n\t }\n\t\n\t var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t var idTokenKey = keyPrefix + '.idToken';\n\t var accessTokenKey = keyPrefix + '.accessToken';\n\t var refreshTokenKey = keyPrefix + '.refreshToken';\n\t\n\t if (this.storage.getItem(idTokenKey)) {\n\t var idToken = new _CognitoIdToken2.default({\n\t IdToken: this.storage.getItem(idTokenKey)\n\t });\n\t var accessToken = new _CognitoAccessToken2.default({\n\t AccessToken: this.storage.getItem(accessTokenKey)\n\t });\n\t var refreshToken = new _CognitoRefreshToken2.default({\n\t RefreshToken: this.storage.getItem(refreshTokenKey)\n\t });\n\t\n\t var sessionData = {\n\t IdToken: idToken,\n\t AccessToken: accessToken,\n\t RefreshToken: refreshToken\n\t };\n\t var cachedSession = new _CognitoUserSession2.default(sessionData);\n\t if (cachedSession.isValid()) {\n\t this.signInUserSession = cachedSession;\n\t return callback(null, this.signInUserSession);\n\t }\n\t\n\t if (refreshToken.getToken() == null) {\n\t return callback(new Error('Cannot retrieve a new session. Please authenticate.'), null);\n\t }\n\t\n\t this.refreshSession(refreshToken, callback);\n\t } else {\n\t callback(new Error('Local storage is missing an ID Token, Please authenticate'), null);\n\t }\n\t\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This uses the refreshToken to retrieve a new session\n\t * @param {CognitoRefreshToken} refreshToken A previous session's refresh token.\n\t * @param {nodeCallback} callback Called on success or error.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'refreshSession',\n\t value: function refreshSession(refreshToken, callback) {\n\t var _this8 = this;\n\t\n\t var authParameters = {};\n\t authParameters.REFRESH_TOKEN = refreshToken.getToken();\n\t var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t var lastUserKey = keyPrefix + '.LastAuthUser';\n\t\n\t if (this.storage.getItem(lastUserKey)) {\n\t this.username = this.storage.getItem(lastUserKey);\n\t var deviceKeyKey = keyPrefix + '.' + this.username + '.deviceKey';\n\t this.deviceKey = this.storage.getItem(deviceKeyKey);\n\t authParameters.DEVICE_KEY = this.deviceKey;\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('initiateAuth', {\n\t ClientId: this.pool.getClientId(),\n\t AuthFlow: 'REFRESH_TOKEN_AUTH',\n\t AuthParameters: authParameters\n\t }, function (err, authResult) {\n\t if (err) {\n\t if (err.code === 'NotAuthorizedException') {\n\t _this8.clearCachedTokens();\n\t }\n\t return callback(err, null);\n\t }\n\t if (authResult) {\n\t var authenticationResult = authResult.AuthenticationResult;\n\t if (!Object.prototype.hasOwnProperty.call(authenticationResult, 'RefreshToken')) {\n\t authenticationResult.RefreshToken = refreshToken.getToken();\n\t }\n\t _this8.signInUserSession = _this8.getCognitoUserSession(authenticationResult);\n\t _this8.cacheTokens();\n\t return callback(null, _this8.signInUserSession);\n\t }\n\t return undefined;\n\t });\n\t }\n\t\n\t /**\n\t * This is used to save the session tokens to local storage\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'cacheTokens',\n\t value: function cacheTokens() {\n\t var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t var idTokenKey = keyPrefix + '.' + this.username + '.idToken';\n\t var accessTokenKey = keyPrefix + '.' + this.username + '.accessToken';\n\t var refreshTokenKey = keyPrefix + '.' + this.username + '.refreshToken';\n\t var lastUserKey = keyPrefix + '.LastAuthUser';\n\t\n\t this.storage.setItem(idTokenKey, this.signInUserSession.getIdToken().getJwtToken());\n\t this.storage.setItem(accessTokenKey, this.signInUserSession.getAccessToken().getJwtToken());\n\t this.storage.setItem(refreshTokenKey, this.signInUserSession.getRefreshToken().getToken());\n\t this.storage.setItem(lastUserKey, this.username);\n\t }\n\t\n\t /**\n\t * This is used to cache the device key and device group and device password\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'cacheDeviceKeyAndPassword',\n\t value: function cacheDeviceKeyAndPassword() {\n\t var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t var deviceKeyKey = keyPrefix + '.deviceKey';\n\t var randomPasswordKey = keyPrefix + '.randomPasswordKey';\n\t var deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\t\n\t this.storage.setItem(deviceKeyKey, this.deviceKey);\n\t this.storage.setItem(randomPasswordKey, this.randomPassword);\n\t this.storage.setItem(deviceGroupKeyKey, this.deviceGroupKey);\n\t }\n\t\n\t /**\n\t * This is used to get current device key and device group and device password\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'getCachedDeviceKeyAndPassword',\n\t value: function getCachedDeviceKeyAndPassword() {\n\t var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t var deviceKeyKey = keyPrefix + '.deviceKey';\n\t var randomPasswordKey = keyPrefix + '.randomPasswordKey';\n\t var deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\t\n\t if (this.storage.getItem(deviceKeyKey)) {\n\t this.deviceKey = this.storage.getItem(deviceKeyKey);\n\t this.randomPassword = this.storage.getItem(randomPasswordKey);\n\t this.deviceGroupKey = this.storage.getItem(deviceGroupKeyKey);\n\t }\n\t }\n\t\n\t /**\n\t * This is used to clear the device key info from local storage\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'clearCachedDeviceKeyAndPassword',\n\t value: function clearCachedDeviceKeyAndPassword() {\n\t var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t var deviceKeyKey = keyPrefix + '.deviceKey';\n\t var randomPasswordKey = keyPrefix + '.randomPasswordKey';\n\t var deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\t\n\t this.storage.removeItem(deviceKeyKey);\n\t this.storage.removeItem(randomPasswordKey);\n\t this.storage.removeItem(deviceGroupKeyKey);\n\t }\n\t\n\t /**\n\t * This is used to clear the session tokens from local storage\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'clearCachedTokens',\n\t value: function clearCachedTokens() {\n\t var keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t var idTokenKey = keyPrefix + '.' + this.username + '.idToken';\n\t var accessTokenKey = keyPrefix + '.' + this.username + '.accessToken';\n\t var refreshTokenKey = keyPrefix + '.' + this.username + '.refreshToken';\n\t var lastUserKey = keyPrefix + '.LastAuthUser';\n\t\n\t this.storage.removeItem(idTokenKey);\n\t this.storage.removeItem(accessTokenKey);\n\t this.storage.removeItem(refreshTokenKey);\n\t this.storage.removeItem(lastUserKey);\n\t }\n\t\n\t /**\n\t * This is used to build a user session from tokens retrieved in the authentication result\n\t * @param {object} authResult Successful auth response from server.\n\t * @returns {CognitoUserSession} The new user session.\n\t * @private\n\t */\n\t\n\t }, {\n\t key: 'getCognitoUserSession',\n\t value: function getCognitoUserSession(authResult) {\n\t var idToken = new _CognitoIdToken2.default(authResult);\n\t var accessToken = new _CognitoAccessToken2.default(authResult);\n\t var refreshToken = new _CognitoRefreshToken2.default(authResult);\n\t\n\t var sessionData = {\n\t IdToken: idToken,\n\t AccessToken: accessToken,\n\t RefreshToken: refreshToken\n\t };\n\t\n\t return new _CognitoUserSession2.default(sessionData);\n\t }\n\t\n\t /**\n\t * This is used to initiate a forgot password request\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {inputVerificationCode?} callback.inputVerificationCode\n\t * Optional callback raised instead of onSuccess with response data.\n\t * @param {onSuccess?} callback.onSuccess Called on success.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'forgotPassword',\n\t value: function forgotPassword(callback) {\n\t this.client.makeUnauthenticatedRequest('forgotPassword', {\n\t ClientId: this.pool.getClientId(),\n\t Username: this.username\n\t }, function (err, data) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t if (typeof callback.inputVerificationCode === 'function') {\n\t return callback.inputVerificationCode(data);\n\t }\n\t return callback.onSuccess();\n\t });\n\t }\n\t\n\t /**\n\t * This is used to confirm a new password using a confirmationCode\n\t * @param {string} confirmationCode Code entered by user.\n\t * @param {string} newPassword Confirm new password.\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {onSuccess} callback.onSuccess Called on success.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'confirmPassword',\n\t value: function confirmPassword(confirmationCode, newPassword, callback) {\n\t this.client.makeUnauthenticatedRequest('confirmForgotPassword', {\n\t ClientId: this.pool.getClientId(),\n\t Username: this.username,\n\t ConfirmationCode: confirmationCode,\n\t Password: newPassword\n\t }, function (err) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t return callback.onSuccess();\n\t });\n\t }\n\t\n\t /**\n\t * This is used to initiate an attribute confirmation request\n\t * @param {string} attributeName User attribute that needs confirmation.\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {inputVerificationCode} callback.inputVerificationCode Called on success.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'getAttributeVerificationCode',\n\t value: function getAttributeVerificationCode(attributeName, callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback.onFailure(new Error('User is not authenticated'));\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('getUserAttributeVerificationCode', {\n\t AttributeName: attributeName,\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err, data) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t return callback.inputVerificationCode(data);\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used to confirm an attribute using a confirmation code\n\t * @param {string} attributeName Attribute being confirmed.\n\t * @param {string} confirmationCode Code entered by user.\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {onSuccess} callback.onSuccess Called on success.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'verifyAttribute',\n\t value: function verifyAttribute(attributeName, confirmationCode, callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback.onFailure(new Error('User is not authenticated'));\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('verifyUserAttribute', {\n\t AttributeName: attributeName,\n\t Code: confirmationCode,\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t return callback.onSuccess('SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used to get the device information using the current device key\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {onSuccess<*>} callback.onSuccess Called on success with device data.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'getDevice',\n\t value: function getDevice(callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback.onFailure(new Error('User is not authenticated'));\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('getDevice', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t DeviceKey: this.deviceKey\n\t }, function (err, data) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t return callback.onSuccess(data);\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used to forget a specific device\n\t * @param {string} deviceKey Device key.\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {onSuccess} callback.onSuccess Called on success.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'forgetSpecificDevice',\n\t value: function forgetSpecificDevice(deviceKey, callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback.onFailure(new Error('User is not authenticated'));\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('forgetDevice', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t DeviceKey: deviceKey\n\t }, function (err) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t return callback.onSuccess('SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used to forget the current device\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {onSuccess} callback.onSuccess Called on success.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'forgetDevice',\n\t value: function forgetDevice(callback) {\n\t var _this9 = this;\n\t\n\t this.forgetSpecificDevice(this.deviceKey, {\n\t onFailure: callback.onFailure,\n\t onSuccess: function onSuccess(result) {\n\t _this9.deviceKey = null;\n\t _this9.deviceGroupKey = null;\n\t _this9.randomPassword = null;\n\t _this9.clearCachedDeviceKeyAndPassword();\n\t return callback.onSuccess(result);\n\t }\n\t });\n\t }\n\t\n\t /**\n\t * This is used to set the device status as remembered\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {onSuccess} callback.onSuccess Called on success.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'setDeviceStatusRemembered',\n\t value: function setDeviceStatusRemembered(callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback.onFailure(new Error('User is not authenticated'));\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('updateDeviceStatus', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t DeviceKey: this.deviceKey,\n\t DeviceRememberedStatus: 'remembered'\n\t }, function (err) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t return callback.onSuccess('SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used to set the device status as not remembered\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {onSuccess} callback.onSuccess Called on success.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'setDeviceStatusNotRemembered',\n\t value: function setDeviceStatusNotRemembered(callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback.onFailure(new Error('User is not authenticated'));\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('updateDeviceStatus', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t DeviceKey: this.deviceKey,\n\t DeviceRememberedStatus: 'not_remembered'\n\t }, function (err) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t return callback.onSuccess('SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used to list all devices for a user\n\t *\n\t * @param {int} limit the number of devices returned in a call\n\t * @param {string} paginationToken the pagination token in case any was returned before\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {onSuccess<*>} callback.onSuccess Called on success with device list.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'listDevices',\n\t value: function listDevices(limit, paginationToken, callback) {\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback.onFailure(new Error('User is not authenticated'));\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('listDevices', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t Limit: limit,\n\t PaginationToken: paginationToken\n\t }, function (err, data) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t return callback.onSuccess(data);\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used to globally revoke all tokens issued to a user\n\t * @param {object} callback Result callback map.\n\t * @param {onFailure} callback.onFailure Called on any error.\n\t * @param {onSuccess} callback.onSuccess Called on success.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'globalSignOut',\n\t value: function globalSignOut(callback) {\n\t var _this10 = this;\n\t\n\t if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t return callback.onFailure(new Error('User is not authenticated'));\n\t }\n\t\n\t this.client.makeUnauthenticatedRequest('globalSignOut', {\n\t AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t }, function (err) {\n\t if (err) {\n\t return callback.onFailure(err);\n\t }\n\t _this10.clearCachedTokens();\n\t return callback.onSuccess('SUCCESS');\n\t });\n\t return undefined;\n\t }\n\t\n\t /**\n\t * This is used for the user to signOut of the application and clear the cached tokens.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'signOut',\n\t value: function signOut() {\n\t this.signInUserSession = null;\n\t this.clearCachedTokens();\n\t }\n\t }]);\n\t\n\t return CognitoUser;\n\t}();\n\t\n\texports.default = CognitoUser;\n\n/***/ },\n/* 7 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\t/** @class */\n\tvar CognitoUserAttribute = function () {\n\t /**\n\t * Constructs a new CognitoUserAttribute object\n\t * @param {string=} Name The record's name\n\t * @param {string=} Value The record's value\n\t */\n\t function CognitoUserAttribute() {\n\t var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t Name = _ref.Name,\n\t Value = _ref.Value;\n\t\n\t _classCallCheck(this, CognitoUserAttribute);\n\t\n\t this.Name = Name || '';\n\t this.Value = Value || '';\n\t }\n\t\n\t /**\n\t * @returns {string} the record's value.\n\t */\n\t\n\t\n\t _createClass(CognitoUserAttribute, [{\n\t key: 'getValue',\n\t value: function getValue() {\n\t return this.Value;\n\t }\n\t\n\t /**\n\t * Sets the record's value.\n\t * @param {string} value The new value.\n\t * @returns {CognitoUserAttribute} The record for method chaining.\n\t */\n\t\n\t }, {\n\t key: 'setValue',\n\t value: function setValue(value) {\n\t this.Value = value;\n\t return this;\n\t }\n\t\n\t /**\n\t * @returns {string} the record's name.\n\t */\n\t\n\t }, {\n\t key: 'getName',\n\t value: function getName() {\n\t return this.Name;\n\t }\n\t\n\t /**\n\t * Sets the record's name\n\t * @param {string} name The new name.\n\t * @returns {CognitoUserAttribute} The record for method chaining.\n\t */\n\t\n\t }, {\n\t key: 'setName',\n\t value: function setName(name) {\n\t this.Name = name;\n\t return this;\n\t }\n\t\n\t /**\n\t * @returns {string} a string representation of the record.\n\t */\n\t\n\t }, {\n\t key: 'toString',\n\t value: function toString() {\n\t return JSON.stringify(this);\n\t }\n\t\n\t /**\n\t * @returns {object} a flat object representing the record.\n\t */\n\t\n\t }, {\n\t key: 'toJSON',\n\t value: function toJSON() {\n\t return {\n\t Name: this.Name,\n\t Value: this.Value\n\t };\n\t }\n\t }]);\n\t\n\t return CognitoUserAttribute;\n\t}();\n\t\n\texports.default = CognitoUserAttribute;\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\t/** @class */\n\tvar CognitoUserSession = function () {\n\t /**\n\t * Constructs a new CognitoUserSession object\n\t * @param {string} IdToken The session's Id token.\n\t * @param {string=} RefreshToken The session's refresh token.\n\t * @param {string} AccessToken The session's access token.\n\t */\n\t function CognitoUserSession() {\n\t var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t IdToken = _ref.IdToken,\n\t RefreshToken = _ref.RefreshToken,\n\t AccessToken = _ref.AccessToken;\n\t\n\t _classCallCheck(this, CognitoUserSession);\n\t\n\t if (AccessToken == null || IdToken == null) {\n\t throw new Error('Id token and Access Token must be present.');\n\t }\n\t\n\t this.idToken = IdToken;\n\t this.refreshToken = RefreshToken;\n\t this.accessToken = AccessToken;\n\t }\n\t\n\t /**\n\t * @returns {CognitoIdToken} the session's Id token\n\t */\n\t\n\t\n\t _createClass(CognitoUserSession, [{\n\t key: 'getIdToken',\n\t value: function getIdToken() {\n\t return this.idToken;\n\t }\n\t\n\t /**\n\t * @returns {CognitoRefreshToken} the session's refresh token\n\t */\n\t\n\t }, {\n\t key: 'getRefreshToken',\n\t value: function getRefreshToken() {\n\t return this.refreshToken;\n\t }\n\t\n\t /**\n\t * @returns {CognitoAccessToken} the session's access token\n\t */\n\t\n\t }, {\n\t key: 'getAccessToken',\n\t value: function getAccessToken() {\n\t return this.accessToken;\n\t }\n\t\n\t /**\n\t * Checks to see if the session is still valid based on session expiry information found\n\t * in tokens and the current time\n\t * @returns {boolean} if the session is still valid\n\t */\n\t\n\t }, {\n\t key: 'isValid',\n\t value: function isValid() {\n\t var now = Math.floor(new Date() / 1000);\n\t\n\t return now < this.accessToken.getExpiration() && now < this.idToken.getExpiration();\n\t }\n\t }]);\n\t\n\t return CognitoUserSession;\n\t}();\n\t\n\texports.default = CognitoUserSession;\n\n/***/ },\n/* 9 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\tvar monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\tvar weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n\t\n\t/** @class */\n\t\n\tvar DateHelper = function () {\n\t function DateHelper() {\n\t _classCallCheck(this, DateHelper);\n\t }\n\t\n\t _createClass(DateHelper, [{\n\t key: 'getNowString',\n\t\n\t /**\n\t * @returns {string} The current time in \"ddd MMM D HH:mm:ss UTC YYYY\" format.\n\t */\n\t value: function getNowString() {\n\t var now = new Date();\n\t\n\t var weekDay = weekNames[now.getUTCDay()];\n\t var month = monthNames[now.getUTCMonth()];\n\t var day = now.getUTCDate();\n\t\n\t var hours = now.getUTCHours();\n\t if (hours < 10) {\n\t hours = '0' + hours;\n\t }\n\t\n\t var minutes = now.getUTCMinutes();\n\t if (minutes < 10) {\n\t minutes = '0' + minutes;\n\t }\n\t\n\t var seconds = now.getUTCSeconds();\n\t if (seconds < 10) {\n\t seconds = '0' + seconds;\n\t }\n\t\n\t var year = now.getUTCFullYear();\n\t\n\t // ddd MMM D HH:mm:ss UTC YYYY\n\t var dateNow = weekDay + ' ' + month + ' ' + day + ' ' + hours + ':' + minutes + ':' + seconds + ' UTC ' + year;\n\t\n\t return dateNow;\n\t }\n\t }]);\n\t\n\t return DateHelper;\n\t}();\n\t\n\texports.default = DateHelper;\n\n/***/ },\n/* 10 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\tvar dataMemory = {};\n\t\n\t/** @class */\n\t\n\tvar MemoryStorage = function () {\n\t function MemoryStorage() {\n\t _classCallCheck(this, MemoryStorage);\n\t }\n\t\n\t _createClass(MemoryStorage, null, [{\n\t key: 'setItem',\n\t\n\t\n\t /**\n\t * This is used to set a specific item in storage\n\t * @param {string} key - the key for the item\n\t * @param {object} value - the value\n\t * @returns {string} value that was set\n\t */\n\t value: function setItem(key, value) {\n\t dataMemory[key] = value;\n\t return dataMemory[key];\n\t }\n\t\n\t /**\n\t * This is used to get a specific key from storage\n\t * @param {string} key - the key for the item\n\t * This is used to clear the storage\n\t * @returns {string} the data item\n\t */\n\t\n\t }, {\n\t key: 'getItem',\n\t value: function getItem(key) {\n\t return Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n\t }\n\t\n\t /**\n\t * This is used to remove an item from storage\n\t * @param {string} key - the key being set\n\t * @returns {string} value - value that was deleted\n\t */\n\t\n\t }, {\n\t key: 'removeItem',\n\t value: function removeItem(key) {\n\t return delete dataMemory[key];\n\t }\n\t\n\t /**\n\t * This is used to clear the storage\n\t * @returns {string} nothing\n\t */\n\t\n\t }, {\n\t key: 'clear',\n\t value: function clear() {\n\t dataMemory = {};\n\t return dataMemory;\n\t }\n\t }]);\n\t\n\t return MemoryStorage;\n\t}();\n\t\n\t/** @class */\n\t\n\t\n\tvar StorageHelper = function () {\n\t\n\t /**\n\t * This is used to get a storage object\n\t * @returns {object} the storage\n\t */\n\t function StorageHelper() {\n\t _classCallCheck(this, StorageHelper);\n\t\n\t try {\n\t this.storageWindow = window.localStorage;\n\t this.storageWindow.setItem('aws.cognito.test-ls', 1);\n\t this.storageWindow.removeItem('aws.cognito.test-ls');\n\t } catch (exception) {\n\t this.storageWindow = MemoryStorage;\n\t }\n\t }\n\t\n\t /**\n\t * This is used to return the storage\n\t * @returns {object} the storage\n\t */\n\t\n\t\n\t _createClass(StorageHelper, [{\n\t key: 'getStorage',\n\t value: function getStorage() {\n\t return this.storageWindow;\n\t }\n\t }]);\n\t\n\t return StorageHelper;\n\t}();\n\t\n\texports.default = StorageHelper;\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_11__;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_12__;\n\n/***/ },\n/* 13 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\t/** @class */\n\tvar AuthenticationDetails = function () {\n\t /**\n\t * Constructs a new AuthenticationDetails object\n\t * @param {object=} data Creation options.\n\t * @param {string} data.Username User being authenticated.\n\t * @param {string} data.Password Plain-text password to authenticate with.\n\t * @param {(AttributeArg[])?} data.ValidationData Application extra metadata.\n\t */\n\t function AuthenticationDetails(data) {\n\t _classCallCheck(this, AuthenticationDetails);\n\t\n\t var _ref = data || {},\n\t ValidationData = _ref.ValidationData,\n\t Username = _ref.Username,\n\t Password = _ref.Password;\n\t\n\t this.validationData = ValidationData || [];\n\t this.username = Username;\n\t this.password = Password;\n\t }\n\t\n\t /**\n\t * @returns {string} the record's username\n\t */\n\t\n\t\n\t _createClass(AuthenticationDetails, [{\n\t key: \"getUsername\",\n\t value: function getUsername() {\n\t return this.username;\n\t }\n\t\n\t /**\n\t * @returns {string} the record's password\n\t */\n\t\n\t }, {\n\t key: \"getPassword\",\n\t value: function getPassword() {\n\t return this.password;\n\t }\n\t\n\t /**\n\t * @returns {Array} the record's validationData\n\t */\n\t\n\t }, {\n\t key: \"getValidationData\",\n\t value: function getValidationData() {\n\t return this.validationData;\n\t }\n\t }]);\n\t\n\t return AuthenticationDetails;\n\t}();\n\t\n\texports.default = AuthenticationDetails;\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*!\n\t * Copyright 2016 Amazon.com,\n\t * Inc. or its affiliates. All Rights Reserved.\n\t *\n\t * Licensed under the Amazon Software License (the \"License\").\n\t * You may not use this file except in compliance with the\n\t * License. A copy of the License is located at\n\t *\n\t * http://aws.amazon.com/asl/\n\t *\n\t * or in the \"license\" file accompanying this file. This file is\n\t * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n\t * CONDITIONS OF ANY KIND, express or implied. See the License\n\t * for the specific language governing permissions and\n\t * limitations under the License.\n\t */\n\t\n\tvar _cognitoidentityserviceprovider = __webpack_require__(11);\n\t\n\tvar _cognitoidentityserviceprovider2 = _interopRequireDefault(_cognitoidentityserviceprovider);\n\t\n\tvar _CognitoUser = __webpack_require__(6);\n\t\n\tvar _CognitoUser2 = _interopRequireDefault(_CognitoUser);\n\t\n\tvar _StorageHelper = __webpack_require__(10);\n\t\n\tvar _StorageHelper2 = _interopRequireDefault(_StorageHelper);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/** @class */\n\tvar CognitoUserPool = function () {\n\t /**\n\t * Constructs a new CognitoUserPool object\n\t * @param {object} data Creation options.\n\t * @param {string} data.UserPoolId Cognito user pool id.\n\t * @param {string} data.ClientId User pool application client id.\n\t */\n\t function CognitoUserPool(data) {\n\t _classCallCheck(this, CognitoUserPool);\n\t\n\t var _ref = data || {},\n\t UserPoolId = _ref.UserPoolId,\n\t ClientId = _ref.ClientId;\n\t\n\t if (!UserPoolId || !ClientId) {\n\t throw new Error('Both UserPoolId and ClientId are required.');\n\t }\n\t if (!/^[\\w-]+_.+$/.test(UserPoolId)) {\n\t throw new Error('Invalid UserPoolId format.');\n\t }\n\t var region = UserPoolId.split('_')[0];\n\t\n\t this.userPoolId = UserPoolId;\n\t this.clientId = ClientId;\n\t\n\t this.client = new _cognitoidentityserviceprovider2.default({ apiVersion: '2016-04-19', region: region });\n\t\n\t this.storage = new _StorageHelper2.default().getStorage();\n\t }\n\t\n\t /**\n\t * @returns {string} the user pool id\n\t */\n\t\n\t\n\t _createClass(CognitoUserPool, [{\n\t key: 'getUserPoolId',\n\t value: function getUserPoolId() {\n\t return this.userPoolId;\n\t }\n\t\n\t /**\n\t * @returns {string} the client id\n\t */\n\t\n\t }, {\n\t key: 'getClientId',\n\t value: function getClientId() {\n\t return this.clientId;\n\t }\n\t\n\t /**\n\t * @typedef {object} SignUpResult\n\t * @property {CognitoUser} user New user.\n\t * @property {bool} userConfirmed If the user is already confirmed.\n\t */\n\t /**\n\t * method for signing up a user\n\t * @param {string} username User's username.\n\t * @param {string} password Plain-text initial password entered by user.\n\t * @param {(AttributeArg[])=} userAttributes New user attributes.\n\t * @param {(AttributeArg[])=} validationData Application metadata.\n\t * @param {nodeCallback} callback Called on error or with the new user.\n\t * @returns {void}\n\t */\n\t\n\t }, {\n\t key: 'signUp',\n\t value: function signUp(username, password, userAttributes, validationData, callback) {\n\t var _this = this;\n\t\n\t this.client.makeUnauthenticatedRequest('signUp', {\n\t ClientId: this.clientId,\n\t Username: username,\n\t Password: password,\n\t UserAttributes: userAttributes,\n\t ValidationData: validationData\n\t }, function (err, data) {\n\t if (err) {\n\t return callback(err, null);\n\t }\n\t\n\t var cognitoUser = {\n\t Username: username,\n\t Pool: _this\n\t };\n\t\n\t var returnData = {\n\t user: new _CognitoUser2.default(cognitoUser),\n\t userConfirmed: data.UserConfirmed\n\t };\n\t\n\t return callback(null, returnData);\n\t });\n\t }\n\t\n\t /**\n\t * method for getting the current user of the application from the local storage\n\t *\n\t * @returns {CognitoUser} the user retrieved from storage\n\t */\n\t\n\t }, {\n\t key: 'getCurrentUser',\n\t value: function getCurrentUser() {\n\t var lastUserKey = 'CognitoIdentityServiceProvider.' + this.clientId + '.LastAuthUser';\n\t\n\t var lastAuthUser = this.storage.getItem(lastUserKey);\n\t if (lastAuthUser) {\n\t var cognitoUser = {\n\t Username: lastAuthUser,\n\t Pool: this\n\t };\n\t\n\t return new _CognitoUser2.default(cognitoUser);\n\t }\n\t\n\t return null;\n\t }\n\t }]);\n\t\n\t return CognitoUserPool;\n\t}();\n\t\n\texports.default = CognitoUserPool;\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _AuthenticationDetails = __webpack_require__(13);\n\t\n\tObject.defineProperty(exports, 'AuthenticationDetails', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_AuthenticationDetails).default;\n\t }\n\t});\n\t\n\tvar _AuthenticationHelper = __webpack_require__(2);\n\t\n\tObject.defineProperty(exports, 'AuthenticationHelper', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_AuthenticationHelper).default;\n\t }\n\t});\n\t\n\tvar _CognitoAccessToken = __webpack_require__(3);\n\t\n\tObject.defineProperty(exports, 'CognitoAccessToken', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_CognitoAccessToken).default;\n\t }\n\t});\n\t\n\tvar _CognitoIdToken = __webpack_require__(4);\n\t\n\tObject.defineProperty(exports, 'CognitoIdToken', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_CognitoIdToken).default;\n\t }\n\t});\n\t\n\tvar _CognitoRefreshToken = __webpack_require__(5);\n\t\n\tObject.defineProperty(exports, 'CognitoRefreshToken', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_CognitoRefreshToken).default;\n\t }\n\t});\n\t\n\tvar _CognitoUser = __webpack_require__(6);\n\t\n\tObject.defineProperty(exports, 'CognitoUser', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_CognitoUser).default;\n\t }\n\t});\n\t\n\tvar _CognitoUserAttribute = __webpack_require__(7);\n\t\n\tObject.defineProperty(exports, 'CognitoUserAttribute', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_CognitoUserAttribute).default;\n\t }\n\t});\n\t\n\tvar _CognitoUserPool = __webpack_require__(14);\n\t\n\tObject.defineProperty(exports, 'CognitoUserPool', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_CognitoUserPool).default;\n\t }\n\t});\n\t\n\tvar _CognitoUserSession = __webpack_require__(8);\n\t\n\tObject.defineProperty(exports, 'CognitoUserSession', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_CognitoUserSession).default;\n\t }\n\t});\n\t\n\tvar _DateHelper = __webpack_require__(9);\n\t\n\tObject.defineProperty(exports, 'DateHelper', {\n\t enumerable: true,\n\t get: function get() {\n\t return _interopRequireDefault(_DateHelper).default;\n\t }\n\t});\n\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/***/ }\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// amazon-cognito-identity.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 03508c239c5db8678652","import CognitoIdentityServiceProvider from 'aws-sdk/clients/cognitoidentityserviceprovider';\nimport * as enhancements from './src';\n\nexport * from './src';\n\nObject.keys(enhancements).forEach(key => {\n CognitoIdentityServiceProvider[key] = enhancements[key];\n});\n\n// The version of crypto-browserify included by aws-sdk only\n// checks for window.crypto, not window.msCrypto as used by\n// IE 11 – so we set it explicitly here\nif (typeof window !== 'undefined' && !window.crypto && window.msCrypto) {\n window.crypto = window.msCrypto;\n}\n\n\n\n// WEBPACK FOOTER //\n// ./enhance.js","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":[\"AWSCognito\"],\"commonjs2\":\"aws-sdk/global\",\"commonjs\":\"aws-sdk/global\",\"amd\":\"aws-sdk/global\"}\n// module id = 1\n// module chunks = 0","/*!\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 */\n\nimport { util } from 'aws-sdk/global';\nimport { BigInteger } from 'jsbn';\n\nconst initN = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1'\n + '29024E088A67CC74020BBEA63B139B22514A08798E3404DD'\n + 'EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245'\n + 'E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED'\n + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D'\n + 'C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F'\n + '83655D23DCA3AD961C62F356208552BB9ED529077096966D'\n + '670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B'\n + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9'\n + 'DE2BCBF6955817183995497CEA956AE515D2261898FA0510'\n + '15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64'\n + 'ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7'\n + 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B'\n + 'F12FFA06D98A0864D87602733EC86A64521F2B18177B200C'\n + 'BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31'\n + '43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF';\n\nconst newPasswordRequiredChallengeUserAttributePrefix = 'userAttributes.';\n\n/** @class */\nexport default class AuthenticationHelper {\n /**\n * Constructs a new AuthenticationHelper object\n * @param {string} PoolName Cognito user pool name.\n */\n constructor(PoolName) {\n this.N = new BigInteger(initN, 16);\n this.g = new BigInteger('2');\n this.k = new BigInteger(this.hexHash(`00${this.N.toString(16)}0${this.g.toString(16)}`), 16);\n\n this.smallAValue = this.generateRandomSmallA();\n this.largeAValue = this.calculateA(this.smallAValue);\n\n this.infoBits = new util.Buffer('Caldera Derived Key', 'utf8');\n\n this.poolName = PoolName;\n }\n\n /**\n * @returns {BigInteger} small A, a random number\n */\n getSmallAValue() {\n return this.smallAValue;\n }\n\n /**\n * @returns {BigInteger} large A, a value generated from small A\n */\n getLargeAValue() {\n return this.largeAValue;\n }\n\n /**\n * helper function to generate a random big integer\n * @returns {BigInteger} a random value.\n * @private\n */\n generateRandomSmallA() {\n const hexRandom = util.crypto.lib.randomBytes(128).toString('hex');\n\n const randomBigInt = new BigInteger(hexRandom, 16);\n const smallABigInt = randomBigInt.mod(this.N);\n\n return smallABigInt;\n }\n\n /**\n * helper function to generate a random string\n * @returns {string} a random value.\n * @private\n */\n generateRandomString() {\n return util.crypto.lib.randomBytes(40).toString('base64');\n }\n\n /**\n * @returns {string} Generated random value included in password hash.\n */\n getRandomPassword() {\n return this.randomPassword;\n }\n\n /**\n * @returns {string} Generated random value included in devices hash.\n */\n getSaltDevices() {\n return this.SaltToHashDevices;\n }\n\n /**\n * @returns {string} Value used to verify devices.\n */\n getVerifierDevices() {\n return this.verifierDevices;\n }\n\n /**\n * Generate salts and compute verifier.\n * @param {string} deviceGroupKey Devices to generate verifier for.\n * @param {string} username User to generate verifier for.\n * @returns {void}\n */\n generateHashDevice(deviceGroupKey, username) {\n this.randomPassword = this.generateRandomString();\n const combinedString = `${deviceGroupKey}${username}:${this.randomPassword}`;\n const hashedString = this.hash(combinedString);\n\n const hexRandom = util.crypto.lib.randomBytes(16).toString('hex');\n this.SaltToHashDevices = this.padHex(new BigInteger(hexRandom, 16));\n\n const verifierDevicesNotPadded = this.g.modPow(\n new BigInteger(this.hexHash(this.SaltToHashDevices + hashedString), 16),\n this.N);\n\n this.verifierDevices = this.padHex(verifierDevicesNotPadded);\n }\n\n /**\n * Calculate the client's public value A = g^a%N\n * with the generated random number a\n * @param {BigInteger} a Randomly generated small A.\n * @returns {BigInteger} Computed large A.\n * @private\n */\n calculateA(a) {\n const A = this.g.modPow(a, this.N);\n\n if (A.mod(this.N).toString() === '0') {\n throw new Error('Illegal paramater. A mod N cannot be 0.');\n }\n return A;\n }\n\n /**\n * Calculate the client's value U which is the hash of A and B\n * @param {BigInteger} A Large A value.\n * @param {BigInteger} B Server B value.\n * @returns {BigInteger} Computed U value.\n * @private\n */\n calculateU(A, B) {\n this.UHexHash = this.hexHash(this.padHex(A) + this.padHex(B));\n const finalU = new BigInteger(this.UHexHash, 16);\n\n return finalU;\n }\n\n /**\n * Calculate a hash from a bitArray\n * @param {Buffer} buf Value to hash.\n * @returns {String} Hex-encoded hash.\n * @private\n */\n hash(buf) {\n const hashHex = util.crypto.sha256(buf, 'hex');\n return (new Array(64 - hashHex.length).join('0')) + hashHex;\n }\n\n /**\n * Calculate a hash from a hex string\n * @param {String} hexStr Value to hash.\n * @returns {String} Hex-encoded hash.\n * @private\n */\n hexHash(hexStr) {\n return this.hash(new util.Buffer(hexStr, 'hex'));\n }\n\n /**\n * Standard hkdf algorithm\n * @param {Buffer} ikm Input key material.\n * @param {Buffer} salt Salt value.\n * @returns {Buffer} Strong key material.\n * @private\n */\n computehkdf(ikm, salt) {\n const prk = util.crypto.hmac(salt, ikm, 'buffer', 'sha256');\n const infoBitsUpdate = util.buffer.concat([\n this.infoBits,\n new util.Buffer(String.fromCharCode(1), 'utf8'),\n ]);\n const hmac = util.crypto.hmac(prk, infoBitsUpdate, 'buffer', 'sha256');\n return hmac.slice(0, 16);\n }\n\n /**\n * Calculates the final hkdf based on computed S value, and computed U value and the key\n * @param {String} username Username.\n * @param {String} password Password.\n * @param {BigInteger} serverBValue Server B value.\n * @param {BigInteger} salt Generated salt.\n * @returns {Buffer} Computed HKDF value.\n */\n getPasswordAuthenticationKey(username, password, serverBValue, salt) {\n if (serverBValue.mod(this.N).equals(new BigInteger('0', 16))) {\n throw new Error('B cannot be zero.');\n }\n\n this.UValue = this.calculateU(this.largeAValue, serverBValue);\n\n if (this.UValue.equals(new BigInteger('0', 16))) {\n throw new Error('U cannot be zero.');\n }\n\n const usernamePassword = `${this.poolName}${username}:${password}`;\n const usernamePasswordHash = this.hash(usernamePassword);\n\n const xValue = new BigInteger(this.hexHash(this.padHex(salt) + usernamePasswordHash), 16);\n\n const gModPowXN = this.g.modPow(xValue, this.N);\n const intValue2 = serverBValue.subtract(this.k.multiply(gModPowXN));\n const sValue = intValue2.modPow(\n this.smallAValue.add(this.UValue.multiply(xValue)),\n this.N\n ).mod(this.N);\n\n const hkdf = this.computehkdf(\n new util.Buffer(this.padHex(sValue), 'hex'),\n new util.Buffer(this.padHex(this.UValue.toString(16)), 'hex'));\n\n return hkdf;\n }\n\n /**\n * Return constant newPasswordRequiredChallengeUserAttributePrefix\n * @return {newPasswordRequiredChallengeUserAttributePrefix} constant prefix value\n */\n getNewPasswordRequiredChallengeUserAttributePrefix() {\n return newPasswordRequiredChallengeUserAttributePrefix;\n }\n\n /**\n * Converts a BigInteger (or hex string) to hex format padded with zeroes for hashing\n * @param {BigInteger|String} bigInt Number or string to pad.\n * @returns {String} Padded hex string.\n */\n padHex(bigInt) {\n let hashStr = bigInt.toString(16);\n if (hashStr.length % 2 === 1) {\n hashStr = `0${hashStr}`;\n } else if ('89ABCDEFabcdef'.indexOf(hashStr[0]) !== -1) {\n hashStr = `00${hashStr}`;\n }\n return hashStr;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthenticationHelper.js","/*\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 */\n\nimport { util } from 'aws-sdk/global';\n\n/** @class */\nexport default class CognitoAccessToken {\n /**\n * Constructs a new CognitoAccessToken object\n * @param {string=} AccessToken The JWT access token.\n */\n constructor({ AccessToken } = {}) {\n // Assign object\n this.jwtToken = AccessToken || '';\n }\n\n /**\n * @returns {string} the record's token.\n */\n getJwtToken() {\n return this.jwtToken;\n }\n\n /**\n * @returns {int} the token's expiration (exp member).\n */\n getExpiration() {\n const payload = this.jwtToken.split('.')[1];\n const expiration = JSON.parse(util.base64.decode(payload).toString('utf8'));\n return expiration.exp;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CognitoAccessToken.js","/*!\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 */\n\nimport { util } from 'aws-sdk/global';\n\n/** @class */\nexport default class CognitoIdToken {\n /**\n * Constructs a new CognitoIdToken object\n * @param {string=} IdToken The JWT Id token\n */\n constructor({ IdToken } = {}) {\n // Assign object\n this.jwtToken = IdToken || '';\n }\n\n /**\n * @returns {string} the record's token.\n */\n getJwtToken() {\n return this.jwtToken;\n }\n\n /**\n * @returns {int} the token's expiration (exp member).\n */\n getExpiration() {\n const payload = this.jwtToken.split('.')[1];\n const expiration = JSON.parse(util.base64.decode(payload).toString('utf8'));\n return expiration.exp;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CognitoIdToken.js","/*!\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 */\n\n/** @class */\nexport default class CognitoRefreshToken {\n /**\n * Constructs a new CognitoRefreshToken object\n * @param {string=} RefreshToken The JWT refresh token.\n */\n constructor({ RefreshToken } = {}) {\n // Assign object\n this.token = RefreshToken || '';\n }\n\n /**\n * @returns {string} the record's token.\n */\n getToken() {\n return this.token;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CognitoRefreshToken.js","/*!\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 */\n\nimport { util } from 'aws-sdk/global';\nimport { BigInteger } from 'jsbn';\n\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/**\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\n\n/** @class */\nexport default class CognitoUser {\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 */\n constructor(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\n this.client = data.Pool.client;\n\n this.signInUserSession = null;\n this.authenticationFlowType = 'USER_SRP_AUTH';\n\n this.storage = new StorageHelper().getStorage();\n }\n\n /**\n * @returns {CognitoUserSession} the current session for this user\n */\n getSignInUserSession() {\n return this.signInUserSession;\n }\n\n /**\n * @returns {string} the user's username\n */\n getUsername() {\n return this.username;\n }\n\n /**\n * @returns {String} the authentication flow type\n */\n getAuthenticationFlowType() {\n return this.authenticationFlowType;\n }\n\n /**\n * sets authentication flow type\n * @param {string} authenticationFlowType New value.\n * @returns {void}\n */\n setAuthenticationFlowType(authenticationFlowType) {\n this.authenticationFlowType = authenticationFlowType;\n }\n\n /**\n * This is used for authenticating the user. 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 authenticateUser(authDetails, callback) {\n const authenticationHelper = new AuthenticationHelper(\n this.pool.getUserPoolId().split('_')[1]);\n const dateHelper = new DateHelper();\n\n let serverBValue;\n let salt;\n const authParameters = {};\n\n if (this.deviceKey != null) {\n authParameters.DEVICE_KEY = this.deviceKey;\n }\n\n authParameters.USERNAME = this.username;\n authParameters.SRP_A = authenticationHelper.getLargeAValue().toString(16);\n\n if (this.authenticationFlowType === 'CUSTOM_AUTH') {\n authParameters.CHALLENGE_NAME = 'SRP_A';\n }\n\n this.client.makeUnauthenticatedRequest('initiateAuth', {\n AuthFlow: this.authenticationFlowType,\n ClientId: this.pool.getClientId(),\n AuthParameters: authParameters,\n ClientMetadata: authDetails.getValidationData(),\n }, (err, data) => {\n if (err) {\n return callback.onFailure(err);\n }\n\n const challengeParameters = data.ChallengeParameters;\n\n this.username = challengeParameters.USER_ID_FOR_SRP;\n serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n salt = new BigInteger(challengeParameters.SALT, 16);\n this.getCachedDeviceKeyAndPassword();\n\n const hkdf = authenticationHelper.getPasswordAuthenticationKey(\n this.username,\n authDetails.getPassword(),\n serverBValue,\n salt);\n\n const dateNow = dateHelper.getNowString();\n\n const signatureString = util.crypto.hmac(hkdf, util.buffer.concat([\n new util.Buffer(this.pool.getUserPoolId().split('_')[1], 'utf8'),\n new util.Buffer(this.username, 'utf8'),\n new util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'),\n new util.Buffer(dateNow, 'utf8'),\n ]), 'base64', 'sha256');\n\n const challengeResponses = {};\n\n challengeResponses.USERNAME = this.username;\n challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n challengeResponses.TIMESTAMP = dateNow;\n challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\n if (this.deviceKey != null) {\n challengeResponses.DEVICE_KEY = this.deviceKey;\n }\n\n const respondToAuthChallenge = (challenge, challengeCallback) =>\n this.client.makeUnauthenticatedRequest('respondToAuthChallenge', challenge,\n (errChallenge, dataChallenge) => {\n if (errChallenge && errChallenge.code === 'ResourceNotFoundException' &&\n errChallenge.message.toLowerCase().indexOf('device') !== -1) {\n challengeResponses.DEVICE_KEY = null;\n this.deviceKey = null;\n this.randomPassword = null;\n this.deviceGroupKey = null;\n this.clearCachedDeviceKeyAndPassword();\n return respondToAuthChallenge(challenge, challengeCallback);\n }\n return challengeCallback(errChallenge, dataChallenge);\n });\n\n respondToAuthChallenge({\n ChallengeName: 'PASSWORD_VERIFIER',\n ClientId: this.pool.getClientId(),\n ChallengeResponses: challengeResponses,\n Session: data.Session,\n }, (errAuthenticate, dataAuthenticate) => {\n if (errAuthenticate) {\n return callback.onFailure(errAuthenticate);\n }\n\n const challengeName = dataAuthenticate.ChallengeName;\n if (challengeName === 'NEW_PASSWORD_REQUIRED') {\n this.Session = dataAuthenticate.Session;\n let userAttributes = null;\n let rawRequiredAttributes = null;\n const requiredAttributes = [];\n const userAttributesPrefix = authenticationHelper\n .getNewPasswordRequiredChallengeUserAttributePrefix();\n\n if (dataAuthenticate.ChallengeParameters) {\n userAttributes = JSON.parse(\n dataAuthenticate.ChallengeParameters.userAttributes);\n rawRequiredAttributes = JSON.parse(\n dataAuthenticate.ChallengeParameters.requiredAttributes);\n }\n\n if (rawRequiredAttributes) {\n for (let i = 0; i < rawRequiredAttributes.length; i++) {\n requiredAttributes[i] = rawRequiredAttributes[i].substr(userAttributesPrefix.length);\n }\n }\n return callback.newPasswordRequired(userAttributes, requiredAttributes);\n }\n return this.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n });\n return undefined;\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 {object} dataAuthenticate authentication data\n * @param {object} authenticationHelper helper created\n * @param {callback} callback passed on from caller\n * @returns {void}\n */\n authenticateUserInternal(dataAuthenticate, authenticationHelper, callback) {\n const challengeName = dataAuthenticate.ChallengeName;\n const 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 === 'CUSTOM_CHALLENGE') {\n this.Session = dataAuthenticate.Session;\n return callback.customChallenge(challengeParameters);\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.cacheTokens();\n\n const newDeviceMetadata = dataAuthenticate.AuthenticationResult.NewDeviceMetadata;\n if (newDeviceMetadata == null) {\n return callback.onSuccess(this.signInUserSession);\n }\n\n authenticationHelper.generateHashDevice(\n dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,\n dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey);\n\n const deviceSecretVerifierConfig = {\n Salt: new util.Buffer(\n authenticationHelper.getSaltDevices(), 'hex'\n ).toString('base64'),\n PasswordVerifier: new util.Buffer(\n authenticationHelper.getVerifierDevices(), 'hex'\n ).toString('base64'),\n };\n\n this.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n this.deviceGroupKey = newDeviceMetadata.DeviceGroupKey;\n this.randomPassword = authenticationHelper.getRandomPassword();\n\n this.client.makeUnauthenticatedRequest('confirmDevice', {\n DeviceKey: newDeviceMetadata.DeviceKey,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n DeviceName: navigator.userAgent,\n }, (errConfirm, dataConfirm) => {\n if (errConfirm) {\n return callback.onFailure(errConfirm);\n }\n\n this.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n this.cacheDeviceKeyAndPassword();\n if (dataConfirm.UserConfirmationNecessary === true) {\n return callback.onSuccess(\n this.signInUserSession, dataConfirm.UserConfirmationNecessary);\n }\n return callback.onSuccess(this.signInUserSession);\n });\n return undefined;\n }\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..\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 * @returns {void}\n */\n completeNewPasswordChallenge(newPassword, requiredAttributeData, callback) {\n if (!newPassword) {\n return callback.onFailure(new Error('New password is required.'));\n }\n const authenticationHelper = new AuthenticationHelper(\n this.pool.getUserPoolId().split('_')[1]);\n const userAttributesPrefix = authenticationHelper\n .getNewPasswordRequiredChallengeUserAttributePrefix();\n\n const finalUserAttributes = {};\n if (requiredAttributeData) {\n Object.keys(requiredAttributeData).forEach((key) => {\n finalUserAttributes[userAttributesPrefix + key] = requiredAttributeData[key];\n });\n }\n\n finalUserAttributes.NEW_PASSWORD = newPassword;\n finalUserAttributes.USERNAME = this.username;\n this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n ChallengeName: 'NEW_PASSWORD_REQUIRED',\n ClientId: this.pool.getClientId(),\n ChallengeResponses: finalUserAttributes,\n Session: this.Session,\n }, (errAuthenticate, dataAuthenticate) => {\n if (errAuthenticate) {\n return callback.onFailure(errAuthenticate);\n }\n return this.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n });\n return undefined;\n }\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 * @returns {void}\n * @private\n */\n getDeviceResponse(callback) {\n const authenticationHelper = new AuthenticationHelper(\n this.deviceGroupKey);\n const dateHelper = new DateHelper();\n\n const authParameters = {};\n\n authParameters.USERNAME = this.username;\n authParameters.DEVICE_KEY = this.deviceKey;\n authParameters.SRP_A = authenticationHelper.getLargeAValue().toString(16);\n\n this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n ChallengeName: 'DEVICE_SRP_AUTH',\n ClientId: this.pool.getClientId(),\n ChallengeResponses: authParameters,\n }, (err, data) => {\n if (err) {\n return callback.onFailure(err);\n }\n\n const challengeParameters = data.ChallengeParameters;\n\n const serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n const salt = new BigInteger(challengeParameters.SALT, 16);\n\n const hkdf = authenticationHelper.getPasswordAuthenticationKey(\n this.deviceKey,\n this.randomPassword,\n serverBValue,\n salt);\n\n const dateNow = dateHelper.getNowString();\n\n const signatureString = util.crypto.hmac(hkdf, util.buffer.concat([\n new util.Buffer(this.deviceGroupKey, 'utf8'),\n new util.Buffer(this.deviceKey, 'utf8'),\n new util.Buffer(challengeParameters.SECRET_BLOCK, 'base64'),\n new util.Buffer(dateNow, 'utf8'),\n ]), 'base64', 'sha256');\n\n const challengeResponses = {};\n\n challengeResponses.USERNAME = this.username;\n challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n challengeResponses.TIMESTAMP = dateNow;\n challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n challengeResponses.DEVICE_KEY = this.deviceKey;\n\n this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n ChallengeName: 'DEVICE_PASSWORD_VERIFIER',\n ClientId: this.pool.getClientId(),\n ChallengeResponses: challengeResponses,\n Session: data.Session,\n }, (errAuthenticate, dataAuthenticate) => {\n if (errAuthenticate) {\n return callback.onFailure(errAuthenticate);\n }\n\n this.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n this.cacheTokens();\n\n return callback.onSuccess(this.signInUserSession);\n });\n return undefined;\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} callback Called on success or error.\n * @returns {void}\n */\n confirmRegistration(confirmationCode, forceAliasCreation, callback) {\n this.client.makeUnauthenticatedRequest('confirmSignUp', {\n ClientId: this.pool.getClientId(),\n ConfirmationCode: confirmationCode,\n Username: this.username,\n ForceAliasCreation: forceAliasCreation,\n }, err => {\n if (err) {\n return callback(err, null);\n }\n return callback(null, 'SUCCESS');\n });\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 challange 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 * @returns {void}\n */\n sendCustomChallengeAnswer(answerChallenge, callback) {\n const challengeResponses = {};\n challengeResponses.USERNAME = this.username;\n challengeResponses.ANSWER = answerChallenge;\n\n this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n ChallengeName: 'CUSTOM_CHALLENGE',\n ChallengeResponses: challengeResponses,\n ClientId: this.pool.getClientId(),\n Session: this.Session,\n }, (err, data) => {\n if (err) {\n return callback.onFailure(err);\n }\n\n const challengeName = data.ChallengeName;\n\n if (challengeName === 'CUSTOM_CHALLENGE') {\n this.Session = data.Session;\n return callback.customChallenge(data.ChallengeParameters);\n }\n\n this.signInUserSession = this.getCognitoUserSession(data.AuthenticationResult);\n this.cacheTokens();\n return callback.onSuccess(this.signInUserSession);\n });\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 {onFailure} callback.onFailure Called on any error.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @returns {void}\n */\n sendMFACode(confirmationCode, callback) {\n const challengeResponses = {};\n challengeResponses.USERNAME = this.username;\n challengeResponses.SMS_MFA_CODE = confirmationCode;\n\n if (this.deviceKey != null) {\n challengeResponses.DEVICE_KEY = this.deviceKey;\n }\n\n this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {\n ChallengeName: 'SMS_MFA',\n ChallengeResponses: challengeResponses,\n ClientId: this.pool.getClientId(),\n Session: this.Session,\n }, (err, dataAuthenticate) => {\n if (err) {\n return callback.onFailure(err);\n }\n\n const challengeName = dataAuthenticate.ChallengeName;\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.cacheTokens();\n\n if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {\n return callback.onSuccess(this.signInUserSession);\n }\n\n const authenticationHelper = new AuthenticationHelper(\n this.pool.getUserPoolId().split('_')[1]);\n authenticationHelper.generateHashDevice(\n dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,\n dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey);\n\n const deviceSecretVerifierConfig = {\n Salt: new util.Buffer(\n authenticationHelper.getSaltDevices(), 'hex'\n ).toString('base64'),\n PasswordVerifier: new util.Buffer(\n authenticationHelper.getVerifierDevices(), 'hex'\n ).toString('base64'),\n };\n\n this.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n this.deviceGroupKey = dataAuthenticate.AuthenticationResult\n .NewDeviceMetadata.DeviceGroupKey;\n this.randomPassword = authenticationHelper.getRandomPassword();\n\n this.client.makeUnauthenticatedRequest('confirmDevice', {\n DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n DeviceName: navigator.userAgent,\n }, (errConfirm, dataConfirm) => {\n if (errConfirm) {\n return callback.onFailure(errConfirm);\n }\n\n this.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n this.cacheDeviceKeyAndPassword();\n if (dataConfirm.UserConfirmationNecessary === true) {\n return callback.onSuccess(\n this.signInUserSession,\n dataConfirm.UserConfirmationNecessary);\n }\n return callback.onSuccess(this.signInUserSession);\n });\n return undefined;\n });\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} callback Called on success or error.\n * @returns {void}\n */\n changePassword(oldUserPassword, newUserPassword, callback) {\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.makeUnauthenticatedRequest('changePassword', {\n PreviousPassword: oldUserPassword,\n ProposedPassword: newUserPassword,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, err => {\n if (err) {\n return callback(err, null);\n }\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n\n /**\n * This is used by an authenticated user to enable MFA for himself\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n enableMFA(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n const mfaOptions = [];\n const mfaEnabled = {\n DeliveryMedium: 'SMS',\n AttributeName: 'phone_number',\n };\n mfaOptions.push(mfaEnabled);\n\n this.client.makeUnauthenticatedRequest('setUserSettings', {\n MFAOptions: mfaOptions,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, err => {\n if (err) {\n return callback(err, null);\n }\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n\n /**\n * This is used by an authenticated user to disable MFA for himself\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n disableMFA(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n const mfaOptions = [];\n\n this.client.makeUnauthenticatedRequest('setUserSettings', {\n MFAOptions: mfaOptions,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, err => {\n if (err) {\n return callback(err, null);\n }\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n\n\n /**\n * This is used by an authenticated user to delete himself\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n deleteUser(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.makeUnauthenticatedRequest('deleteUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, err => {\n if (err) {\n return callback(err, null);\n }\n this.clearCachedTokens();\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n\n /**\n * @typedef {CognitoUserAttribute | { Name:string, Value:string }} AttributeArg\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} callback Called on success or error.\n * @returns {void}\n */\n updateAttributes(attributes, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.makeUnauthenticatedRequest('updateUserAttributes', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n UserAttributes: attributes,\n }, err => {\n if (err) {\n return callback(err, null);\n }\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n\n /**\n * This is used by an authenticated user to get a list of attributes\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n 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.makeUnauthenticatedRequest('getUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, (err, userData) => {\n if (err) {\n return callback(err, null);\n }\n\n const attributeList = [];\n\n for (let i = 0; i < userData.UserAttributes.length; i++) {\n const attribute = {\n Name: userData.UserAttributes[i].Name,\n Value: userData.UserAttributes[i].Value,\n };\n const userAttribute = new CognitoUserAttribute(attribute);\n attributeList.push(userAttribute);\n }\n\n return callback(null, attributeList);\n });\n return undefined;\n }\n\n /**\n * This is used by an authenticated user to get the MFAOptions\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n 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.makeUnauthenticatedRequest('getUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, (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 /**\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} callback Called on success or error.\n * @returns {void}\n */\n 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.makeUnauthenticatedRequest('deleteUserAttributes', {\n UserAttributeNames: attributeList,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, err => {\n if (err) {\n return callback(err, null);\n }\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n\n /**\n * This is used by a user to resend a confirmation code\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n resendConfirmationCode(callback) {\n this.client.makeUnauthenticatedRequest('resendConfirmationCode', {\n ClientId: this.pool.getClientId(),\n Username: this.username,\n }, err => {\n if (err) {\n return callback(err, null);\n }\n return callback(null, 'SUCCESS');\n });\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} callback Called on success or error.\n * @returns {void}\n */\n getSession(callback) {\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 const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}.${this.username}`;\n const idTokenKey = `${keyPrefix}.idToken`;\n const accessTokenKey = `${keyPrefix}.accessToken`;\n const refreshTokenKey = `${keyPrefix}.refreshToken`;\n\n if (this.storage.getItem(idTokenKey)) {\n const idToken = new CognitoIdToken({\n IdToken: this.storage.getItem(idTokenKey),\n });\n const accessToken = new CognitoAccessToken({\n AccessToken: this.storage.getItem(accessTokenKey),\n });\n const refreshToken = new CognitoRefreshToken({\n RefreshToken: this.storage.getItem(refreshTokenKey),\n });\n\n const sessionData = {\n IdToken: idToken,\n AccessToken: accessToken,\n RefreshToken: refreshToken,\n };\n const cachedSession = new CognitoUserSession(sessionData);\n if (cachedSession.isValid()) {\n this.signInUserSession = cachedSession;\n return callback(null, this.signInUserSession);\n }\n\n if (refreshToken.getToken() == null) {\n return callback(new Error('Cannot retrieve a new session. Please authenticate.'), null);\n }\n\n this.refreshSession(refreshToken, callback);\n } else {\n callback(new Error('Local storage is missing an ID Token, Please authenticate'), null);\n }\n\n return undefined;\n }\n\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} callback Called on success or error.\n * @returns {void}\n */\n refreshSession(refreshToken, callback) {\n const authParameters = {};\n authParameters.REFRESH_TOKEN = refreshToken.getToken();\n const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}`;\n const lastUserKey = `${keyPrefix}.LastAuthUser`;\n\n if (this.storage.getItem(lastUserKey)) {\n this.username = this.storage.getItem(lastUserKey);\n const deviceKeyKey = `${keyPrefix}.${this.username}.deviceKey`;\n this.deviceKey = this.storage.getItem(deviceKeyKey);\n authParameters.DEVICE_KEY = this.deviceKey;\n }\n\n this.client.makeUnauthenticatedRequest('initiateAuth', {\n ClientId: this.pool.getClientId(),\n AuthFlow: 'REFRESH_TOKEN_AUTH',\n AuthParameters: authParameters,\n }, (err, authResult) => {\n if (err) {\n if (err.code === 'NotAuthorizedException') {\n this.clearCachedTokens();\n }\n return callback(err, null);\n }\n if (authResult) {\n const authenticationResult = authResult.AuthenticationResult;\n if (!Object.prototype.hasOwnProperty.call(authenticationResult, 'RefreshToken')) {\n authenticationResult.RefreshToken = refreshToken.getToken();\n }\n this.signInUserSession = this.getCognitoUserSession(authenticationResult);\n this.cacheTokens();\n return callback(null, this.signInUserSession);\n }\n return undefined;\n });\n }\n\n /**\n * This is used to save the session tokens to local storage\n * @returns {void}\n */\n cacheTokens() {\n const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}`;\n const idTokenKey = `${keyPrefix}.${this.username}.idToken`;\n const accessTokenKey = `${keyPrefix}.${this.username}.accessToken`;\n const refreshTokenKey = `${keyPrefix}.${this.username}.refreshToken`;\n const lastUserKey = `${keyPrefix}.LastAuthUser`;\n\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(lastUserKey, this.username);\n }\n\n /**\n * This is used to cache the device key and device group and device password\n * @returns {void}\n */\n cacheDeviceKeyAndPassword() {\n const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}.${this.username}`;\n const deviceKeyKey = `${keyPrefix}.deviceKey`;\n const randomPasswordKey = `${keyPrefix}.randomPasswordKey`;\n const deviceGroupKeyKey = `${keyPrefix}.deviceGroupKey`;\n\n this.storage.setItem(deviceKeyKey, this.deviceKey);\n this.storage.setItem(randomPasswordKey, this.randomPassword);\n this.storage.setItem(deviceGroupKeyKey, this.deviceGroupKey);\n }\n\n /**\n * This is used to get current device key and device group and device password\n * @returns {void}\n */\n getCachedDeviceKeyAndPassword() {\n const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}.${this.username}`;\n const deviceKeyKey = `${keyPrefix}.deviceKey`;\n const randomPasswordKey = `${keyPrefix}.randomPasswordKey`;\n const 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 /**\n * This is used to clear the device key info from local storage\n * @returns {void}\n */\n clearCachedDeviceKeyAndPassword() {\n const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}.${this.username}`;\n const deviceKeyKey = `${keyPrefix}.deviceKey`;\n const randomPasswordKey = `${keyPrefix}.randomPasswordKey`;\n const deviceGroupKeyKey = `${keyPrefix}.deviceGroupKey`;\n\n this.storage.removeItem(deviceKeyKey);\n this.storage.removeItem(randomPasswordKey);\n this.storage.removeItem(deviceGroupKeyKey);\n }\n\n /**\n * This is used to clear the session tokens from local storage\n * @returns {void}\n */\n clearCachedTokens() {\n const keyPrefix = `CognitoIdentityServiceProvider.${this.pool.getClientId()}`;\n const idTokenKey = `${keyPrefix}.${this.username}.idToken`;\n const accessTokenKey = `${keyPrefix}.${this.username}.accessToken`;\n const refreshTokenKey = `${keyPrefix}.${this.username}.refreshToken`;\n const lastUserKey = `${keyPrefix}.LastAuthUser`;\n\n this.storage.removeItem(idTokenKey);\n this.storage.removeItem(accessTokenKey);\n this.storage.removeItem(refreshTokenKey);\n this.storage.removeItem(lastUserKey);\n }\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 getCognitoUserSession(authResult) {\n const idToken = new CognitoIdToken(authResult);\n const accessToken = new CognitoAccessToken(authResult);\n const refreshToken = new CognitoRefreshToken(authResult);\n\n const sessionData = {\n IdToken: idToken,\n AccessToken: accessToken,\n RefreshToken: refreshToken,\n };\n\n return new CognitoUserSession(sessionData);\n }\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 * @returns {void}\n */\n forgotPassword(callback) {\n this.client.makeUnauthenticatedRequest('forgotPassword', {\n ClientId: this.pool.getClientId(),\n Username: this.username,\n }, (err, data) => {\n if (err) {\n return callback.onFailure(err);\n }\n if (typeof callback.inputVerificationCode === 'function') {\n return callback.inputVerificationCode(data);\n }\n return callback.onSuccess();\n });\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} callback.onSuccess Called on success.\n * @returns {void}\n */\n confirmPassword(confirmationCode, newPassword, callback) {\n this.client.makeUnauthenticatedRequest('confirmForgotPassword', {\n ClientId: this.pool.getClientId(),\n Username: this.username,\n ConfirmationCode: confirmationCode,\n Password: newPassword,\n }, err => {\n if (err) {\n return callback.onFailure(err);\n }\n return callback.onSuccess();\n });\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 * @returns {void}\n */\n getAttributeVerificationCode(attributeName, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.makeUnauthenticatedRequest('getUserAttributeVerificationCode', {\n AttributeName: attributeName,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, (err, data) => {\n if (err) {\n return callback.onFailure(err);\n }\n return callback.inputVerificationCode(data);\n });\n return undefined;\n }\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} callback.onSuccess Called on success.\n * @returns {void}\n */\n 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.makeUnauthenticatedRequest('verifyUserAttribute', {\n AttributeName: attributeName,\n Code: confirmationCode,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, err => {\n if (err) {\n return callback.onFailure(err);\n }\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\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 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.makeUnauthenticatedRequest('getDevice', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: this.deviceKey,\n }, (err, data) => {\n if (err) {\n return callback.onFailure(err);\n }\n return callback.onSuccess(data);\n });\n return undefined;\n }\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} callback.onSuccess Called on success.\n * @returns {void}\n */\n 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.makeUnauthenticatedRequest('forgetDevice', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: deviceKey,\n }, err => {\n if (err) {\n return callback.onFailure(err);\n }\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\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} callback.onSuccess Called on success.\n * @returns {void}\n */\n forgetDevice(callback) {\n this.forgetSpecificDevice(this.deviceKey, {\n onFailure: callback.onFailure,\n onSuccess: result => {\n this.deviceKey = null;\n this.deviceGroupKey = null;\n this.randomPassword = null;\n this.clearCachedDeviceKeyAndPassword();\n return callback.onSuccess(result);\n },\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} callback.onSuccess Called on success.\n * @returns {void}\n */\n 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.makeUnauthenticatedRequest('updateDeviceStatus', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: this.deviceKey,\n DeviceRememberedStatus: 'remembered',\n }, err => {\n if (err) {\n return callback.onFailure(err);\n }\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\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} callback.onSuccess Called on success.\n * @returns {void}\n */\n 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.makeUnauthenticatedRequest('updateDeviceStatus', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: this.deviceKey,\n DeviceRememberedStatus: 'not_remembered',\n }, err => {\n if (err) {\n return callback.onFailure(err);\n }\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\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} 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 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 this.client.makeUnauthenticatedRequest('listDevices', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n Limit: limit,\n PaginationToken: paginationToken,\n }, (err, data) => {\n if (err) {\n return callback.onFailure(err);\n }\n return callback.onSuccess(data);\n });\n return undefined;\n }\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} callback.onSuccess Called on success.\n * @returns {void}\n */\n globalSignOut(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.makeUnauthenticatedRequest('globalSignOut', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n }, err => {\n if (err) {\n return callback.onFailure(err);\n }\n this.clearCachedTokens();\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n\n /**\n * This is used for the user to signOut of the application and clear the cached tokens.\n * @returns {void}\n */\n signOut() {\n this.signInUserSession = null;\n this.clearCachedTokens();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CognitoUser.js","/*!\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 */\n\n/** @class */\nexport default class CognitoUserAttribute {\n /**\n * Constructs a new CognitoUserAttribute object\n * @param {string=} Name The record's name\n * @param {string=} Value The record's value\n */\n constructor({ Name, Value } = {}) {\n this.Name = Name || '';\n this.Value = Value || '';\n }\n\n /**\n * @returns {string} the record's value.\n */\n getValue() {\n return this.Value;\n }\n\n /**\n * Sets the record's value.\n * @param {string} value The new value.\n * @returns {CognitoUserAttribute} The record for method chaining.\n */\n setValue(value) {\n this.Value = value;\n return this;\n }\n\n /**\n * @returns {string} the record's name.\n */\n getName() {\n return this.Name;\n }\n\n /**\n * Sets the record's name\n * @param {string} name The new name.\n * @returns {CognitoUserAttribute} The record for method chaining.\n */\n setName(name) {\n this.Name = name;\n return this;\n }\n\n /**\n * @returns {string} a string representation of the record.\n */\n toString() {\n return JSON.stringify(this);\n }\n\n /**\n * @returns {object} a flat object representing the record.\n */\n toJSON() {\n return {\n Name: this.Name,\n Value: this.Value,\n };\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CognitoUserAttribute.js","/*!\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 */\n\n/** @class */\nexport default class CognitoUserSession {\n /**\n * Constructs a new CognitoUserSession object\n * @param {string} IdToken The session's Id token.\n * @param {string=} RefreshToken The session's refresh token.\n * @param {string} AccessToken The session's access token.\n */\n constructor({ IdToken, RefreshToken, AccessToken } = {}) {\n if (AccessToken == null || IdToken == null) {\n throw new Error('Id token and Access Token must be present.');\n }\n\n this.idToken = IdToken;\n this.refreshToken = RefreshToken;\n this.accessToken = AccessToken;\n }\n\n /**\n * @returns {CognitoIdToken} the session's Id token\n */\n getIdToken() {\n return this.idToken;\n }\n\n /**\n * @returns {CognitoRefreshToken} the session's refresh token\n */\n getRefreshToken() {\n return this.refreshToken;\n }\n\n /**\n * @returns {CognitoAccessToken} the session's access token\n */\n getAccessToken() {\n return this.accessToken;\n }\n\n /**\n * Checks to see if the session is still valid based on session expiry information found\n * in tokens and the current time\n * @returns {boolean} if the session is still valid\n */\n isValid() {\n const now = Math.floor(new Date() / 1000);\n\n return now < this.accessToken.getExpiration() && now < this.idToken.getExpiration();\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CognitoUserSession.js","/*!\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 */\n\nconst monthNames =\n ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\nconst weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n\n/** @class */\nexport default class DateHelper {\n /**\n * @returns {string} The current time in \"ddd MMM D HH:mm:ss UTC YYYY\" format.\n */\n getNowString() {\n const now = new Date();\n\n const weekDay = weekNames[now.getUTCDay()];\n const month = monthNames[now.getUTCMonth()];\n const day = now.getUTCDate();\n\n let hours = now.getUTCHours();\n if (hours < 10) {\n hours = `0${hours}`;\n }\n\n let minutes = now.getUTCMinutes();\n if (minutes < 10) {\n minutes = `0${minutes}`;\n }\n\n let seconds = now.getUTCSeconds();\n if (seconds < 10) {\n seconds = `0${seconds}`;\n }\n\n const year = now.getUTCFullYear();\n\n // ddd MMM D HH:mm:ss UTC YYYY\n const dateNow = `${weekDay} ${month} ${day} ${hours}:${minutes}:${seconds} UTC ${year}`;\n\n return dateNow;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/DateHelper.js","/*!\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 */\n\nlet dataMemory = {};\n\n/** @class */\nclass MemoryStorage {\n\n /**\n * This is used to set a specific item in storage\n * @param {string} key - the key for the item\n * @param {object} value - the value\n * @returns {string} value that was set\n */\n static setItem(key, value) {\n dataMemory[key] = value;\n return dataMemory[key];\n }\n\n /**\n * This is used to get a specific key from storage\n * @param {string} key - the key for the item\n * This is used to clear the storage\n * @returns {string} the data item\n */\n static getItem(key) {\n return Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n }\n\n /**\n * This is used to remove an item from storage\n * @param {string} key - the key being set\n * @returns {string} value - value that was deleted\n */\n static removeItem(key) {\n return delete dataMemory[key];\n }\n\n /**\n * This is used to clear the storage\n * @returns {string} nothing\n */\n static clear() {\n dataMemory = {};\n return dataMemory;\n }\n}\n\n/** @class */\nexport default class StorageHelper {\n\n /**\n * This is used to get a storage object\n * @returns {object} the storage\n */\n constructor() {\n try {\n this.storageWindow = window.localStorage;\n this.storageWindow.setItem('aws.cognito.test-ls', 1);\n this.storageWindow.removeItem('aws.cognito.test-ls');\n } catch (exception) {\n this.storageWindow = MemoryStorage;\n }\n }\n\n /**\n * This is used to return the storage\n * @returns {object} the storage\n */\n getStorage() {\n return this.storageWindow;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/StorageHelper.js","module.exports = __WEBPACK_EXTERNAL_MODULE_11__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":[\"AWSCognito\",\"CognitoIdentityServiceProvider\"],\"commonjs2\":\"aws-sdk/clients/cognitoidentityserviceprovider\",\"commonjs\":\"aws-sdk/clients/cognitoidentityserviceprovider\",\"amd\":\"aws-sdk/clients/cognitoidentityserviceprovider\"}\n// module id = 11\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_12__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"root\":[],\"commonjs2\":\"jsbn\",\"commonjs\":\"jsbn\",\"amd\":\"jsbn\"}\n// module id = 12\n// module chunks = 0","/*!\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 */\n\n/** @class */\nexport default class AuthenticationDetails {\n /**\n * Constructs a new AuthenticationDetails object\n * @param {object=} data Creation options.\n * @param {string} data.Username User being authenticated.\n * @param {string} data.Password Plain-text password to authenticate with.\n * @param {(AttributeArg[])?} data.ValidationData Application extra metadata.\n */\n constructor(data) {\n const { ValidationData, Username, Password } = data || {};\n this.validationData = ValidationData || [];\n this.username = Username;\n this.password = Password;\n }\n\n /**\n * @returns {string} the record's username\n */\n getUsername() {\n return this.username;\n }\n\n /**\n * @returns {string} the record's password\n */\n getPassword() {\n return this.password;\n }\n\n /**\n * @returns {Array} the record's validationData\n */\n getValidationData() {\n return this.validationData;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/AuthenticationDetails.js","/*!\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 */\n\nimport CognitoIdentityServiceProvider from 'aws-sdk/clients/cognitoidentityserviceprovider';\n\nimport CognitoUser from './CognitoUser';\nimport StorageHelper from './StorageHelper';\n\n/** @class */\nexport default class CognitoUserPool {\n /**\n * Constructs a new CognitoUserPool object\n * @param {object} data Creation options.\n * @param {string} data.UserPoolId Cognito user pool id.\n * @param {string} data.ClientId User pool application client id.\n */\n constructor(data) {\n const { UserPoolId, ClientId } = data || {};\n if (!UserPoolId || !ClientId) {\n throw new Error('Both UserPoolId and ClientId are required.');\n }\n if (!/^[\\w-]+_.+$/.test(UserPoolId)) {\n throw new Error('Invalid UserPoolId format.');\n }\n const region = UserPoolId.split('_')[0];\n\n this.userPoolId = UserPoolId;\n this.clientId = ClientId;\n\n this.client = new CognitoIdentityServiceProvider({ apiVersion: '2016-04-19', region });\n\n this.storage = new StorageHelper().getStorage();\n }\n\n /**\n * @returns {string} the user pool id\n */\n getUserPoolId() {\n return this.userPoolId;\n }\n\n /**\n * @returns {string} the client id\n */\n getClientId() {\n return this.clientId;\n }\n\n /**\n * @typedef {object} SignUpResult\n * @property {CognitoUser} user New user.\n * @property {bool} userConfirmed If the user is already confirmed.\n */\n /**\n * method for signing up a user\n * @param {string} username User's username.\n * @param {string} password Plain-text initial password entered by user.\n * @param {(AttributeArg[])=} userAttributes New user attributes.\n * @param {(AttributeArg[])=} validationData Application metadata.\n * @param {nodeCallback} callback Called on error or with the new user.\n * @returns {void}\n */\n signUp(username, password, userAttributes, validationData, callback) {\n this.client.makeUnauthenticatedRequest('signUp', {\n ClientId: this.clientId,\n Username: username,\n Password: password,\n UserAttributes: userAttributes,\n ValidationData: validationData,\n }, (err, data) => {\n if (err) {\n return callback(err, null);\n }\n\n const cognitoUser = {\n Username: username,\n Pool: this,\n };\n\n const returnData = {\n user: new CognitoUser(cognitoUser),\n userConfirmed: data.UserConfirmed,\n };\n\n return callback(null, returnData);\n });\n }\n\n\n /**\n * method for getting the current user of the application from the local storage\n *\n * @returns {CognitoUser} the user retrieved from storage\n */\n getCurrentUser() {\n const lastUserKey = `CognitoIdentityServiceProvider.${this.clientId}.LastAuthUser`;\n\n const lastAuthUser = this.storage.getItem(lastUserKey);\n if (lastAuthUser) {\n const cognitoUser = {\n Username: lastAuthUser,\n Pool: this,\n };\n\n return new CognitoUser(cognitoUser);\n }\n\n return null;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/CognitoUserPool.js","/*!\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 */\n\nexport { default as AuthenticationDetails } from './AuthenticationDetails';\nexport { default as AuthenticationHelper } from './AuthenticationHelper';\nexport { default as CognitoAccessToken } from './CognitoAccessToken';\nexport { default as CognitoIdToken } from './CognitoIdToken';\nexport { default as CognitoRefreshToken } from './CognitoRefreshToken';\nexport { default as CognitoUser } from './CognitoUser';\nexport { default as CognitoUserAttribute } from './CognitoUserAttribute';\nexport { default as CognitoUserPool } from './CognitoUserPool';\nexport { default as CognitoUserSession } from './CognitoUserSession';\nexport { default as DateHelper } from './DateHelper';\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.js"],"sourceRoot":""}