{"version":3,"sources":["webpack:///./node_modules/amazon-cognito-identity-js/es/utils/cryptoSecureRandomInt.js","webpack:///./node_modules/amazon-cognito-identity-js/es/AuthenticationDetails.js","webpack:///./node_modules/amazon-cognito-identity-js/es/utils/WordArray.js","webpack:///./node_modules/amazon-cognito-identity-js/es/BigInteger.js","webpack:///./node_modules/amazon-cognito-identity-js/es/AuthenticationHelper.js","webpack:///./node_modules/amazon-cognito-identity-js/es/CognitoJwtToken.js","webpack:///./node_modules/amazon-cognito-identity-js/es/CognitoAccessToken.js","webpack:///./node_modules/amazon-cognito-identity-js/es/CognitoIdToken.js","webpack:///./node_modules/amazon-cognito-identity-js/es/CognitoRefreshToken.js","webpack:///./node_modules/amazon-cognito-identity-js/es/CognitoUserSession.js","webpack:///./node_modules/amazon-cognito-identity-js/es/DateHelper.js","webpack:///./node_modules/amazon-cognito-identity-js/es/CognitoUserAttribute.js","webpack:///./node_modules/amazon-cognito-identity-js/es/StorageHelper.js","webpack:///./node_modules/amazon-cognito-identity-js/es/CognitoUser.js","webpack:///./node_modules/amazon-cognito-identity-js/es/Platform/index.js","webpack:///./node_modules/amazon-cognito-identity-js/es/UserAgent.js","webpack:///./node_modules/amazon-cognito-identity-js/es/Client.js","webpack:///./node_modules/amazon-cognito-identity-js/es/CognitoUserPool.js","webpack:///./node_modules/amazon-cognito-identity-js/es/CookieStorage.js","webpack:///./node_modules/base64-js/index.js","webpack:///./node_modules/aws-amplify/lib-esm/index.js"],"names":["crypto","window","msCrypto","global","err","cryptoSecureRandomInt","getRandomValues","Uint32Array","randomBytes","readInt32LE","Error","AuthenticationDetails","data","_ref","ValidationData","Username","Password","AuthParameters","ClientMetadata","this","validationData","authParameters","clientMetadata","username","password","_proto","prototype","getUsername","getPassword","getValidationData","getAuthParameters","getClientMetadata","dbits","WordArray","words","sigBytes","undefined","length","random","nBytes","i","push","toString","wordArray","hexChars","bite","join","hexStringify","BigInteger","a","b","fromString","nbi","inBrowser","navigator","appName","am","x","w","j","c","n","xl","xh","l","h","m","v","Math","floor","DB","DM","DV","FV","pow","F1","F2","rr","vv","BI_RC","Array","charCodeAt","int2char","charAt","intAt","s","nbv","r","fromInt","nbits","t","Montgomery","mp","invDigit","mpl","mph","um","mt2","from","convert","abs","dlShiftTo","divRemTo","compareTo","ZERO","subTo","revert","copyTo","reduce","u0","clamp","drShiftTo","mulTo","y","multiplyTo","sqrTo","squareTo","k","mi","sh","max","lShiftTo","bs","cbs","bm","ds","rShiftTo","min","q","pm","pt","ts","ms","nsh","ys","y0","yt","d1","d2","e","ONE","qd","addTo","negate","d","km","p","bitLength","mod","equals","add","subtract","multiply","divide","modPow","callback","z","g","k1","g2","is1","r2","result","HEX_MSB_REGEX","AuthenticationHelper","PoolName","N","hexHash","padHex","smallAValue","generateRandomSmallA","getLargeAValue","infoBits","poolName","getSmallAValue","_this","largeAValue","calculateA","hexRandom","generateRandomString","getRandomPassword","randomPassword","getSaltDevices","SaltToHashDevices","getVerifierDevices","verifierDevices","generateHashDevice","deviceGroupKey","_this2","combinedString","hashedString","hash","verifierDevicesNotPadded","_this3","A","calculateU","B","UHexHash","buf","str","lib","create","hashHex","hexStr","computehkdf","ikm","salt","infoBitsWordArray","concat","String","fromCharCode","ikmWordArray","saltWordArray","prk","hmac","slice","getPasswordAuthenticationKey","serverBValue","_this4","UValue","usernamePassword","usernamePasswordHash","xValue","calculateS","sValue","hkdf","_this5","gModPowXN","err2","getNewPasswordRequiredChallengeUserAttributePrefix","bigInt","isNegative","test","invertedNibbles","split","map","invertedNibble","parseInt","toUpperCase","startsWith","substring","CognitoJwtToken","token","jwtToken","payload","decodePayload","getJwtToken","getExpiration","exp","getIssuedAt","iat","JSON","parse","_setPrototypeOf","o","Object","setPrototypeOf","__proto__","CognitoAccessToken","_CognitoJwtToken","subClass","superClass","_temp","AccessToken","call","constructor","CognitoIdToken","IdToken","CognitoRefreshToken","RefreshToken","getToken","CognitoUserSession","ClockDrift","idToken","refreshToken","accessToken","clockDrift","calculateClockDrift","getIdToken","getRefreshToken","getAccessToken","getClockDrift","Date","isValid","adjusted","monthNames","weekNames","DateHelper","getNowString","now","weekDay","getUTCDay","month","getUTCMonth","day","getUTCDate","hours","getUTCHours","minutes","getUTCMinutes","seconds","getUTCSeconds","getUTCFullYear","CognitoUserAttribute","Name","Value","getValue","setValue","value","getName","setName","name","stringify","toJSON","dataMemory","MemoryStorage","setItem","key","getItem","hasOwnProperty","removeItem","clear","StorageHelper","storageWindow","localStorage","exception","getStorage","userAgent","CognitoUser","Pool","pool","Session","client","signInUserSession","authenticationFlowType","storage","Storage","keyPrefix","getClientId","userDataKey","setSignInUserSession","clearCachedUserData","cacheTokens","getSignInUserSession","getAuthenticationFlowType","setAuthenticationFlowType","initiateAuth","authDetails","USERNAME","clientMetaData","keys","jsonReq","AuthFlow","ClientId","getUserContextData","UserContextData","request","onFailure","challengeName","ChallengeName","challengeParameters","ChallengeParameters","customChallenge","getCognitoUserSession","AuthenticationResult","onSuccess","authenticateUser","authenticateUserPlainUsernamePassword","authenticateUserDefaultAuth","authenticationHelper","getUserPoolId","dateHelper","deviceKey","DEVICE_KEY","errOnAValue","aValue","SRP_A","CHALLENGE_NAME","USER_ID_FOR_SRP","SRP_B","SALT","getCachedDeviceKeyAndPassword","errOnHkdf","dateNow","message","SECRET_BLOCK","signatureString","challengeResponses","PASSWORD_CLAIM_SECRET_BLOCK","TIMESTAMP","PASSWORD_CLAIM_SIGNATURE","jsonReqResp","ChallengeResponses","respondToAuthChallenge","challenge","challengeCallback","errChallenge","dataChallenge","code","toLowerCase","indexOf","clearCachedDeviceKeyAndPassword","errAuthenticate","dataAuthenticate","authenticateUserInternal","PASSWORD","authResult","mfaRequired","selectMFAType","mfaSetup","totpRequired","userAttributes","rawRequiredAttributes","requiredAttributes","userAttributesPrefix","substr","newPasswordRequired","getDeviceResponse","newDeviceMetadata","NewDeviceMetadata","DeviceGroupKey","DeviceKey","errGenHash","deviceSecretVerifierConfig","Salt","PasswordVerifier","DeviceSecretVerifierConfig","DeviceName","errConfirm","dataConfirm","cacheDeviceKeyAndPassword","UserConfirmationNecessary","completeNewPasswordChallenge","newPassword","requiredAttributeData","finalUserAttributes","forEach","NEW_PASSWORD","_this6","errAValue","errHkdf","confirmRegistration","confirmationCode","forceAliasCreation","ConfirmationCode","ForceAliasCreation","sendCustomChallengeAnswer","answerChallenge","_this7","ANSWER","sendMFACode","mfaType","_this8","SMS_MFA_CODE","mfaTypeSelection","SOFTWARE_TOKEN_MFA_CODE","changePassword","oldUserPassword","newUserPassword","PreviousPassword","ProposedPassword","enableMFA","mfaOptions","DeliveryMedium","AttributeName","MFAOptions","setUserMfaPreference","smsMfaSettings","softwareTokenMfaSettings","SMSMfaSettings","SoftwareTokenMfaSettings","disableMFA","deleteUser","_this9","clearCachedUser","updateAttributes","attributes","_this10","UserAttributes","getUserData","bypassCache","getUserAttributes","userData","attributeList","attribute","userAttribute","getMFAOptions","createGetUserRequest","promisifyRequest","refreshSessionIfPossible","options","_this11","Promise","resolve","refresh","refreshSession","params","_this12","getUserDataFromCache","isFetchUserDataAndTokenRequired","fetchUserData","then","_ref$bypassCache","_this13","cacheUserData","deleteAttributes","_this14","UserAttributeNames","resendConfirmationCode","getSession","idTokenKey","accessTokenKey","refreshTokenKey","clockDriftKey","cachedSession","_this15","wrappedCallback","wrapRefreshSessionCallback","REFRESH_TOKEN","lastUserKey","deviceKeyKey","authenticationResult","clearCachedTokens","randomPasswordKey","deviceGroupKeyKey","forgotPassword","inputVerificationCode","confirmPassword","getAttributeVerificationCode","attributeName","verifyAttribute","Code","getDevice","forgetSpecificDevice","forgetDevice","_this16","setDeviceStatusRemembered","DeviceRememberedStatus","setDeviceStatusNotRemembered","listDevices","limit","paginationToken","requestParams","Limit","PaginationToken","globalSignOut","_this17","signOut","revokeTokenCallback","_this18","error","_session","revokeTokens","cleanClientData","isSessionRevocable","revokeToken","origin_jti","_ref2","requestWithRetry","Token","sendMFASelectionAnswer","_this19","associateSoftwareToken","_this20","associateSecretCode","SecretCode","verifySoftwareToken","totpCode","friendlyDeviceName","_this21","UserCode","FriendlyDeviceName","errRespond","dataRespond","BASE_USER_AGENT","Platform","product","isReactNative","UserAgent","_wrapNativeSuper","Class","_cache","Map","fn","Function","TypeError","has","get","set","Wrapper","_construct","arguments","_getPrototypeOf","enumerable","writable","configurable","Parent","args","_isNativeReflectConstruct","Reflect","construct","apply","instance","bind","sham","Proxy","Boolean","valueOf","getPrototypeOf","CognitoError","_Error","statusCode","Client","region","endpoint","fetchOptions","credentials","operation","reject","functionToRetry","maxDelayMs","MAX_DELAY_MS","retry","BASE_TIME_MS","JITTER_FACTOR","attempt","delay","jitteredBackoff","jitteredExponentialRetry","res","rej","response","headers","assign","method","mode","cache","body","fetch","resp","json","ok","__type","pop","Message","status","ex","logger","delayFn","obj","retryIn","setTimeout","CognitoUserPool","UserPoolId","AdvancedSecurityDataCollectionFlag","userPoolId","clientId","advancedSecurityDataCollectionFlag","signUp","cognitoUser","returnData","user","userConfirmed","UserConfirmed","userSub","UserSub","codeDeliveryDetails","CodeDeliveryDetails","getCurrentUser","lastAuthUser","AmazonCognitoAdvancedSecurityData","amazonCognitoAdvancedSecurityDataConst","advancedSecurityData","getData","EncodedData","CookieStorage","domain","path","expires","secure","includes","sameSite","cookies","numKeys","index","exports","byteLength","b64","lens","getLens","validLen","placeHoldersLen","toByteArray","tmp","arr","Arr","_byteLength","curByte","len","revLookup","fromByteArray","uint8","extraBytes","parts","maxChunkLength","len2","encodeChunk","lookup","Uint8Array","start","end","num","output","Auth","Cache","ServiceWorker"],"mappings":";6FAAA,gBAAIA,EAiBJ,GAjBA,kCAEsB,oBAAXC,QAA0BA,OAAOD,SAC1CA,EAASC,OAAOD,SAIbA,GAA4B,oBAAXC,QAA0BA,OAAOC,WACrDF,EAASC,OAAOC,WAIbF,QAA4B,IAAXG,GAA0BA,EAAOH,SACrDA,EAASG,EAAOH,SAIbA,EACH,IACEA,EAAS,EAAQ,KACjB,MAAOI,IAQI,SAASC,IACtB,GAAIL,E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AAK9pB,GAAK,EAChC6oB,GACIQ,EAAMrpB,IAAM,GAAM,WAClBqpB,EAAMrpB,EAAI,IAAM,EAAK,QACP,IAAfqpB,EAAMrpB,EAAI,IACbgqB,OAAO/pB,KAdF0pB,GADiBI,EAeMlB,IAdT,GAAK,IACxBc,EAAOI,GAAO,GAAK,IACnBJ,EAAOI,GAAO,EAAI,IAClBJ,EAAa,GAANI,IAaT,OAAOC,OAAO1pB,KAAK,IAjGrB6oB,EAAU,IAAI1mB,WAAW,IAAM,GAC/B0mB,EAAU,IAAI1mB,WAAW,IAAM,I,gCCnB/B,oDAkBA,IAAQwnB,KAAO,IACf,IAAQC,MAAQ,IAChB,IAAQC,cAAgB,IAmBT,YAAO","file":"0c80895.js","sourcesContent":["var crypto; // Native crypto from window (Browser)\n\nif (typeof window !== 'undefined' && window.crypto) {\n crypto = window.crypto;\n} // Native (experimental IE 11) crypto from window (Browser)\n\n\nif (!crypto && typeof window !== 'undefined' && window.msCrypto) {\n crypto = window.msCrypto;\n} // Native crypto from global (NodeJS)\n\n\nif (!crypto && typeof global !== 'undefined' && global.crypto) {\n crypto = global.crypto;\n} // Native crypto import via require (NodeJS)\n\n\nif (!crypto && typeof require === 'function') {\n try {\n crypto = require('crypto');\n } catch (err) {}\n}\n/*\n * Cryptographically secure pseudorandom number generator\n * As Math.random() is cryptographically not safe to use\n */\n\n\nexport default function cryptoSecureRandomInt() {\n if (crypto) {\n // Use getRandomValues method (Browser)\n if (typeof crypto.getRandomValues === 'function') {\n try {\n return crypto.getRandomValues(new Uint32Array(1))[0];\n } catch (err) {}\n } // Use randomBytes method (NodeJS)\n\n\n if (typeof crypto.randomBytes === 'function') {\n try {\n return crypto.randomBytes(4).readInt32LE();\n } catch (err) {}\n }\n }\n\n throw new Error('Native crypto module could not be used to get secure random number.');\n}","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/** @class */\nvar AuthenticationDetails = /*#__PURE__*/function () {\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 * @param {(AttributeArg[])?} data.AuthParamaters Authentication paramaters for custom auth.\n */\n function AuthenticationDetails(data) {\n var _ref = data || {},\n ValidationData = _ref.ValidationData,\n Username = _ref.Username,\n Password = _ref.Password,\n AuthParameters = _ref.AuthParameters,\n ClientMetadata = _ref.ClientMetadata;\n\n this.validationData = ValidationData || {};\n this.authParameters = AuthParameters || {};\n this.clientMetadata = ClientMetadata || {};\n this.username = Username;\n this.password = Password;\n }\n /**\n * @returns {string} the record's username\n */\n\n\n var _proto = AuthenticationDetails.prototype;\n\n _proto.getUsername = function getUsername() {\n return this.username;\n }\n /**\n * @returns {string} the record's password\n */\n ;\n\n _proto.getPassword = function getPassword() {\n return this.password;\n }\n /**\n * @returns {Array} the record's validationData\n */\n ;\n\n _proto.getValidationData = function getValidationData() {\n return this.validationData;\n }\n /**\n * @returns {Array} the record's authParameters\n */\n ;\n\n _proto.getAuthParameters = function getAuthParameters() {\n return this.authParameters;\n }\n /**\n * @returns {ClientMetadata} the clientMetadata for a Lambda trigger\n */\n ;\n\n _proto.getClientMetadata = function getClientMetadata() {\n return this.clientMetadata;\n };\n\n return AuthenticationDetails;\n}();\n\nexport { AuthenticationDetails as default };","import cryptoSecureRandomInt from './cryptoSecureRandomInt';\n/**\n * Hex encoding strategy.\n * Converts a word array to a hex string.\n * @param {WordArray} wordArray The word array.\n * @return {string} The hex string.\n * @static\n */\n\nfunction hexStringify(wordArray) {\n // Shortcuts\n var words = wordArray.words;\n var sigBytes = wordArray.sigBytes; // Convert\n\n var hexChars = [];\n\n for (var i = 0; i < sigBytes; i++) {\n var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;\n hexChars.push((bite >>> 4).toString(16));\n hexChars.push((bite & 0x0f).toString(16));\n }\n\n return hexChars.join('');\n}\n\nvar WordArray = /*#__PURE__*/function () {\n function WordArray(words, sigBytes) {\n words = this.words = words || [];\n\n if (sigBytes != undefined) {\n this.sigBytes = sigBytes;\n } else {\n this.sigBytes = words.length * 4;\n }\n }\n\n var _proto = WordArray.prototype;\n\n _proto.random = function random(nBytes) {\n var words = [];\n\n for (var i = 0; i < nBytes; i += 4) {\n words.push(cryptoSecureRandomInt());\n }\n\n return new WordArray(words, nBytes);\n };\n\n _proto.toString = function toString() {\n return hexStringify(this);\n };\n\n return WordArray;\n}();\n\nexport { WordArray as default };","// A small implementation of BigInteger based on http://www-cs-students.stanford.edu/~tjw/jsbn/\n//\n// All public methods have been removed except the following:\n// new BigInteger(a, b) (only radix 2, 4, 8, 16 and 32 supported)\n// toString (only radix 2, 4, 8, 16 and 32 supported)\n// negate\n// abs\n// compareTo\n// bitLength\n// mod\n// equals\n// add\n// subtract\n// multiply\n// divide\n// modPow\nexport default BigInteger;\n/*\n * Copyright (c) 2003-2005 Tom Wu\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * In addition, the following condition applies:\n *\n * All redistributions must retain an intact copy of this copyright notice\n * and disclaimer.\n */\n// (public) Constructor\n\nfunction BigInteger(a, b) {\n if (a != null) this.fromString(a, b);\n} // return new, unset BigInteger\n\n\nfunction nbi() {\n return new BigInteger(null);\n} // Bits per digit\n\n\nvar dbits; // JavaScript engine analysis\n\nvar canary = 0xdeadbeefcafe;\nvar j_lm = (canary & 0xffffff) == 0xefcafe; // am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\n\nfunction am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c;\n c = Math.floor(v / 0x4000000);\n w[j++] = v & 0x3ffffff;\n }\n\n return c;\n} // am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\n\n\nfunction am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff,\n xh = x >> 15;\n\n while (--n >= 0) {\n var l = this[i] & 0x7fff;\n var h = this[i++] >> 15;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n w[j++] = l & 0x3fffffff;\n }\n\n return c;\n} // Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\n\n\nfunction am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff,\n xh = x >> 14;\n\n while (--n >= 0) {\n var l = this[i] & 0x3fff;\n var h = this[i++] >> 14;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n c = (l >> 28) + (m >> 14) + xh * h;\n w[j++] = l & 0xfffffff;\n }\n\n return c;\n}\n\nvar inBrowser = typeof navigator !== 'undefined';\n\nif (inBrowser && j_lm && navigator.appName == 'Microsoft Internet Explorer') {\n BigInteger.prototype.am = am2;\n dbits = 30;\n} else if (inBrowser && j_lm && navigator.appName != 'Netscape') {\n BigInteger.prototype.am = am1;\n dbits = 26;\n} else {\n // Mozilla/Netscape seems to prefer am3\n BigInteger.prototype.am = am3;\n dbits = 28;\n}\n\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = (1 << dbits) - 1;\nBigInteger.prototype.DV = 1 << dbits;\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP; // Digit conversions\n\nvar BI_RM = '0123456789abcdefghijklmnopqrstuvwxyz';\nvar BI_RC = new Array();\nvar rr, vv;\nrr = '0'.charCodeAt(0);\n\nfor (vv = 0; vv <= 9; ++vv) {\n BI_RC[rr++] = vv;\n}\n\nrr = 'a'.charCodeAt(0);\n\nfor (vv = 10; vv < 36; ++vv) {\n BI_RC[rr++] = vv;\n}\n\nrr = 'A'.charCodeAt(0);\n\nfor (vv = 10; vv < 36; ++vv) {\n BI_RC[rr++] = vv;\n}\n\nfunction int2char(n) {\n return BI_RM.charAt(n);\n}\n\nfunction intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)];\n return c == null ? -1 : c;\n} // (protected) copy this to r\n\n\nfunction bnpCopyTo(r) {\n for (var i = this.t - 1; i >= 0; --i) {\n r[i] = this[i];\n }\n\n r.t = this.t;\n r.s = this.s;\n} // (protected) set from integer value x, -DV <= x < DV\n\n\nfunction bnpFromInt(x) {\n this.t = 1;\n this.s = x < 0 ? -1 : 0;\n if (x > 0) this[0] = x;else if (x < -1) this[0] = x + this.DV;else this.t = 0;\n} // return bigint initialized to value\n\n\nfunction nbv(i) {\n var r = nbi();\n r.fromInt(i);\n return r;\n} // (protected) set from string and radix\n\n\nfunction bnpFromString(s, b) {\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else throw new Error('Only radix 2, 4, 8, 16, 32 are supported');\n this.t = 0;\n this.s = 0;\n var i = s.length,\n mi = false,\n sh = 0;\n\n while (--i >= 0) {\n var x = intAt(s, i);\n\n if (x < 0) {\n if (s.charAt(i) == '-') mi = true;\n continue;\n }\n\n mi = false;\n if (sh == 0) this[this.t++] = x;else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & (1 << this.DB - sh) - 1) << sh;\n this[this.t++] = x >> this.DB - sh;\n } else this[this.t - 1] |= x << sh;\n sh += k;\n if (sh >= this.DB) sh -= this.DB;\n }\n\n this.clamp();\n if (mi) BigInteger.ZERO.subTo(this, this);\n} // (protected) clamp off excess high words\n\n\nfunction bnpClamp() {\n var c = this.s & this.DM;\n\n while (this.t > 0 && this[this.t - 1] == c) {\n --this.t;\n }\n} // (public) return string representation in given radix\n\n\nfunction bnToString(b) {\n if (this.s < 0) return '-' + this.negate().toString(b);\n var k;\n if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else throw new Error('Only radix 2, 4, 8, 16, 32 are supported');\n var km = (1 << k) - 1,\n d,\n m = false,\n r = '',\n i = this.t;\n var p = this.DB - i * this.DB % k;\n\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & (1 << p) - 1) << k - p;\n d |= this[--i] >> (p += this.DB - k);\n } else {\n d = this[i] >> (p -= k) & km;\n\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n\n if (d > 0) m = true;\n if (m) r += int2char(d);\n }\n }\n\n return m ? r : '0';\n} // (public) -this\n\n\nfunction bnNegate() {\n var r = nbi();\n BigInteger.ZERO.subTo(this, r);\n return r;\n} // (public) |this|\n\n\nfunction bnAbs() {\n return this.s < 0 ? this.negate() : this;\n} // (public) return + if this > a, - if this < a, 0 if equal\n\n\nfunction bnCompareTo(a) {\n var r = this.s - a.s;\n if (r != 0) return r;\n var i = this.t;\n r = i - a.t;\n if (r != 0) return this.s < 0 ? -r : r;\n\n while (--i >= 0) {\n if ((r = this[i] - a[i]) != 0) return r;\n }\n\n return 0;\n} // returns bit length of the integer x\n\n\nfunction nbits(x) {\n var r = 1,\n t;\n\n if ((t = x >>> 16) != 0) {\n x = t;\n r += 16;\n }\n\n if ((t = x >> 8) != 0) {\n x = t;\n r += 8;\n }\n\n if ((t = x >> 4) != 0) {\n x = t;\n r += 4;\n }\n\n if ((t = x >> 2) != 0) {\n x = t;\n r += 2;\n }\n\n if ((t = x >> 1) != 0) {\n x = t;\n r += 1;\n }\n\n return r;\n} // (public) return the number of bits in \"this\"\n\n\nfunction bnBitLength() {\n if (this.t <= 0) return 0;\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);\n} // (protected) r = this << n*DB\n\n\nfunction bnpDLShiftTo(n, r) {\n var i;\n\n for (i = this.t - 1; i >= 0; --i) {\n r[i + n] = this[i];\n }\n\n for (i = n - 1; i >= 0; --i) {\n r[i] = 0;\n }\n\n r.t = this.t + n;\n r.s = this.s;\n} // (protected) r = this >> n*DB\n\n\nfunction bnpDRShiftTo(n, r) {\n for (var i = n; i < this.t; ++i) {\n r[i - n] = this[i];\n }\n\n r.t = Math.max(this.t - n, 0);\n r.s = this.s;\n} // (protected) r = this << n\n\n\nfunction bnpLShiftTo(n, r) {\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << cbs) - 1;\n var ds = Math.floor(n / this.DB),\n c = this.s << bs & this.DM,\n i;\n\n for (i = this.t - 1; i >= 0; --i) {\n r[i + ds + 1] = this[i] >> cbs | c;\n c = (this[i] & bm) << bs;\n }\n\n for (i = ds - 1; i >= 0; --i) {\n r[i] = 0;\n }\n\n r[ds] = c;\n r.t = this.t + ds + 1;\n r.s = this.s;\n r.clamp();\n} // (protected) r = this >> n\n\n\nfunction bnpRShiftTo(n, r) {\n r.s = this.s;\n var ds = Math.floor(n / this.DB);\n\n if (ds >= this.t) {\n r.t = 0;\n return;\n }\n\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << bs) - 1;\n r[0] = this[ds] >> bs;\n\n for (var i = ds + 1; i < this.t; ++i) {\n r[i - ds - 1] |= (this[i] & bm) << cbs;\n r[i - ds] = this[i] >> bs;\n }\n\n if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;\n r.t = this.t - ds;\n r.clamp();\n} // (protected) r = this - a\n\n\nfunction bnpSubTo(a, r) {\n var i = 0,\n c = 0,\n m = Math.min(a.t, this.t);\n\n while (i < m) {\n c += this[i] - a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n if (a.t < this.t) {\n c -= a.s;\n\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n c += this.s;\n } else {\n c += this.s;\n\n while (i < a.t) {\n c -= a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n c -= a.s;\n }\n\n r.s = c < 0 ? -1 : 0;\n if (c < -1) r[i++] = this.DV + c;else if (c > 0) r[i++] = c;\n r.t = i;\n r.clamp();\n} // (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\n\n\nfunction bnpMultiplyTo(a, r) {\n var x = this.abs(),\n y = a.abs();\n var i = x.t;\n r.t = i + y.t;\n\n while (--i >= 0) {\n r[i] = 0;\n }\n\n for (i = 0; i < y.t; ++i) {\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n }\n\n r.s = 0;\n r.clamp();\n if (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n} // (protected) r = this^2, r != this (HAC 14.16)\n\n\nfunction bnpSquareTo(r) {\n var x = this.abs();\n var i = r.t = 2 * x.t;\n\n while (--i >= 0) {\n r[i] = 0;\n }\n\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\n\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n r[i + x.t] -= x.DV;\n r[i + x.t + 1] = 1;\n }\n }\n\n if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n r.s = 0;\n r.clamp();\n} // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n// r != q, this != m. q or r may be null.\n\n\nfunction bnpDivRemTo(m, q, r) {\n var pm = m.abs();\n if (pm.t <= 0) return;\n var pt = this.abs();\n\n if (pt.t < pm.t) {\n if (q != null) q.fromInt(0);\n if (r != null) this.copyTo(r);\n return;\n }\n\n if (r == null) r = nbi();\n var y = nbi(),\n ts = this.s,\n ms = m.s;\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\n\n if (nsh > 0) {\n pm.lShiftTo(nsh, y);\n pt.lShiftTo(nsh, r);\n } else {\n pm.copyTo(y);\n pt.copyTo(r);\n }\n\n var ys = y.t;\n var y0 = y[ys - 1];\n if (y0 == 0) return;\n var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);\n var d1 = this.FV / yt,\n d2 = (1 << this.F1) / yt,\n e = 1 << this.F2;\n var i = r.t,\n j = i - ys,\n t = q == null ? nbi() : q;\n y.dlShiftTo(j, t);\n\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1;\n r.subTo(t, r);\n }\n\n BigInteger.ONE.dlShiftTo(ys, t);\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\n\n while (y.t < ys) {\n y[y.t++] = 0;\n }\n\n while (--j >= 0) {\n // Estimate quotient digit\n var qd = r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n // Try it out\n y.dlShiftTo(j, t);\n r.subTo(t, r);\n\n while (r[i] < --qd) {\n r.subTo(t, r);\n }\n }\n }\n\n if (q != null) {\n r.drShiftTo(ys, q);\n if (ts != ms) BigInteger.ZERO.subTo(q, q);\n }\n\n r.t = ys;\n r.clamp();\n if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder\n\n if (ts < 0) BigInteger.ZERO.subTo(r, r);\n} // (public) this mod a\n\n\nfunction bnMod(a) {\n var r = nbi();\n this.abs().divRemTo(a, null, r);\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);\n return r;\n} // (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n// justification:\n// xy == 1 (mod m)\n// xy = 1+km\n// xy(2-xy) = (1+km)(1-km)\n// x[y(2-xy)] = 1-k^2m^2\n// x[y(2-xy)] == 1 (mod m^2)\n// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n// JS multiply \"overflows\" differently from C/C++, so care is needed here.\n\n\nfunction bnpInvDigit() {\n if (this.t < 1) return 0;\n var x = this[0];\n if ((x & 1) == 0) return 0;\n var y = x & 3; // y == 1/x mod 2^2\n\n y = y * (2 - (x & 0xf) * y) & 0xf; // y == 1/x mod 2^4\n\n y = y * (2 - (x & 0xff) * y) & 0xff; // y == 1/x mod 2^8\n\n y = y * (2 - ((x & 0xffff) * y & 0xffff)) & 0xffff; // y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n\n y = y * (2 - x * y % this.DV) % this.DV; // y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n\n return y > 0 ? this.DV - y : -y;\n}\n\nfunction bnEquals(a) {\n return this.compareTo(a) == 0;\n} // (protected) r = this + a\n\n\nfunction bnpAddTo(a, r) {\n var i = 0,\n c = 0,\n m = Math.min(a.t, this.t);\n\n while (i < m) {\n c += this[i] + a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n if (a.t < this.t) {\n c += a.s;\n\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n c += this.s;\n } else {\n c += this.s;\n\n while (i < a.t) {\n c += a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n\n c += a.s;\n }\n\n r.s = c < 0 ? -1 : 0;\n if (c > 0) r[i++] = c;else if (c < -1) r[i++] = this.DV + c;\n r.t = i;\n r.clamp();\n} // (public) this + a\n\n\nfunction bnAdd(a) {\n var r = nbi();\n this.addTo(a, r);\n return r;\n} // (public) this - a\n\n\nfunction bnSubtract(a) {\n var r = nbi();\n this.subTo(a, r);\n return r;\n} // (public) this * a\n\n\nfunction bnMultiply(a) {\n var r = nbi();\n this.multiplyTo(a, r);\n return r;\n} // (public) this / a\n\n\nfunction bnDivide(a) {\n var r = nbi();\n this.divRemTo(a, r, null);\n return r;\n} // Montgomery reduction\n\n\nfunction Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp & 0x7fff;\n this.mph = this.mp >> 15;\n this.um = (1 << m.DB - 15) - 1;\n this.mt2 = 2 * m.t;\n} // xR mod m\n\n\nfunction montConvert(x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t, r);\n r.divRemTo(this.m, null, r);\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);\n return r;\n} // x/R mod m\n\n\nfunction montRevert(x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n} // x = x/R mod m (HAC 14.32)\n\n\nfunction montReduce(x) {\n while (x.t <= this.mt2) {\n // pad x so am has enough room later\n x[x.t++] = 0;\n }\n\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff;\n var u0 = j * this.mpl + ((j * this.mph + (x[i] >> 15) * this.mpl & this.um) << 15) & x.DM; // use am to combine the multiply-shift-add into one call\n\n j = i + this.m.t;\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t); // propagate carry\n\n while (x[j] >= x.DV) {\n x[j] -= x.DV;\n x[++j]++;\n }\n }\n\n x.clamp();\n x.drShiftTo(this.m.t, x);\n if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n} // r = \"x^2/R mod m\"; x != r\n\n\nfunction montSqrTo(x, r) {\n x.squareTo(r);\n this.reduce(r);\n} // r = \"xy/R mod m\"; x,y != r\n\n\nfunction montMulTo(x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n}\n\nMontgomery.prototype.convert = montConvert;\nMontgomery.prototype.revert = montRevert;\nMontgomery.prototype.reduce = montReduce;\nMontgomery.prototype.mulTo = montMulTo;\nMontgomery.prototype.sqrTo = montSqrTo; // (public) this^e % m (HAC 14.85)\n\nfunction bnModPow(e, m, callback) {\n var i = e.bitLength(),\n k,\n r = nbv(1),\n z = new Montgomery(m);\n if (i <= 0) return r;else if (i < 18) k = 1;else if (i < 48) k = 3;else if (i < 144) k = 4;else if (i < 768) k = 5;else k = 6; // precomputation\n\n var g = new Array(),\n n = 3,\n k1 = k - 1,\n km = (1 << k) - 1;\n g[1] = z.convert(this);\n\n if (k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1], g2);\n\n while (n <= km) {\n g[n] = nbi();\n z.mulTo(g2, g[n - 2], g[n]);\n n += 2;\n }\n }\n\n var j = e.t - 1,\n w,\n is1 = true,\n r2 = nbi(),\n t;\n i = nbits(e[j]) - 1;\n\n while (j >= 0) {\n if (i >= k1) w = e[j] >> i - k1 & km;else {\n w = (e[j] & (1 << i + 1) - 1) << k1 - i;\n if (j > 0) w |= e[j - 1] >> this.DB + i - k1;\n }\n n = k;\n\n while ((w & 1) == 0) {\n w >>= 1;\n --n;\n }\n\n if ((i -= n) < 0) {\n i += this.DB;\n --j;\n }\n\n if (is1) {\n // ret == 1, don't bother squaring or multiplying it\n g[w].copyTo(r);\n is1 = false;\n } else {\n while (n > 1) {\n z.sqrTo(r, r2);\n z.sqrTo(r2, r);\n n -= 2;\n }\n\n if (n > 0) z.sqrTo(r, r2);else {\n t = r;\n r = r2;\n r2 = t;\n }\n z.mulTo(r2, g[w], r);\n }\n\n while (j >= 0 && (e[j] & 1 << i) == 0) {\n z.sqrTo(r, r2);\n t = r;\n r = r2;\n r2 = t;\n\n if (--i < 0) {\n i = this.DB - 1;\n --j;\n }\n }\n }\n\n var result = z.revert(r);\n callback(null, result);\n return result;\n} // protected\n\n\nBigInteger.prototype.copyTo = bnpCopyTo;\nBigInteger.prototype.fromInt = bnpFromInt;\nBigInteger.prototype.fromString = bnpFromString;\nBigInteger.prototype.clamp = bnpClamp;\nBigInteger.prototype.dlShiftTo = bnpDLShiftTo;\nBigInteger.prototype.drShiftTo = bnpDRShiftTo;\nBigInteger.prototype.lShiftTo = bnpLShiftTo;\nBigInteger.prototype.rShiftTo = bnpRShiftTo;\nBigInteger.prototype.subTo = bnpSubTo;\nBigInteger.prototype.multiplyTo = bnpMultiplyTo;\nBigInteger.prototype.squareTo = bnpSquareTo;\nBigInteger.prototype.divRemTo = bnpDivRemTo;\nBigInteger.prototype.invDigit = bnpInvDigit;\nBigInteger.prototype.addTo = bnpAddTo; // public\n\nBigInteger.prototype.toString = bnToString;\nBigInteger.prototype.negate = bnNegate;\nBigInteger.prototype.abs = bnAbs;\nBigInteger.prototype.compareTo = bnCompareTo;\nBigInteger.prototype.bitLength = bnBitLength;\nBigInteger.prototype.mod = bnMod;\nBigInteger.prototype.equals = bnEquals;\nBigInteger.prototype.add = bnAdd;\nBigInteger.prototype.subtract = bnSubtract;\nBigInteger.prototype.multiply = bnMultiply;\nBigInteger.prototype.divide = bnDivide;\nBigInteger.prototype.modPow = bnModPow; // \"constants\"\n\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { Buffer } from 'buffer';\nimport CryptoJS from 'crypto-js/core';\nimport 'crypto-js/lib-typedarrays'; // necessary for crypto js\n\nimport SHA256 from 'crypto-js/sha256';\nimport HmacSHA256 from 'crypto-js/hmac-sha256';\nimport WordArray from './utils/WordArray';\n/**\n * Returns a Buffer with a sequence of random nBytes\n *\n * @param {number} nBytes\n * @returns {Buffer} fixed-length sequence of random bytes\n */\n\nfunction randomBytes(nBytes) {\n return Buffer.from(new WordArray().random(nBytes).toString(), 'hex');\n}\n\nimport BigInteger from './BigInteger';\n/**\n * Tests if a hex string has it most significant bit set (case-insensitive regex)\n */\n\nvar HEX_MSB_REGEX = /^[89a-f]/i;\nvar initN = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1' + '29024E088A67CC74020BBEA63B139B22514A08798E3404DD' + 'EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245' + 'E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D' + 'C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F' + '83655D23DCA3AD961C62F356208552BB9ED529077096966D' + '670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9' + 'DE2BCBF6955817183995497CEA956AE515D2261898FA0510' + '15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64' + 'ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' + 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B' + 'F12FFA06D98A0864D87602733EC86A64521F2B18177B200C' + 'BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31' + '43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF';\nvar newPasswordRequiredChallengeUserAttributePrefix = 'userAttributes.';\n/** @class */\n\nvar AuthenticationHelper = /*#__PURE__*/function () {\n /**\n * Constructs a new AuthenticationHelper object\n * @param {string} PoolName Cognito user pool name.\n */\n function AuthenticationHelper(PoolName) {\n this.N = new BigInteger(initN, 16);\n this.g = new BigInteger('2', 16);\n this.k = new BigInteger(this.hexHash(\"\" + this.padHex(this.N) + this.padHex(this.g)), 16);\n this.smallAValue = this.generateRandomSmallA();\n this.getLargeAValue(function () {});\n this.infoBits = Buffer.from('Caldera Derived Key', 'utf8');\n this.poolName = PoolName;\n }\n /**\n * @returns {BigInteger} small A, a random number\n */\n\n\n var _proto = AuthenticationHelper.prototype;\n\n _proto.getSmallAValue = function getSmallAValue() {\n return this.smallAValue;\n }\n /**\n * @param {nodeCallback} callback Called with (err, largeAValue)\n * @returns {void}\n */\n ;\n\n _proto.getLargeAValue = function getLargeAValue(callback) {\n var _this = this;\n\n if (this.largeAValue) {\n callback(null, this.largeAValue);\n } else {\n this.calculateA(this.smallAValue, function (err, largeAValue) {\n if (err) {\n callback(err, null);\n }\n\n _this.largeAValue = largeAValue;\n callback(null, _this.largeAValue);\n });\n }\n }\n /**\n * helper function to generate a random big integer\n * @returns {BigInteger} a random value.\n * @private\n */\n ;\n\n _proto.generateRandomSmallA = function generateRandomSmallA() {\n // This will be interpreted as a postive 128-bit integer\n var hexRandom = randomBytes(128).toString('hex');\n var randomBigInt = new BigInteger(hexRandom, 16); // There is no need to do randomBigInt.mod(this.N - 1) as N (3072-bit) is > 128 bytes (1024-bit)\n\n return randomBigInt;\n }\n /**\n * helper function to generate a random string\n * @returns {string} a random value.\n * @private\n */\n ;\n\n _proto.generateRandomString = function generateRandomString() {\n return randomBytes(40).toString('base64');\n }\n /**\n * @returns {string} Generated random value included in password hash.\n */\n ;\n\n _proto.getRandomPassword = function getRandomPassword() {\n return this.randomPassword;\n }\n /**\n * @returns {string} Generated random value included in devices hash.\n */\n ;\n\n _proto.getSaltDevices = function getSaltDevices() {\n return this.SaltToHashDevices;\n }\n /**\n * @returns {string} Value used to verify devices.\n */\n ;\n\n _proto.getVerifierDevices = function getVerifierDevices() {\n return this.verifierDevices;\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 * @param {nodeCallback} callback Called with (err, null)\n * @returns {void}\n */\n ;\n\n _proto.generateHashDevice = function generateHashDevice(deviceGroupKey, username, callback) {\n var _this2 = this;\n\n this.randomPassword = this.generateRandomString();\n var combinedString = \"\" + deviceGroupKey + username + \":\" + this.randomPassword;\n var hashedString = this.hash(combinedString);\n var hexRandom = randomBytes(16).toString('hex'); // The random hex will be unambiguously represented as a postive integer\n\n this.SaltToHashDevices = this.padHex(new BigInteger(hexRandom, 16));\n this.g.modPow(new BigInteger(this.hexHash(this.SaltToHashDevices + hashedString), 16), this.N, function (err, verifierDevicesNotPadded) {\n if (err) {\n callback(err, null);\n }\n\n _this2.verifierDevices = _this2.padHex(verifierDevicesNotPadded);\n callback(null, null);\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 * @param {nodeCallback} callback Called with (err, largeAValue)\n * @returns {void}\n * @private\n */\n ;\n\n _proto.calculateA = function calculateA(a, callback) {\n var _this3 = this;\n\n this.g.modPow(a, this.N, function (err, A) {\n if (err) {\n callback(err, null);\n }\n\n if (A.mod(_this3.N).equals(BigInteger.ZERO)) {\n callback(new Error('Illegal paramater. A mod N cannot be 0.'), null);\n }\n\n callback(null, 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 ;\n\n _proto.calculateU = function calculateU(A, B) {\n this.UHexHash = this.hexHash(this.padHex(A) + this.padHex(B));\n var finalU = new BigInteger(this.UHexHash, 16);\n return finalU;\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 ;\n\n _proto.hash = function hash(buf) {\n var str = buf instanceof Buffer ? CryptoJS.lib.WordArray.create(buf) : buf;\n var hashHex = SHA256(str).toString();\n return new Array(64 - hashHex.length).join('0') + hashHex;\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 ;\n\n _proto.hexHash = function hexHash(hexStr) {\n return this.hash(Buffer.from(hexStr, 'hex'));\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 ;\n\n _proto.computehkdf = function computehkdf(ikm, salt) {\n var infoBitsWordArray = CryptoJS.lib.WordArray.create(Buffer.concat([this.infoBits, Buffer.from(String.fromCharCode(1), 'utf8')]));\n var ikmWordArray = ikm instanceof Buffer ? CryptoJS.lib.WordArray.create(ikm) : ikm;\n var saltWordArray = salt instanceof Buffer ? CryptoJS.lib.WordArray.create(salt) : salt;\n var prk = HmacSHA256(ikmWordArray, saltWordArray);\n var hmac = HmacSHA256(infoBitsWordArray, prk);\n return Buffer.from(hmac.toString(), 'hex').slice(0, 16);\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 * @param {nodeCallback} callback Called with (err, hkdfValue)\n * @returns {void}\n */\n ;\n\n _proto.getPasswordAuthenticationKey = function getPasswordAuthenticationKey(username, password, serverBValue, salt, callback) {\n var _this4 = this;\n\n if (serverBValue.mod(this.N).equals(BigInteger.ZERO)) {\n throw new Error('B cannot be zero.');\n }\n\n this.UValue = this.calculateU(this.largeAValue, serverBValue);\n\n if (this.UValue.equals(BigInteger.ZERO)) {\n throw new Error('U cannot be zero.');\n }\n\n var usernamePassword = \"\" + this.poolName + username + \":\" + password;\n var usernamePasswordHash = this.hash(usernamePassword);\n var xValue = new BigInteger(this.hexHash(this.padHex(salt) + usernamePasswordHash), 16);\n this.calculateS(xValue, serverBValue, function (err, sValue) {\n if (err) {\n callback(err, null);\n }\n\n var hkdf = _this4.computehkdf(Buffer.from(_this4.padHex(sValue), 'hex'), Buffer.from(_this4.padHex(_this4.UValue), 'hex'));\n\n callback(null, hkdf);\n });\n }\n /**\n * Calculates the S value used in getPasswordAuthenticationKey\n * @param {BigInteger} xValue Salted password hash value.\n * @param {BigInteger} serverBValue Server B value.\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.calculateS = function calculateS(xValue, serverBValue, callback) {\n var _this5 = this;\n\n this.g.modPow(xValue, this.N, function (err, gModPowXN) {\n if (err) {\n callback(err, null);\n }\n\n var intValue2 = serverBValue.subtract(_this5.k.multiply(gModPowXN));\n intValue2.modPow(_this5.smallAValue.add(_this5.UValue.multiply(xValue)), _this5.N, function (err2, result) {\n if (err2) {\n callback(err2, null);\n }\n\n callback(null, result.mod(_this5.N));\n });\n });\n }\n /**\n * Return constant newPasswordRequiredChallengeUserAttributePrefix\n * @return {newPasswordRequiredChallengeUserAttributePrefix} constant prefix value\n */\n ;\n\n _proto.getNewPasswordRequiredChallengeUserAttributePrefix = function getNewPasswordRequiredChallengeUserAttributePrefix() {\n return newPasswordRequiredChallengeUserAttributePrefix;\n }\n /**\n * Returns an unambiguous, even-length hex string of the two's complement encoding of an integer.\n *\n * It is compatible with the hex encoding of Java's BigInteger's toByteArray(), wich returns a\n * byte array containing the two's-complement representation of a BigInteger. The array contains\n * the minimum number of bytes required to represent the BigInteger, including at least one sign bit.\n *\n * Examples showing how ambiguity is avoided by left padding with:\n * \t\"00\" (for positive values where the most-significant-bit is set)\n * \"FF\" (for negative values where the most-significant-bit is set)\n *\n * padHex(bigInteger.fromInt(-236)) === \"FF14\"\n * padHex(bigInteger.fromInt(20)) === \"14\"\n *\n * padHex(bigInteger.fromInt(-200)) === \"FF38\"\n * padHex(bigInteger.fromInt(56)) === \"38\"\n *\n * padHex(bigInteger.fromInt(-20)) === \"EC\"\n * padHex(bigInteger.fromInt(236)) === \"00EC\"\n *\n * padHex(bigInteger.fromInt(-56)) === \"C8\"\n * padHex(bigInteger.fromInt(200)) === \"00C8\"\n *\n * @param {BigInteger} bigInt Number to encode.\n * @returns {String} even-length hex string of the two's complement encoding.\n */\n ;\n\n _proto.padHex = function padHex(bigInt) {\n if (!(bigInt instanceof BigInteger)) {\n throw new Error('Not a BigInteger');\n }\n\n var isNegative = bigInt.compareTo(BigInteger.ZERO) < 0;\n /* Get a hex string for abs(bigInt) */\n\n var hexStr = bigInt.abs().toString(16);\n /* Pad hex to even length if needed */\n\n hexStr = hexStr.length % 2 !== 0 ? \"0\" + hexStr : hexStr;\n /* Prepend \"00\" if the most significant bit is set */\n\n hexStr = HEX_MSB_REGEX.test(hexStr) ? \"00\" + hexStr : hexStr;\n\n if (isNegative) {\n /* Flip the bits of the representation */\n var invertedNibbles = hexStr.split('').map(function (x) {\n var invertedNibble = ~parseInt(x, 16) & 0xf;\n return '0123456789ABCDEF'.charAt(invertedNibble);\n }).join('');\n /* After flipping the bits, add one to get the 2's complement representation */\n\n var flippedBitsBI = new BigInteger(invertedNibbles, 16).add(BigInteger.ONE);\n hexStr = flippedBitsBI.toString(16);\n /*\n For hex strings starting with 'FF8', 'FF' can be dropped, e.g. 0xFFFF80=0xFF80=0x80=-128\n \t\tAny sequence of '1' bits on the left can always be substituted with a single '1' bit\n without changing the represented value.\n \t\tThis only happens in the case when the input is 80...00\n */\n\n if (hexStr.toUpperCase().startsWith('FF8')) {\n hexStr = hexStr.substring(2);\n }\n }\n\n return hexStr;\n };\n\n return AuthenticationHelper;\n}();\n\nexport { AuthenticationHelper as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { Buffer } from 'buffer';\n/** @class */\n\nvar CognitoJwtToken = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoJwtToken object\n * @param {string=} token The JWT token.\n */\n function CognitoJwtToken(token) {\n // Assign object\n this.jwtToken = token || '';\n this.payload = this.decodePayload();\n }\n /**\n * @returns {string} the record's token.\n */\n\n\n var _proto = CognitoJwtToken.prototype;\n\n _proto.getJwtToken = function getJwtToken() {\n return this.jwtToken;\n }\n /**\n * @returns {int} the token's expiration (exp member).\n */\n ;\n\n _proto.getExpiration = function getExpiration() {\n return this.payload.exp;\n }\n /**\n * @returns {int} the token's \"issued at\" (iat member).\n */\n ;\n\n _proto.getIssuedAt = function getIssuedAt() {\n return this.payload.iat;\n }\n /**\n * @returns {object} the token's payload.\n */\n ;\n\n _proto.decodePayload = function decodePayload() {\n var payload = this.jwtToken.split('.')[1];\n\n try {\n return JSON.parse(Buffer.from(payload, 'base64').toString('utf8'));\n } catch (err) {\n return {};\n }\n };\n\n return CognitoJwtToken;\n}();\n\nexport { CognitoJwtToken as default };","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport CognitoJwtToken from './CognitoJwtToken';\n/** @class */\n\nvar CognitoAccessToken = /*#__PURE__*/function (_CognitoJwtToken) {\n _inheritsLoose(CognitoAccessToken, _CognitoJwtToken);\n\n /**\n * Constructs a new CognitoAccessToken object\n * @param {string=} AccessToken The JWT access token.\n */\n function CognitoAccessToken(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n AccessToken = _ref.AccessToken;\n\n return _CognitoJwtToken.call(this, AccessToken || '') || this;\n }\n\n return CognitoAccessToken;\n}(CognitoJwtToken);\n\nexport { CognitoAccessToken as default };","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport CognitoJwtToken from './CognitoJwtToken';\n/** @class */\n\nvar CognitoIdToken = /*#__PURE__*/function (_CognitoJwtToken) {\n _inheritsLoose(CognitoIdToken, _CognitoJwtToken);\n\n /**\n * Constructs a new CognitoIdToken object\n * @param {string=} IdToken The JWT Id token\n */\n function CognitoIdToken(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n IdToken = _ref.IdToken;\n\n return _CognitoJwtToken.call(this, IdToken || '') || this;\n }\n\n return CognitoIdToken;\n}(CognitoJwtToken);\n\nexport { CognitoIdToken as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/** @class */\nvar CognitoRefreshToken = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoRefreshToken object\n * @param {string=} RefreshToken The JWT refresh token.\n */\n function CognitoRefreshToken(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n RefreshToken = _ref.RefreshToken;\n\n // Assign object\n this.token = RefreshToken || '';\n }\n /**\n * @returns {string} the record's token.\n */\n\n\n var _proto = CognitoRefreshToken.prototype;\n\n _proto.getToken = function getToken() {\n return this.token;\n };\n\n return CognitoRefreshToken;\n}();\n\nexport { CognitoRefreshToken as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/** @class */\nvar CognitoUserSession = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoUserSession object\n * @param {CognitoIdToken} IdToken The session's Id token.\n * @param {CognitoRefreshToken=} RefreshToken The session's refresh token.\n * @param {CognitoAccessToken} AccessToken The session's access token.\n * @param {int} ClockDrift The saved computer's clock drift or undefined to force calculation.\n */\n function CognitoUserSession(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n IdToken = _ref.IdToken,\n RefreshToken = _ref.RefreshToken,\n AccessToken = _ref.AccessToken,\n ClockDrift = _ref.ClockDrift;\n\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 this.clockDrift = ClockDrift === undefined ? this.calculateClockDrift() : ClockDrift;\n }\n /**\n * @returns {CognitoIdToken} the session's Id token\n */\n\n\n var _proto = CognitoUserSession.prototype;\n\n _proto.getIdToken = function getIdToken() {\n return this.idToken;\n }\n /**\n * @returns {CognitoRefreshToken} the session's refresh token\n */\n ;\n\n _proto.getRefreshToken = function getRefreshToken() {\n return this.refreshToken;\n }\n /**\n * @returns {CognitoAccessToken} the session's access token\n */\n ;\n\n _proto.getAccessToken = function getAccessToken() {\n return this.accessToken;\n }\n /**\n * @returns {int} the session's clock drift\n */\n ;\n\n _proto.getClockDrift = function getClockDrift() {\n return this.clockDrift;\n }\n /**\n * @returns {int} the computer's clock drift\n */\n ;\n\n _proto.calculateClockDrift = function calculateClockDrift() {\n var now = Math.floor(new Date() / 1000);\n var iat = Math.min(this.accessToken.getIssuedAt(), this.idToken.getIssuedAt());\n return now - iat;\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 (adjusted with clock drift)\n * @returns {boolean} if the session is still valid\n */\n ;\n\n _proto.isValid = function isValid() {\n var now = Math.floor(new Date() / 1000);\n var adjusted = now - this.clockDrift;\n return adjusted < this.accessToken.getExpiration() && adjusted < this.idToken.getExpiration();\n };\n\n return CognitoUserSession;\n}();\n\nexport { CognitoUserSession as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nvar monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\nvar weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n/** @class */\n\nvar DateHelper = /*#__PURE__*/function () {\n function DateHelper() {}\n\n var _proto = DateHelper.prototype;\n\n /**\n * @returns {string} The current time in \"ddd MMM D HH:mm:ss UTC YYYY\" format.\n */\n _proto.getNowString = function getNowString() {\n var now = new Date();\n var weekDay = weekNames[now.getUTCDay()];\n var month = monthNames[now.getUTCMonth()];\n var day = now.getUTCDate();\n var hours = now.getUTCHours();\n\n if (hours < 10) {\n hours = \"0\" + hours;\n }\n\n var minutes = now.getUTCMinutes();\n\n if (minutes < 10) {\n minutes = \"0\" + minutes;\n }\n\n var seconds = now.getUTCSeconds();\n\n if (seconds < 10) {\n seconds = \"0\" + seconds;\n }\n\n var year = now.getUTCFullYear(); // ddd MMM D HH:mm:ss UTC YYYY\n\n var dateNow = weekDay + \" \" + month + \" \" + day + \" \" + hours + \":\" + minutes + \":\" + seconds + \" UTC \" + year;\n return dateNow;\n };\n\n return DateHelper;\n}();\n\nexport { DateHelper as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/** @class */\nvar CognitoUserAttribute = /*#__PURE__*/function () {\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 function CognitoUserAttribute(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n Name = _ref.Name,\n Value = _ref.Value;\n\n this.Name = Name || '';\n this.Value = Value || '';\n }\n /**\n * @returns {string} the record's value.\n */\n\n\n var _proto = CognitoUserAttribute.prototype;\n\n _proto.getValue = function getValue() {\n return this.Value;\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 ;\n\n _proto.setValue = function setValue(value) {\n this.Value = value;\n return this;\n }\n /**\n * @returns {string} the record's name.\n */\n ;\n\n _proto.getName = function getName() {\n return this.Name;\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 ;\n\n _proto.setName = function setName(name) {\n this.Name = name;\n return this;\n }\n /**\n * @returns {string} a string representation of the record.\n */\n ;\n\n _proto.toString = function toString() {\n return JSON.stringify(this);\n }\n /**\n * @returns {object} a flat object representing the record.\n */\n ;\n\n _proto.toJSON = function toJSON() {\n return {\n Name: this.Name,\n Value: this.Value\n };\n };\n\n return CognitoUserAttribute;\n}();\n\nexport { CognitoUserAttribute as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nvar dataMemory = {};\n/** @class */\n\nexport var MemoryStorage = /*#__PURE__*/function () {\n function 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 MemoryStorage.setItem = function setItem(key, value) {\n dataMemory[key] = value;\n return dataMemory[key];\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 ;\n\n MemoryStorage.getItem = function getItem(key) {\n return Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n }\n /**\n * This is used to remove an item from storage\n * @param {string} key - the key being set\n * @returns {boolean} return true\n */\n ;\n\n MemoryStorage.removeItem = function removeItem(key) {\n return delete dataMemory[key];\n }\n /**\n * This is used to clear the storage\n * @returns {string} nothing\n */\n ;\n\n MemoryStorage.clear = function clear() {\n dataMemory = {};\n return dataMemory;\n };\n\n return MemoryStorage;\n}();\n/** @class */\n\nvar StorageHelper = /*#__PURE__*/function () {\n /**\n * This is used to get a storage object\n * @returns {object} the storage\n */\n function StorageHelper() {\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 * This is used to return the storage\n * @returns {object} the storage\n */\n\n\n var _proto = StorageHelper.prototype;\n\n _proto.getStorage = function getStorage() {\n return this.storageWindow;\n };\n\n return StorageHelper;\n}();\n\nexport { StorageHelper as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { Buffer } from 'buffer';\nimport CryptoJS from 'crypto-js/core';\nimport TypedArrays from 'crypto-js/lib-typedarrays'; // necessary for crypto js\n\nimport Base64 from 'crypto-js/enc-base64';\nimport HmacSHA256 from 'crypto-js/hmac-sha256';\nimport BigInteger from './BigInteger';\nimport AuthenticationHelper from './AuthenticationHelper';\nimport CognitoAccessToken from './CognitoAccessToken';\nimport CognitoIdToken from './CognitoIdToken';\nimport CognitoRefreshToken from './CognitoRefreshToken';\nimport CognitoUserSession from './CognitoUserSession';\nimport DateHelper from './DateHelper';\nimport CognitoUserAttribute from './CognitoUserAttribute';\nimport StorageHelper from './StorageHelper';\n/**\n * @callback nodeCallback\n * @template T result\n * @param {*} err The operation failure reason, or null.\n * @param {T} result The operation result.\n */\n\n/**\n * @callback onFailure\n * @param {*} err Failure reason.\n */\n\n/**\n * @callback onSuccess\n * @template T result\n * @param {T} result The operation result.\n */\n\n/**\n * @callback mfaRequired\n * @param {*} details MFA challenge details.\n */\n\n/**\n * @callback customChallenge\n * @param {*} details Custom challenge details.\n */\n\n/**\n * @callback inputVerificationCode\n * @param {*} data Server response.\n */\n\n/**\n * @callback authSuccess\n * @param {CognitoUserSession} session The new session.\n * @param {bool=} userConfirmationNecessary User must be confirmed.\n */\n\nvar isBrowser = typeof navigator !== 'undefined';\nvar userAgent = isBrowser ? navigator.userAgent : 'nodejs';\n/** @class */\n\nvar CognitoUser = /*#__PURE__*/function () {\n /**\n * Constructs a new CognitoUser object\n * @param {object} data Creation options\n * @param {string} data.Username The user's username.\n * @param {CognitoUserPool} data.Pool Pool containing the user.\n * @param {object} data.Storage Optional storage object.\n */\n function CognitoUser(data) {\n if (data == null || data.Username == null || data.Pool == null) {\n throw new Error('Username and Pool information are required.');\n }\n\n this.username = data.Username || '';\n this.pool = data.Pool;\n this.Session = null;\n this.client = data.Pool.client;\n this.signInUserSession = null;\n this.authenticationFlowType = 'USER_SRP_AUTH';\n this.storage = data.Storage || new StorageHelper().getStorage();\n this.keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n this.userDataKey = this.keyPrefix + \".\" + this.username + \".userData\";\n }\n /**\n * Sets the session for this user\n * @param {CognitoUserSession} signInUserSession the session\n * @returns {void}\n */\n\n\n var _proto = CognitoUser.prototype;\n\n _proto.setSignInUserSession = function setSignInUserSession(signInUserSession) {\n this.clearCachedUserData();\n this.signInUserSession = signInUserSession;\n this.cacheTokens();\n }\n /**\n * @returns {CognitoUserSession} the current session for this user\n */\n ;\n\n _proto.getSignInUserSession = function getSignInUserSession() {\n return this.signInUserSession;\n }\n /**\n * @returns {string} the user's username\n */\n ;\n\n _proto.getUsername = function getUsername() {\n return this.username;\n }\n /**\n * @returns {String} the authentication flow type\n */\n ;\n\n _proto.getAuthenticationFlowType = function getAuthenticationFlowType() {\n return this.authenticationFlowType;\n }\n /**\n * sets authentication flow type\n * @param {string} authenticationFlowType New value.\n * @returns {void}\n */\n ;\n\n _proto.setAuthenticationFlowType = function setAuthenticationFlowType(authenticationFlowType) {\n this.authenticationFlowType = authenticationFlowType;\n }\n /**\n * This is used for authenticating the user through the custom authentication flow.\n * @param {AuthenticationDetails} authDetails Contains the authentication data\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {customChallenge} callback.customChallenge Custom challenge\n * response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @returns {void}\n */\n ;\n\n _proto.initiateAuth = function initiateAuth(authDetails, callback) {\n var _this = this;\n\n var authParameters = authDetails.getAuthParameters();\n authParameters.USERNAME = this.username;\n var clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n var jsonReq = {\n AuthFlow: 'CUSTOM_AUTH',\n ClientId: this.pool.getClientId(),\n AuthParameters: authParameters,\n ClientMetadata: clientMetaData\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('InitiateAuth', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n var challengeName = data.ChallengeName;\n var challengeParameters = data.ChallengeParameters;\n\n if (challengeName === 'CUSTOM_CHALLENGE') {\n _this.Session = data.Session;\n return callback.customChallenge(challengeParameters);\n }\n\n _this.signInUserSession = _this.getCognitoUserSession(data.AuthenticationResult);\n\n _this.cacheTokens();\n\n return callback.onSuccess(_this.signInUserSession);\n });\n }\n /**\n * This is used for authenticating the user.\n * stuff\n * @param {AuthenticationDetails} authDetails Contains the authentication data\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {newPasswordRequired} callback.newPasswordRequired new\n * password and any required attributes are required to continue\n * @param {mfaRequired} callback.mfaRequired MFA code\n * required to continue.\n * @param {customChallenge} callback.customChallenge Custom challenge\n * response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @returns {void}\n */\n ;\n\n _proto.authenticateUser = function authenticateUser(authDetails, callback) {\n if (this.authenticationFlowType === 'USER_PASSWORD_AUTH') {\n return this.authenticateUserPlainUsernamePassword(authDetails, callback);\n } else if (this.authenticationFlowType === 'USER_SRP_AUTH' || this.authenticationFlowType === 'CUSTOM_AUTH') {\n return this.authenticateUserDefaultAuth(authDetails, callback);\n }\n\n return callback.onFailure(new Error('Authentication flow type is invalid.'));\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n * It calls the AuthenticationHelper for SRP related\n * stuff\n * @param {AuthenticationDetails} authDetails Contains the authentication data\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {newPasswordRequired} callback.newPasswordRequired new\n * password and any required attributes are required to continue\n * @param {mfaRequired} callback.mfaRequired MFA code\n * required to continue.\n * @param {customChallenge} callback.customChallenge Custom challenge\n * response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @returns {void}\n */\n ;\n\n _proto.authenticateUserDefaultAuth = function authenticateUserDefaultAuth(authDetails, callback) {\n var _this2 = this;\n\n var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n var dateHelper = new DateHelper();\n var serverBValue;\n var salt;\n var authParameters = {};\n\n if (this.deviceKey != null) {\n authParameters.DEVICE_KEY = this.deviceKey;\n }\n\n authParameters.USERNAME = this.username;\n authenticationHelper.getLargeAValue(function (errOnAValue, aValue) {\n // getLargeAValue callback start\n if (errOnAValue) {\n callback.onFailure(errOnAValue);\n }\n\n authParameters.SRP_A = aValue.toString(16);\n\n if (_this2.authenticationFlowType === 'CUSTOM_AUTH') {\n authParameters.CHALLENGE_NAME = 'SRP_A';\n }\n\n var clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n var jsonReq = {\n AuthFlow: _this2.authenticationFlowType,\n ClientId: _this2.pool.getClientId(),\n AuthParameters: authParameters,\n ClientMetadata: clientMetaData\n };\n\n if (_this2.getUserContextData(_this2.username)) {\n jsonReq.UserContextData = _this2.getUserContextData(_this2.username);\n }\n\n _this2.client.request('InitiateAuth', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n var challengeParameters = data.ChallengeParameters;\n _this2.username = challengeParameters.USER_ID_FOR_SRP;\n _this2.userDataKey = _this2.keyPrefix + \".\" + _this2.username + \".userData\";\n serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n salt = new BigInteger(challengeParameters.SALT, 16);\n\n _this2.getCachedDeviceKeyAndPassword();\n\n authenticationHelper.getPasswordAuthenticationKey(_this2.username, authDetails.getPassword(), serverBValue, salt, function (errOnHkdf, hkdf) {\n // getPasswordAuthenticationKey callback start\n if (errOnHkdf) {\n callback.onFailure(errOnHkdf);\n }\n\n var dateNow = dateHelper.getNowString();\n var message = CryptoJS.lib.WordArray.create(Buffer.concat([Buffer.from(_this2.pool.getUserPoolId().split('_')[1], 'utf8'), Buffer.from(_this2.username, 'utf8'), Buffer.from(challengeParameters.SECRET_BLOCK, 'base64'), Buffer.from(dateNow, 'utf8')]));\n var key = CryptoJS.lib.WordArray.create(hkdf);\n var signatureString = Base64.stringify(HmacSHA256(message, key));\n var challengeResponses = {};\n challengeResponses.USERNAME = _this2.username;\n challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n challengeResponses.TIMESTAMP = dateNow;\n challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\n if (_this2.deviceKey != null) {\n challengeResponses.DEVICE_KEY = _this2.deviceKey;\n }\n\n var respondToAuthChallenge = function respondToAuthChallenge(challenge, challengeCallback) {\n return _this2.client.request('RespondToAuthChallenge', challenge, function (errChallenge, dataChallenge) {\n if (errChallenge && errChallenge.code === 'ResourceNotFoundException' && errChallenge.message.toLowerCase().indexOf('device') !== -1) {\n challengeResponses.DEVICE_KEY = null;\n _this2.deviceKey = null;\n _this2.randomPassword = null;\n _this2.deviceGroupKey = null;\n\n _this2.clearCachedDeviceKeyAndPassword();\n\n return respondToAuthChallenge(challenge, challengeCallback);\n }\n\n return challengeCallback(errChallenge, dataChallenge);\n });\n };\n\n var jsonReqResp = {\n ChallengeName: 'PASSWORD_VERIFIER',\n ClientId: _this2.pool.getClientId(),\n ChallengeResponses: challengeResponses,\n Session: data.Session,\n ClientMetadata: clientMetaData\n };\n\n if (_this2.getUserContextData()) {\n jsonReqResp.UserContextData = _this2.getUserContextData();\n }\n\n respondToAuthChallenge(jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n if (errAuthenticate) {\n return callback.onFailure(errAuthenticate);\n }\n\n return _this2.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n });\n return undefined; // getPasswordAuthenticationKey callback end\n });\n return undefined;\n }); // getLargeAValue callback end\n\n });\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n * @param {AuthenticationDetails} authDetails Contains the authentication data.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {mfaRequired} callback.mfaRequired MFA code\n * required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @returns {void}\n */\n ;\n\n _proto.authenticateUserPlainUsernamePassword = function authenticateUserPlainUsernamePassword(authDetails, callback) {\n var _this3 = this;\n\n var authParameters = {};\n authParameters.USERNAME = this.username;\n authParameters.PASSWORD = authDetails.getPassword();\n\n if (!authParameters.PASSWORD) {\n callback.onFailure(new Error('PASSWORD parameter is required'));\n return;\n }\n\n var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n this.getCachedDeviceKeyAndPassword();\n\n if (this.deviceKey != null) {\n authParameters.DEVICE_KEY = this.deviceKey;\n }\n\n var clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n var jsonReq = {\n AuthFlow: 'USER_PASSWORD_AUTH',\n ClientId: this.pool.getClientId(),\n AuthParameters: authParameters,\n ClientMetadata: clientMetaData\n };\n\n if (this.getUserContextData(this.username)) {\n jsonReq.UserContextData = this.getUserContextData(this.username);\n } // USER_PASSWORD_AUTH happens in a single round-trip: client sends userName and password,\n // Cognito UserPools verifies password and returns tokens.\n\n\n this.client.request('InitiateAuth', jsonReq, function (err, authResult) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return _this3.authenticateUserInternal(authResult, authenticationHelper, callback);\n });\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n * @param {object} dataAuthenticate authentication data\n * @param {object} authenticationHelper helper created\n * @param {callback} callback passed on from caller\n * @returns {void}\n */\n ;\n\n _proto.authenticateUserInternal = function authenticateUserInternal(dataAuthenticate, authenticationHelper, callback) {\n var _this4 = this;\n\n var challengeName = dataAuthenticate.ChallengeName;\n var challengeParameters = dataAuthenticate.ChallengeParameters;\n\n if (challengeName === 'SMS_MFA') {\n this.Session = dataAuthenticate.Session;\n return callback.mfaRequired(challengeName, challengeParameters);\n }\n\n if (challengeName === 'SELECT_MFA_TYPE') {\n this.Session = dataAuthenticate.Session;\n return callback.selectMFAType(challengeName, challengeParameters);\n }\n\n if (challengeName === 'MFA_SETUP') {\n this.Session = dataAuthenticate.Session;\n return callback.mfaSetup(challengeName, challengeParameters);\n }\n\n if (challengeName === 'SOFTWARE_TOKEN_MFA') {\n this.Session = dataAuthenticate.Session;\n return callback.totpRequired(challengeName, challengeParameters);\n }\n\n if (challengeName === 'CUSTOM_CHALLENGE') {\n this.Session = dataAuthenticate.Session;\n return callback.customChallenge(challengeParameters);\n }\n\n if (challengeName === 'NEW_PASSWORD_REQUIRED') {\n this.Session = dataAuthenticate.Session;\n var userAttributes = null;\n var rawRequiredAttributes = null;\n var requiredAttributes = [];\n var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\n if (challengeParameters) {\n userAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.userAttributes);\n rawRequiredAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.requiredAttributes);\n }\n\n if (rawRequiredAttributes) {\n for (var i = 0; i < rawRequiredAttributes.length; i++) {\n requiredAttributes[i] = rawRequiredAttributes[i].substr(userAttributesPrefix.length);\n }\n }\n\n return callback.newPasswordRequired(userAttributes, requiredAttributes);\n }\n\n if (challengeName === 'DEVICE_SRP_AUTH') {\n this.Session = dataAuthenticate.Session;\n this.getDeviceResponse(callback);\n return undefined;\n }\n\n this.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n this.challengeName = challengeName;\n this.cacheTokens();\n var newDeviceMetadata = dataAuthenticate.AuthenticationResult.NewDeviceMetadata;\n\n if (newDeviceMetadata == null) {\n return callback.onSuccess(this.signInUserSession);\n }\n\n authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n if (errGenHash) {\n return callback.onFailure(errGenHash);\n }\n\n var deviceSecretVerifierConfig = {\n Salt: Buffer.from(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n PasswordVerifier: Buffer.from(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n };\n _this4.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n _this4.deviceGroupKey = newDeviceMetadata.DeviceGroupKey;\n _this4.randomPassword = authenticationHelper.getRandomPassword();\n\n _this4.client.request('ConfirmDevice', {\n DeviceKey: newDeviceMetadata.DeviceKey,\n AccessToken: _this4.signInUserSession.getAccessToken().getJwtToken(),\n DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n DeviceName: userAgent\n }, function (errConfirm, dataConfirm) {\n if (errConfirm) {\n return callback.onFailure(errConfirm);\n }\n\n _this4.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\n _this4.cacheDeviceKeyAndPassword();\n\n if (dataConfirm.UserConfirmationNecessary === true) {\n return callback.onSuccess(_this4.signInUserSession, dataConfirm.UserConfirmationNecessary);\n }\n\n return callback.onSuccess(_this4.signInUserSession);\n });\n\n return undefined;\n });\n return undefined;\n }\n /**\n * This method is user to complete the NEW_PASSWORD_REQUIRED challenge.\n * Pass the new password with any new user attributes to be updated.\n * User attribute keys must be of format userAttributes..\n * @param {string} newPassword new password for this user\n * @param {object} requiredAttributeData map with values for all required attributes\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {mfaRequired} callback.mfaRequired MFA code required to continue.\n * @param {customChallenge} callback.customChallenge Custom challenge\n * response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.completeNewPasswordChallenge = function completeNewPasswordChallenge(newPassword, requiredAttributeData, callback, clientMetadata) {\n var _this5 = this;\n\n if (!newPassword) {\n return callback.onFailure(new Error('New password is required.'));\n }\n\n var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n var userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n var finalUserAttributes = {};\n\n if (requiredAttributeData) {\n Object.keys(requiredAttributeData).forEach(function (key) {\n finalUserAttributes[userAttributesPrefix + key] = requiredAttributeData[key];\n });\n }\n\n finalUserAttributes.NEW_PASSWORD = newPassword;\n finalUserAttributes.USERNAME = this.username;\n var jsonReq = {\n ChallengeName: 'NEW_PASSWORD_REQUIRED',\n ClientId: this.pool.getClientId(),\n ChallengeResponses: finalUserAttributes,\n Session: this.Session,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('RespondToAuthChallenge', jsonReq, function (errAuthenticate, dataAuthenticate) {\n if (errAuthenticate) {\n return callback.onFailure(errAuthenticate);\n }\n\n return _this5.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n });\n return undefined;\n }\n /**\n * This is used to get a session using device authentication. It is called at the end of user\n * authentication\n *\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n * @private\n */\n ;\n\n _proto.getDeviceResponse = function getDeviceResponse(callback, clientMetadata) {\n var _this6 = this;\n\n var authenticationHelper = new AuthenticationHelper(this.deviceGroupKey);\n var dateHelper = new DateHelper();\n var authParameters = {};\n authParameters.USERNAME = this.username;\n authParameters.DEVICE_KEY = this.deviceKey;\n authenticationHelper.getLargeAValue(function (errAValue, aValue) {\n // getLargeAValue callback start\n if (errAValue) {\n callback.onFailure(errAValue);\n }\n\n authParameters.SRP_A = aValue.toString(16);\n var jsonReq = {\n ChallengeName: 'DEVICE_SRP_AUTH',\n ClientId: _this6.pool.getClientId(),\n ChallengeResponses: authParameters,\n ClientMetadata: clientMetadata,\n Session: _this6.Session\n };\n\n if (_this6.getUserContextData()) {\n jsonReq.UserContextData = _this6.getUserContextData();\n }\n\n _this6.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n var challengeParameters = data.ChallengeParameters;\n var serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n var salt = new BigInteger(challengeParameters.SALT, 16);\n authenticationHelper.getPasswordAuthenticationKey(_this6.deviceKey, _this6.randomPassword, serverBValue, salt, function (errHkdf, hkdf) {\n // getPasswordAuthenticationKey callback start\n if (errHkdf) {\n return callback.onFailure(errHkdf);\n }\n\n var dateNow = dateHelper.getNowString();\n var message = CryptoJS.lib.WordArray.create(Buffer.concat([Buffer.from(_this6.deviceGroupKey, 'utf8'), Buffer.from(_this6.deviceKey, 'utf8'), Buffer.from(challengeParameters.SECRET_BLOCK, 'base64'), Buffer.from(dateNow, 'utf8')]));\n var key = CryptoJS.lib.WordArray.create(hkdf);\n var signatureString = Base64.stringify(HmacSHA256(message, key));\n var challengeResponses = {};\n challengeResponses.USERNAME = _this6.username;\n challengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n challengeResponses.TIMESTAMP = dateNow;\n challengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n challengeResponses.DEVICE_KEY = _this6.deviceKey;\n var jsonReqResp = {\n ChallengeName: 'DEVICE_PASSWORD_VERIFIER',\n ClientId: _this6.pool.getClientId(),\n ChallengeResponses: challengeResponses,\n Session: data.Session\n };\n\n if (_this6.getUserContextData()) {\n jsonReqResp.UserContextData = _this6.getUserContextData();\n }\n\n _this6.client.request('RespondToAuthChallenge', jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n if (errAuthenticate) {\n return callback.onFailure(errAuthenticate);\n }\n\n _this6.signInUserSession = _this6.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\n _this6.cacheTokens();\n\n return callback.onSuccess(_this6.signInUserSession);\n });\n\n return undefined; // getPasswordAuthenticationKey callback end\n });\n return undefined;\n }); // getLargeAValue callback end\n\n });\n }\n /**\n * This is used for a certain user to confirm the registration by using a confirmation code\n * @param {string} confirmationCode Code entered by user.\n * @param {bool} forceAliasCreation Allow migrating from an existing email / phone number.\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.confirmRegistration = function confirmRegistration(confirmationCode, forceAliasCreation, callback, clientMetadata) {\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n ConfirmationCode: confirmationCode,\n Username: this.username,\n ForceAliasCreation: forceAliasCreation,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('ConfirmSignUp', jsonReq, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n }\n /**\n * This is used by the user once he has the responses to a custom challenge\n * @param {string} answerChallenge The custom challenge answer.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {customChallenge} callback.customChallenge\n * Custom challenge response required to continue.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.sendCustomChallengeAnswer = function sendCustomChallengeAnswer(answerChallenge, callback, clientMetadata) {\n var _this7 = this;\n\n var challengeResponses = {};\n challengeResponses.USERNAME = this.username;\n challengeResponses.ANSWER = answerChallenge;\n var authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n this.getCachedDeviceKeyAndPassword();\n\n if (this.deviceKey != null) {\n challengeResponses.DEVICE_KEY = this.deviceKey;\n }\n\n var jsonReq = {\n ChallengeName: 'CUSTOM_CHALLENGE',\n ChallengeResponses: challengeResponses,\n ClientId: this.pool.getClientId(),\n Session: this.Session,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return _this7.authenticateUserInternal(data, authenticationHelper, callback);\n });\n }\n /**\n * This is used by the user once he has an MFA code\n * @param {string} confirmationCode The MFA code entered by the user.\n * @param {object} callback Result callback map.\n * @param {string} mfaType The mfa we are replying to.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {authSuccess} callback.onSuccess Called on success with the new session.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.sendMFACode = function sendMFACode(confirmationCode, callback, mfaType, clientMetadata) {\n var _this8 = this;\n\n var challengeResponses = {};\n challengeResponses.USERNAME = this.username;\n challengeResponses.SMS_MFA_CODE = confirmationCode;\n var mfaTypeSelection = mfaType || 'SMS_MFA';\n\n if (mfaTypeSelection === 'SOFTWARE_TOKEN_MFA') {\n challengeResponses.SOFTWARE_TOKEN_MFA_CODE = confirmationCode;\n }\n\n if (this.deviceKey != null) {\n challengeResponses.DEVICE_KEY = this.deviceKey;\n }\n\n var jsonReq = {\n ChallengeName: mfaTypeSelection,\n ChallengeResponses: challengeResponses,\n ClientId: this.pool.getClientId(),\n Session: this.Session,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('RespondToAuthChallenge', jsonReq, function (err, dataAuthenticate) {\n if (err) {\n return callback.onFailure(err);\n }\n\n var challengeName = dataAuthenticate.ChallengeName;\n\n if (challengeName === 'DEVICE_SRP_AUTH') {\n _this8.getDeviceResponse(callback);\n\n return undefined;\n }\n\n _this8.signInUserSession = _this8.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\n _this8.cacheTokens();\n\n if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {\n return callback.onSuccess(_this8.signInUserSession);\n }\n\n var authenticationHelper = new AuthenticationHelper(_this8.pool.getUserPoolId().split('_')[1]);\n authenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n if (errGenHash) {\n return callback.onFailure(errGenHash);\n }\n\n var deviceSecretVerifierConfig = {\n Salt: Buffer.from(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n PasswordVerifier: Buffer.from(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n };\n _this8.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n _this8.deviceGroupKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey;\n _this8.randomPassword = authenticationHelper.getRandomPassword();\n\n _this8.client.request('ConfirmDevice', {\n DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n AccessToken: _this8.signInUserSession.getAccessToken().getJwtToken(),\n DeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n DeviceName: userAgent\n }, function (errConfirm, dataConfirm) {\n if (errConfirm) {\n return callback.onFailure(errConfirm);\n }\n\n _this8.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\n _this8.cacheDeviceKeyAndPassword();\n\n if (dataConfirm.UserConfirmationNecessary === true) {\n return callback.onSuccess(_this8.signInUserSession, dataConfirm.UserConfirmationNecessary);\n }\n\n return callback.onSuccess(_this8.signInUserSession);\n });\n\n return undefined;\n });\n return undefined;\n });\n }\n /**\n * This is used by an authenticated user to change the current password\n * @param {string} oldUserPassword The current password.\n * @param {string} newUserPassword The requested new password.\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.changePassword = function changePassword(oldUserPassword, newUserPassword, callback, clientMetadata) {\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('ChangePassword', {\n PreviousPassword: oldUserPassword,\n ProposedPassword: newUserPassword,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n ClientMetadata: clientMetadata\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to enable MFA for itself\n * @deprecated\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.enableMFA = function enableMFA(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n var mfaOptions = [];\n var mfaEnabled = {\n DeliveryMedium: 'SMS',\n AttributeName: 'phone_number'\n };\n mfaOptions.push(mfaEnabled);\n this.client.request('SetUserSettings', {\n MFAOptions: mfaOptions,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to enable MFA for itself\n * @param {IMfaSettings} smsMfaSettings the sms mfa settings\n * @param {IMFASettings} softwareTokenMfaSettings the software token mfa settings\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.setUserMfaPreference = function setUserMfaPreference(smsMfaSettings, softwareTokenMfaSettings, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('SetUserMFAPreference', {\n SMSMfaSettings: smsMfaSettings,\n SoftwareTokenMfaSettings: softwareTokenMfaSettings,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to disable MFA for itself\n * @deprecated\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.disableMFA = function disableMFA(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n var mfaOptions = [];\n this.client.request('SetUserSettings', {\n MFAOptions: mfaOptions,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to delete itself\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.deleteUser = function deleteUser(callback, clientMetadata) {\n var _this9 = this;\n\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('DeleteUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n ClientMetadata: clientMetadata\n }, function (err) {\n if (err) {\n return callback(err, null);\n }\n\n _this9.clearCachedUser();\n\n return callback(null, 'SUCCESS');\n });\n return undefined;\n }\n /**\n * @typedef {CognitoUserAttribute | { Name:string, Value:string }} AttributeArg\n */\n\n /**\n * This is used by an authenticated user to change a list of attributes\n * @param {AttributeArg[]} attributes A list of the new user attributes.\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.updateAttributes = function updateAttributes(attributes, callback, clientMetadata) {\n var _this10 = this;\n\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('UpdateUserAttributes', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n UserAttributes: attributes,\n ClientMetadata: clientMetadata\n }, function (err) {\n if (err) {\n return callback(err, null);\n } // update cached user\n\n\n return _this10.getUserData(function () {\n return callback(null, 'SUCCESS');\n }, {\n bypassCache: true\n });\n });\n return undefined;\n }\n /**\n * This is used by an authenticated user to get a list of attributes\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.getUserAttributes = function getUserAttributes(callback) {\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('GetUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err, userData) {\n if (err) {\n return callback(err, null);\n }\n\n var attributeList = [];\n\n for (var i = 0; i < userData.UserAttributes.length; i++) {\n var attribute = {\n Name: userData.UserAttributes[i].Name,\n Value: userData.UserAttributes[i].Value\n };\n var userAttribute = new CognitoUserAttribute(attribute);\n attributeList.push(userAttribute);\n }\n\n return callback(null, attributeList);\n });\n return undefined;\n }\n /**\n * This was previously used by an authenticated user to get MFAOptions,\n * but no longer returns a meaningful response. Refer to the documentation for\n * how to setup and use MFA: https://docs.amplify.aws/lib/auth/mfa/q/platform/js\n * @deprecated\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.getMFAOptions = function getMFAOptions(callback) {\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('GetUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err, userData) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, userData.MFAOptions);\n });\n return undefined;\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.createGetUserRequest = function createGetUserRequest() {\n return this.client.promisifyRequest('GetUser', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n });\n }\n /**\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.refreshSessionIfPossible = function refreshSessionIfPossible(options) {\n var _this11 = this;\n\n if (options === void 0) {\n options = {};\n }\n\n // best effort, if not possible\n return new Promise(function (resolve) {\n var refresh = _this11.signInUserSession.getRefreshToken();\n\n if (refresh && refresh.getToken()) {\n _this11.refreshSession(refresh, resolve, options.clientMetadata);\n } else {\n resolve();\n }\n });\n }\n /**\n * @typedef {Object} GetUserDataOptions\n * @property {boolean} bypassCache - force getting data from Cognito service\n * @property {Record} clientMetadata - clientMetadata for getSession\n */\n\n /**\n * This is used by an authenticated users to get the userData\n * @param {nodeCallback} callback Called on success or error.\n * @param {GetUserDataOptions} params\n * @returns {void}\n */\n ;\n\n _proto.getUserData = function getUserData(callback, params) {\n var _this12 = this;\n\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n this.clearCachedUserData();\n return callback(new Error('User is not authenticated'), null);\n }\n\n var userData = this.getUserDataFromCache();\n\n if (!userData) {\n this.fetchUserData().then(function (data) {\n callback(null, data);\n })[\"catch\"](callback);\n return;\n }\n\n if (this.isFetchUserDataAndTokenRequired(params)) {\n this.fetchUserData().then(function (data) {\n return _this12.refreshSessionIfPossible(params).then(function () {\n return data;\n });\n }).then(function (data) {\n return callback(null, data);\n })[\"catch\"](callback);\n return;\n }\n\n try {\n callback(null, JSON.parse(userData));\n return;\n } catch (err) {\n this.clearCachedUserData();\n callback(err, null);\n return;\n }\n }\n /**\n *\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.getUserDataFromCache = function getUserDataFromCache() {\n var userData = this.storage.getItem(this.userDataKey);\n return userData;\n }\n /**\n *\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.isFetchUserDataAndTokenRequired = function isFetchUserDataAndTokenRequired(params) {\n var _ref = params || {},\n _ref$bypassCache = _ref.bypassCache,\n bypassCache = _ref$bypassCache === void 0 ? false : _ref$bypassCache;\n\n return bypassCache;\n }\n /**\n *\n * PRIVATE ONLY: This is an internal only method and should not\n * be directly called by the consumers.\n */\n ;\n\n _proto.fetchUserData = function fetchUserData() {\n var _this13 = this;\n\n return this.createGetUserRequest().then(function (data) {\n _this13.cacheUserData(data);\n\n return data;\n });\n }\n /**\n * This is used by an authenticated user to delete a list of attributes\n * @param {string[]} attributeList Names of the attributes to delete.\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.deleteAttributes = function deleteAttributes(attributeList, callback) {\n var _this14 = this;\n\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n return callback(new Error('User is not authenticated'), null);\n }\n\n this.client.request('DeleteUserAttributes', {\n UserAttributeNames: attributeList,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback(err, null);\n } // update cached user\n\n\n return _this14.getUserData(function () {\n return callback(null, 'SUCCESS');\n }, {\n bypassCache: true\n });\n });\n return undefined;\n }\n /**\n * This is used by a user to resend a confirmation code\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.resendConfirmationCode = function resendConfirmationCode(callback, clientMetadata) {\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n Username: this.username,\n ClientMetadata: clientMetadata\n };\n this.client.request('ResendConfirmationCode', jsonReq, function (err, result) {\n if (err) {\n return callback(err, null);\n }\n\n return callback(null, result);\n });\n }\n /**\n * @typedef {Object} GetSessionOptions\n * @property {Record} clientMetadata - clientMetadata for getSession\n */\n\n /**\n * This is used to get a session, either from the session object\n * or from the local storage, or by using a refresh token\n *\n * @param {nodeCallback} callback Called on success or error.\n * @param {GetSessionOptions} options\n * @returns {void}\n */\n ;\n\n _proto.getSession = function getSession(callback, options) {\n if (options === void 0) {\n options = {};\n }\n\n if (this.username == null) {\n return callback(new Error('Username is null. Cannot retrieve a new session'), null);\n }\n\n if (this.signInUserSession != null && this.signInUserSession.isValid()) {\n return callback(null, this.signInUserSession);\n }\n\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n var idTokenKey = keyPrefix + \".idToken\";\n var accessTokenKey = keyPrefix + \".accessToken\";\n var refreshTokenKey = keyPrefix + \".refreshToken\";\n var clockDriftKey = keyPrefix + \".clockDrift\";\n\n if (this.storage.getItem(idTokenKey)) {\n var idToken = new CognitoIdToken({\n IdToken: this.storage.getItem(idTokenKey)\n });\n var accessToken = new CognitoAccessToken({\n AccessToken: this.storage.getItem(accessTokenKey)\n });\n var refreshToken = new CognitoRefreshToken({\n RefreshToken: this.storage.getItem(refreshTokenKey)\n });\n var clockDrift = parseInt(this.storage.getItem(clockDriftKey), 0) || 0;\n var sessionData = {\n IdToken: idToken,\n AccessToken: accessToken,\n RefreshToken: refreshToken,\n ClockDrift: clockDrift\n };\n var cachedSession = new CognitoUserSession(sessionData);\n\n if (cachedSession.isValid()) {\n this.signInUserSession = cachedSession;\n return callback(null, this.signInUserSession);\n }\n\n if (!refreshToken.getToken()) {\n return callback(new Error('Cannot retrieve a new session. Please authenticate.'), null);\n }\n\n this.refreshSession(refreshToken, callback, options.clientMetadata);\n } else {\n callback(new Error('Local storage is missing an ID Token, Please authenticate'), null);\n }\n\n return undefined;\n }\n /**\n * This uses the refreshToken to retrieve a new session\n * @param {CognitoRefreshToken} refreshToken A previous session's refresh token.\n * @param {nodeCallback} callback Called on success or error.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.refreshSession = function refreshSession(refreshToken, callback, clientMetadata) {\n var _this15 = this;\n\n var wrappedCallback = this.pool.wrapRefreshSessionCallback ? this.pool.wrapRefreshSessionCallback(callback) : callback;\n var authParameters = {};\n authParameters.REFRESH_TOKEN = refreshToken.getToken();\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n var lastUserKey = keyPrefix + \".LastAuthUser\";\n\n if (this.storage.getItem(lastUserKey)) {\n this.username = this.storage.getItem(lastUserKey);\n var deviceKeyKey = keyPrefix + \".\" + this.username + \".deviceKey\";\n this.deviceKey = this.storage.getItem(deviceKeyKey);\n authParameters.DEVICE_KEY = this.deviceKey;\n }\n\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n AuthFlow: 'REFRESH_TOKEN_AUTH',\n AuthParameters: authParameters,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('InitiateAuth', jsonReq, function (err, authResult) {\n if (err) {\n if (err.code === 'NotAuthorizedException') {\n _this15.clearCachedUser();\n }\n\n return wrappedCallback(err, null);\n }\n\n if (authResult) {\n var authenticationResult = authResult.AuthenticationResult;\n\n if (!Object.prototype.hasOwnProperty.call(authenticationResult, 'RefreshToken')) {\n authenticationResult.RefreshToken = refreshToken.getToken();\n }\n\n _this15.signInUserSession = _this15.getCognitoUserSession(authenticationResult);\n\n _this15.cacheTokens();\n\n return wrappedCallback(null, _this15.signInUserSession);\n }\n\n return undefined;\n });\n }\n /**\n * This is used to save the session tokens to local storage\n * @returns {void}\n */\n ;\n\n _proto.cacheTokens = function cacheTokens() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n var idTokenKey = keyPrefix + \".\" + this.username + \".idToken\";\n var accessTokenKey = keyPrefix + \".\" + this.username + \".accessToken\";\n var refreshTokenKey = keyPrefix + \".\" + this.username + \".refreshToken\";\n var clockDriftKey = keyPrefix + \".\" + this.username + \".clockDrift\";\n var lastUserKey = keyPrefix + \".LastAuthUser\";\n this.storage.setItem(idTokenKey, this.signInUserSession.getIdToken().getJwtToken());\n this.storage.setItem(accessTokenKey, this.signInUserSession.getAccessToken().getJwtToken());\n this.storage.setItem(refreshTokenKey, this.signInUserSession.getRefreshToken().getToken());\n this.storage.setItem(clockDriftKey, \"\" + this.signInUserSession.getClockDrift());\n this.storage.setItem(lastUserKey, this.username);\n }\n /**\n * This is to cache user data\n */\n ;\n\n _proto.cacheUserData = function cacheUserData(userData) {\n this.storage.setItem(this.userDataKey, JSON.stringify(userData));\n }\n /**\n * This is to remove cached user data\n */\n ;\n\n _proto.clearCachedUserData = function clearCachedUserData() {\n this.storage.removeItem(this.userDataKey);\n };\n\n _proto.clearCachedUser = function clearCachedUser() {\n this.clearCachedTokens();\n this.clearCachedUserData();\n }\n /**\n * This is used to cache the device key and device group and device password\n * @returns {void}\n */\n ;\n\n _proto.cacheDeviceKeyAndPassword = function cacheDeviceKeyAndPassword() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n var deviceKeyKey = keyPrefix + \".deviceKey\";\n var randomPasswordKey = keyPrefix + \".randomPasswordKey\";\n var deviceGroupKeyKey = keyPrefix + \".deviceGroupKey\";\n this.storage.setItem(deviceKeyKey, this.deviceKey);\n this.storage.setItem(randomPasswordKey, this.randomPassword);\n this.storage.setItem(deviceGroupKeyKey, this.deviceGroupKey);\n }\n /**\n * This is used to get current device key and device group and device password\n * @returns {void}\n */\n ;\n\n _proto.getCachedDeviceKeyAndPassword = function getCachedDeviceKeyAndPassword() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n var deviceKeyKey = keyPrefix + \".deviceKey\";\n var randomPasswordKey = keyPrefix + \".randomPasswordKey\";\n var deviceGroupKeyKey = keyPrefix + \".deviceGroupKey\";\n\n if (this.storage.getItem(deviceKeyKey)) {\n this.deviceKey = this.storage.getItem(deviceKeyKey);\n this.randomPassword = this.storage.getItem(randomPasswordKey);\n this.deviceGroupKey = this.storage.getItem(deviceGroupKeyKey);\n }\n }\n /**\n * This is used to clear the device key info from local storage\n * @returns {void}\n */\n ;\n\n _proto.clearCachedDeviceKeyAndPassword = function clearCachedDeviceKeyAndPassword() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId() + \".\" + this.username;\n var deviceKeyKey = keyPrefix + \".deviceKey\";\n var randomPasswordKey = keyPrefix + \".randomPasswordKey\";\n var deviceGroupKeyKey = keyPrefix + \".deviceGroupKey\";\n this.storage.removeItem(deviceKeyKey);\n this.storage.removeItem(randomPasswordKey);\n this.storage.removeItem(deviceGroupKeyKey);\n }\n /**\n * This is used to clear the session tokens from local storage\n * @returns {void}\n */\n ;\n\n _proto.clearCachedTokens = function clearCachedTokens() {\n var keyPrefix = \"CognitoIdentityServiceProvider.\" + this.pool.getClientId();\n var idTokenKey = keyPrefix + \".\" + this.username + \".idToken\";\n var accessTokenKey = keyPrefix + \".\" + this.username + \".accessToken\";\n var refreshTokenKey = keyPrefix + \".\" + this.username + \".refreshToken\";\n var lastUserKey = keyPrefix + \".LastAuthUser\";\n var clockDriftKey = keyPrefix + \".\" + this.username + \".clockDrift\";\n this.storage.removeItem(idTokenKey);\n this.storage.removeItem(accessTokenKey);\n this.storage.removeItem(refreshTokenKey);\n this.storage.removeItem(lastUserKey);\n this.storage.removeItem(clockDriftKey);\n }\n /**\n * This is used to build a user session from tokens retrieved in the authentication result\n * @param {object} authResult Successful auth response from server.\n * @returns {CognitoUserSession} The new user session.\n * @private\n */\n ;\n\n _proto.getCognitoUserSession = function getCognitoUserSession(authResult) {\n var idToken = new CognitoIdToken(authResult);\n var accessToken = new CognitoAccessToken(authResult);\n var refreshToken = new CognitoRefreshToken(authResult);\n var sessionData = {\n IdToken: idToken,\n AccessToken: accessToken,\n RefreshToken: refreshToken\n };\n return new CognitoUserSession(sessionData);\n }\n /**\n * This is used to initiate a forgot password request\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {inputVerificationCode?} callback.inputVerificationCode\n * Optional callback raised instead of onSuccess with response data.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.forgotPassword = function forgotPassword(callback, clientMetadata) {\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n Username: this.username,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('ForgotPassword', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n if (typeof callback.inputVerificationCode === 'function') {\n return callback.inputVerificationCode(data);\n }\n\n return callback.onSuccess(data);\n });\n }\n /**\n * This is used to confirm a new password using a confirmationCode\n * @param {string} confirmationCode Code entered by user.\n * @param {string} newPassword Confirm new password.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.confirmPassword = function confirmPassword(confirmationCode, newPassword, callback, clientMetadata) {\n var jsonReq = {\n ClientId: this.pool.getClientId(),\n Username: this.username,\n ConfirmationCode: confirmationCode,\n Password: newPassword,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('ConfirmForgotPassword', jsonReq, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n }\n /**\n * This is used to initiate an attribute confirmation request\n * @param {string} attributeName User attribute that needs confirmation.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {inputVerificationCode} callback.inputVerificationCode Called on success.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.getAttributeVerificationCode = function getAttributeVerificationCode(attributeName, callback, clientMetadata) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('GetUserAttributeVerificationCode', {\n AttributeName: attributeName,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n ClientMetadata: clientMetadata\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n if (typeof callback.inputVerificationCode === 'function') {\n return callback.inputVerificationCode(data);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to confirm an attribute using a confirmation code\n * @param {string} attributeName Attribute being confirmed.\n * @param {string} confirmationCode Code entered by user.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.verifyAttribute = function verifyAttribute(attributeName, confirmationCode, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('VerifyUserAttribute', {\n AttributeName: attributeName,\n Code: confirmationCode,\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to get the device information using the current device key\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess<*>} callback.onSuccess Called on success with device data.\n * @returns {void}\n */\n ;\n\n _proto.getDevice = function getDevice(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('GetDevice', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: this.deviceKey\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess(data);\n });\n return undefined;\n }\n /**\n * This is used to forget a specific device\n * @param {string} deviceKey Device key.\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.forgetSpecificDevice = function forgetSpecificDevice(deviceKey, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('ForgetDevice', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: deviceKey\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to forget the current device\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.forgetDevice = function forgetDevice(callback) {\n var _this16 = this;\n\n this.forgetSpecificDevice(this.deviceKey, {\n onFailure: callback.onFailure,\n onSuccess: function onSuccess(result) {\n _this16.deviceKey = null;\n _this16.deviceGroupKey = null;\n _this16.randomPassword = null;\n\n _this16.clearCachedDeviceKeyAndPassword();\n\n return callback.onSuccess(result);\n }\n });\n }\n /**\n * This is used to set the device status as remembered\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.setDeviceStatusRemembered = function setDeviceStatusRemembered(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('UpdateDeviceStatus', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: this.deviceKey,\n DeviceRememberedStatus: 'remembered'\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to set the device status as not remembered\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.setDeviceStatusNotRemembered = function setDeviceStatusNotRemembered(callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('UpdateDeviceStatus', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n DeviceKey: this.deviceKey,\n DeviceRememberedStatus: 'not_remembered'\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used to list all devices for a user\n *\n * @param {int} limit the number of devices returned in a call\n * @param {string | null} paginationToken the pagination token in case any was returned before\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess<*>} callback.onSuccess Called on success with device list.\n * @returns {void}\n */\n ;\n\n _proto.listDevices = function listDevices(limit, paginationToken, callback) {\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n var requestParams = {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n Limit: limit\n };\n\n if (paginationToken) {\n requestParams.PaginationToken = paginationToken;\n }\n\n this.client.request('ListDevices', requestParams, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess(data);\n });\n return undefined;\n }\n /**\n * This is used to globally revoke all tokens issued to a user\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess} callback.onSuccess Called on success.\n * @returns {void}\n */\n ;\n\n _proto.globalSignOut = function globalSignOut(callback) {\n var _this17 = this;\n\n if (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n return callback.onFailure(new Error('User is not authenticated'));\n }\n\n this.client.request('GlobalSignOut', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err) {\n if (err) {\n return callback.onFailure(err);\n }\n\n _this17.clearCachedUser();\n\n return callback.onSuccess('SUCCESS');\n });\n return undefined;\n }\n /**\n * This is used for the user to signOut of the application and clear the cached tokens.\n * @returns {void}\n */\n ;\n\n _proto.signOut = function signOut(revokeTokenCallback) {\n var _this18 = this;\n\n // If tokens won't be revoked, we just clean the client data.\n if (!revokeTokenCallback || typeof revokeTokenCallback !== 'function') {\n this.cleanClientData();\n return;\n }\n\n this.getSession(function (error, _session) {\n if (error) {\n return revokeTokenCallback(error);\n }\n\n _this18.revokeTokens(function (err) {\n _this18.cleanClientData();\n\n revokeTokenCallback(err);\n });\n });\n };\n\n _proto.revokeTokens = function revokeTokens(revokeTokenCallback) {\n if (revokeTokenCallback === void 0) {\n revokeTokenCallback = function revokeTokenCallback() {};\n }\n\n if (typeof revokeTokenCallback !== 'function') {\n throw new Error('Invalid revokeTokenCallback. It should be a function.');\n }\n\n var tokensToBeRevoked = [];\n\n if (!this.signInUserSession) {\n var error = new Error('User is not authenticated');\n return revokeTokenCallback(error);\n }\n\n if (!this.signInUserSession.getAccessToken()) {\n var _error = new Error('No Access token available');\n\n return revokeTokenCallback(_error);\n }\n\n var refreshToken = this.signInUserSession.getRefreshToken().getToken();\n var accessToken = this.signInUserSession.getAccessToken();\n\n if (this.isSessionRevocable(accessToken)) {\n if (refreshToken) {\n return this.revokeToken({\n token: refreshToken,\n callback: revokeTokenCallback\n });\n }\n }\n\n revokeTokenCallback();\n };\n\n _proto.isSessionRevocable = function isSessionRevocable(token) {\n if (token && typeof token.decodePayload === 'function') {\n try {\n var _token$decodePayload = token.decodePayload(),\n origin_jti = _token$decodePayload.origin_jti;\n\n return !!origin_jti;\n } catch (err) {// Nothing to do, token doesnt have origin_jti claim\n }\n }\n\n return false;\n };\n\n _proto.cleanClientData = function cleanClientData() {\n this.signInUserSession = null;\n this.clearCachedUser();\n };\n\n _proto.revokeToken = function revokeToken(_ref2) {\n var token = _ref2.token,\n callback = _ref2.callback;\n this.client.requestWithRetry('RevokeToken', {\n Token: token,\n ClientId: this.pool.getClientId()\n }, function (err) {\n if (err) {\n return callback(err);\n }\n\n callback();\n });\n }\n /**\n * This is used by a user trying to select a given MFA\n * @param {string} answerChallenge the mfa the user wants\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.sendMFASelectionAnswer = function sendMFASelectionAnswer(answerChallenge, callback) {\n var _this19 = this;\n\n var challengeResponses = {};\n challengeResponses.USERNAME = this.username;\n challengeResponses.ANSWER = answerChallenge;\n var jsonReq = {\n ChallengeName: 'SELECT_MFA_TYPE',\n ChallengeResponses: challengeResponses,\n ClientId: this.pool.getClientId(),\n Session: this.Session\n };\n\n if (this.getUserContextData()) {\n jsonReq.UserContextData = this.getUserContextData();\n }\n\n this.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n _this19.Session = data.Session;\n\n if (answerChallenge === 'SMS_MFA') {\n return callback.mfaRequired(data.ChallengeName, data.ChallengeParameters);\n }\n\n if (answerChallenge === 'SOFTWARE_TOKEN_MFA') {\n return callback.totpRequired(data.ChallengeName, data.ChallengeParameters);\n }\n\n return undefined;\n });\n }\n /**\n * This returns the user context data for advanced security feature.\n * @returns {string} the user context data from CognitoUserPool\n */\n ;\n\n _proto.getUserContextData = function getUserContextData() {\n var pool = this.pool;\n return pool.getUserContextData(this.username);\n }\n /**\n * This is used by an authenticated or a user trying to authenticate to associate a TOTP MFA\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.associateSoftwareToken = function associateSoftwareToken(callback) {\n var _this20 = this;\n\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n this.client.request('AssociateSoftwareToken', {\n Session: this.Session\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n _this20.Session = data.Session;\n return callback.associateSecretCode(data.SecretCode);\n });\n } else {\n this.client.request('AssociateSoftwareToken', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.associateSecretCode(data.SecretCode);\n });\n }\n }\n /**\n * This is used by an authenticated or a user trying to authenticate to verify a TOTP MFA\n * @param {string} totpCode The MFA code entered by the user.\n * @param {string} friendlyDeviceName The device name we are assigning to the device.\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n ;\n\n _proto.verifySoftwareToken = function verifySoftwareToken(totpCode, friendlyDeviceName, callback) {\n var _this21 = this;\n\n if (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n this.client.request('VerifySoftwareToken', {\n Session: this.Session,\n UserCode: totpCode,\n FriendlyDeviceName: friendlyDeviceName\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n _this21.Session = data.Session;\n var challengeResponses = {};\n challengeResponses.USERNAME = _this21.username;\n var jsonReq = {\n ChallengeName: 'MFA_SETUP',\n ClientId: _this21.pool.getClientId(),\n ChallengeResponses: challengeResponses,\n Session: _this21.Session\n };\n\n if (_this21.getUserContextData()) {\n jsonReq.UserContextData = _this21.getUserContextData();\n }\n\n _this21.client.request('RespondToAuthChallenge', jsonReq, function (errRespond, dataRespond) {\n if (errRespond) {\n return callback.onFailure(errRespond);\n }\n\n _this21.signInUserSession = _this21.getCognitoUserSession(dataRespond.AuthenticationResult);\n\n _this21.cacheTokens();\n\n return callback.onSuccess(_this21.signInUserSession);\n });\n\n return undefined;\n });\n } else {\n this.client.request('VerifySoftwareToken', {\n AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n UserCode: totpCode,\n FriendlyDeviceName: friendlyDeviceName\n }, function (err, data) {\n if (err) {\n return callback.onFailure(err);\n }\n\n return callback.onSuccess(data);\n });\n }\n };\n\n return CognitoUser;\n}();\n\nexport { CognitoUser as default };","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { version } from './version';\nvar BASE_USER_AGENT = \"aws-amplify/\" + version;\nexport var Platform = {\n userAgent: BASE_USER_AGENT + \" js\",\n product: '',\n navigator: null,\n isReactNative: false\n};\n\nif (typeof navigator !== 'undefined' && navigator.product) {\n Platform.product = navigator.product || '';\n Platform.navigator = navigator || null;\n\n switch (navigator.product) {\n case 'ReactNative':\n Platform.userAgent = BASE_USER_AGENT + \" react-native\";\n Platform.isReactNative = true;\n break;\n\n default:\n Platform.userAgent = BASE_USER_AGENT + \" js\";\n Platform.isReactNative = false;\n break;\n }\n}\n\nexport var getUserAgent = function getUserAgent() {\n return Platform.userAgent;\n};\n/**\n * @deprecated use named import\n */\n\nexport default Platform;","import { getUserAgent } from \"./Platform\"; // constructor\n\nfunction UserAgent() {} // public\n\n\nUserAgent.prototype.userAgent = getUserAgent();\nexport var appendToCognitoUserAgent = function appendToCognitoUserAgent(content) {\n if (!content) {\n return;\n }\n\n if (UserAgent.prototype.userAgent && !UserAgent.prototype.userAgent.includes(content)) {\n UserAgent.prototype.userAgent = UserAgent.prototype.userAgent.concat(' ', content);\n }\n\n if (!UserAgent.prototype.userAgent || UserAgent.prototype.userAgent === '') {\n UserAgent.prototype.userAgent = content;\n }\n}; // class for defining the amzn user-agent\n\nexport default UserAgent;","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport 'isomorphic-unfetch';\nimport UserAgent from './UserAgent';\n\nvar CognitoError = /*#__PURE__*/function (_Error) {\n _inheritsLoose(CognitoError, _Error);\n\n function CognitoError(message, code, name, statusCode) {\n var _this;\n\n _this = _Error.call(this, message) || this;\n _this.code = code;\n _this.name = name;\n _this.statusCode = statusCode;\n return _this;\n }\n\n return CognitoError;\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n/** @class */\n\n\nvar Client = /*#__PURE__*/function () {\n /**\n * Constructs a new AWS Cognito Identity Provider client object\n * @param {string} region AWS region\n * @param {string} endpoint endpoint\n * @param {object} fetchOptions options for fetch API (only credentials is supported)\n */\n function Client(region, endpoint, fetchOptions) {\n this.endpoint = endpoint || \"https://cognito-idp.\" + region + \".amazonaws.com/\";\n\n var _ref = fetchOptions || {},\n credentials = _ref.credentials;\n\n this.fetchOptions = credentials ? {\n credentials: credentials\n } : {};\n }\n /**\n * Makes an unauthenticated request on AWS Cognito Identity Provider API\n * using fetch\n * @param {string} operation API operation\n * @param {object} params Input parameters\n * @returns Promise\n */\n\n\n var _proto = Client.prototype;\n\n _proto.promisifyRequest = function promisifyRequest(operation, params) {\n var _this2 = this;\n\n return new Promise(function (resolve, reject) {\n _this2.request(operation, params, function (err, data) {\n if (err) {\n reject(new CognitoError(err.message, err.code, err.name, err.statusCode));\n } else {\n resolve(data);\n }\n });\n });\n };\n\n _proto.requestWithRetry = function requestWithRetry(operation, params, callback) {\n var _this3 = this;\n\n var MAX_DELAY_IN_MILLIS = 5 * 1000;\n jitteredExponentialRetry(function (p) {\n return new Promise(function (res, rej) {\n _this3.request(operation, p, function (error, result) {\n if (error) {\n rej(error);\n } else {\n res(result);\n }\n });\n });\n }, [params], MAX_DELAY_IN_MILLIS).then(function (result) {\n return callback(null, result);\n })[\"catch\"](function (error) {\n return callback(error);\n });\n }\n /**\n * Makes an unauthenticated request on AWS Cognito Identity Provider API\n * using fetch\n * @param {string} operation API operation\n * @param {object} params Input parameters\n * @param {function} callback Callback called when a response is returned\n * @returns {void}\n */\n ;\n\n _proto.request = function request(operation, params, callback) {\n var headers = {\n 'Content-Type': 'application/x-amz-json-1.1',\n 'X-Amz-Target': \"AWSCognitoIdentityProviderService.\" + operation,\n 'X-Amz-User-Agent': UserAgent.prototype.userAgent\n };\n var options = Object.assign({}, this.fetchOptions, {\n headers: headers,\n method: 'POST',\n mode: 'cors',\n cache: 'no-cache',\n body: JSON.stringify(params)\n });\n var response;\n var responseJsonData;\n fetch(this.endpoint, options).then(function (resp) {\n response = resp;\n return resp;\n }, function (err) {\n // If error happens here, the request failed\n // if it is TypeError throw network error\n if (err instanceof TypeError) {\n throw new Error('Network error');\n }\n\n throw err;\n }).then(function (resp) {\n return resp.json()[\"catch\"](function () {\n return {};\n });\n }).then(function (data) {\n // return parsed body stream\n if (response.ok) return callback(null, data);\n responseJsonData = data; // Taken from aws-sdk-js/lib/protocol/json.js\n // eslint-disable-next-line no-underscore-dangle\n\n var code = (data.__type || data.code).split('#').pop();\n var error = new Error(data.message || data.Message || null);\n error.name = code;\n error.code = code;\n return callback(error);\n })[\"catch\"](function (err) {\n // first check if we have a service error\n if (response && response.headers && response.headers.get('x-amzn-errortype')) {\n try {\n var code = response.headers.get('x-amzn-errortype').split(':')[0];\n var error = new Error(response.status ? response.status.toString() : null);\n error.code = code;\n error.name = code;\n error.statusCode = response.status;\n return callback(error);\n } catch (ex) {\n return callback(err);\n } // otherwise check if error is Network error\n\n } else if (err instanceof Error && err.message === 'Network error') {\n err.code = 'NetworkError';\n }\n\n return callback(err);\n });\n };\n\n return Client;\n}();\n\nexport { Client as default };\nvar logger = {\n debug: function debug() {// Intentionally blank. This package doesn't have logging\n }\n};\n/**\n * For now, all errors are retryable.\n */\n\nvar NonRetryableError = /*#__PURE__*/function (_Error2) {\n _inheritsLoose(NonRetryableError, _Error2);\n\n function NonRetryableError(message) {\n var _this4;\n\n _this4 = _Error2.call(this, message) || this;\n _this4.nonRetryable = true;\n return _this4;\n }\n\n return NonRetryableError;\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nvar isNonRetryableError = function isNonRetryableError(obj) {\n var key = 'nonRetryable';\n return obj && obj[key];\n};\n\nfunction retry(functionToRetry, args, delayFn, attempt) {\n if (attempt === void 0) {\n attempt = 1;\n }\n\n if (typeof functionToRetry !== 'function') {\n throw Error('functionToRetry must be a function');\n }\n\n logger.debug(functionToRetry.name + \" attempt #\" + attempt + \" with args: \" + JSON.stringify(args));\n return functionToRetry.apply(void 0, args)[\"catch\"](function (err) {\n logger.debug(\"error on \" + functionToRetry.name, err);\n\n if (isNonRetryableError(err)) {\n logger.debug(functionToRetry.name + \" non retryable error\", err);\n throw err;\n }\n\n var retryIn = delayFn(attempt, args, err);\n logger.debug(functionToRetry.name + \" retrying in \" + retryIn + \" ms\");\n\n if (retryIn !== false) {\n return new Promise(function (res) {\n return setTimeout(res, retryIn);\n }).then(function () {\n return retry(functionToRetry, args, delayFn, attempt + 1);\n });\n } else {\n throw err;\n }\n });\n}\n\nfunction jitteredBackoff(maxDelayMs) {\n var BASE_TIME_MS = 100;\n var JITTER_FACTOR = 100;\n return function (attempt) {\n var delay = Math.pow(2, attempt) * BASE_TIME_MS + JITTER_FACTOR * Math.random();\n return delay > maxDelayMs ? false : delay;\n };\n}\n\nvar MAX_DELAY_MS = 5 * 60 * 1000;\n\nfunction jitteredExponentialRetry(functionToRetry, args, maxDelayMs) {\n if (maxDelayMs === void 0) {\n maxDelayMs = MAX_DELAY_MS;\n }\n\n return retry(functionToRetry, args, jitteredBackoff(maxDelayMs));\n}\n\n;","/*!\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport Client from './Client';\nimport CognitoUser from './CognitoUser';\nimport StorageHelper from './StorageHelper';\nvar USER_POOL_ID_MAX_LENGTH = 55;\n/** @class */\n\nvar CognitoUserPool = /*#__PURE__*/function () {\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 * @param {string} data.endpoint Optional custom service endpoint.\n * @param {object} data.fetchOptions Optional options for fetch API.\n * (only credentials option is supported)\n * @param {object} data.Storage Optional storage object.\n * @param {boolean} data.AdvancedSecurityDataCollectionFlag Optional:\n * boolean flag indicating if the data collection is enabled\n * to support cognito advanced security features. By default, this\n * flag is set to true.\n */\n function CognitoUserPool(data, wrapRefreshSessionCallback) {\n var _ref = data || {},\n UserPoolId = _ref.UserPoolId,\n ClientId = _ref.ClientId,\n endpoint = _ref.endpoint,\n fetchOptions = _ref.fetchOptions,\n AdvancedSecurityDataCollectionFlag = _ref.AdvancedSecurityDataCollectionFlag;\n\n if (!UserPoolId || !ClientId) {\n throw new Error('Both UserPoolId and ClientId are required.');\n }\n\n if (UserPoolId.length > USER_POOL_ID_MAX_LENGTH || !/^[\\w-]+_[0-9a-zA-Z]+$/.test(UserPoolId)) {\n throw new Error('Invalid UserPoolId format.');\n }\n\n var region = UserPoolId.split('_')[0];\n this.userPoolId = UserPoolId;\n this.clientId = ClientId;\n this.client = new Client(region, endpoint, fetchOptions);\n /**\n * By default, AdvancedSecurityDataCollectionFlag is set to true,\n * if no input value is provided.\n */\n\n this.advancedSecurityDataCollectionFlag = AdvancedSecurityDataCollectionFlag !== false;\n this.storage = data.Storage || new StorageHelper().getStorage();\n\n if (wrapRefreshSessionCallback) {\n this.wrapRefreshSessionCallback = wrapRefreshSessionCallback;\n }\n }\n /**\n * @returns {string} the user pool id\n */\n\n\n var _proto = CognitoUserPool.prototype;\n\n _proto.getUserPoolId = function getUserPoolId() {\n return this.userPoolId;\n }\n /**\n * @returns {string} the client id\n */\n ;\n\n _proto.getClientId = function getClientId() {\n return this.clientId;\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 /**\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 {(AttributeArg[])=} clientMetadata Client metadata.\n * @param {nodeCallback} callback Called on error or with the new user.\n * @param {ClientMetadata} clientMetadata object which is passed from client to Cognito Lambda trigger\n * @returns {void}\n */\n ;\n\n _proto.signUp = function signUp(username, password, userAttributes, validationData, callback, clientMetadata) {\n var _this = this;\n\n var jsonReq = {\n ClientId: this.clientId,\n Username: username,\n Password: password,\n UserAttributes: userAttributes,\n ValidationData: validationData,\n ClientMetadata: clientMetadata\n };\n\n if (this.getUserContextData(username)) {\n jsonReq.UserContextData = this.getUserContextData(username);\n }\n\n this.client.request('SignUp', jsonReq, function (err, data) {\n if (err) {\n return callback(err, null);\n }\n\n var cognitoUser = {\n Username: username,\n Pool: _this,\n Storage: _this.storage\n };\n var returnData = {\n user: new CognitoUser(cognitoUser),\n userConfirmed: data.UserConfirmed,\n userSub: data.UserSub,\n codeDeliveryDetails: data.CodeDeliveryDetails\n };\n return callback(null, returnData);\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 ;\n\n _proto.getCurrentUser = function getCurrentUser() {\n var lastUserKey = \"CognitoIdentityServiceProvider.\" + this.clientId + \".LastAuthUser\";\n var lastAuthUser = this.storage.getItem(lastUserKey);\n\n if (lastAuthUser) {\n var cognitoUser = {\n Username: lastAuthUser,\n Pool: this,\n Storage: this.storage\n };\n return new CognitoUser(cognitoUser);\n }\n\n return null;\n }\n /**\n * This method returns the encoded data string used for cognito advanced security feature.\n * This would be generated only when developer has included the JS used for collecting the\n * data on their client. Please refer to documentation to know more about using AdvancedSecurity\n * features\n * @param {string} username the username for the context data\n * @returns {string} the user context data\n **/\n ;\n\n _proto.getUserContextData = function getUserContextData(username) {\n if (typeof AmazonCognitoAdvancedSecurityData === 'undefined') {\n return undefined;\n }\n /* eslint-disable */\n\n\n var amazonCognitoAdvancedSecurityDataConst = AmazonCognitoAdvancedSecurityData;\n /* eslint-enable */\n\n if (this.advancedSecurityDataCollectionFlag) {\n var advancedSecurityData = amazonCognitoAdvancedSecurityDataConst.getData(username, this.userPoolId, this.clientId);\n\n if (advancedSecurityData) {\n var userContextData = {\n EncodedData: advancedSecurityData\n };\n return userContextData;\n }\n }\n\n return {};\n };\n\n return CognitoUserPool;\n}();\n\nexport { CognitoUserPool as default };","import * as Cookies from 'js-cookie';\n/** @class */\n\nvar CookieStorage = /*#__PURE__*/function () {\n /**\n * Constructs a new CookieStorage object\n * @param {object} data Creation options.\n * @param {string} data.domain Cookies domain (mandatory).\n * @param {string} data.path Cookies path (default: '/')\n * @param {integer} data.expires Cookie expiration (in days, default: 365)\n * @param {boolean} data.secure Cookie secure flag (default: true)\n * @param {string} data.sameSite Cookie request behaviour (default: null)\n */\n function CookieStorage(data) {\n if (data.domain) {\n this.domain = data.domain;\n } else {\n throw new Error('The domain of cookieStorage can not be undefined.');\n }\n\n if (data.path) {\n this.path = data.path;\n } else {\n this.path = '/';\n }\n\n if (Object.prototype.hasOwnProperty.call(data, 'expires')) {\n this.expires = data.expires;\n } else {\n this.expires = 365;\n }\n\n if (Object.prototype.hasOwnProperty.call(data, 'secure')) {\n this.secure = data.secure;\n } else {\n this.secure = true;\n }\n\n if (Object.prototype.hasOwnProperty.call(data, 'sameSite')) {\n if (!['strict', 'lax', 'none'].includes(data.sameSite)) {\n throw new Error('The sameSite value of cookieStorage must be \"lax\", \"strict\" or \"none\".');\n }\n\n if (data.sameSite === 'none' && !this.secure) {\n throw new Error('sameSite = None requires the Secure attribute in latest browser versions.');\n }\n\n this.sameSite = data.sameSite;\n } else {\n this.sameSite = null;\n }\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\n\n var _proto = CookieStorage.prototype;\n\n _proto.setItem = function setItem(key, value) {\n var options = {\n path: this.path,\n expires: this.expires,\n domain: this.domain,\n secure: this.secure\n };\n\n if (this.sameSite) {\n options.sameSite = this.sameSite;\n }\n\n Cookies.set(key, value, options);\n return Cookies.get(key);\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 ;\n\n _proto.getItem = function getItem(key) {\n return Cookies.get(key);\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 ;\n\n _proto.removeItem = function removeItem(key) {\n var options = {\n path: this.path,\n expires: this.expires,\n domain: this.domain,\n secure: this.secure\n };\n\n if (this.sameSite) {\n options.sameSite = this.sameSite;\n }\n\n return Cookies.remove(key, options);\n }\n /**\n * This is used to clear the storage of optional\n * items that were previously set\n * @returns {} an empty object\n */\n ;\n\n _proto.clear = function clear() {\n var cookies = Cookies.get();\n var numKeys = Object.keys(cookies).length;\n\n for (var index = 0; index < numKeys; ++index) {\n this.removeItem(Object.keys(cookies)[index]);\n }\n\n return {};\n };\n\n return CookieStorage;\n}();\n\nexport { CookieStorage as default };","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*\n * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { Amplify, ServiceWorker } from '@aws-amplify/core';\nimport { Auth } from '@aws-amplify/auth';\nimport Cache from '@aws-amplify/cache';\n/** Always importing Auth when users import Amplify such that\n for unauthenticated access (no sign in and sign up),\n users don't have to import Auth explicitly **/\nAmplify.Auth = Auth;\nAmplify.Cache = Cache;\nAmplify.ServiceWorker = ServiceWorker;\nexport { Analytics, AWSPinpointProvider, AWSKinesisProvider, AWSKinesisFirehoseProvider, AmazonPersonalizeProvider, } from '@aws-amplify/analytics';\nexport { Auth } from '@aws-amplify/auth';\nexport { Storage, StorageClass } from '@aws-amplify/storage';\nexport { API, APIClass, graphqlOperation } from '@aws-amplify/api';\nexport { AuthModeStrategyType, DataStore, Predicates, SortDirection, syncExpression, } from '@aws-amplify/datastore';\nexport { PubSub } from '@aws-amplify/pubsub';\nexport { default as Cache } from '@aws-amplify/cache';\nexport { Interactions } from '@aws-amplify/interactions';\nexport * from '@aws-amplify/ui';\nexport { XR } from '@aws-amplify/xr';\nexport { Predictions } from '@aws-amplify/predictions';\nexport { ConsoleLogger as Logger, Hub, JS, ClientDevice, Signer, I18n, ServiceWorker, AWSCloudWatchProvider, } from '@aws-amplify/core';\nexport { withSSRContext } from './withSSRContext';\nexport { Geo } from '@aws-amplify/geo';\nexport { Amplify };\n/**\n * @deprecated use named import\n */\nexport default Amplify;\n//# sourceMappingURL=index.js.map"],"sourceRoot":""}