{"version":3,"sources":["webpack:///./node_modules/aws-amplify/lib-esm/index.js","webpack:///./node_modules/amazon-cognito-identity-js/es/AuthenticationDetails.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/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/async-validator/es/util.js","webpack:///./node_modules/async-validator/es/rule/required.js","webpack:///./node_modules/async-validator/es/rule/whitespace.js","webpack:///./node_modules/async-validator/es/rule/type.js","webpack:///./node_modules/async-validator/es/rule/range.js","webpack:///./node_modules/async-validator/es/rule/enum.js","webpack:///./node_modules/async-validator/es/rule/pattern.js","webpack:///./node_modules/async-validator/es/rule/index.js","webpack:///./node_modules/async-validator/es/validator/string.js","webpack:///./node_modules/async-validator/es/validator/method.js","webpack:///./node_modules/async-validator/es/validator/number.js","webpack:///./node_modules/async-validator/es/validator/boolean.js","webpack:///./node_modules/async-validator/es/validator/regexp.js","webpack:///./node_modules/async-validator/es/validator/integer.js","webpack:///./node_modules/async-validator/es/validator/float.js","webpack:///./node_modules/async-validator/es/validator/array.js","webpack:///./node_modules/async-validator/es/validator/object.js","webpack:///./node_modules/async-validator/es/validator/enum.js","webpack:///./node_modules/async-validator/es/validator/pattern.js","webpack:///./node_modules/async-validator/es/validator/date.js","webpack:///./node_modules/async-validator/es/validator/required.js","webpack:///./node_modules/async-validator/es/validator/type.js","webpack:///./node_modules/async-validator/es/validator/index.js","webpack:///./node_modules/async-validator/es/messages.js","webpack:///./node_modules/async-validator/es/index.js"],"names":["Auth","Analytics","API","Storage","I18n","Cache","PubSub","Logger","ServiceWorker","Interactions","UI","XR","Predictions","_classCallCheck","instance","Constructor","TypeError","dbits","AuthenticationDetails","data","this","_ref","ValidationData","Username","Password","AuthParameters","ClientMetadata","validationData","authParameters","clientMetadata","username","password","prototype","getUsername","getPassword","getValidationData","getAuthParameters","getClientMetadata","BigInteger","a","b","fromString","nbi","canary","j_lm","am1","i","x","w","j","c","n","v","Math","floor","am2","xl","xh","l","h","m","am3","inBrowser","navigator","appName","am","DB","DM","DV","BI_FP","FV","pow","F1","F2","rr","vv","BI_RM","BI_RC","Array","charCodeAt","int2char","charAt","intAt","s","bnpCopyTo","r","t","bnpFromInt","nbv","fromInt","bnpFromString","k","Error","length","mi","sh","clamp","ZERO","subTo","bnpClamp","bnToString","negate","toString","d","km","p","bnNegate","bnAbs","bnCompareTo","nbits","bnBitLength","bnpDLShiftTo","bnpDRShiftTo","max","bnpLShiftTo","bs","cbs","bm","ds","bnpRShiftTo","bnpSubTo","min","bnpMultiplyTo","abs","y","bnpSquareTo","bnpDivRemTo","q","pm","pt","copyTo","ts","ms","nsh","lShiftTo","ys","y0","yt","d1","d2","e","dlShiftTo","compareTo","ONE","qd","drShiftTo","rShiftTo","bnMod","divRemTo","bnpInvDigit","bnEquals","bnpAddTo","bnAdd","addTo","bnSubtract","bnMultiply","multiplyTo","bnDivide","Montgomery","mp","invDigit","mpl","mph","um","mt2","montConvert","montRevert","reduce","montReduce","u0","montSqrTo","squareTo","montMulTo","bnModPow","callback","bitLength","z","g","k1","convert","g2","sqrTo","mulTo","is1","r2","result","revert","mod","equals","add","subtract","multiply","divide","modPow","nBytes","from","lib","WordArray","random","initN","newPasswordRequiredChallengeUserAttributePrefix","AuthenticationHelper","PoolName","N","hexHash","smallAValue","generateRandomSmallA","getLargeAValue","infoBits","poolName","getSmallAValue","_this","largeAValue","calculateA","err","hexRandom","randomBigInt","smallABigInt","generateRandomString","getRandomPassword","randomPassword","getSaltDevices","SaltToHashDevices","getVerifierDevices","verifierDevices","generateHashDevice","deviceGroupKey","_this2","combinedString","hashedString","hash","padHex","verifierDevicesNotPadded","_this3","A","calculateU","B","UHexHash","finalU","buf","str","create","hashHex","join","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","intValue2","err2","getNewPasswordRequiredChallengeUserAttributePrefix","bigInt","hashStr","indexOf","CognitoJwtToken","token","jwtToken","payload","decodePayload","getJwtToken","getExpiration","exp","getIssuedAt","iat","split","JSON","parse","_possibleConstructorReturn","self","call","ReferenceError","_inherits","subClass","superClass","Object","constructor","value","enumerable","writable","configurable","setPrototypeOf","__proto__","CognitoAccessToken","_CognitoJwtToken","arguments","undefined","AccessToken","CognitoIdToken","IdToken","CognitoRefreshToken","RefreshToken","getToken","CognitoUserSession","ClockDrift","idToken","refreshToken","accessToken","clockDrift","calculateClockDrift","getIdToken","getRefreshToken","getAccessToken","getClockDrift","now","Date","isValid","adjusted","monthNames","weekNames","DateHelper","getNowString","weekDay","getUTCDay","month","getUTCMonth","day","getUTCDate","hours","getUTCHours","minutes","getUTCMinutes","seconds","getUTCSeconds","year","getUTCFullYear","dateNow","CognitoUserAttribute","Name","Value","getValue","setValue","getName","setName","name","stringify","toJSON","dataMemory","MemoryStorage","setItem","key","getItem","hasOwnProperty","removeItem","clear","StorageHelper","storageWindow","window","localStorage","exception","getStorage","CognitoUser","Pool","pool","Session","client","signInUserSession","authenticationFlowType","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","message","SECRET_BLOCK","signatureString","challengeResponses","PASSWORD_CLAIM_SECRET_BLOCK","TIMESTAMP","PASSWORD_CLAIM_SIGNATURE","respondToAuthChallenge","challenge","challengeCallback","errChallenge","dataChallenge","code","toLowerCase","clearCachedDeviceKeyAndPassword","jsonReqResp","ChallengeResponses","errAuthenticate","dataAuthenticate","authenticateUserInternal","PASSWORD","authResult","mfaRequired","selectMFAType","mfaSetup","totpRequired","userAttributes","rawRequiredAttributes","requiredAttributes","userAttributesPrefix","substr","newPasswordRequired","newDeviceMetadata","NewDeviceMetadata","DeviceGroupKey","DeviceKey","errGenHash","deviceSecretVerifierConfig","Salt","PasswordVerifier","DeviceSecretVerifierConfig","DeviceName","userAgent","errConfirm","dataConfirm","cacheDeviceKeyAndPassword","UserConfirmationNecessary","getDeviceResponse","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","mfaEnabled","DeliveryMedium","AttributeName","push","MFAOptions","setUserMfaPreference","smsMfaSettings","softwareTokenMfaSettings","SMSMfaSettings","SoftwareTokenMfaSettings","disableMFA","deleteUser","_this9","clearCachedUser","updateAttributes","attributes","UserAttributes","getUserAttributes","userData","attributeList","attribute","userAttribute","getMFAOptions","getUserData","params","_this10","bypassCache","latestUserData","cacheUserData","refresh","refreshSession","refreshError","deleteAttributes","UserAttributeNames","resendConfirmationCode","getSession","idTokenKey","accessTokenKey","refreshTokenKey","clockDriftKey","parseInt","sessionData","cachedSession","_this11","REFRESH_TOKEN","lastUserKey","deviceKeyKey","authenticationResult","clearCachedTokens","randomPasswordKey","deviceGroupKeyKey","forgotPassword","inputVerificationCode","confirmPassword","getAttributeVerificationCode","attributeName","verifyAttribute","Code","getDevice","forgetSpecificDevice","forgetDevice","_this12","setDeviceStatusRemembered","DeviceRememberedStatus","setDeviceStatusNotRemembered","listDevices","limit","paginationToken","Limit","PaginationToken","globalSignOut","_this13","signOut","sendMFASelectionAnswer","_this14","associateSoftwareToken","_this15","associateSecretCode","SecretCode","verifySoftwareToken","totpCode","friendlyDeviceName","_this16","UserCode","FriendlyDeviceName","errRespond","dataRespond","UserAgent","Client","region","endpoint","operation","headers","options","method","mode","cache","body","response","fetch","then","resp","json","catch","ok","__type","pop","error","Message","get","_error","statusCode","status","ex","CognitoUserPool","UserPoolId","AdvancedSecurityDataCollectionFlag","test","userPoolId","clientId","advancedSecurityDataCollectionFlag","signUp","cognitoUser","returnData","user","userConfirmed","UserConfirmed","userSub","UserSub","codeDeliveryDetails","CodeDeliveryDetails","getCurrentUser","lastAuthUser","AmazonCognitoAdvancedSecurityData","amazonCognitoAdvancedSecurityDataConst","advancedSecurityData","getData","userContextData","EncodedData","CookieStorage","domain","path","expires","secure","cookies","index","formatRegExp","warning","format","_len","args","_key","f","len","apply","replace","Number","_","arg","isNativeStringType","type","isEmptyValue","isArray","asyncParallelArray","arr","func","results","total","arrLength","count","errors","asyncSerialArray","next","original","flattenObjArr","objArr","ret","asyncMap","option","first","flattenArr","firstFields","objArrKeys","objArrLength","complementError","rule","oe","field","fullField","deepMerge","target","source","required","messages","whitespace","pattern","email","url","RegExp","hex","types","integer","number","float","array","regexp","date","getTime","getMonth","getYear","isNaN","object","match","custom","ruleType","range","spRegexp","val","num","ENUM","lastIndex","mismatch","_pattern","string","validate","floatFn","dateObject","boolean","newMessages","invalid","clone","cloned","Schema","descriptor","rules","_messages","define","item","source_","o","oc","series","transform","validator","getValidationMethod","getType","errorFields","doIt","deep","fields","defaultField","addFullfield","schema","cb","map","fieldsSchema","fieldSchema","bind","errs","res","complete","messageIndex","splice","register"],"mappings":"0HAAA,mLAuBe,cACf,OAAQA,KAAO,OACf,OAAQC,UAAY,OACpB,OAAQC,IAAM,OACd,OAAQC,QAAU,OAClB,OAAQC,KAAO,OACf,OAAQC,MAAQ,OAChB,OAAQC,OAAS,OACjB,OAAQC,OAAS,OACjB,OAAQC,cAAgB,OACxB,OAAQC,aAAe,OACvB,OAAQC,GAAK,EACb,OAAQC,GAAK,OACb,OAAQC,YAAc,Q,oCCpCtB,SAASC,EAAgBC,EAAUC,GAAe,KAAMD,aAAoBC,GAAgB,MAAM,IAAIC,UAAU;;;;;;;;;;;;;;;;6TAoBhH,ICyCIC,EDzCAC,EAAwB,WAS3B,SAASA,EAAsBC,GAC9BN,EAAgBO,KAAMF,GAEtB,IAAIG,EAAOF,GAAQ,GACfG,EAAiBD,EAAKC,eACtBC,EAAWF,EAAKE,SAChBC,EAAWH,EAAKG,SAChBC,EAAiBJ,EAAKI,eACtBC,EAAiBL,EAAKK,eAE1BN,KAAKO,eAAiBL,GAAkB,GACxCF,KAAKQ,eAAiBH,GAAkB,GACxCL,KAAKS,eAAiBH,GAAkB,GACxCN,KAAKU,SAAWP,EAChBH,KAAKW,SAAWP,EAgDjB,OAxCAN,EAAsBc,UAAUC,YAAc,WAC7C,OAA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erX,EAAKtH,QAAQ,WAIhC,OAHsB,IAAlB2e,GACFrX,EAAKsX,OAAOD,EAAc,GAER,IAAhBrX,EAAK3S,QAA4B,aAAZ2S,EAAK,GACrB,GAAWgT,SAEb,GAAWpqB,KAAKytB,QAAQ5D,MAAU,IAI7C+C,GAAO+B,SAAW,SAAkBvG,EAAMmF,GACxC,GAAyB,oBAAdA,EACT,MAAM,IAAI/oB,MAAM,oEAElB,GAAW4jB,GAAQmF,GAGrBX,GAAOvC,SAAW,GAEH","file":"js/chunk-vendors~c060ebf0.5b3dfda5.js","sourcesContent":["/*\n * Copyright 2017-2017 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 Analytics, { AnalyticsClass, AWSPinpointProvider, AWSKinesisProvider, AmazonPersonalizeProvider, } from '@aws-amplify/analytics';\nimport Auth, { AuthClass } from '@aws-amplify/auth';\nimport Storage, { StorageClass } from '@aws-amplify/storage';\nimport API, { APIClass, graphqlOperation } from '@aws-amplify/api';\nimport PubSub, { PubSubClass } from '@aws-amplify/pubsub';\nimport Cache from '@aws-amplify/cache';\nimport Interactions, { InteractionsClass } from '@aws-amplify/interactions';\nimport * as UI from '@aws-amplify/ui';\nimport XR, { XRClass } from '@aws-amplify/xr';\nimport Predictions from '@aws-amplify/predictions';\nimport Amplify, { ConsoleLogger as Logger, Hub, JS, ClientDevice, Signer, I18n, ServiceWorker, } from '@aws-amplify/core';\nexport default Amplify;\nAmplify.Auth = Auth;\nAmplify.Analytics = Analytics;\nAmplify.API = API;\nAmplify.Storage = Storage;\nAmplify.I18n = I18n;\nAmplify.Cache = Cache;\nAmplify.PubSub = PubSub;\nAmplify.Logger = Logger;\nAmplify.ServiceWorker = ServiceWorker;\nAmplify.Interactions = Interactions;\nAmplify.UI = UI;\nAmplify.XR = XR;\nAmplify.Predictions = Predictions;\nexport { Auth, Analytics, Storage, API, PubSub, I18n, Logger, Hub, Cache, JS, ClientDevice, Signer, ServiceWorker, Interactions, UI, XR, Predictions, };\nexport { AuthClass, AnalyticsClass, APIClass, StorageClass, PubSubClass, InteractionsClass, XRClass, AWSPinpointProvider, AWSKinesisProvider, AmazonPersonalizeProvider, };\nexport { graphqlOperation };\n//# sourceMappingURL=index.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nvar AuthenticationDetails = function () {\n\t/**\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\tfunction AuthenticationDetails(data) {\n\t\t_classCallCheck(this, AuthenticationDetails);\n\n\t\tvar _ref = data || {},\n\t\t ValidationData = _ref.ValidationData,\n\t\t Username = _ref.Username,\n\t\t Password = _ref.Password,\n\t\t AuthParameters = _ref.AuthParameters,\n\t\t ClientMetadata = _ref.ClientMetadata;\n\n\t\tthis.validationData = ValidationData || {};\n\t\tthis.authParameters = AuthParameters || {};\n\t\tthis.clientMetadata = ClientMetadata || {};\n\t\tthis.username = Username;\n\t\tthis.password = Password;\n\t}\n\n\t/**\n * @returns {string} the record's username\n */\n\n\n\tAuthenticationDetails.prototype.getUsername = function getUsername() {\n\t\treturn this.username;\n\t};\n\n\t/**\n * @returns {string} the record's password\n */\n\n\n\tAuthenticationDetails.prototype.getPassword = function getPassword() {\n\t\treturn this.password;\n\t};\n\n\t/**\n * @returns {Array} the record's validationData\n */\n\n\n\tAuthenticationDetails.prototype.getValidationData = function getValidationData() {\n\t\treturn this.validationData;\n\t};\n\n\t/**\n * @returns {Array} the record's authParameters\n */\n\n\n\tAuthenticationDetails.prototype.getAuthParameters = function getAuthParameters() {\n\t\treturn this.authParameters;\n\t};\n\n\t/**\n * @returns {ClientMetadata} the clientMetadata for a Lambda trigger\n */\n\n\n\tAuthenticationDetails.prototype.getClientMetadata = function getClientMetadata() {\n\t\treturn this.clientMetadata;\n\t};\n\n\treturn AuthenticationDetails;\n}();\n\nexport default AuthenticationDetails;","// 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\n\nexport default BigInteger;\n\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\n// (public) Constructor\nfunction BigInteger(a, b) {\n\tif (a != null) this.fromString(a, b);\n}\n\n// return new, unset BigInteger\nfunction nbi() {\n\treturn new BigInteger(null);\n}\n\n// Bits per digit\nvar dbits;\n\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = (canary & 0xffffff) == 0xefcafe;\n\n// 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\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)\nfunction am1(i, x, w, j, c, n) {\n\twhile (--n >= 0) {\n\t\tvar v = x * this[i++] + w[j] + c;\n\t\tc = Math.floor(v / 0x4000000);\n\t\tw[j++] = v & 0x3ffffff;\n\t}\n\treturn c;\n}\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)\nfunction am2(i, x, w, j, c, n) {\n\tvar xl = x & 0x7fff,\n\t xh = x >> 15;\n\twhile (--n >= 0) {\n\t\tvar l = this[i] & 0x7fff;\n\t\tvar h = this[i++] >> 15;\n\t\tvar m = xh * l + h * xl;\n\t\tl = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n\t\tc = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n\t\tw[j++] = l & 0x3fffffff;\n\t}\n\treturn c;\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i, x, w, j, c, n) {\n\tvar xl = x & 0x3fff,\n\t xh = x >> 14;\n\twhile (--n >= 0) {\n\t\tvar l = this[i] & 0x3fff;\n\t\tvar h = this[i++] >> 14;\n\t\tvar m = xh * l + h * xl;\n\t\tl = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n\t\tc = (l >> 28) + (m >> 14) + xh * h;\n\t\tw[j++] = l & 0xfffffff;\n\t}\n\treturn c;\n}\nvar inBrowser = typeof navigator !== 'undefined';\nif (inBrowser && j_lm && navigator.appName == 'Microsoft Internet Explorer') {\n\tBigInteger.prototype.am = am2;\n\tdbits = 30;\n} else if (inBrowser && j_lm && navigator.appName != 'Netscape') {\n\tBigInteger.prototype.am = am1;\n\tdbits = 26;\n} else {\n\t// Mozilla/Netscape seems to prefer am3\n\tBigInteger.prototype.am = am3;\n\tdbits = 28;\n}\n\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = (1 << dbits) - 1;\nBigInteger.prototype.DV = 1 << dbits;\n\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;\n\n// Digit conversions\nvar BI_RM = '0123456789abcdefghijklmnopqrstuvwxyz';\nvar BI_RC = new Array();\nvar rr, vv;\nrr = '0'.charCodeAt(0);\nfor (vv = 0; vv <= 9; ++vv) {\n\tBI_RC[rr++] = vv;\n}rr = 'a'.charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) {\n\tBI_RC[rr++] = vv;\n}rr = 'A'.charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv) {\n\tBI_RC[rr++] = vv;\n}function int2char(n) {\n\treturn BI_RM.charAt(n);\n}\nfunction intAt(s, i) {\n\tvar c = BI_RC[s.charCodeAt(i)];\n\treturn c == null ? -1 : c;\n}\n\n// (protected) copy this to r\nfunction bnpCopyTo(r) {\n\tfor (var i = this.t - 1; i >= 0; --i) {\n\t\tr[i] = this[i];\n\t}r.t = this.t;\n\tr.s = this.s;\n}\n\n// (protected) set from integer value x, -DV <= x < DV\nfunction bnpFromInt(x) {\n\tthis.t = 1;\n\tthis.s = x < 0 ? -1 : 0;\n\tif (x > 0) this[0] = x;else if (x < -1) this[0] = x + this.DV;else this.t = 0;\n}\n\n// return bigint initialized to value\nfunction nbv(i) {\n\tvar r = nbi();\n\n\tr.fromInt(i);\n\n\treturn r;\n}\n\n// (protected) set from string and radix\nfunction bnpFromString(s, b) {\n\tvar k;\n\tif (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\tthis.t = 0;\n\tthis.s = 0;\n\tvar i = s.length,\n\t mi = false,\n\t sh = 0;\n\twhile (--i >= 0) {\n\t\tvar x = intAt(s, i);\n\t\tif (x < 0) {\n\t\t\tif (s.charAt(i) == '-') mi = true;\n\t\t\tcontinue;\n\t\t}\n\t\tmi = false;\n\t\tif (sh == 0) this[this.t++] = x;else if (sh + k > this.DB) {\n\t\t\tthis[this.t - 1] |= (x & (1 << this.DB - sh) - 1) << sh;\n\t\t\tthis[this.t++] = x >> this.DB - sh;\n\t\t} else this[this.t - 1] |= x << sh;\n\t\tsh += k;\n\t\tif (sh >= this.DB) sh -= this.DB;\n\t}\n\tthis.clamp();\n\tif (mi) BigInteger.ZERO.subTo(this, this);\n}\n\n// (protected) clamp off excess high words\nfunction bnpClamp() {\n\tvar c = this.s & this.DM;\n\twhile (this.t > 0 && this[this.t - 1] == c) {\n\t\t--this.t;\n\t}\n}\n\n// (public) return string representation in given radix\nfunction bnToString(b) {\n\tif (this.s < 0) return '-' + this.negate().toString();\n\tvar k;\n\tif (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\tvar km = (1 << k) - 1,\n\t d,\n\t m = false,\n\t r = '',\n\t i = this.t;\n\tvar p = this.DB - i * this.DB % k;\n\tif (i-- > 0) {\n\t\tif (p < this.DB && (d = this[i] >> p) > 0) {\n\t\t\tm = true;\n\t\t\tr = int2char(d);\n\t\t}\n\t\twhile (i >= 0) {\n\t\t\tif (p < k) {\n\t\t\t\td = (this[i] & (1 << p) - 1) << k - p;\n\t\t\t\td |= this[--i] >> (p += this.DB - k);\n\t\t\t} else {\n\t\t\t\td = this[i] >> (p -= k) & km;\n\t\t\t\tif (p <= 0) {\n\t\t\t\t\tp += this.DB;\n\t\t\t\t\t--i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (d > 0) m = true;\n\t\t\tif (m) r += int2char(d);\n\t\t}\n\t}\n\treturn m ? r : '0';\n}\n\n// (public) -this\nfunction bnNegate() {\n\tvar r = nbi();\n\n\tBigInteger.ZERO.subTo(this, r);\n\n\treturn r;\n}\n\n// (public) |this|\nfunction bnAbs() {\n\treturn this.s < 0 ? this.negate() : this;\n}\n\n// (public) return + if this > a, - if this < a, 0 if equal\nfunction bnCompareTo(a) {\n\tvar r = this.s - a.s;\n\tif (r != 0) return r;\n\tvar i = this.t;\n\tr = i - a.t;\n\tif (r != 0) return this.s < 0 ? -r : r;\n\twhile (--i >= 0) {\n\t\tif ((r = this[i] - a[i]) != 0) return r;\n\t}return 0;\n}\n\n// returns bit length of the integer x\nfunction nbits(x) {\n\tvar r = 1,\n\t t;\n\tif ((t = x >>> 16) != 0) {\n\t\tx = t;\n\t\tr += 16;\n\t}\n\tif ((t = x >> 8) != 0) {\n\t\tx = t;\n\t\tr += 8;\n\t}\n\tif ((t = x >> 4) != 0) {\n\t\tx = t;\n\t\tr += 4;\n\t}\n\tif ((t = x >> 2) != 0) {\n\t\tx = t;\n\t\tr += 2;\n\t}\n\tif ((t = x >> 1) != 0) {\n\t\tx = t;\n\t\tr += 1;\n\t}\n\treturn r;\n}\n\n// (public) return the number of bits in \"this\"\nfunction bnBitLength() {\n\tif (this.t <= 0) return 0;\n\treturn this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);\n}\n\n// (protected) r = this << n*DB\nfunction bnpDLShiftTo(n, r) {\n\tvar i;\n\tfor (i = this.t - 1; i >= 0; --i) {\n\t\tr[i + n] = this[i];\n\t}for (i = n - 1; i >= 0; --i) {\n\t\tr[i] = 0;\n\t}r.t = this.t + n;\n\tr.s = this.s;\n}\n\n// (protected) r = this >> n*DB\nfunction bnpDRShiftTo(n, r) {\n\tfor (var i = n; i < this.t; ++i) {\n\t\tr[i - n] = this[i];\n\t}r.t = Math.max(this.t - n, 0);\n\tr.s = this.s;\n}\n\n// (protected) r = this << n\nfunction bnpLShiftTo(n, r) {\n\tvar bs = n % this.DB;\n\tvar cbs = this.DB - bs;\n\tvar bm = (1 << cbs) - 1;\n\tvar ds = Math.floor(n / this.DB),\n\t c = this.s << bs & this.DM,\n\t i;\n\tfor (i = this.t - 1; i >= 0; --i) {\n\t\tr[i + ds + 1] = this[i] >> cbs | c;\n\t\tc = (this[i] & bm) << bs;\n\t}\n\tfor (i = ds - 1; i >= 0; --i) {\n\t\tr[i] = 0;\n\t}r[ds] = c;\n\tr.t = this.t + ds + 1;\n\tr.s = this.s;\n\tr.clamp();\n}\n\n// (protected) r = this >> n\nfunction bnpRShiftTo(n, r) {\n\tr.s = this.s;\n\tvar ds = Math.floor(n / this.DB);\n\tif (ds >= this.t) {\n\t\tr.t = 0;\n\t\treturn;\n\t}\n\tvar bs = n % this.DB;\n\tvar cbs = this.DB - bs;\n\tvar bm = (1 << bs) - 1;\n\tr[0] = this[ds] >> bs;\n\tfor (var i = ds + 1; i < this.t; ++i) {\n\t\tr[i - ds - 1] |= (this[i] & bm) << cbs;\n\t\tr[i - ds] = this[i] >> bs;\n\t}\n\tif (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;\n\tr.t = this.t - ds;\n\tr.clamp();\n}\n\n// (protected) r = this - a\nfunction bnpSubTo(a, r) {\n\tvar i = 0,\n\t c = 0,\n\t m = Math.min(a.t, this.t);\n\twhile (i < m) {\n\t\tc += this[i] - a[i];\n\t\tr[i++] = c & this.DM;\n\t\tc >>= this.DB;\n\t}\n\tif (a.t < this.t) {\n\t\tc -= a.s;\n\t\twhile (i < this.t) {\n\t\t\tc += this[i];\n\t\t\tr[i++] = c & this.DM;\n\t\t\tc >>= this.DB;\n\t\t}\n\t\tc += this.s;\n\t} else {\n\t\tc += this.s;\n\t\twhile (i < a.t) {\n\t\t\tc -= a[i];\n\t\t\tr[i++] = c & this.DM;\n\t\t\tc >>= this.DB;\n\t\t}\n\t\tc -= a.s;\n\t}\n\tr.s = c < 0 ? -1 : 0;\n\tif (c < -1) r[i++] = this.DV + c;else if (c > 0) r[i++] = c;\n\tr.t = i;\n\tr.clamp();\n}\n\n// (protected) r = this * a, r != this,a (HAC 14.12)\n// \"this\" should be the larger one if appropriate.\nfunction bnpMultiplyTo(a, r) {\n\tvar x = this.abs(),\n\t y = a.abs();\n\tvar i = x.t;\n\tr.t = i + y.t;\n\twhile (--i >= 0) {\n\t\tr[i] = 0;\n\t}for (i = 0; i < y.t; ++i) {\n\t\tr[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n\t}r.s = 0;\n\tr.clamp();\n\tif (this.s != a.s) BigInteger.ZERO.subTo(r, r);\n}\n\n// (protected) r = this^2, r != this (HAC 14.16)\nfunction bnpSquareTo(r) {\n\tvar x = this.abs();\n\tvar i = r.t = 2 * x.t;\n\twhile (--i >= 0) {\n\t\tr[i] = 0;\n\t}for (i = 0; i < x.t - 1; ++i) {\n\t\tvar c = x.am(i, x[i], r, 2 * i, 0, 1);\n\t\tif ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n\t\t\tr[i + x.t] -= x.DV;\n\t\t\tr[i + x.t + 1] = 1;\n\t\t}\n\t}\n\tif (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n\tr.s = 0;\n\tr.clamp();\n}\n\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.\nfunction bnpDivRemTo(m, q, r) {\n\tvar pm = m.abs();\n\tif (pm.t <= 0) return;\n\tvar pt = this.abs();\n\tif (pt.t < pm.t) {\n\t\tif (q != null) q.fromInt(0);\n\t\tif (r != null) this.copyTo(r);\n\t\treturn;\n\t}\n\tif (r == null) r = nbi();\n\tvar y = nbi(),\n\t ts = this.s,\n\t ms = m.s;\n\tvar nsh = this.DB - nbits(pm[pm.t - 1]);\n\t// normalize modulus\n\tif (nsh > 0) {\n\t\tpm.lShiftTo(nsh, y);\n\t\tpt.lShiftTo(nsh, r);\n\t} else {\n\t\tpm.copyTo(y);\n\t\tpt.copyTo(r);\n\t}\n\tvar ys = y.t;\n\tvar y0 = y[ys - 1];\n\tif (y0 == 0) return;\n\tvar yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);\n\tvar d1 = this.FV / yt,\n\t d2 = (1 << this.F1) / yt,\n\t e = 1 << this.F2;\n\tvar i = r.t,\n\t j = i - ys,\n\t t = q == null ? nbi() : q;\n\ty.dlShiftTo(j, t);\n\tif (r.compareTo(t) >= 0) {\n\t\tr[r.t++] = 1;\n\t\tr.subTo(t, r);\n\t}\n\tBigInteger.ONE.dlShiftTo(ys, t);\n\tt.subTo(y, y);\n\t// \"negative\" y so we can replace sub with am later\n\twhile (y.t < ys) {\n\t\ty[y.t++] = 0;\n\t}while (--j >= 0) {\n\t\t// Estimate quotient digit\n\t\tvar qd = r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n\t\tif ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n\t\t\t// Try it out\n\t\t\ty.dlShiftTo(j, t);\n\t\t\tr.subTo(t, r);\n\t\t\twhile (r[i] < --qd) {\n\t\t\t\tr.subTo(t, r);\n\t\t\t}\n\t\t}\n\t}\n\tif (q != null) {\n\t\tr.drShiftTo(ys, q);\n\t\tif (ts != ms) BigInteger.ZERO.subTo(q, q);\n\t}\n\tr.t = ys;\n\tr.clamp();\n\tif (nsh > 0) r.rShiftTo(nsh, r);\n\t// Denormalize remainder\n\tif (ts < 0) BigInteger.ZERO.subTo(r, r);\n}\n\n// (public) this mod a\nfunction bnMod(a) {\n\tvar r = nbi();\n\tthis.abs().divRemTo(a, null, r);\n\tif (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);\n\treturn r;\n}\n\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.\nfunction bnpInvDigit() {\n\tif (this.t < 1) return 0;\n\tvar x = this[0];\n\tif ((x & 1) == 0) return 0;\n\tvar y = x & 3;\n\t// y == 1/x mod 2^2\n\ty = y * (2 - (x & 0xf) * y) & 0xf;\n\t// y == 1/x mod 2^4\n\ty = y * (2 - (x & 0xff) * y) & 0xff;\n\t// y == 1/x mod 2^8\n\ty = y * (2 - ((x & 0xffff) * y & 0xffff)) & 0xffff;\n\t// y == 1/x mod 2^16\n\t// last step - calculate inverse mod DV directly;\n\t// assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n\ty = y * (2 - x * y % this.DV) % this.DV;\n\t// y == 1/x mod 2^dbits\n\t// we really want the negative inverse, and -DV < y < DV\n\treturn y > 0 ? this.DV - y : -y;\n}\n\nfunction bnEquals(a) {\n\treturn this.compareTo(a) == 0;\n}\n\n// (protected) r = this + a\nfunction bnpAddTo(a, r) {\n\tvar i = 0,\n\t c = 0,\n\t m = Math.min(a.t, this.t);\n\twhile (i < m) {\n\t\tc += this[i] + a[i];\n\t\tr[i++] = c & this.DM;\n\t\tc >>= this.DB;\n\t}\n\tif (a.t < this.t) {\n\t\tc += a.s;\n\t\twhile (i < this.t) {\n\t\t\tc += this[i];\n\t\t\tr[i++] = c & this.DM;\n\t\t\tc >>= this.DB;\n\t\t}\n\t\tc += this.s;\n\t} else {\n\t\tc += this.s;\n\t\twhile (i < a.t) {\n\t\t\tc += a[i];\n\t\t\tr[i++] = c & this.DM;\n\t\t\tc >>= this.DB;\n\t\t}\n\t\tc += a.s;\n\t}\n\tr.s = c < 0 ? -1 : 0;\n\tif (c > 0) r[i++] = c;else if (c < -1) r[i++] = this.DV + c;\n\tr.t = i;\n\tr.clamp();\n}\n\n// (public) this + a\nfunction bnAdd(a) {\n\tvar r = nbi();\n\n\tthis.addTo(a, r);\n\n\treturn r;\n}\n\n// (public) this - a\nfunction bnSubtract(a) {\n\tvar r = nbi();\n\n\tthis.subTo(a, r);\n\n\treturn r;\n}\n\n// (public) this * a\nfunction bnMultiply(a) {\n\tvar r = nbi();\n\n\tthis.multiplyTo(a, r);\n\n\treturn r;\n}\n\n// (public) this / a\nfunction bnDivide(a) {\n\tvar r = nbi();\n\n\tthis.divRemTo(a, r, null);\n\n\treturn r;\n}\n\n// Montgomery reduction\nfunction Montgomery(m) {\n\tthis.m = m;\n\tthis.mp = m.invDigit();\n\tthis.mpl = this.mp & 0x7fff;\n\tthis.mph = this.mp >> 15;\n\tthis.um = (1 << m.DB - 15) - 1;\n\tthis.mt2 = 2 * m.t;\n}\n\n// xR mod m\nfunction montConvert(x) {\n\tvar r = nbi();\n\tx.abs().dlShiftTo(this.m.t, r);\n\tr.divRemTo(this.m, null, r);\n\tif (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);\n\treturn r;\n}\n\n// x/R mod m\nfunction montRevert(x) {\n\tvar r = nbi();\n\tx.copyTo(r);\n\tthis.reduce(r);\n\treturn r;\n}\n\n// x = x/R mod m (HAC 14.32)\nfunction montReduce(x) {\n\twhile (x.t <= this.mt2) {\n\t\t// pad x so am has enough room later\n\t\tx[x.t++] = 0;\n\t}for (var i = 0; i < this.m.t; ++i) {\n\t\t// faster way of calculating u0 = x[i]*mp mod DV\n\t\tvar j = x[i] & 0x7fff;\n\t\tvar u0 = j * this.mpl + ((j * this.mph + (x[i] >> 15) * this.mpl & this.um) << 15) & x.DM;\n\t\t// use am to combine the multiply-shift-add into one call\n\t\tj = i + this.m.t;\n\t\tx[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n\t\t// propagate carry\n\t\twhile (x[j] >= x.DV) {\n\t\t\tx[j] -= x.DV;\n\t\t\tx[++j]++;\n\t\t}\n\t}\n\tx.clamp();\n\tx.drShiftTo(this.m.t, x);\n\tif (x.compareTo(this.m) >= 0) x.subTo(this.m, x);\n}\n\n// r = \"x^2/R mod m\"; x != r\nfunction montSqrTo(x, r) {\n\tx.squareTo(r);\n\n\tthis.reduce(r);\n}\n\n// r = \"xy/R mod m\"; x,y != r\nfunction montMulTo(x, y, r) {\n\tx.multiplyTo(y, r);\n\n\tthis.reduce(r);\n}\n\nMontgomery.prototype.convert = montConvert;\nMontgomery.prototype.revert = montRevert;\nMontgomery.prototype.reduce = montReduce;\nMontgomery.prototype.mulTo = montMulTo;\nMontgomery.prototype.sqrTo = montSqrTo;\n\n// (public) this^e % m (HAC 14.85)\nfunction bnModPow(e, m, callback) {\n\tvar i = e.bitLength(),\n\t k,\n\t r = nbv(1),\n\t z = new Montgomery(m);\n\tif (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;\n\n\t// precomputation\n\tvar g = new Array(),\n\t n = 3,\n\t k1 = k - 1,\n\t km = (1 << k) - 1;\n\tg[1] = z.convert(this);\n\tif (k > 1) {\n\t\tvar g2 = nbi();\n\t\tz.sqrTo(g[1], g2);\n\t\twhile (n <= km) {\n\t\t\tg[n] = nbi();\n\t\t\tz.mulTo(g2, g[n - 2], g[n]);\n\t\t\tn += 2;\n\t\t}\n\t}\n\n\tvar j = e.t - 1,\n\t w,\n\t is1 = true,\n\t r2 = nbi(),\n\t t;\n\ti = nbits(e[j]) - 1;\n\twhile (j >= 0) {\n\t\tif (i >= k1) w = e[j] >> i - k1 & km;else {\n\t\t\tw = (e[j] & (1 << i + 1) - 1) << k1 - i;\n\t\t\tif (j > 0) w |= e[j - 1] >> this.DB + i - k1;\n\t\t}\n\n\t\tn = k;\n\t\twhile ((w & 1) == 0) {\n\t\t\tw >>= 1;\n\t\t\t--n;\n\t\t}\n\t\tif ((i -= n) < 0) {\n\t\t\ti += this.DB;\n\t\t\t--j;\n\t\t}\n\t\tif (is1) {\n\t\t\t// ret == 1, don't bother squaring or multiplying it\n\t\t\tg[w].copyTo(r);\n\t\t\tis1 = false;\n\t\t} else {\n\t\t\twhile (n > 1) {\n\t\t\t\tz.sqrTo(r, r2);\n\t\t\t\tz.sqrTo(r2, r);\n\t\t\t\tn -= 2;\n\t\t\t}\n\t\t\tif (n > 0) z.sqrTo(r, r2);else {\n\t\t\t\tt = r;\n\t\t\t\tr = r2;\n\t\t\t\tr2 = t;\n\t\t\t}\n\t\t\tz.mulTo(r2, g[w], r);\n\t\t}\n\n\t\twhile (j >= 0 && (e[j] & 1 << i) == 0) {\n\t\t\tz.sqrTo(r, r2);\n\t\t\tt = r;\n\t\t\tr = r2;\n\t\t\tr2 = t;\n\t\t\tif (--i < 0) {\n\t\t\t\ti = this.DB - 1;\n\t\t\t\t--j;\n\t\t\t}\n\t\t}\n\t}\n\tvar result = z.revert(r);\n\tcallback(null, result);\n\treturn result;\n}\n\n// protected\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;\n\n// public\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;\n\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Buffer } from 'buffer/';\nimport CryptoJS from 'crypto-js/core';\nimport 'crypto-js/lib-typedarrays'; // necessary for crypto js\nimport SHA256 from 'crypto-js/sha256';\nimport HmacSHA256 from 'crypto-js/hmac-sha256';\n\nvar randomBytes = function randomBytes(nBytes) {\n\treturn Buffer.from(CryptoJS.lib.WordArray.random(nBytes).toString(), 'hex');\n};\n\nimport BigInteger from './BigInteger';\n\nvar initN = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1' + '29024E088A67CC74020BBEA63B139B22514A08798E3404DD' + 'EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245' + 'E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D' + 'C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F' + '83655D23DCA3AD961C62F356208552BB9ED529077096966D' + '670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' + 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9' + 'DE2BCBF6955817183995497CEA956AE515D2261898FA0510' + '15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64' + 'ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' + 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B' + 'F12FFA06D98A0864D87602733EC86A64521F2B18177B200C' + 'BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31' + '43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF';\n\nvar newPasswordRequiredChallengeUserAttributePrefix = 'userAttributes.';\n\n/** @class */\n\nvar AuthenticationHelper = function () {\n\t/**\n * Constructs a new AuthenticationHelper object\n * @param {string} PoolName Cognito user pool name.\n */\n\tfunction AuthenticationHelper(PoolName) {\n\t\t_classCallCheck(this, AuthenticationHelper);\n\n\t\tthis.N = new BigInteger(initN, 16);\n\t\tthis.g = new BigInteger('2', 16);\n\t\tthis.k = new BigInteger(this.hexHash('00' + this.N.toString(16) + '0' + this.g.toString(16)), 16);\n\n\t\tthis.smallAValue = this.generateRandomSmallA();\n\t\tthis.getLargeAValue(function () {});\n\n\t\tthis.infoBits = Buffer.from('Caldera Derived Key', 'utf8');\n\n\t\tthis.poolName = PoolName;\n\t}\n\n\t/**\n * @returns {BigInteger} small A, a random number\n */\n\n\n\tAuthenticationHelper.prototype.getSmallAValue = function getSmallAValue() {\n\t\treturn this.smallAValue;\n\t};\n\n\t/**\n * @param {nodeCallback} callback Called with (err, largeAValue)\n * @returns {void}\n */\n\n\n\tAuthenticationHelper.prototype.getLargeAValue = function getLargeAValue(callback) {\n\t\tvar _this = this;\n\n\t\tif (this.largeAValue) {\n\t\t\tcallback(null, this.largeAValue);\n\t\t} else {\n\t\t\tthis.calculateA(this.smallAValue, function (err, largeAValue) {\n\t\t\t\tif (err) {\n\t\t\t\t\tcallback(err, null);\n\t\t\t\t}\n\n\t\t\t\t_this.largeAValue = largeAValue;\n\t\t\t\tcallback(null, _this.largeAValue);\n\t\t\t});\n\t\t}\n\t};\n\n\t/**\n * helper function to generate a random big integer\n * @returns {BigInteger} a random value.\n * @private\n */\n\n\n\tAuthenticationHelper.prototype.generateRandomSmallA = function generateRandomSmallA() {\n\t\tvar hexRandom = randomBytes(128).toString('hex');\n\n\t\tvar randomBigInt = new BigInteger(hexRandom, 16);\n\t\tvar smallABigInt = randomBigInt.mod(this.N);\n\n\t\treturn smallABigInt;\n\t};\n\n\t/**\n * helper function to generate a random string\n * @returns {string} a random value.\n * @private\n */\n\n\n\tAuthenticationHelper.prototype.generateRandomString = function generateRandomString() {\n\t\treturn randomBytes(40).toString('base64');\n\t};\n\n\t/**\n * @returns {string} Generated random value included in password hash.\n */\n\n\n\tAuthenticationHelper.prototype.getRandomPassword = function getRandomPassword() {\n\t\treturn this.randomPassword;\n\t};\n\n\t/**\n * @returns {string} Generated random value included in devices hash.\n */\n\n\n\tAuthenticationHelper.prototype.getSaltDevices = function getSaltDevices() {\n\t\treturn this.SaltToHashDevices;\n\t};\n\n\t/**\n * @returns {string} Value used to verify devices.\n */\n\n\n\tAuthenticationHelper.prototype.getVerifierDevices = function getVerifierDevices() {\n\t\treturn this.verifierDevices;\n\t};\n\n\t/**\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\tAuthenticationHelper.prototype.generateHashDevice = function generateHashDevice(deviceGroupKey, username, callback) {\n\t\tvar _this2 = this;\n\n\t\tthis.randomPassword = this.generateRandomString();\n\t\tvar combinedString = '' + deviceGroupKey + username + ':' + this.randomPassword;\n\t\tvar hashedString = this.hash(combinedString);\n\n\t\tvar hexRandom = randomBytes(16).toString('hex');\n\t\tthis.SaltToHashDevices = this.padHex(new BigInteger(hexRandom, 16));\n\n\t\tthis.g.modPow(new BigInteger(this.hexHash(this.SaltToHashDevices + hashedString), 16), this.N, function (err, verifierDevicesNotPadded) {\n\t\t\tif (err) {\n\t\t\t\tcallback(err, null);\n\t\t\t}\n\n\t\t\t_this2.verifierDevices = _this2.padHex(verifierDevicesNotPadded);\n\t\t\tcallback(null, null);\n\t\t});\n\t};\n\n\t/**\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\tAuthenticationHelper.prototype.calculateA = function calculateA(a, callback) {\n\t\tvar _this3 = this;\n\n\t\tthis.g.modPow(a, this.N, function (err, A) {\n\t\t\tif (err) {\n\t\t\t\tcallback(err, null);\n\t\t\t}\n\n\t\t\tif (A.mod(_this3.N).equals(BigInteger.ZERO)) {\n\t\t\t\tcallback(new Error('Illegal paramater. A mod N cannot be 0.'), null);\n\t\t\t}\n\n\t\t\tcallback(null, A);\n\t\t});\n\t};\n\n\t/**\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\tAuthenticationHelper.prototype.calculateU = function calculateU(A, B) {\n\t\tthis.UHexHash = this.hexHash(this.padHex(A) + this.padHex(B));\n\t\tvar finalU = new BigInteger(this.UHexHash, 16);\n\n\t\treturn finalU;\n\t};\n\n\t/**\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\tAuthenticationHelper.prototype.hash = function hash(buf) {\n\t\tvar str = buf instanceof Buffer ? CryptoJS.lib.WordArray.create(buf) : buf;\n\t\tvar hashHex = SHA256(str).toString();\n\n\t\treturn new Array(64 - hashHex.length).join('0') + hashHex;\n\t};\n\n\t/**\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\tAuthenticationHelper.prototype.hexHash = function hexHash(hexStr) {\n\t\treturn this.hash(Buffer.from(hexStr, 'hex'));\n\t};\n\n\t/**\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\tAuthenticationHelper.prototype.computehkdf = function computehkdf(ikm, salt) {\n\t\tvar infoBitsWordArray = CryptoJS.lib.WordArray.create(Buffer.concat([this.infoBits, Buffer.from(String.fromCharCode(1), 'utf8')]));\n\t\tvar ikmWordArray = ikm instanceof Buffer ? CryptoJS.lib.WordArray.create(ikm) : ikm;\n\t\tvar saltWordArray = salt instanceof Buffer ? CryptoJS.lib.WordArray.create(salt) : salt;\n\n\t\tvar prk = HmacSHA256(ikmWordArray, saltWordArray);\n\t\tvar hmac = HmacSHA256(infoBitsWordArray, prk);\n\t\treturn Buffer.from(hmac.toString(), 'hex').slice(0, 16);\n\t};\n\n\t/**\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\tAuthenticationHelper.prototype.getPasswordAuthenticationKey = function getPasswordAuthenticationKey(username, password, serverBValue, salt, callback) {\n\t\tvar _this4 = this;\n\n\t\tif (serverBValue.mod(this.N).equals(BigInteger.ZERO)) {\n\t\t\tthrow new Error('B cannot be zero.');\n\t\t}\n\n\t\tthis.UValue = this.calculateU(this.largeAValue, serverBValue);\n\n\t\tif (this.UValue.equals(BigInteger.ZERO)) {\n\t\t\tthrow new Error('U cannot be zero.');\n\t\t}\n\n\t\tvar usernamePassword = '' + this.poolName + username + ':' + password;\n\t\tvar usernamePasswordHash = this.hash(usernamePassword);\n\n\t\tvar xValue = new BigInteger(this.hexHash(this.padHex(salt) + usernamePasswordHash), 16);\n\t\tthis.calculateS(xValue, serverBValue, function (err, sValue) {\n\t\t\tif (err) {\n\t\t\t\tcallback(err, null);\n\t\t\t}\n\n\t\t\tvar hkdf = _this4.computehkdf(Buffer.from(_this4.padHex(sValue), 'hex'), Buffer.from(_this4.padHex(_this4.UValue.toString(16)), 'hex'));\n\n\t\t\tcallback(null, hkdf);\n\t\t});\n\t};\n\n\t/**\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\tAuthenticationHelper.prototype.calculateS = function calculateS(xValue, serverBValue, callback) {\n\t\tvar _this5 = this;\n\n\t\tthis.g.modPow(xValue, this.N, function (err, gModPowXN) {\n\t\t\tif (err) {\n\t\t\t\tcallback(err, null);\n\t\t\t}\n\n\t\t\tvar intValue2 = serverBValue.subtract(_this5.k.multiply(gModPowXN));\n\t\t\tintValue2.modPow(_this5.smallAValue.add(_this5.UValue.multiply(xValue)), _this5.N, function (err2, result) {\n\t\t\t\tif (err2) {\n\t\t\t\t\tcallback(err2, null);\n\t\t\t\t}\n\n\t\t\t\tcallback(null, result.mod(_this5.N));\n\t\t\t});\n\t\t});\n\t};\n\n\t/**\n * Return constant newPasswordRequiredChallengeUserAttributePrefix\n * @return {newPasswordRequiredChallengeUserAttributePrefix} constant prefix value\n */\n\n\n\tAuthenticationHelper.prototype.getNewPasswordRequiredChallengeUserAttributePrefix = function getNewPasswordRequiredChallengeUserAttributePrefix() {\n\t\treturn newPasswordRequiredChallengeUserAttributePrefix;\n\t};\n\n\t/**\n * Converts a BigInteger (or hex string) to hex format padded with zeroes for hashing\n * @param {BigInteger|String} bigInt Number or string to pad.\n * @returns {String} Padded hex string.\n */\n\n\n\tAuthenticationHelper.prototype.padHex = function padHex(bigInt) {\n\t\tvar hashStr = bigInt.toString(16);\n\t\tif (hashStr.length % 2 === 1) {\n\t\t\thashStr = '0' + hashStr;\n\t\t} else if ('89ABCDEFabcdef'.indexOf(hashStr[0]) !== -1) {\n\t\t\thashStr = '00' + hashStr;\n\t\t}\n\t\treturn hashStr;\n\t};\n\n\treturn AuthenticationHelper;\n}();\n\nexport default AuthenticationHelper;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Buffer } from 'buffer/';\n\n/** @class */\n\nvar CognitoJwtToken = function () {\n\t/**\n * Constructs a new CognitoJwtToken object\n * @param {string=} token The JWT token.\n */\n\tfunction CognitoJwtToken(token) {\n\t\t_classCallCheck(this, CognitoJwtToken);\n\n\t\t// Assign object\n\t\tthis.jwtToken = token || '';\n\t\tthis.payload = this.decodePayload();\n\t}\n\n\t/**\n * @returns {string} the record's token.\n */\n\n\n\tCognitoJwtToken.prototype.getJwtToken = function getJwtToken() {\n\t\treturn this.jwtToken;\n\t};\n\n\t/**\n * @returns {int} the token's expiration (exp member).\n */\n\n\n\tCognitoJwtToken.prototype.getExpiration = function getExpiration() {\n\t\treturn this.payload.exp;\n\t};\n\n\t/**\n * @returns {int} the token's \"issued at\" (iat member).\n */\n\n\n\tCognitoJwtToken.prototype.getIssuedAt = function getIssuedAt() {\n\t\treturn this.payload.iat;\n\t};\n\n\t/**\n * @returns {object} the token's payload.\n */\n\n\n\tCognitoJwtToken.prototype.decodePayload = function decodePayload() {\n\t\tvar payload = this.jwtToken.split('.')[1];\n\t\ttry {\n\t\t\treturn JSON.parse(Buffer.from(payload, 'base64').toString('utf8'));\n\t\t} catch (err) {\n\t\t\treturn {};\n\t\t}\n\t};\n\n\treturn CognitoJwtToken;\n}();\n\nexport default CognitoJwtToken;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport CognitoJwtToken from './CognitoJwtToken';\n\n/** @class */\n\nvar CognitoAccessToken = function (_CognitoJwtToken) {\n _inherits(CognitoAccessToken, _CognitoJwtToken);\n\n /**\n * Constructs a new CognitoAccessToken object\n * @param {string=} AccessToken The JWT access token.\n */\n function CognitoAccessToken() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n AccessToken = _ref.AccessToken;\n\n _classCallCheck(this, CognitoAccessToken);\n\n return _possibleConstructorReturn(this, _CognitoJwtToken.call(this, AccessToken || ''));\n }\n\n return CognitoAccessToken;\n}(CognitoJwtToken);\n\nexport default CognitoAccessToken;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport CognitoJwtToken from './CognitoJwtToken';\n\n/** @class */\n\nvar CognitoIdToken = function (_CognitoJwtToken) {\n _inherits(CognitoIdToken, _CognitoJwtToken);\n\n /**\n * Constructs a new CognitoIdToken object\n * @param {string=} IdToken The JWT Id token\n */\n function CognitoIdToken() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n IdToken = _ref.IdToken;\n\n _classCallCheck(this, CognitoIdToken);\n\n return _possibleConstructorReturn(this, _CognitoJwtToken.call(this, IdToken || ''));\n }\n\n return CognitoIdToken;\n}(CognitoJwtToken);\n\nexport default CognitoIdToken;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nvar CognitoRefreshToken = function () {\n /**\n * Constructs a new CognitoRefreshToken object\n * @param {string=} RefreshToken The JWT refresh token.\n */\n function CognitoRefreshToken() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n RefreshToken = _ref.RefreshToken;\n\n _classCallCheck(this, CognitoRefreshToken);\n\n // Assign object\n this.token = RefreshToken || '';\n }\n\n /**\n * @returns {string} the record's token.\n */\n\n\n CognitoRefreshToken.prototype.getToken = function getToken() {\n return this.token;\n };\n\n return CognitoRefreshToken;\n}();\n\nexport default CognitoRefreshToken;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nvar CognitoUserSession = function () {\n\t/**\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\tfunction CognitoUserSession() {\n\t\tvar _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t\t IdToken = _ref.IdToken,\n\t\t RefreshToken = _ref.RefreshToken,\n\t\t AccessToken = _ref.AccessToken,\n\t\t ClockDrift = _ref.ClockDrift;\n\n\t\t_classCallCheck(this, CognitoUserSession);\n\n\t\tif (AccessToken == null || IdToken == null) {\n\t\t\tthrow new Error('Id token and Access Token must be present.');\n\t\t}\n\n\t\tthis.idToken = IdToken;\n\t\tthis.refreshToken = RefreshToken;\n\t\tthis.accessToken = AccessToken;\n\t\tthis.clockDrift = ClockDrift === undefined ? this.calculateClockDrift() : ClockDrift;\n\t}\n\n\t/**\n * @returns {CognitoIdToken} the session's Id token\n */\n\n\n\tCognitoUserSession.prototype.getIdToken = function getIdToken() {\n\t\treturn this.idToken;\n\t};\n\n\t/**\n * @returns {CognitoRefreshToken} the session's refresh token\n */\n\n\n\tCognitoUserSession.prototype.getRefreshToken = function getRefreshToken() {\n\t\treturn this.refreshToken;\n\t};\n\n\t/**\n * @returns {CognitoAccessToken} the session's access token\n */\n\n\n\tCognitoUserSession.prototype.getAccessToken = function getAccessToken() {\n\t\treturn this.accessToken;\n\t};\n\n\t/**\n * @returns {int} the session's clock drift\n */\n\n\n\tCognitoUserSession.prototype.getClockDrift = function getClockDrift() {\n\t\treturn this.clockDrift;\n\t};\n\n\t/**\n * @returns {int} the computer's clock drift\n */\n\n\n\tCognitoUserSession.prototype.calculateClockDrift = function calculateClockDrift() {\n\t\tvar now = Math.floor(new Date() / 1000);\n\t\tvar iat = Math.min(this.accessToken.getIssuedAt(), this.idToken.getIssuedAt());\n\n\t\treturn now - iat;\n\t};\n\n\t/**\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\tCognitoUserSession.prototype.isValid = function isValid() {\n\t\tvar now = Math.floor(new Date() / 1000);\n\t\tvar adjusted = now - this.clockDrift;\n\n\t\treturn adjusted < this.accessToken.getExpiration() && adjusted < this.idToken.getExpiration();\n\t};\n\n\treturn CognitoUserSession;\n}();\n\nexport default CognitoUserSession;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\nvar weekNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];\n\n/** @class */\n\nvar DateHelper = function () {\n\tfunction DateHelper() {\n\t\t_classCallCheck(this, DateHelper);\n\t}\n\n\t/**\n * @returns {string} The current time in \"ddd MMM D HH:mm:ss UTC YYYY\" format.\n */\n\tDateHelper.prototype.getNowString = function getNowString() {\n\t\tvar now = new Date();\n\n\t\tvar weekDay = weekNames[now.getUTCDay()];\n\t\tvar month = monthNames[now.getUTCMonth()];\n\t\tvar day = now.getUTCDate();\n\n\t\tvar hours = now.getUTCHours();\n\t\tif (hours < 10) {\n\t\t\thours = '0' + hours;\n\t\t}\n\n\t\tvar minutes = now.getUTCMinutes();\n\t\tif (minutes < 10) {\n\t\t\tminutes = '0' + minutes;\n\t\t}\n\n\t\tvar seconds = now.getUTCSeconds();\n\t\tif (seconds < 10) {\n\t\t\tseconds = '0' + seconds;\n\t\t}\n\n\t\tvar year = now.getUTCFullYear();\n\n\t\t// ddd MMM D HH:mm:ss UTC YYYY\n\t\tvar dateNow = weekDay + ' ' + month + ' ' + day + ' ' + hours + ':' + minutes + ':' + seconds + ' UTC ' + year;\n\n\t\treturn dateNow;\n\t};\n\n\treturn DateHelper;\n}();\n\nexport default DateHelper;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @class */\nvar CognitoUserAttribute = function () {\n\t/**\n * Constructs a new CognitoUserAttribute object\n * @param {string=} Name The record's name\n * @param {string=} Value The record's value\n */\n\tfunction CognitoUserAttribute() {\n\t\tvar _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n\t\t Name = _ref.Name,\n\t\t Value = _ref.Value;\n\n\t\t_classCallCheck(this, CognitoUserAttribute);\n\n\t\tthis.Name = Name || '';\n\t\tthis.Value = Value || '';\n\t}\n\n\t/**\n * @returns {string} the record's value.\n */\n\n\n\tCognitoUserAttribute.prototype.getValue = function getValue() {\n\t\treturn this.Value;\n\t};\n\n\t/**\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\tCognitoUserAttribute.prototype.setValue = function setValue(value) {\n\t\tthis.Value = value;\n\t\treturn this;\n\t};\n\n\t/**\n * @returns {string} the record's name.\n */\n\n\n\tCognitoUserAttribute.prototype.getName = function getName() {\n\t\treturn this.Name;\n\t};\n\n\t/**\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\tCognitoUserAttribute.prototype.setName = function setName(name) {\n\t\tthis.Name = name;\n\t\treturn this;\n\t};\n\n\t/**\n * @returns {string} a string representation of the record.\n */\n\n\n\tCognitoUserAttribute.prototype.toString = function toString() {\n\t\treturn JSON.stringify(this);\n\t};\n\n\t/**\n * @returns {object} a flat object representing the record.\n */\n\n\n\tCognitoUserAttribute.prototype.toJSON = function toJSON() {\n\t\treturn {\n\t\t\tName: this.Name,\n\t\t\tValue: this.Value\n\t\t};\n\t};\n\n\treturn CognitoUserAttribute;\n}();\n\nexport default CognitoUserAttribute;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar dataMemory = {};\n\n/** @class */\n\nvar MemoryStorage = function () {\n\tfunction MemoryStorage() {\n\t\t_classCallCheck(this, MemoryStorage);\n\t}\n\n\t/**\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\tMemoryStorage.setItem = function setItem(key, value) {\n\t\tdataMemory[key] = value;\n\t\treturn dataMemory[key];\n\t};\n\n\t/**\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\tMemoryStorage.getItem = function getItem(key) {\n\t\treturn Object.prototype.hasOwnProperty.call(dataMemory, key) ? dataMemory[key] : undefined;\n\t};\n\n\t/**\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\tMemoryStorage.removeItem = function removeItem(key) {\n\t\treturn delete dataMemory[key];\n\t};\n\n\t/**\n * This is used to clear the storage\n * @returns {string} nothing\n */\n\n\n\tMemoryStorage.clear = function clear() {\n\t\tdataMemory = {};\n\t\treturn dataMemory;\n\t};\n\n\treturn MemoryStorage;\n}();\n\n/** @class */\n\n\nvar StorageHelper = function () {\n\t/**\n * This is used to get a storage object\n * @returns {object} the storage\n */\n\tfunction StorageHelper() {\n\t\t_classCallCheck(this, StorageHelper);\n\n\t\ttry {\n\t\t\tthis.storageWindow = window.localStorage;\n\t\t\tthis.storageWindow.setItem('aws.cognito.test-ls', 1);\n\t\t\tthis.storageWindow.removeItem('aws.cognito.test-ls');\n\t\t} catch (exception) {\n\t\t\tthis.storageWindow = MemoryStorage;\n\t\t}\n\t}\n\n\t/**\n * This is used to return the storage\n * @returns {object} the storage\n */\n\n\n\tStorageHelper.prototype.getStorage = function getStorage() {\n\t\treturn this.storageWindow;\n\t};\n\n\treturn StorageHelper;\n}();\n\nexport default StorageHelper;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Buffer } from 'buffer/';\nimport CryptoJS from 'crypto-js/core';\nimport TypedArrays from 'crypto-js/lib-typedarrays'; // necessary for crypto js\nimport Base64 from 'crypto-js/enc-base64';\nimport HmacSHA256 from 'crypto-js/hmac-sha256';\n\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/**\n * @callback nodeCallback\n * @template T result\n * @param {*} err The operation failure reason, or null.\n * @param {T} result The operation result.\n */\n\n/**\n * @callback onFailure\n * @param {*} err Failure reason.\n */\n\n/**\n * @callback onSuccess\n * @template T result\n * @param {T} result The operation result.\n */\n\n/**\n * @callback mfaRequired\n * @param {*} details MFA challenge details.\n */\n\n/**\n * @callback customChallenge\n * @param {*} details Custom challenge details.\n */\n\n/**\n * @callback inputVerificationCode\n * @param {*} data Server response.\n */\n\n/**\n * @callback authSuccess\n * @param {CognitoUserSession} session The new session.\n * @param {bool=} userConfirmationNecessary User must be confirmed.\n */\n\n/** @class */\n\nvar CognitoUser = function () {\n\t/**\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\tfunction CognitoUser(data) {\n\t\t_classCallCheck(this, CognitoUser);\n\n\t\tif (data == null || data.Username == null || data.Pool == null) {\n\t\t\tthrow new Error('Username and pool information are required.');\n\t\t}\n\n\t\tthis.username = data.Username || '';\n\t\tthis.pool = data.Pool;\n\t\tthis.Session = null;\n\n\t\tthis.client = data.Pool.client;\n\n\t\tthis.signInUserSession = null;\n\t\tthis.authenticationFlowType = 'USER_SRP_AUTH';\n\n\t\tthis.storage = data.Storage || new StorageHelper().getStorage();\n\n\t\tthis.keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t\tthis.userDataKey = this.keyPrefix + '.' + this.username + '.userData';\n\t}\n\n\t/**\n * Sets the session for this user\n * @param {CognitoUserSession} signInUserSession the session\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.setSignInUserSession = function setSignInUserSession(signInUserSession) {\n\t\tthis.clearCachedUserData();\n\t\tthis.signInUserSession = signInUserSession;\n\t\tthis.cacheTokens();\n\t};\n\n\t/**\n * @returns {CognitoUserSession} the current session for this user\n */\n\n\n\tCognitoUser.prototype.getSignInUserSession = function getSignInUserSession() {\n\t\treturn this.signInUserSession;\n\t};\n\n\t/**\n * @returns {string} the user's username\n */\n\n\n\tCognitoUser.prototype.getUsername = function getUsername() {\n\t\treturn this.username;\n\t};\n\n\t/**\n * @returns {String} the authentication flow type\n */\n\n\n\tCognitoUser.prototype.getAuthenticationFlowType = function getAuthenticationFlowType() {\n\t\treturn this.authenticationFlowType;\n\t};\n\n\t/**\n * sets authentication flow type\n * @param {string} authenticationFlowType New value.\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.setAuthenticationFlowType = function setAuthenticationFlowType(authenticationFlowType) {\n\t\tthis.authenticationFlowType = authenticationFlowType;\n\t};\n\n\t/**\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\tCognitoUser.prototype.initiateAuth = function initiateAuth(authDetails, callback) {\n\t\tvar _this = this;\n\n\t\tvar authParameters = authDetails.getAuthParameters();\n\t\tauthParameters.USERNAME = this.username;\n\n\t\tvar clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n\n\t\tvar jsonReq = {\n\t\t\tAuthFlow: 'CUSTOM_AUTH',\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tAuthParameters: authParameters,\n\t\t\tClientMetadata: clientMetaData\n\t\t};\n\t\tif (this.getUserContextData()) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData();\n\t\t}\n\n\t\tthis.client.request('InitiateAuth', jsonReq, function (err, data) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\tvar challengeName = data.ChallengeName;\n\t\t\tvar challengeParameters = data.ChallengeParameters;\n\n\t\t\tif (challengeName === 'CUSTOM_CHALLENGE') {\n\t\t\t\t_this.Session = data.Session;\n\t\t\t\treturn callback.customChallenge(challengeParameters);\n\t\t\t}\n\t\t\t_this.signInUserSession = _this.getCognitoUserSession(data.AuthenticationResult);\n\t\t\t_this.cacheTokens();\n\t\t\treturn callback.onSuccess(_this.signInUserSession);\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.authenticateUser = function authenticateUser(authDetails, callback) {\n\t\tif (this.authenticationFlowType === 'USER_PASSWORD_AUTH') {\n\t\t\treturn this.authenticateUserPlainUsernamePassword(authDetails, callback);\n\t\t} else if (this.authenticationFlowType === 'USER_SRP_AUTH' || this.authenticationFlowType === 'CUSTOM_AUTH') {\n\t\t\treturn this.authenticateUserDefaultAuth(authDetails, callback);\n\t\t}\n\t\treturn callback.onFailure(new Error('Authentication flow type is invalid.'));\n\t};\n\n\t/**\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\tCognitoUser.prototype.authenticateUserDefaultAuth = function authenticateUserDefaultAuth(authDetails, callback) {\n\t\tvar _this2 = this;\n\n\t\tvar authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n\t\tvar dateHelper = new DateHelper();\n\n\t\tvar serverBValue = void 0;\n\t\tvar salt = void 0;\n\t\tvar authParameters = {};\n\n\t\tif (this.deviceKey != null) {\n\t\t\tauthParameters.DEVICE_KEY = this.deviceKey;\n\t\t}\n\n\t\tauthParameters.USERNAME = this.username;\n\t\tauthenticationHelper.getLargeAValue(function (errOnAValue, aValue) {\n\t\t\t// getLargeAValue callback start\n\t\t\tif (errOnAValue) {\n\t\t\t\tcallback.onFailure(errOnAValue);\n\t\t\t}\n\n\t\t\tauthParameters.SRP_A = aValue.toString(16);\n\n\t\t\tif (_this2.authenticationFlowType === 'CUSTOM_AUTH') {\n\t\t\t\tauthParameters.CHALLENGE_NAME = 'SRP_A';\n\t\t\t}\n\n\t\t\tvar clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n\n\t\t\tvar jsonReq = {\n\t\t\t\tAuthFlow: _this2.authenticationFlowType,\n\t\t\t\tClientId: _this2.pool.getClientId(),\n\t\t\t\tAuthParameters: authParameters,\n\t\t\t\tClientMetadata: clientMetaData\n\t\t\t};\n\t\t\tif (_this2.getUserContextData(_this2.username)) {\n\t\t\t\tjsonReq.UserContextData = _this2.getUserContextData(_this2.username);\n\t\t\t}\n\n\t\t\t_this2.client.request('InitiateAuth', jsonReq, function (err, data) {\n\t\t\t\tif (err) {\n\t\t\t\t\treturn callback.onFailure(err);\n\t\t\t\t}\n\n\t\t\t\tvar challengeParameters = data.ChallengeParameters;\n\n\t\t\t\t_this2.username = challengeParameters.USER_ID_FOR_SRP;\n\t\t\t\tserverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n\t\t\t\tsalt = new BigInteger(challengeParameters.SALT, 16);\n\t\t\t\t_this2.getCachedDeviceKeyAndPassword();\n\n\t\t\t\tauthenticationHelper.getPasswordAuthenticationKey(_this2.username, authDetails.getPassword(), serverBValue, salt, function (errOnHkdf, hkdf) {\n\t\t\t\t\t// getPasswordAuthenticationKey callback start\n\t\t\t\t\tif (errOnHkdf) {\n\t\t\t\t\t\tcallback.onFailure(errOnHkdf);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar dateNow = dateHelper.getNowString();\n\n\t\t\t\t\tvar 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\t\t\t\t\tvar key = CryptoJS.lib.WordArray.create(hkdf);\n\t\t\t\t\tvar signatureString = Base64.stringify(HmacSHA256(message, key));\n\n\t\t\t\t\tvar challengeResponses = {};\n\n\t\t\t\t\tchallengeResponses.USERNAME = _this2.username;\n\t\t\t\t\tchallengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n\t\t\t\t\tchallengeResponses.TIMESTAMP = dateNow;\n\t\t\t\t\tchallengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\n\t\t\t\t\tif (_this2.deviceKey != null) {\n\t\t\t\t\t\tchallengeResponses.DEVICE_KEY = _this2.deviceKey;\n\t\t\t\t\t}\n\n\t\t\t\t\tvar respondToAuthChallenge = function respondToAuthChallenge(challenge, challengeCallback) {\n\t\t\t\t\t\treturn _this2.client.request('RespondToAuthChallenge', challenge, function (errChallenge, dataChallenge) {\n\t\t\t\t\t\t\tif (errChallenge && errChallenge.code === 'ResourceNotFoundException' && errChallenge.message.toLowerCase().indexOf('device') !== -1) {\n\t\t\t\t\t\t\t\tchallengeResponses.DEVICE_KEY = null;\n\t\t\t\t\t\t\t\t_this2.deviceKey = null;\n\t\t\t\t\t\t\t\t_this2.randomPassword = null;\n\t\t\t\t\t\t\t\t_this2.deviceGroupKey = null;\n\t\t\t\t\t\t\t\t_this2.clearCachedDeviceKeyAndPassword();\n\t\t\t\t\t\t\t\treturn respondToAuthChallenge(challenge, challengeCallback);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn challengeCallback(errChallenge, dataChallenge);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\n\t\t\t\t\tvar jsonReqResp = {\n\t\t\t\t\t\tChallengeName: 'PASSWORD_VERIFIER',\n\t\t\t\t\t\tClientId: _this2.pool.getClientId(),\n\t\t\t\t\t\tChallengeResponses: challengeResponses,\n\t\t\t\t\t\tSession: data.Session,\n\t\t\t\t\t\tClientMetadata: clientMetaData\n\t\t\t\t\t};\n\t\t\t\t\tif (_this2.getUserContextData()) {\n\t\t\t\t\t\tjsonReqResp.UserContextData = _this2.getUserContextData();\n\t\t\t\t\t}\n\t\t\t\t\trespondToAuthChallenge(jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n\t\t\t\t\t\tif (errAuthenticate) {\n\t\t\t\t\t\t\treturn callback.onFailure(errAuthenticate);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn _this2.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n\t\t\t\t\t});\n\t\t\t\t\treturn undefined;\n\t\t\t\t\t// getPasswordAuthenticationKey callback end\n\t\t\t\t});\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t\t// getLargeAValue callback end\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.authenticateUserPlainUsernamePassword = function authenticateUserPlainUsernamePassword(authDetails, callback) {\n\t\tvar _this3 = this;\n\n\t\tvar authParameters = {};\n\t\tauthParameters.USERNAME = this.username;\n\t\tauthParameters.PASSWORD = authDetails.getPassword();\n\t\tif (!authParameters.PASSWORD) {\n\t\t\tcallback.onFailure(new Error('PASSWORD parameter is required'));\n\t\t\treturn;\n\t\t}\n\t\tvar authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n\t\tthis.getCachedDeviceKeyAndPassword();\n\t\tif (this.deviceKey != null) {\n\t\t\tauthParameters.DEVICE_KEY = this.deviceKey;\n\t\t}\n\n\t\tvar clientMetaData = Object.keys(authDetails.getValidationData()).length !== 0 ? authDetails.getValidationData() : authDetails.getClientMetadata();\n\n\t\tvar jsonReq = {\n\t\t\tAuthFlow: 'USER_PASSWORD_AUTH',\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tAuthParameters: authParameters,\n\t\t\tClientMetadata: clientMetaData\n\t\t};\n\t\tif (this.getUserContextData(this.username)) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData(this.username);\n\t\t}\n\t\t// USER_PASSWORD_AUTH happens in a single round-trip: client sends userName and password,\n\t\t// Cognito UserPools verifies password and returns tokens.\n\t\tthis.client.request('InitiateAuth', jsonReq, function (err, authResult) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\treturn _this3.authenticateUserInternal(authResult, authenticationHelper, callback);\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.authenticateUserInternal = function authenticateUserInternal(dataAuthenticate, authenticationHelper, callback) {\n\t\tvar _this4 = this;\n\n\t\tvar challengeName = dataAuthenticate.ChallengeName;\n\t\tvar challengeParameters = dataAuthenticate.ChallengeParameters;\n\n\t\tif (challengeName === 'SMS_MFA') {\n\t\t\tthis.Session = dataAuthenticate.Session;\n\t\t\treturn callback.mfaRequired(challengeName, challengeParameters);\n\t\t}\n\n\t\tif (challengeName === 'SELECT_MFA_TYPE') {\n\t\t\tthis.Session = dataAuthenticate.Session;\n\t\t\treturn callback.selectMFAType(challengeName, challengeParameters);\n\t\t}\n\n\t\tif (challengeName === 'MFA_SETUP') {\n\t\t\tthis.Session = dataAuthenticate.Session;\n\t\t\treturn callback.mfaSetup(challengeName, challengeParameters);\n\t\t}\n\n\t\tif (challengeName === 'SOFTWARE_TOKEN_MFA') {\n\t\t\tthis.Session = dataAuthenticate.Session;\n\t\t\treturn callback.totpRequired(challengeName, challengeParameters);\n\t\t}\n\n\t\tif (challengeName === 'CUSTOM_CHALLENGE') {\n\t\t\tthis.Session = dataAuthenticate.Session;\n\t\t\treturn callback.customChallenge(challengeParameters);\n\t\t}\n\n\t\tif (challengeName === 'NEW_PASSWORD_REQUIRED') {\n\t\t\tthis.Session = dataAuthenticate.Session;\n\n\t\t\tvar userAttributes = null;\n\t\t\tvar rawRequiredAttributes = null;\n\t\t\tvar requiredAttributes = [];\n\t\t\tvar userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\n\t\t\tif (challengeParameters) {\n\t\t\t\tuserAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.userAttributes);\n\t\t\t\trawRequiredAttributes = JSON.parse(dataAuthenticate.ChallengeParameters.requiredAttributes);\n\t\t\t}\n\n\t\t\tif (rawRequiredAttributes) {\n\t\t\t\tfor (var i = 0; i < rawRequiredAttributes.length; i++) {\n\t\t\t\t\trequiredAttributes[i] = rawRequiredAttributes[i].substr(userAttributesPrefix.length);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn callback.newPasswordRequired(userAttributes, requiredAttributes);\n\t\t}\n\n\t\tif (challengeName === 'DEVICE_SRP_AUTH') {\n\t\t\tthis.getDeviceResponse(callback);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\t\tthis.challengeName = challengeName;\n\t\tthis.cacheTokens();\n\n\t\tvar newDeviceMetadata = dataAuthenticate.AuthenticationResult.NewDeviceMetadata;\n\t\tif (newDeviceMetadata == null) {\n\t\t\treturn callback.onSuccess(this.signInUserSession);\n\t\t}\n\n\t\tauthenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n\t\t\tif (errGenHash) {\n\t\t\t\treturn callback.onFailure(errGenHash);\n\t\t\t}\n\n\t\t\tvar deviceSecretVerifierConfig = {\n\t\t\t\tSalt: Buffer.from(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n\t\t\t\tPasswordVerifier: Buffer.from(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n\t\t\t};\n\n\t\t\t_this4.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n\t\t\t_this4.deviceGroupKey = newDeviceMetadata.DeviceGroupKey;\n\t\t\t_this4.randomPassword = authenticationHelper.getRandomPassword();\n\n\t\t\t_this4.client.request('ConfirmDevice', {\n\t\t\t\tDeviceKey: newDeviceMetadata.DeviceKey,\n\t\t\t\tAccessToken: _this4.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\t\tDeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n\t\t\t\tDeviceName: navigator.userAgent\n\t\t\t}, function (errConfirm, dataConfirm) {\n\t\t\t\tif (errConfirm) {\n\t\t\t\t\treturn callback.onFailure(errConfirm);\n\t\t\t\t}\n\n\t\t\t\t_this4.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\t\t\t\t_this4.cacheDeviceKeyAndPassword();\n\t\t\t\tif (dataConfirm.UserConfirmationNecessary === true) {\n\t\t\t\t\treturn callback.onSuccess(_this4.signInUserSession, dataConfirm.UserConfirmationNecessary);\n\t\t\t\t}\n\t\t\t\treturn callback.onSuccess(_this4.signInUserSession);\n\t\t\t});\n\t\t\treturn undefined;\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.completeNewPasswordChallenge = function completeNewPasswordChallenge(newPassword, requiredAttributeData, callback, clientMetadata) {\n\t\tvar _this5 = this;\n\n\t\tif (!newPassword) {\n\t\t\treturn callback.onFailure(new Error('New password is required.'));\n\t\t}\n\t\tvar authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n\t\tvar userAttributesPrefix = authenticationHelper.getNewPasswordRequiredChallengeUserAttributePrefix();\n\n\t\tvar finalUserAttributes = {};\n\t\tif (requiredAttributeData) {\n\t\t\tObject.keys(requiredAttributeData).forEach(function (key) {\n\t\t\t\tfinalUserAttributes[userAttributesPrefix + key] = requiredAttributeData[key];\n\t\t\t});\n\t\t}\n\n\t\tfinalUserAttributes.NEW_PASSWORD = newPassword;\n\t\tfinalUserAttributes.USERNAME = this.username;\n\t\tvar jsonReq = {\n\t\t\tChallengeName: 'NEW_PASSWORD_REQUIRED',\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tChallengeResponses: finalUserAttributes,\n\t\t\tSession: this.Session,\n\t\t\tClientMetadata: clientMetadata\n\t\t};\n\t\tif (this.getUserContextData()) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData();\n\t\t}\n\n\t\tthis.client.request('RespondToAuthChallenge', jsonReq, function (errAuthenticate, dataAuthenticate) {\n\t\t\tif (errAuthenticate) {\n\t\t\t\treturn callback.onFailure(errAuthenticate);\n\t\t\t}\n\t\t\treturn _this5.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.getDeviceResponse = function getDeviceResponse(callback, clientMetadata) {\n\t\tvar _this6 = this;\n\n\t\tvar authenticationHelper = new AuthenticationHelper(this.deviceGroupKey);\n\t\tvar dateHelper = new DateHelper();\n\n\t\tvar authParameters = {};\n\n\t\tauthParameters.USERNAME = this.username;\n\t\tauthParameters.DEVICE_KEY = this.deviceKey;\n\t\tauthenticationHelper.getLargeAValue(function (errAValue, aValue) {\n\t\t\t// getLargeAValue callback start\n\t\t\tif (errAValue) {\n\t\t\t\tcallback.onFailure(errAValue);\n\t\t\t}\n\n\t\t\tauthParameters.SRP_A = aValue.toString(16);\n\n\t\t\tvar jsonReq = {\n\t\t\t\tChallengeName: 'DEVICE_SRP_AUTH',\n\t\t\t\tClientId: _this6.pool.getClientId(),\n\t\t\t\tChallengeResponses: authParameters,\n\t\t\t\tClientMetadata: clientMetadata\n\t\t\t};\n\t\t\tif (_this6.getUserContextData()) {\n\t\t\t\tjsonReq.UserContextData = _this6.getUserContextData();\n\t\t\t}\n\t\t\t_this6.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n\t\t\t\tif (err) {\n\t\t\t\t\treturn callback.onFailure(err);\n\t\t\t\t}\n\n\t\t\t\tvar challengeParameters = data.ChallengeParameters;\n\n\t\t\t\tvar serverBValue = new BigInteger(challengeParameters.SRP_B, 16);\n\t\t\t\tvar salt = new BigInteger(challengeParameters.SALT, 16);\n\n\t\t\t\tauthenticationHelper.getPasswordAuthenticationKey(_this6.deviceKey, _this6.randomPassword, serverBValue, salt, function (errHkdf, hkdf) {\n\t\t\t\t\t// getPasswordAuthenticationKey callback start\n\t\t\t\t\tif (errHkdf) {\n\t\t\t\t\t\treturn callback.onFailure(errHkdf);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar dateNow = dateHelper.getNowString();\n\n\t\t\t\t\tvar 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\t\t\t\t\tvar key = CryptoJS.lib.WordArray.create(hkdf);\n\t\t\t\t\tvar signatureString = Base64.stringify(HmacSHA256(message, key));\n\n\t\t\t\t\tvar challengeResponses = {};\n\n\t\t\t\t\tchallengeResponses.USERNAME = _this6.username;\n\t\t\t\t\tchallengeResponses.PASSWORD_CLAIM_SECRET_BLOCK = challengeParameters.SECRET_BLOCK;\n\t\t\t\t\tchallengeResponses.TIMESTAMP = dateNow;\n\t\t\t\t\tchallengeResponses.PASSWORD_CLAIM_SIGNATURE = signatureString;\n\t\t\t\t\tchallengeResponses.DEVICE_KEY = _this6.deviceKey;\n\n\t\t\t\t\tvar jsonReqResp = {\n\t\t\t\t\t\tChallengeName: 'DEVICE_PASSWORD_VERIFIER',\n\t\t\t\t\t\tClientId: _this6.pool.getClientId(),\n\t\t\t\t\t\tChallengeResponses: challengeResponses,\n\t\t\t\t\t\tSession: data.Session\n\t\t\t\t\t};\n\t\t\t\t\tif (_this6.getUserContextData()) {\n\t\t\t\t\t\tjsonReqResp.UserContextData = _this6.getUserContextData();\n\t\t\t\t\t}\n\n\t\t\t\t\t_this6.client.request('RespondToAuthChallenge', jsonReqResp, function (errAuthenticate, dataAuthenticate) {\n\t\t\t\t\t\tif (errAuthenticate) {\n\t\t\t\t\t\t\treturn callback.onFailure(errAuthenticate);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t_this6.signInUserSession = _this6.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\t\t\t\t\t\t_this6.cacheTokens();\n\n\t\t\t\t\t\treturn callback.onSuccess(_this6.signInUserSession);\n\t\t\t\t\t});\n\t\t\t\t\treturn undefined;\n\t\t\t\t\t// getPasswordAuthenticationKey callback end\n\t\t\t\t});\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t\t// getLargeAValue callback end\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.confirmRegistration = function confirmRegistration(confirmationCode, forceAliasCreation, callback, clientMetadata) {\n\t\tvar jsonReq = {\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tConfirmationCode: confirmationCode,\n\t\t\tUsername: this.username,\n\t\t\tForceAliasCreation: forceAliasCreation,\n\t\t\tClientMetadata: clientMetadata\n\t\t};\n\t\tif (this.getUserContextData()) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData();\n\t\t}\n\t\tthis.client.request('ConfirmSignUp', jsonReq, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\treturn callback(null, 'SUCCESS');\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.sendCustomChallengeAnswer = function sendCustomChallengeAnswer(answerChallenge, callback, clientMetadata) {\n\t\tvar _this7 = this;\n\n\t\tvar challengeResponses = {};\n\t\tchallengeResponses.USERNAME = this.username;\n\t\tchallengeResponses.ANSWER = answerChallenge;\n\n\t\tvar authenticationHelper = new AuthenticationHelper(this.pool.getUserPoolId().split('_')[1]);\n\t\tthis.getCachedDeviceKeyAndPassword();\n\t\tif (this.deviceKey != null) {\n\t\t\tchallengeResponses.DEVICE_KEY = this.deviceKey;\n\t\t}\n\n\t\tvar jsonReq = {\n\t\t\tChallengeName: 'CUSTOM_CHALLENGE',\n\t\t\tChallengeResponses: challengeResponses,\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tSession: this.Session,\n\t\t\tClientMetadata: clientMetadata\n\t\t};\n\t\tif (this.getUserContextData()) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData();\n\t\t}\n\t\tthis.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\n\t\t\treturn _this7.authenticateUserInternal(data, authenticationHelper, callback);\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.sendMFACode = function sendMFACode(confirmationCode, callback, mfaType, clientMetadata) {\n\t\tvar _this8 = this;\n\n\t\tvar challengeResponses = {};\n\t\tchallengeResponses.USERNAME = this.username;\n\t\tchallengeResponses.SMS_MFA_CODE = confirmationCode;\n\t\tvar mfaTypeSelection = mfaType || 'SMS_MFA';\n\t\tif (mfaTypeSelection === 'SOFTWARE_TOKEN_MFA') {\n\t\t\tchallengeResponses.SOFTWARE_TOKEN_MFA_CODE = confirmationCode;\n\t\t}\n\n\t\tif (this.deviceKey != null) {\n\t\t\tchallengeResponses.DEVICE_KEY = this.deviceKey;\n\t\t}\n\n\t\tvar jsonReq = {\n\t\t\tChallengeName: mfaTypeSelection,\n\t\t\tChallengeResponses: challengeResponses,\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tSession: this.Session,\n\t\t\tClientMetadata: clientMetadata\n\t\t};\n\t\tif (this.getUserContextData()) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData();\n\t\t}\n\n\t\tthis.client.request('RespondToAuthChallenge', jsonReq, function (err, dataAuthenticate) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\n\t\t\tvar challengeName = dataAuthenticate.ChallengeName;\n\n\t\t\tif (challengeName === 'DEVICE_SRP_AUTH') {\n\t\t\t\t_this8.getDeviceResponse(callback);\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t_this8.signInUserSession = _this8.getCognitoUserSession(dataAuthenticate.AuthenticationResult);\n\t\t\t_this8.cacheTokens();\n\n\t\t\tif (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {\n\t\t\t\treturn callback.onSuccess(_this8.signInUserSession);\n\t\t\t}\n\n\t\t\tvar authenticationHelper = new AuthenticationHelper(_this8.pool.getUserPoolId().split('_')[1]);\n\t\t\tauthenticationHelper.generateHashDevice(dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey, dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey, function (errGenHash) {\n\t\t\t\tif (errGenHash) {\n\t\t\t\t\treturn callback.onFailure(errGenHash);\n\t\t\t\t}\n\n\t\t\t\tvar deviceSecretVerifierConfig = {\n\t\t\t\t\tSalt: Buffer.from(authenticationHelper.getSaltDevices(), 'hex').toString('base64'),\n\t\t\t\t\tPasswordVerifier: Buffer.from(authenticationHelper.getVerifierDevices(), 'hex').toString('base64')\n\t\t\t\t};\n\n\t\t\t\t_this8.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;\n\t\t\t\t_this8.deviceGroupKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey;\n\t\t\t\t_this8.randomPassword = authenticationHelper.getRandomPassword();\n\n\t\t\t\t_this8.client.request('ConfirmDevice', {\n\t\t\t\t\tDeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,\n\t\t\t\t\tAccessToken: _this8.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\t\t\tDeviceSecretVerifierConfig: deviceSecretVerifierConfig,\n\t\t\t\t\tDeviceName: navigator.userAgent\n\t\t\t\t}, function (errConfirm, dataConfirm) {\n\t\t\t\t\tif (errConfirm) {\n\t\t\t\t\t\treturn callback.onFailure(errConfirm);\n\t\t\t\t\t}\n\n\t\t\t\t\t_this8.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;\n\t\t\t\t\t_this8.cacheDeviceKeyAndPassword();\n\t\t\t\t\tif (dataConfirm.UserConfirmationNecessary === true) {\n\t\t\t\t\t\treturn callback.onSuccess(_this8.signInUserSession, dataConfirm.UserConfirmationNecessary);\n\t\t\t\t\t}\n\t\t\t\t\treturn callback.onSuccess(_this8.signInUserSession);\n\t\t\t\t});\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t\treturn undefined;\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.changePassword = function changePassword(oldUserPassword, newUserPassword, callback, clientMetadata) {\n\t\tif (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tthis.client.request('ChangePassword', {\n\t\t\tPreviousPassword: oldUserPassword,\n\t\t\tProposedPassword: newUserPassword,\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\tClientMetadata: clientMetadata\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\treturn callback(null, 'SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.enableMFA = function enableMFA(callback) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tvar mfaOptions = [];\n\t\tvar mfaEnabled = {\n\t\t\tDeliveryMedium: 'SMS',\n\t\t\tAttributeName: 'phone_number'\n\t\t};\n\t\tmfaOptions.push(mfaEnabled);\n\n\t\tthis.client.request('SetUserSettings', {\n\t\t\tMFAOptions: mfaOptions,\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\treturn callback(null, 'SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.setUserMfaPreference = function setUserMfaPreference(smsMfaSettings, softwareTokenMfaSettings, callback) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tthis.client.request('SetUserMFAPreference', {\n\t\t\tSMSMfaSettings: smsMfaSettings,\n\t\t\tSoftwareTokenMfaSettings: softwareTokenMfaSettings,\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\treturn callback(null, 'SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.disableMFA = function disableMFA(callback) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tvar mfaOptions = [];\n\n\t\tthis.client.request('SetUserSettings', {\n\t\t\tMFAOptions: mfaOptions,\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\treturn callback(null, 'SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.deleteUser = function deleteUser(callback, clientMetadata) {\n\t\tvar _this9 = this;\n\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tthis.client.request('DeleteUser', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\tClientMetadata: clientMetadata\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\t_this9.clearCachedUser();\n\t\t\treturn callback(null, 'SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\n * @typedef {CognitoUserAttribute | { Name:string, Value:string }} AttributeArg\n */\n\t/**\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\tCognitoUser.prototype.updateAttributes = function updateAttributes(attributes, callback, clientMetadata) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tthis.client.request('UpdateUserAttributes', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\tUserAttributes: attributes,\n\t\t\tClientMetadata: clientMetadata\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\treturn callback(null, 'SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.getUserAttributes = function getUserAttributes(callback) {\n\t\tif (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tthis.client.request('GetUser', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t}, function (err, userData) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\n\t\t\tvar attributeList = [];\n\n\t\t\tfor (var i = 0; i < userData.UserAttributes.length; i++) {\n\t\t\t\tvar attribute = {\n\t\t\t\t\tName: userData.UserAttributes[i].Name,\n\t\t\t\t\tValue: userData.UserAttributes[i].Value\n\t\t\t\t};\n\t\t\t\tvar userAttribute = new CognitoUserAttribute(attribute);\n\t\t\t\tattributeList.push(userAttribute);\n\t\t\t}\n\n\t\t\treturn callback(null, attributeList);\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\n * This is used by an authenticated user to get the MFAOptions\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.getMFAOptions = function getMFAOptions(callback) {\n\t\tif (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tthis.client.request('GetUser', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t}, function (err, userData) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\n\t\t\treturn callback(null, userData.MFAOptions);\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\n * This is used by an authenticated users to get the userData\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.getUserData = function getUserData(callback, params) {\n\t\tvar _this10 = this;\n\n\t\tif (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t\t\tthis.clearCachedUserData();\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tvar bypassCache = params ? params.bypassCache : false;\n\n\t\tvar userData = this.storage.getItem(this.userDataKey);\n\t\t// get the cached user data\n\n\t\tif (!userData || bypassCache) {\n\t\t\tthis.client.request('GetUser', {\n\t\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t\t}, function (err, latestUserData) {\n\t\t\t\tif (err) {\n\t\t\t\t\treturn callback(err, null);\n\t\t\t\t}\n\t\t\t\t_this10.cacheUserData(latestUserData);\n\t\t\t\tvar refresh = _this10.signInUserSession.getRefreshToken();\n\t\t\t\tif (refresh && refresh.getToken()) {\n\t\t\t\t\t_this10.refreshSession(refresh, function (refreshError, data) {\n\t\t\t\t\t\tif (refreshError) {\n\t\t\t\t\t\t\treturn callback(refreshError, null);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn callback(null, latestUserData);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn callback(null, latestUserData);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\ttry {\n\t\t\t\treturn callback(null, JSON.parse(userData));\n\t\t\t} catch (err) {\n\t\t\t\tthis.clearCachedUserData();\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.deleteAttributes = function deleteAttributes(attributeList, callback) {\n\t\tif (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t\t\treturn callback(new Error('User is not authenticated'), null);\n\t\t}\n\n\t\tthis.client.request('DeleteUserAttributes', {\n\t\t\tUserAttributeNames: attributeList,\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\treturn callback(null, 'SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.resendConfirmationCode = function resendConfirmationCode(callback, clientMetadata) {\n\t\tvar jsonReq = {\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tUsername: this.username,\n\t\t\tClientMetadata: clientMetadata\n\t\t};\n\n\t\tthis.client.request('ResendConfirmationCode', jsonReq, function (err, result) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\treturn callback(null, result);\n\t\t});\n\t};\n\n\t/**\n * This is used to get a session, either from the session object\n * or from the local storage, or by using a refresh token\n *\n * @param {nodeCallback} callback Called on success or error.\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.getSession = function getSession(callback) {\n\t\tif (this.username == null) {\n\t\t\treturn callback(new Error('Username is null. Cannot retrieve a new session'), null);\n\t\t}\n\n\t\tif (this.signInUserSession != null && this.signInUserSession.isValid()) {\n\t\t\treturn callback(null, this.signInUserSession);\n\t\t}\n\n\t\tvar keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t\tvar idTokenKey = keyPrefix + '.idToken';\n\t\tvar accessTokenKey = keyPrefix + '.accessToken';\n\t\tvar refreshTokenKey = keyPrefix + '.refreshToken';\n\t\tvar clockDriftKey = keyPrefix + '.clockDrift';\n\n\t\tif (this.storage.getItem(idTokenKey)) {\n\t\t\tvar idToken = new CognitoIdToken({\n\t\t\t\tIdToken: this.storage.getItem(idTokenKey)\n\t\t\t});\n\t\t\tvar accessToken = new CognitoAccessToken({\n\t\t\t\tAccessToken: this.storage.getItem(accessTokenKey)\n\t\t\t});\n\t\t\tvar refreshToken = new CognitoRefreshToken({\n\t\t\t\tRefreshToken: this.storage.getItem(refreshTokenKey)\n\t\t\t});\n\t\t\tvar clockDrift = parseInt(this.storage.getItem(clockDriftKey), 0) || 0;\n\n\t\t\tvar sessionData = {\n\t\t\t\tIdToken: idToken,\n\t\t\t\tAccessToken: accessToken,\n\t\t\t\tRefreshToken: refreshToken,\n\t\t\t\tClockDrift: clockDrift\n\t\t\t};\n\t\t\tvar cachedSession = new CognitoUserSession(sessionData);\n\t\t\tif (cachedSession.isValid()) {\n\t\t\t\tthis.signInUserSession = cachedSession;\n\t\t\t\treturn callback(null, this.signInUserSession);\n\t\t\t}\n\n\t\t\tif (!refreshToken.getToken()) {\n\t\t\t\treturn callback(new Error('Cannot retrieve a new session. Please authenticate.'), null);\n\t\t\t}\n\n\t\t\tthis.refreshSession(refreshToken, callback);\n\t\t} else {\n\t\t\tcallback(new Error('Local storage is missing an ID Token, Please authenticate'), null);\n\t\t}\n\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.refreshSession = function refreshSession(refreshToken, callback, clientMetadata) {\n\t\tvar _this11 = this;\n\n\t\tvar authParameters = {};\n\t\tauthParameters.REFRESH_TOKEN = refreshToken.getToken();\n\t\tvar keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t\tvar lastUserKey = keyPrefix + '.LastAuthUser';\n\n\t\tif (this.storage.getItem(lastUserKey)) {\n\t\t\tthis.username = this.storage.getItem(lastUserKey);\n\t\t\tvar deviceKeyKey = keyPrefix + '.' + this.username + '.deviceKey';\n\t\t\tthis.deviceKey = this.storage.getItem(deviceKeyKey);\n\t\t\tauthParameters.DEVICE_KEY = this.deviceKey;\n\t\t}\n\n\t\tvar jsonReq = {\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tAuthFlow: 'REFRESH_TOKEN_AUTH',\n\t\t\tAuthParameters: authParameters,\n\t\t\tClientMetadata: clientMetadata\n\t\t};\n\t\tif (this.getUserContextData()) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData();\n\t\t}\n\t\tthis.client.request('InitiateAuth', jsonReq, function (err, authResult) {\n\t\t\tif (err) {\n\t\t\t\tif (err.code === 'NotAuthorizedException') {\n\t\t\t\t\t_this11.clearCachedUser();\n\t\t\t\t}\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\t\t\tif (authResult) {\n\t\t\t\tvar authenticationResult = authResult.AuthenticationResult;\n\t\t\t\tif (!Object.prototype.hasOwnProperty.call(authenticationResult, 'RefreshToken')) {\n\t\t\t\t\tauthenticationResult.RefreshToken = refreshToken.getToken();\n\t\t\t\t}\n\t\t\t\t_this11.signInUserSession = _this11.getCognitoUserSession(authenticationResult);\n\t\t\t\t_this11.cacheTokens();\n\t\t\t\treturn callback(null, _this11.signInUserSession);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t});\n\t};\n\n\t/**\n * This is used to save the session tokens to local storage\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.cacheTokens = function cacheTokens() {\n\t\tvar keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t\tvar idTokenKey = keyPrefix + '.' + this.username + '.idToken';\n\t\tvar accessTokenKey = keyPrefix + '.' + this.username + '.accessToken';\n\t\tvar refreshTokenKey = keyPrefix + '.' + this.username + '.refreshToken';\n\t\tvar clockDriftKey = keyPrefix + '.' + this.username + '.clockDrift';\n\t\tvar lastUserKey = keyPrefix + '.LastAuthUser';\n\n\t\tthis.storage.setItem(idTokenKey, this.signInUserSession.getIdToken().getJwtToken());\n\t\tthis.storage.setItem(accessTokenKey, this.signInUserSession.getAccessToken().getJwtToken());\n\t\tthis.storage.setItem(refreshTokenKey, this.signInUserSession.getRefreshToken().getToken());\n\t\tthis.storage.setItem(clockDriftKey, '' + this.signInUserSession.getClockDrift());\n\t\tthis.storage.setItem(lastUserKey, this.username);\n\t};\n\n\t/**\n * This is to cache user data\n */\n\n\n\tCognitoUser.prototype.cacheUserData = function cacheUserData(userData) {\n\t\tthis.storage.setItem(this.userDataKey, JSON.stringify(userData));\n\t};\n\n\t/**\n * This is to remove cached user data\n */\n\n\n\tCognitoUser.prototype.clearCachedUserData = function clearCachedUserData() {\n\t\tthis.storage.removeItem(this.userDataKey);\n\t};\n\n\tCognitoUser.prototype.clearCachedUser = function clearCachedUser() {\n\t\tthis.clearCachedTokens();\n\t\tthis.clearCachedUserData();\n\t};\n\n\t/**\n * This is used to cache the device key and device group and device password\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.cacheDeviceKeyAndPassword = function cacheDeviceKeyAndPassword() {\n\t\tvar keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t\tvar deviceKeyKey = keyPrefix + '.deviceKey';\n\t\tvar randomPasswordKey = keyPrefix + '.randomPasswordKey';\n\t\tvar deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\n\t\tthis.storage.setItem(deviceKeyKey, this.deviceKey);\n\t\tthis.storage.setItem(randomPasswordKey, this.randomPassword);\n\t\tthis.storage.setItem(deviceGroupKeyKey, this.deviceGroupKey);\n\t};\n\n\t/**\n * This is used to get current device key and device group and device password\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.getCachedDeviceKeyAndPassword = function getCachedDeviceKeyAndPassword() {\n\t\tvar keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t\tvar deviceKeyKey = keyPrefix + '.deviceKey';\n\t\tvar randomPasswordKey = keyPrefix + '.randomPasswordKey';\n\t\tvar deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\n\t\tif (this.storage.getItem(deviceKeyKey)) {\n\t\t\tthis.deviceKey = this.storage.getItem(deviceKeyKey);\n\t\t\tthis.randomPassword = this.storage.getItem(randomPasswordKey);\n\t\t\tthis.deviceGroupKey = this.storage.getItem(deviceGroupKeyKey);\n\t\t}\n\t};\n\n\t/**\n * This is used to clear the device key info from local storage\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.clearCachedDeviceKeyAndPassword = function clearCachedDeviceKeyAndPassword() {\n\t\tvar keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId() + '.' + this.username;\n\t\tvar deviceKeyKey = keyPrefix + '.deviceKey';\n\t\tvar randomPasswordKey = keyPrefix + '.randomPasswordKey';\n\t\tvar deviceGroupKeyKey = keyPrefix + '.deviceGroupKey';\n\n\t\tthis.storage.removeItem(deviceKeyKey);\n\t\tthis.storage.removeItem(randomPasswordKey);\n\t\tthis.storage.removeItem(deviceGroupKeyKey);\n\t};\n\n\t/**\n * This is used to clear the session tokens from local storage\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.clearCachedTokens = function clearCachedTokens() {\n\t\tvar keyPrefix = 'CognitoIdentityServiceProvider.' + this.pool.getClientId();\n\t\tvar idTokenKey = keyPrefix + '.' + this.username + '.idToken';\n\t\tvar accessTokenKey = keyPrefix + '.' + this.username + '.accessToken';\n\t\tvar refreshTokenKey = keyPrefix + '.' + this.username + '.refreshToken';\n\t\tvar lastUserKey = keyPrefix + '.LastAuthUser';\n\t\tvar clockDriftKey = keyPrefix + '.' + this.username + '.clockDrift';\n\n\t\tthis.storage.removeItem(idTokenKey);\n\t\tthis.storage.removeItem(accessTokenKey);\n\t\tthis.storage.removeItem(refreshTokenKey);\n\t\tthis.storage.removeItem(lastUserKey);\n\t\tthis.storage.removeItem(clockDriftKey);\n\t};\n\n\t/**\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\tCognitoUser.prototype.getCognitoUserSession = function getCognitoUserSession(authResult) {\n\t\tvar idToken = new CognitoIdToken(authResult);\n\t\tvar accessToken = new CognitoAccessToken(authResult);\n\t\tvar refreshToken = new CognitoRefreshToken(authResult);\n\n\t\tvar sessionData = {\n\t\t\tIdToken: idToken,\n\t\t\tAccessToken: accessToken,\n\t\t\tRefreshToken: refreshToken\n\t\t};\n\n\t\treturn new CognitoUserSession(sessionData);\n\t};\n\n\t/**\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\tCognitoUser.prototype.forgotPassword = function forgotPassword(callback, clientMetadata) {\n\t\tvar jsonReq = {\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tUsername: this.username,\n\t\t\tClientMetadata: clientMetadata\n\t\t};\n\t\tif (this.getUserContextData()) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData();\n\t\t}\n\t\tthis.client.request('ForgotPassword', jsonReq, function (err, data) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\tif (typeof callback.inputVerificationCode === 'function') {\n\t\t\t\treturn callback.inputVerificationCode(data);\n\t\t\t}\n\t\t\treturn callback.onSuccess(data);\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.confirmPassword = function confirmPassword(confirmationCode, newPassword, callback, clientMetadata) {\n\t\tvar jsonReq = {\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tUsername: this.username,\n\t\t\tConfirmationCode: confirmationCode,\n\t\t\tPassword: newPassword,\n\t\t\tClientMetadata: clientMetadata\n\t\t};\n\t\tif (this.getUserContextData()) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData();\n\t\t}\n\t\tthis.client.request('ConfirmForgotPassword', jsonReq, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\treturn callback.onSuccess();\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.getAttributeVerificationCode = function getAttributeVerificationCode(attributeName, callback, clientMetadata) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback.onFailure(new Error('User is not authenticated'));\n\t\t}\n\n\t\tthis.client.request('GetUserAttributeVerificationCode', {\n\t\t\tAttributeName: attributeName,\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\tClientMetadata: clientMetadata\n\t\t}, function (err, data) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\tif (typeof callback.inputVerificationCode === 'function') {\n\t\t\t\treturn callback.inputVerificationCode(data);\n\t\t\t}\n\t\t\treturn callback.onSuccess();\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.verifyAttribute = function verifyAttribute(attributeName, confirmationCode, callback) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback.onFailure(new Error('User is not authenticated'));\n\t\t}\n\n\t\tthis.client.request('VerifyUserAttribute', {\n\t\t\tAttributeName: attributeName,\n\t\t\tCode: confirmationCode,\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\treturn callback.onSuccess('SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.getDevice = function getDevice(callback) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback.onFailure(new Error('User is not authenticated'));\n\t\t}\n\n\t\tthis.client.request('GetDevice', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\tDeviceKey: this.deviceKey\n\t\t}, function (err, data) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\treturn callback.onSuccess(data);\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.forgetSpecificDevice = function forgetSpecificDevice(deviceKey, callback) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback.onFailure(new Error('User is not authenticated'));\n\t\t}\n\n\t\tthis.client.request('ForgetDevice', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\tDeviceKey: deviceKey\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\treturn callback.onSuccess('SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.forgetDevice = function forgetDevice(callback) {\n\t\tvar _this12 = this;\n\n\t\tthis.forgetSpecificDevice(this.deviceKey, {\n\t\t\tonFailure: callback.onFailure,\n\t\t\tonSuccess: function onSuccess(result) {\n\t\t\t\t_this12.deviceKey = null;\n\t\t\t\t_this12.deviceGroupKey = null;\n\t\t\t\t_this12.randomPassword = null;\n\t\t\t\t_this12.clearCachedDeviceKeyAndPassword();\n\t\t\t\treturn callback.onSuccess(result);\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\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\tCognitoUser.prototype.setDeviceStatusRemembered = function setDeviceStatusRemembered(callback) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback.onFailure(new Error('User is not authenticated'));\n\t\t}\n\n\t\tthis.client.request('UpdateDeviceStatus', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\tDeviceKey: this.deviceKey,\n\t\t\tDeviceRememberedStatus: 'remembered'\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\treturn callback.onSuccess('SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.setDeviceStatusNotRemembered = function setDeviceStatusNotRemembered(callback) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback.onFailure(new Error('User is not authenticated'));\n\t\t}\n\n\t\tthis.client.request('UpdateDeviceStatus', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\tDeviceKey: this.deviceKey,\n\t\t\tDeviceRememberedStatus: 'not_remembered'\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\treturn callback.onSuccess('SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\n * This is used to list all devices for a user\n *\n * @param {int} limit the number of devices returned in a call\n * @param {string} paginationToken the pagination token in case any was returned before\n * @param {object} callback Result callback map.\n * @param {onFailure} callback.onFailure Called on any error.\n * @param {onSuccess<*>} callback.onSuccess Called on success with device list.\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.listDevices = function listDevices(limit, paginationToken, callback) {\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback.onFailure(new Error('User is not authenticated'));\n\t\t}\n\n\t\tthis.client.request('ListDevices', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\tLimit: limit,\n\t\t\tPaginationToken: paginationToken\n\t\t}, function (err, data) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\treturn callback.onSuccess(data);\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\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\tCognitoUser.prototype.globalSignOut = function globalSignOut(callback) {\n\t\tvar _this13 = this;\n\n\t\tif (this.signInUserSession == null || !this.signInUserSession.isValid()) {\n\t\t\treturn callback.onFailure(new Error('User is not authenticated'));\n\t\t}\n\n\t\tthis.client.request('GlobalSignOut', {\n\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t}, function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\t_this13.clearCachedUser();\n\t\t\treturn callback.onSuccess('SUCCESS');\n\t\t});\n\t\treturn undefined;\n\t};\n\n\t/**\n * This is used for the user to signOut of the application and clear the cached tokens.\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.signOut = function signOut() {\n\t\tthis.signInUserSession = null;\n\t\tthis.clearCachedUser();\n\t};\n\n\t/**\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\tCognitoUser.prototype.sendMFASelectionAnswer = function sendMFASelectionAnswer(answerChallenge, callback) {\n\t\tvar _this14 = this;\n\n\t\tvar challengeResponses = {};\n\t\tchallengeResponses.USERNAME = this.username;\n\t\tchallengeResponses.ANSWER = answerChallenge;\n\n\t\tvar jsonReq = {\n\t\t\tChallengeName: 'SELECT_MFA_TYPE',\n\t\t\tChallengeResponses: challengeResponses,\n\t\t\tClientId: this.pool.getClientId(),\n\t\t\tSession: this.Session\n\t\t};\n\t\tif (this.getUserContextData()) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData();\n\t\t}\n\t\tthis.client.request('RespondToAuthChallenge', jsonReq, function (err, data) {\n\t\t\tif (err) {\n\t\t\t\treturn callback.onFailure(err);\n\t\t\t}\n\t\t\t_this14.Session = data.Session;\n\t\t\tif (answerChallenge === 'SMS_MFA') {\n\t\t\t\treturn callback.mfaRequired(data.challengeName, data.challengeParameters);\n\t\t\t}\n\t\t\tif (answerChallenge === 'SOFTWARE_TOKEN_MFA') {\n\t\t\t\treturn callback.totpRequired(data.challengeName, data.challengeParameters);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t});\n\t};\n\n\t/**\n * This returns the user context data for advanced security feature.\n * @returns {void}\n */\n\n\n\tCognitoUser.prototype.getUserContextData = function getUserContextData() {\n\t\tvar pool = this.pool;\n\t\treturn pool.getUserContextData(this.username);\n\t};\n\n\t/**\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\tCognitoUser.prototype.associateSoftwareToken = function associateSoftwareToken(callback) {\n\t\tvar _this15 = this;\n\n\t\tif (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t\t\tthis.client.request('AssociateSoftwareToken', {\n\t\t\t\tSession: this.Session\n\t\t\t}, function (err, data) {\n\t\t\t\tif (err) {\n\t\t\t\t\treturn callback.onFailure(err);\n\t\t\t\t}\n\t\t\t\t_this15.Session = data.Session;\n\t\t\t\treturn callback.associateSecretCode(data.SecretCode);\n\t\t\t});\n\t\t} else {\n\t\t\tthis.client.request('AssociateSoftwareToken', {\n\t\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken()\n\t\t\t}, function (err, data) {\n\t\t\t\tif (err) {\n\t\t\t\t\treturn callback.onFailure(err);\n\t\t\t\t}\n\t\t\t\treturn callback.associateSecretCode(data.SecretCode);\n\t\t\t});\n\t\t}\n\t};\n\n\t/**\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\tCognitoUser.prototype.verifySoftwareToken = function verifySoftwareToken(totpCode, friendlyDeviceName, callback) {\n\t\tvar _this16 = this;\n\n\t\tif (!(this.signInUserSession != null && this.signInUserSession.isValid())) {\n\t\t\tthis.client.request('VerifySoftwareToken', {\n\t\t\t\tSession: this.Session,\n\t\t\t\tUserCode: totpCode,\n\t\t\t\tFriendlyDeviceName: friendlyDeviceName\n\t\t\t}, function (err, data) {\n\t\t\t\tif (err) {\n\t\t\t\t\treturn callback.onFailure(err);\n\t\t\t\t}\n\t\t\t\t_this16.Session = data.Session;\n\t\t\t\tvar challengeResponses = {};\n\t\t\t\tchallengeResponses.USERNAME = _this16.username;\n\t\t\t\tvar jsonReq = {\n\t\t\t\t\tChallengeName: 'MFA_SETUP',\n\t\t\t\t\tClientId: _this16.pool.getClientId(),\n\t\t\t\t\tChallengeResponses: challengeResponses,\n\t\t\t\t\tSession: _this16.Session\n\t\t\t\t};\n\t\t\t\tif (_this16.getUserContextData()) {\n\t\t\t\t\tjsonReq.UserContextData = _this16.getUserContextData();\n\t\t\t\t}\n\t\t\t\t_this16.client.request('RespondToAuthChallenge', jsonReq, function (errRespond, dataRespond) {\n\t\t\t\t\tif (errRespond) {\n\t\t\t\t\t\treturn callback.onFailure(errRespond);\n\t\t\t\t\t}\n\t\t\t\t\t_this16.signInUserSession = _this16.getCognitoUserSession(dataRespond.AuthenticationResult);\n\t\t\t\t\t_this16.cacheTokens();\n\t\t\t\t\treturn callback.onSuccess(_this16.signInUserSession);\n\t\t\t\t});\n\t\t\t\treturn undefined;\n\t\t\t});\n\t\t} else {\n\t\t\tthis.client.request('VerifySoftwareToken', {\n\t\t\t\tAccessToken: this.signInUserSession.getAccessToken().getJwtToken(),\n\t\t\t\tUserCode: totpCode,\n\t\t\t\tFriendlyDeviceName: friendlyDeviceName\n\t\t\t}, function (err, data) {\n\t\t\t\tif (err) {\n\t\t\t\t\treturn callback.onFailure(err);\n\t\t\t\t}\n\t\t\t\treturn callback.onSuccess(data);\n\t\t\t});\n\t\t}\n\t};\n\n\treturn CognitoUser;\n}();\n\nexport default CognitoUser;","// class for defining the amzn user-agent\nexport default UserAgent;\n// constructor\nfunction UserAgent() {}\n// public\nUserAgent.prototype.userAgent = 'aws-amplify/0.1.x js';","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nimport UserAgent from './UserAgent';\n/** @class */\n\nvar Client = function () {\n\t/**\n * Constructs a new AWS Cognito Identity Provider client object\n * @param {string} region AWS region\n * @param {string} endpoint endpoint\n */\n\tfunction Client(region, endpoint) {\n\t\t_classCallCheck(this, Client);\n\n\t\tthis.endpoint = endpoint || 'https://cognito-idp.' + region + '.amazonaws.com/';\n\t\tthis.userAgent = UserAgent.prototype.userAgent || 'aws-amplify/0.1.x js';\n\t}\n\n\t/**\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\tClient.prototype.request = function request(operation, params, callback) {\n\t\tvar headers = {\n\t\t\t'Content-Type': 'application/x-amz-json-1.1',\n\t\t\t'X-Amz-Target': 'AWSCognitoIdentityProviderService.' + operation,\n\t\t\t'X-Amz-User-Agent': this.userAgent\n\t\t};\n\n\t\tvar options = {\n\t\t\theaders: headers,\n\t\t\tmethod: 'POST',\n\t\t\tmode: 'cors',\n\t\t\tcache: 'no-cache',\n\t\t\tbody: JSON.stringify(params)\n\t\t};\n\n\t\tvar response = void 0;\n\t\tvar responseJsonData = void 0;\n\n\t\tfetch(this.endpoint, options).then(function (resp) {\n\t\t\tresponse = resp;\n\t\t\treturn resp;\n\t\t}, function (err) {\n\t\t\t// If error happens here, the request failed\n\t\t\t// if it is TypeError throw network error\n\t\t\tif (err instanceof TypeError) {\n\t\t\t\tthrow new Error('Network error');\n\t\t\t}\n\t\t\tthrow err;\n\t\t}).then(function (resp) {\n\t\t\treturn resp.json().catch(function () {\n\t\t\t\treturn {};\n\t\t\t});\n\t\t}).then(function (data) {\n\t\t\t// return parsed body stream\n\t\t\tif (response.ok) return callback(null, data);\n\t\t\tresponseJsonData = data;\n\n\t\t\t// Taken from aws-sdk-js/lib/protocol/json.js\n\t\t\t// eslint-disable-next-line no-underscore-dangle\n\t\t\tvar code = (data.__type || data.code).split('#').pop();\n\t\t\tvar error = {\n\t\t\t\tcode: code,\n\t\t\t\tname: code,\n\t\t\t\tmessage: data.message || data.Message || null\n\t\t\t};\n\t\t\treturn callback(error);\n\t\t}).catch(function (err) {\n\t\t\t// first check if we have a service error\n\t\t\tif (response && response.headers && response.headers.get('x-amzn-errortype')) {\n\t\t\t\ttry {\n\t\t\t\t\tvar code = response.headers.get('x-amzn-errortype').split(':')[0];\n\t\t\t\t\tvar error = {\n\t\t\t\t\t\tcode: code,\n\t\t\t\t\t\tname: code,\n\t\t\t\t\t\tstatusCode: response.status,\n\t\t\t\t\t\tmessage: response.status ? response.status.toString() : null\n\t\t\t\t\t};\n\t\t\t\t\treturn callback(error);\n\t\t\t\t} catch (ex) {\n\t\t\t\t\treturn callback(err);\n\t\t\t\t}\n\t\t\t\t// otherwise check if error is Network error\n\t\t\t} else if (err instanceof Error && err.message === 'Network error') {\n\t\t\t\tvar _error = {\n\t\t\t\t\tcode: 'NetworkError',\n\t\t\t\t\tname: err.name,\n\t\t\t\t\tmessage: err.message\n\t\t\t\t};\n\t\t\t\treturn callback(_error);\n\t\t\t} else {\n\t\t\t\treturn callback(err);\n\t\t\t}\n\t\t});\n\t};\n\n\treturn Client;\n}();\n\nexport default Client;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/*!\n * Copyright 2016 Amazon.com,\n * Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Amazon Software License (the \"License\").\n * You may not use this file except in compliance with the\n * License. A copy of the License is located at\n *\n * http://aws.amazon.com/asl/\n *\n * or in the \"license\" file accompanying this file. This file is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, express or implied. See the License\n * for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Client from './Client';\nimport CognitoUser from './CognitoUser';\nimport StorageHelper from './StorageHelper';\n\n/** @class */\n\nvar CognitoUserPool = function () {\n\t/**\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 {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\tfunction CognitoUserPool(data) {\n\t\t_classCallCheck(this, CognitoUserPool);\n\n\t\tvar _ref = data || {},\n\t\t UserPoolId = _ref.UserPoolId,\n\t\t ClientId = _ref.ClientId,\n\t\t endpoint = _ref.endpoint,\n\t\t AdvancedSecurityDataCollectionFlag = _ref.AdvancedSecurityDataCollectionFlag;\n\n\t\tif (!UserPoolId || !ClientId) {\n\t\t\tthrow new Error('Both UserPoolId and ClientId are required.');\n\t\t}\n\t\tif (!/^[\\w-]+_.+$/.test(UserPoolId)) {\n\t\t\tthrow new Error('Invalid UserPoolId format.');\n\t\t}\n\t\tvar region = UserPoolId.split('_')[0];\n\n\t\tthis.userPoolId = UserPoolId;\n\t\tthis.clientId = ClientId;\n\n\t\tthis.client = new Client(region, endpoint);\n\n\t\t/**\n * By default, AdvancedSecurityDataCollectionFlag is set to true,\n * if no input value is provided.\n */\n\t\tthis.advancedSecurityDataCollectionFlag = AdvancedSecurityDataCollectionFlag !== false;\n\n\t\tthis.storage = data.Storage || new StorageHelper().getStorage();\n\t}\n\n\t/**\n * @returns {string} the user pool id\n */\n\n\n\tCognitoUserPool.prototype.getUserPoolId = function getUserPoolId() {\n\t\treturn this.userPoolId;\n\t};\n\n\t/**\n * @returns {string} the client id\n */\n\n\n\tCognitoUserPool.prototype.getClientId = function getClientId() {\n\t\treturn this.clientId;\n\t};\n\n\t/**\n * @typedef {object} SignUpResult\n * @property {CognitoUser} user New user.\n * @property {bool} userConfirmed If the user is already confirmed.\n */\n\t/**\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 * @returns {void}\n */\n\n\n\tCognitoUserPool.prototype.signUp = function signUp(username, password, userAttributes, validationData, callback, clientMetadata) {\n\t\tvar _this = this;\n\n\t\tvar jsonReq = {\n\t\t\tClientId: this.clientId,\n\t\t\tUsername: username,\n\t\t\tPassword: password,\n\t\t\tUserAttributes: userAttributes,\n\t\t\tValidationData: validationData,\n\t\t\tClientMetadata: clientMetadata\n\t\t};\n\t\tif (this.getUserContextData(username)) {\n\t\t\tjsonReq.UserContextData = this.getUserContextData(username);\n\t\t}\n\t\tthis.client.request('SignUp', jsonReq, function (err, data) {\n\t\t\tif (err) {\n\t\t\t\treturn callback(err, null);\n\t\t\t}\n\n\t\t\tvar cognitoUser = {\n\t\t\t\tUsername: username,\n\t\t\t\tPool: _this,\n\t\t\t\tStorage: _this.storage\n\t\t\t};\n\n\t\t\tvar returnData = {\n\t\t\t\tuser: new CognitoUser(cognitoUser),\n\t\t\t\tuserConfirmed: data.UserConfirmed,\n\t\t\t\tuserSub: data.UserSub,\n\t\t\t\tcodeDeliveryDetails: data.CodeDeliveryDetails\n\t\t\t};\n\n\t\t\treturn callback(null, returnData);\n\t\t});\n\t};\n\n\t/**\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\tCognitoUserPool.prototype.getCurrentUser = function getCurrentUser() {\n\t\tvar lastUserKey = 'CognitoIdentityServiceProvider.' + this.clientId + '.LastAuthUser';\n\n\t\tvar lastAuthUser = this.storage.getItem(lastUserKey);\n\t\tif (lastAuthUser) {\n\t\t\tvar cognitoUser = {\n\t\t\t\tUsername: lastAuthUser,\n\t\t\t\tPool: this,\n\t\t\t\tStorage: this.storage\n\t\t\t};\n\n\t\t\treturn new CognitoUser(cognitoUser);\n\t\t}\n\n\t\treturn null;\n\t};\n\n\t/**\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\tCognitoUserPool.prototype.getUserContextData = function getUserContextData(username) {\n\t\tif (typeof AmazonCognitoAdvancedSecurityData === 'undefined') {\n\t\t\treturn undefined;\n\t\t}\n\t\t/* eslint-disable */\n\t\tvar amazonCognitoAdvancedSecurityDataConst = AmazonCognitoAdvancedSecurityData;\n\t\t/* eslint-enable */\n\n\t\tif (this.advancedSecurityDataCollectionFlag) {\n\t\t\tvar advancedSecurityData = amazonCognitoAdvancedSecurityDataConst.getData(username, this.userPoolId, this.clientId);\n\t\t\tif (advancedSecurityData) {\n\t\t\t\tvar userContextData = {\n\t\t\t\t\tEncodedData: advancedSecurityData\n\t\t\t\t};\n\t\t\t\treturn userContextData;\n\t\t\t}\n\t\t}\n\t\treturn {};\n\t};\n\n\treturn CognitoUserPool;\n}();\n\nexport default CognitoUserPool;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nimport * as Cookies from 'js-cookie';\n\n/** @class */\n\nvar CookieStorage = function () {\n\t/**\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 */\n\tfunction CookieStorage(data) {\n\t\t_classCallCheck(this, CookieStorage);\n\n\t\tif (data.domain) {\n\t\t\tthis.domain = data.domain;\n\t\t} else {\n\t\t\tthrow new Error('The domain of cookieStorage can not be undefined.');\n\t\t}\n\t\tif (data.path) {\n\t\t\tthis.path = data.path;\n\t\t} else {\n\t\t\tthis.path = '/';\n\t\t}\n\t\tif (Object.prototype.hasOwnProperty.call(data, 'expires')) {\n\t\t\tthis.expires = data.expires;\n\t\t} else {\n\t\t\tthis.expires = 365;\n\t\t}\n\t\tif (Object.prototype.hasOwnProperty.call(data, 'secure')) {\n\t\t\tthis.secure = data.secure;\n\t\t} else {\n\t\t\tthis.secure = true;\n\t\t}\n\t}\n\n\t/**\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\tCookieStorage.prototype.setItem = function setItem(key, value) {\n\t\tCookies.set(key, value, {\n\t\t\tpath: this.path,\n\t\t\texpires: this.expires,\n\t\t\tdomain: this.domain,\n\t\t\tsecure: this.secure\n\t\t});\n\t\treturn Cookies.get(key);\n\t};\n\n\t/**\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\tCookieStorage.prototype.getItem = function getItem(key) {\n\t\treturn Cookies.get(key);\n\t};\n\n\t/**\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\tCookieStorage.prototype.removeItem = function removeItem(key) {\n\t\treturn Cookies.remove(key, {\n\t\t\tpath: this.path,\n\t\t\tdomain: this.domain,\n\t\t\tsecure: this.secure\n\t\t});\n\t};\n\n\t/**\n * This is used to clear the storage\n * @returns {string} nothing\n */\n\n\n\tCookieStorage.prototype.clear = function clear() {\n\t\tvar cookies = Cookies.get();\n\t\tvar index = void 0;\n\t\tfor (index = 0; index < cookies.length; ++index) {\n\t\t\tCookies.remove(cookies[index]);\n\t\t}\n\t\treturn {};\n\t};\n\n\treturn CookieStorage;\n}();\n\nexport default CookieStorage;","import _extends from 'babel-runtime/helpers/extends';\nimport _typeof from 'babel-runtime/helpers/typeof';\nvar formatRegExp = /%[sdj%]/g;\n\nexport var warning = function warning() {};\n\n// don't print warning message when in production env or node runtime\nif (process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {\n warning = function warning(type, errors) {\n if (typeof console !== 'undefined' && console.warn) {\n if (errors.every(function (e) {\n return typeof e === 'string';\n })) {\n console.warn(type, errors);\n }\n }\n };\n}\n\nexport function format() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var i = 1;\n var f = args[0];\n var len = args.length;\n if (typeof f === 'function') {\n return f.apply(null, args.slice(1));\n }\n if (typeof f === 'string') {\n var str = String(f).replace(formatRegExp, function (x) {\n if (x === '%%') {\n return '%';\n }\n if (i >= len) {\n return x;\n }\n switch (x) {\n case '%s':\n return String(args[i++]);\n case '%d':\n return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n break;\n default:\n return x;\n }\n });\n for (var arg = args[i]; i < len; arg = args[++i]) {\n str += ' ' + arg;\n }\n return str;\n }\n return f;\n}\n\nfunction isNativeStringType(type) {\n return type === 'string' || type === 'url' || type === 'hex' || type === 'email' || type === 'pattern';\n}\n\nexport function isEmptyValue(value, type) {\n if (value === undefined || value === null) {\n return true;\n }\n if (type === 'array' && Array.isArray(value) && !value.length) {\n return true;\n }\n if (isNativeStringType(type) && typeof value === 'string' && !value) {\n return true;\n }\n return false;\n}\n\nexport function isEmptyObject(obj) {\n return Object.keys(obj).length === 0;\n}\n\nfunction asyncParallelArray(arr, func, callback) {\n var results = [];\n var total = 0;\n var arrLength = arr.length;\n\n function count(errors) {\n results.push.apply(results, errors);\n total++;\n if (total === arrLength) {\n callback(results);\n }\n }\n\n arr.forEach(function (a) {\n func(a, count);\n });\n}\n\nfunction asyncSerialArray(arr, func, callback) {\n var index = 0;\n var arrLength = arr.length;\n\n function next(errors) {\n if (errors && errors.length) {\n callback(errors);\n return;\n }\n var original = index;\n index = index + 1;\n if (original < arrLength) {\n func(arr[original], next);\n } else {\n callback([]);\n }\n }\n\n next([]);\n}\n\nfunction flattenObjArr(objArr) {\n var ret = [];\n Object.keys(objArr).forEach(function (k) {\n ret.push.apply(ret, objArr[k]);\n });\n return ret;\n}\n\nexport function asyncMap(objArr, option, func, callback) {\n if (option.first) {\n var flattenArr = flattenObjArr(objArr);\n return asyncSerialArray(flattenArr, func, callback);\n }\n var firstFields = option.firstFields || [];\n if (firstFields === true) {\n firstFields = Object.keys(objArr);\n }\n var objArrKeys = Object.keys(objArr);\n var objArrLength = objArrKeys.length;\n var total = 0;\n var results = [];\n var next = function next(errors) {\n results.push.apply(results, errors);\n total++;\n if (total === objArrLength) {\n callback(results);\n }\n };\n objArrKeys.forEach(function (key) {\n var arr = objArr[key];\n if (firstFields.indexOf(key) !== -1) {\n asyncSerialArray(arr, func, next);\n } else {\n asyncParallelArray(arr, func, next);\n }\n });\n}\n\nexport function complementError(rule) {\n return function (oe) {\n if (oe && oe.message) {\n oe.field = oe.field || rule.fullField;\n return oe;\n }\n return {\n message: oe,\n field: oe.field || rule.fullField\n };\n };\n}\n\nexport function deepMerge(target, source) {\n if (source) {\n for (var s in source) {\n if (source.hasOwnProperty(s)) {\n var value = source[s];\n if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && _typeof(target[s]) === 'object') {\n target[s] = _extends({}, target[s], value);\n } else {\n target[s] = value;\n }\n }\n }\n }\n return target;\n}","import * as util from '../util';\n\n/**\n * Rule for validating required fields.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param source The source object being validated.\n * @param errors An array of errors that this rule may add\n * validation errors to.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction required(rule, value, source, errors, options, type) {\n if (rule.required && (!source.hasOwnProperty(rule.field) || util.isEmptyValue(value, type || rule.type))) {\n errors.push(util.format(options.messages.required, rule.fullField));\n }\n}\n\nexport default required;","import * as util from '../util';\n\n/**\n * Rule for validating whitespace.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param source The source object being validated.\n * @param errors An array of errors that this rule may add\n * validation errors to.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction whitespace(rule, value, source, errors, options) {\n if (/^\\s+$/.test(value) || value === '') {\n errors.push(util.format(options.messages.whitespace, rule.fullField));\n }\n}\n\nexport default whitespace;","import _typeof from 'babel-runtime/helpers/typeof';\nimport * as util from '../util';\nimport required from './required';\n\n/* eslint max-len:0 */\n\nvar pattern = {\n // http://emailregex.com/\n email: /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n url: new RegExp('^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\\\S+(?::\\\\S*)?@)?(?:(?:(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}(?:\\\\.(?:[0-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))|(?:(?:[a-z\\\\u00a1-\\\\uffff0-9]+-?)*[a-z\\\\u00a1-\\\\uffff0-9]+)(?:\\\\.(?:[a-z\\\\u00a1-\\\\uffff0-9]+-?)*[a-z\\\\u00a1-\\\\uffff0-9]+)*(?:\\\\.(?:[a-z\\\\u00a1-\\\\uffff]{2,})))|localhost)(?::\\\\d{2,5})?(?:(/|\\\\?|#)[^\\\\s]*)?$', 'i'),\n hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i\n};\n\nvar types = {\n integer: function integer(value) {\n return types.number(value) && parseInt(value, 10) === value;\n },\n float: function float(value) {\n return types.number(value) && !types.integer(value);\n },\n array: function array(value) {\n return Array.isArray(value);\n },\n regexp: function regexp(value) {\n if (value instanceof RegExp) {\n return true;\n }\n try {\n return !!new RegExp(value);\n } catch (e) {\n return false;\n }\n },\n date: function date(value) {\n return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear === 'function';\n },\n number: function number(value) {\n if (isNaN(value)) {\n return false;\n }\n return typeof value === 'number';\n },\n object: function object(value) {\n return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && !types.array(value);\n },\n method: function method(value) {\n return typeof value === 'function';\n },\n email: function email(value) {\n return typeof value === 'string' && !!value.match(pattern.email) && value.length < 255;\n },\n url: function url(value) {\n return typeof value === 'string' && !!value.match(pattern.url);\n },\n hex: function hex(value) {\n return typeof value === 'string' && !!value.match(pattern.hex);\n }\n};\n\n/**\n * Rule for validating the type of a value.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param source The source object being validated.\n * @param errors An array of errors that this rule may add\n * validation errors to.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction type(rule, value, source, errors, options) {\n if (rule.required && value === undefined) {\n required(rule, value, source, errors, options);\n return;\n }\n var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'number', 'date', 'url', 'hex'];\n var ruleType = rule.type;\n if (custom.indexOf(ruleType) > -1) {\n if (!types[ruleType](value)) {\n errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));\n }\n // straight typeof check\n } else if (ruleType && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== rule.type) {\n errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));\n }\n}\n\nexport default type;","import * as util from '../util';\n\n/**\n * Rule for validating minimum and maximum allowed values.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param source The source object being validated.\n * @param errors An array of errors that this rule may add\n * validation errors to.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction range(rule, value, source, errors, options) {\n var len = typeof rule.len === 'number';\n var min = typeof rule.min === 'number';\n var max = typeof rule.max === 'number';\n // 正则匹配码点范围从U+010000一直到U+10FFFF的文字(补充平面Supplementary Plane)\n var spRegexp = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n var val = value;\n var key = null;\n var num = typeof value === 'number';\n var str = typeof value === 'string';\n var arr = Array.isArray(value);\n if (num) {\n key = 'number';\n } else if (str) {\n key = 'string';\n } else if (arr) {\n key = 'array';\n }\n // if the value is not of a supported type for range validation\n // the validation rule rule should use the\n // type property to also test for a particular type\n if (!key) {\n return false;\n }\n if (arr) {\n val = value.length;\n }\n if (str) {\n // 处理码点大于U+010000的文字length属性不准确的bug,如\"𠮷𠮷𠮷\".lenght !== 3\n val = value.replace(spRegexp, '_').length;\n }\n if (len) {\n if (val !== rule.len) {\n errors.push(util.format(options.messages[key].len, rule.fullField, rule.len));\n }\n } else if (min && !max && val < rule.min) {\n errors.push(util.format(options.messages[key].min, rule.fullField, rule.min));\n } else if (max && !min && val > rule.max) {\n errors.push(util.format(options.messages[key].max, rule.fullField, rule.max));\n } else if (min && max && (val < rule.min || val > rule.max)) {\n errors.push(util.format(options.messages[key].range, rule.fullField, rule.min, rule.max));\n }\n}\n\nexport default range;","import * as util from '../util';\nvar ENUM = 'enum';\n\n/**\n * Rule for validating a value exists in an enumerable list.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param source The source object being validated.\n * @param errors An array of errors that this rule may add\n * validation errors to.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction enumerable(rule, value, source, errors, options) {\n rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];\n if (rule[ENUM].indexOf(value) === -1) {\n errors.push(util.format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', ')));\n }\n}\n\nexport default enumerable;","import * as util from '../util';\n\n/**\n * Rule for validating a regular expression pattern.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param source The source object being validated.\n * @param errors An array of errors that this rule may add\n * validation errors to.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction pattern(rule, value, source, errors, options) {\n if (rule.pattern) {\n if (rule.pattern instanceof RegExp) {\n // if a RegExp instance is passed, reset `lastIndex` in case its `global`\n // flag is accidentally set to `true`, which in a validation scenario\n // is not necessary and the result might be misleading\n rule.pattern.lastIndex = 0;\n if (!rule.pattern.test(value)) {\n errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));\n }\n } else if (typeof rule.pattern === 'string') {\n var _pattern = new RegExp(rule.pattern);\n if (!_pattern.test(value)) {\n errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));\n }\n }\n }\n}\n\nexport default pattern;","import required from './required';\nimport whitespace from './whitespace';\nimport type from './type';\nimport range from './range';\nimport enumRule from './enum';\nimport pattern from './pattern';\n\nexport default {\n required: required,\n whitespace: whitespace,\n type: type,\n range: range,\n 'enum': enumRule,\n pattern: pattern\n};","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\n/**\n * Performs validation for string types.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction string(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value, 'string') && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options, 'string');\n if (!isEmptyValue(value, 'string')) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n rules.pattern(rule, value, source, errors, options);\n if (rule.whitespace === true) {\n rules.whitespace(rule, value, source, errors, options);\n }\n }\n }\n callback(errors);\n}\n\nexport default string;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\n/**\n * Validates a function.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction method(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default method;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\n/**\n * Validates a number.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction number(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default number;","import { isEmptyValue } from '../util';\nimport rules from '../rule/';\n\n/**\n * Validates a boolean.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction boolean(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default boolean;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\n/**\n * Validates the regular expression type.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction regexp(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (!isEmptyValue(value)) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default regexp;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\n/**\n * Validates a number is an integer.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction integer(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default integer;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\n/**\n * Validates a number is a floating point number.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction floatFn(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default floatFn;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n/**\n * Validates an array.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction array(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value, 'array') && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options, 'array');\n if (!isEmptyValue(value, 'array')) {\n rules.type(rule, value, source, errors, options);\n rules.range(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default array;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\n/**\n * Validates an object.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction object(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value !== undefined) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default object;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\nvar ENUM = 'enum';\n\n/**\n * Validates an enumerable list.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction enumerable(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (value) {\n rules[ENUM](rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default enumerable;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\n/**\n * Validates a regular expression pattern.\n *\n * Performs validation when a rule only contains\n * a pattern property but is not declared as a string type.\n *\n * @param rule The validation rule.\n * @param value The value of the field on the source object.\n * @param callback The callback function.\n * @param source The source object being validated.\n * @param options The validation options.\n * @param options.messages The validation messages.\n */\nfunction pattern(rule, value, callback, source, options) {\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value, 'string') && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (!isEmptyValue(value, 'string')) {\n rules.pattern(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default pattern;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\nfunction date(rule, value, callback, source, options) {\n // console.log('integer rule called %j', rule);\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n // console.log('validate on %s value', value);\n if (validate) {\n if (isEmptyValue(value) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options);\n if (!isEmptyValue(value)) {\n var dateObject = void 0;\n\n if (typeof value === 'number') {\n dateObject = new Date(value);\n } else {\n dateObject = value;\n }\n\n rules.type(rule, dateObject, source, errors, options);\n if (dateObject) {\n rules.range(rule, dateObject.getTime(), source, errors, options);\n }\n }\n }\n callback(errors);\n}\n\nexport default date;","import _typeof from 'babel-runtime/helpers/typeof';\nimport rules from '../rule/';\n\nfunction required(rule, value, callback, source, options) {\n var errors = [];\n var type = Array.isArray(value) ? 'array' : typeof value === 'undefined' ? 'undefined' : _typeof(value);\n rules.required(rule, value, source, errors, options, type);\n callback(errors);\n}\n\nexport default required;","import rules from '../rule/';\nimport { isEmptyValue } from '../util';\n\nfunction type(rule, value, callback, source, options) {\n var ruleType = rule.type;\n var errors = [];\n var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);\n if (validate) {\n if (isEmptyValue(value, ruleType) && !rule.required) {\n return callback();\n }\n rules.required(rule, value, source, errors, options, ruleType);\n if (!isEmptyValue(value, ruleType)) {\n rules.type(rule, value, source, errors, options);\n }\n }\n callback(errors);\n}\n\nexport default type;","import string from './string';\nimport method from './method';\nimport number from './number';\nimport boolean from './boolean';\nimport regexp from './regexp';\nimport integer from './integer';\nimport float from './float';\nimport array from './array';\nimport object from './object';\nimport enumValidator from './enum';\nimport pattern from './pattern';\nimport date from './date';\nimport required from './required';\nimport type from './type';\n\nexport default {\n string: string,\n method: method,\n number: number,\n boolean: boolean,\n regexp: regexp,\n integer: integer,\n float: float,\n array: array,\n object: object,\n 'enum': enumValidator,\n pattern: pattern,\n date: date,\n url: type,\n hex: type,\n email: type,\n required: required\n};","export function newMessages() {\n return {\n 'default': 'Validation error on field %s',\n required: '%s is required',\n 'enum': '%s must be one of %s',\n whitespace: '%s cannot be empty',\n date: {\n format: '%s date %s is invalid for format %s',\n parse: '%s date could not be parsed, %s is invalid ',\n invalid: '%s date %s is invalid'\n },\n types: {\n string: '%s is not a %s',\n method: '%s is not a %s (function)',\n array: '%s is not an %s',\n object: '%s is not an %s',\n number: '%s is not a %s',\n date: '%s is not a %s',\n boolean: '%s is not a %s',\n integer: '%s is not an %s',\n float: '%s is not a %s',\n regexp: '%s is not a valid %s',\n email: '%s is not a valid %s',\n url: '%s is not a valid %s',\n hex: '%s is not a valid %s'\n },\n string: {\n len: '%s must be exactly %s characters',\n min: '%s must be at least %s characters',\n max: '%s cannot be longer than %s characters',\n range: '%s must be between %s and %s characters'\n },\n number: {\n len: '%s must equal %s',\n min: '%s cannot be less than %s',\n max: '%s cannot be greater than %s',\n range: '%s must be between %s and %s'\n },\n array: {\n len: '%s must be exactly %s in length',\n min: '%s cannot be less than %s in length',\n max: '%s cannot be greater than %s in length',\n range: '%s must be between %s and %s in length'\n },\n pattern: {\n mismatch: '%s value %s does not match pattern %s'\n },\n clone: function clone() {\n var cloned = JSON.parse(JSON.stringify(this));\n cloned.clone = this.clone;\n return cloned;\n }\n };\n}\n\nexport var messages = newMessages();","import _extends from 'babel-runtime/helpers/extends';\nimport _typeof from 'babel-runtime/helpers/typeof';\nimport { format, complementError, asyncMap, warning, deepMerge } from './util';\nimport validators from './validator/';\nimport { messages as defaultMessages, newMessages } from './messages';\n\n/**\n * Encapsulates a validation schema.\n *\n * @param descriptor An object declaring validation rules\n * for this schema.\n */\nfunction Schema(descriptor) {\n this.rules = null;\n this._messages = defaultMessages;\n this.define(descriptor);\n}\n\nSchema.prototype = {\n messages: function messages(_messages) {\n if (_messages) {\n this._messages = deepMerge(newMessages(), _messages);\n }\n return this._messages;\n },\n define: function define(rules) {\n if (!rules) {\n throw new Error('Cannot configure a schema with no rules');\n }\n if ((typeof rules === 'undefined' ? 'undefined' : _typeof(rules)) !== 'object' || Array.isArray(rules)) {\n throw new Error('Rules must be an object');\n }\n this.rules = {};\n var z = void 0;\n var item = void 0;\n for (z in rules) {\n if (rules.hasOwnProperty(z)) {\n item = rules[z];\n this.rules[z] = Array.isArray(item) ? item : [item];\n }\n }\n },\n validate: function validate(source_) {\n var _this = this;\n\n var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var oc = arguments[2];\n\n var source = source_;\n var options = o;\n var callback = oc;\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n if (!this.rules || Object.keys(this.rules).length === 0) {\n if (callback) {\n callback();\n }\n return;\n }\n function complete(results) {\n var i = void 0;\n var field = void 0;\n var errors = [];\n var fields = {};\n\n function add(e) {\n if (Array.isArray(e)) {\n errors = errors.concat.apply(errors, e);\n } else {\n errors.push(e);\n }\n }\n\n for (i = 0; i < results.length; i++) {\n add(results[i]);\n }\n if (!errors.length) {\n errors = null;\n fields = null;\n } else {\n for (i = 0; i < errors.length; i++) {\n field = errors[i].field;\n fields[field] = fields[field] || [];\n fields[field].push(errors[i]);\n }\n }\n callback(errors, fields);\n }\n\n if (options.messages) {\n var messages = this.messages();\n if (messages === defaultMessages) {\n messages = newMessages();\n }\n deepMerge(messages, options.messages);\n options.messages = messages;\n } else {\n options.messages = this.messages();\n }\n var arr = void 0;\n var value = void 0;\n var series = {};\n var keys = options.keys || Object.keys(this.rules);\n keys.forEach(function (z) {\n arr = _this.rules[z];\n value = source[z];\n arr.forEach(function (r) {\n var rule = r;\n if (typeof rule.transform === 'function') {\n if (source === source_) {\n source = _extends({}, source);\n }\n value = source[z] = rule.transform(value);\n }\n if (typeof rule === 'function') {\n rule = {\n validator: rule\n };\n } else {\n rule = _extends({}, rule);\n }\n rule.validator = _this.getValidationMethod(rule);\n rule.field = z;\n rule.fullField = rule.fullField || z;\n rule.type = _this.getType(rule);\n if (!rule.validator) {\n return;\n }\n series[z] = series[z] || [];\n series[z].push({\n rule: rule,\n value: value,\n source: source,\n field: z\n });\n });\n });\n var errorFields = {};\n asyncMap(series, options, function (data, doIt) {\n var rule = data.rule;\n var deep = (rule.type === 'object' || rule.type === 'array') && (_typeof(rule.fields) === 'object' || _typeof(rule.defaultField) === 'object');\n deep = deep && (rule.required || !rule.required && data.value);\n rule.field = data.field;\n function addFullfield(key, schema) {\n return _extends({}, schema, {\n fullField: rule.fullField + '.' + key\n });\n }\n\n function cb() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n var errors = e;\n if (!Array.isArray(errors)) {\n errors = [errors];\n }\n if (errors.length) {\n warning('async-validator:', errors);\n }\n if (errors.length && rule.message) {\n errors = [].concat(rule.message);\n }\n\n errors = errors.map(complementError(rule));\n\n if (options.first && errors.length) {\n errorFields[rule.field] = 1;\n return doIt(errors);\n }\n if (!deep) {\n doIt(errors);\n } else {\n // if rule is required but the target object\n // does not exist fail at the rule level and don't\n // go deeper\n if (rule.required && !data.value) {\n if (rule.message) {\n errors = [].concat(rule.message).map(complementError(rule));\n } else if (options.error) {\n errors = [options.error(rule, format(options.messages.required, rule.field))];\n } else {\n errors = [];\n }\n return doIt(errors);\n }\n\n var fieldsSchema = {};\n if (rule.defaultField) {\n for (var k in data.value) {\n if (data.value.hasOwnProperty(k)) {\n fieldsSchema[k] = rule.defaultField;\n }\n }\n }\n fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);\n for (var f in fieldsSchema) {\n if (fieldsSchema.hasOwnProperty(f)) {\n var fieldSchema = Array.isArray(fieldsSchema[f]) ? fieldsSchema[f] : [fieldsSchema[f]];\n fieldsSchema[f] = fieldSchema.map(addFullfield.bind(null, f));\n }\n }\n var schema = new Schema(fieldsSchema);\n schema.messages(options.messages);\n if (data.rule.options) {\n data.rule.options.messages = options.messages;\n data.rule.options.error = options.error;\n }\n schema.validate(data.value, data.rule.options || options, function (errs) {\n doIt(errs && errs.length ? errors.concat(errs) : errs);\n });\n }\n }\n\n var res = rule.validator(rule, data.value, cb, data.source, options);\n if (res && res.then) {\n res.then(function () {\n return cb();\n }, function (e) {\n return cb(e);\n });\n }\n }, function (results) {\n complete(results);\n });\n },\n getType: function getType(rule) {\n if (rule.type === undefined && rule.pattern instanceof RegExp) {\n rule.type = 'pattern';\n }\n if (typeof rule.validator !== 'function' && rule.type && !validators.hasOwnProperty(rule.type)) {\n throw new Error(format('Unknown rule type %s', rule.type));\n }\n return rule.type || 'string';\n },\n getValidationMethod: function getValidationMethod(rule) {\n if (typeof rule.validator === 'function') {\n return rule.validator;\n }\n var keys = Object.keys(rule);\n var messageIndex = keys.indexOf('message');\n if (messageIndex !== -1) {\n keys.splice(messageIndex, 1);\n }\n if (keys.length === 1 && keys[0] === 'required') {\n return validators.required;\n }\n return validators[this.getType(rule)] || false;\n }\n};\n\nSchema.register = function register(type, validator) {\n if (typeof validator !== 'function') {\n throw new Error('Cannot register a validator by type, validator is not a function');\n }\n validators[type] = validator;\n};\n\nSchema.messages = defaultMessages;\n\nexport default Schema;"],"sourceRoot":""}