Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

amazon-cognito-identity-js

Package Overview
Dependencies
Maintainers
1
Versions
1620
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amazon-cognito-identity-js - npm Package Compare versions

Comparing version 1.27.0 to 1.28.0

6

dist/amazon-cognito-identity.min.js

@@ -17,3 +17,3 @@ /*!

*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("aws-sdk/global"),require("aws-sdk/clients/cognitoidentityserviceprovider")):"function"==typeof define&&define.amd?define(["aws-sdk/global","aws-sdk/clients/cognitoidentityserviceprovider"],t):"object"==typeof exports?exports.AmazonCognitoIdentity=t(require("aws-sdk/global"),require("aws-sdk/clients/cognitoidentityserviceprovider")):e.AmazonCognitoIdentity=t(e.AWSCognito,e.AWSCognito.CognitoIdentityServiceProvider)}(this,function(e,t){return function(e){function t(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return e[i].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function s(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(17);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var r=n(13),a=s(r),u=i(o);Object.keys(u).forEach(function(e){a.default[e]=u[e]})},function(t,n){t.exports=e},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=n(1),r=n(3),a=i(r),u="FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",c="userAttributes.",l=function(){function e(t){s(this,e),this.N=new a.default(u,16),this.g=new a.default("2",16),this.k=new a.default(this.hexHash("00"+this.N.toString(16)+"0"+this.g.toString(16)),16),this.smallAValue=this.generateRandomSmallA(),this.getLargeAValue(function(){}),this.infoBits=new o.util.Buffer("Caldera Derived Key","utf8"),this.poolName=t}return e.prototype.getSmallAValue=function(){return this.smallAValue},e.prototype.getLargeAValue=function(e){var t=this;this.largeAValue?e(null,this.largeAValue):this.calculateA(this.smallAValue,function(n,i){n&&e(n,null),t.largeAValue=i,e(null,t.largeAValue)})},e.prototype.generateRandomSmallA=function(){var e=o.util.crypto.lib.randomBytes(128).toString("hex"),t=new a.default(e,16),n=t.mod(this.N);return n},e.prototype.generateRandomString=function(){return o.util.crypto.lib.randomBytes(40).toString("base64")},e.prototype.getRandomPassword=function(){return this.randomPassword},e.prototype.getSaltDevices=function(){return this.SaltToHashDevices},e.prototype.getVerifierDevices=function(){return this.verifierDevices},e.prototype.generateHashDevice=function(e,t,n){var i=this;this.randomPassword=this.generateRandomString();var s=""+e+t+":"+this.randomPassword,r=this.hash(s),u=o.util.crypto.lib.randomBytes(16).toString("hex");this.SaltToHashDevices=this.padHex(new a.default(u,16)),this.g.modPow(new a.default(this.hexHash(this.SaltToHashDevices+r),16),this.N,function(e,t){e&&n(e,null),i.verifierDevices=i.padHex(t),n(null,null)})},e.prototype.calculateA=function(e,t){var n=this;this.g.modPow(e,this.N,function(e,i){e&&t(e,null),i.mod(n.N).equals(a.default.ZERO)&&t(new Error("Illegal paramater. A mod N cannot be 0."),null),t(null,i)})},e.prototype.calculateU=function(e,t){this.UHexHash=this.hexHash(this.padHex(e)+this.padHex(t));var n=new a.default(this.UHexHash,16);return n},e.prototype.hash=function(e){var t=o.util.crypto.sha256(e,"hex");return new Array(64-t.length).join("0")+t},e.prototype.hexHash=function(e){return this.hash(new o.util.Buffer(e,"hex"))},e.prototype.computehkdf=function(e,t){var n=o.util.crypto.hmac(t,e,"buffer","sha256"),i=o.util.buffer.concat([this.infoBits,new o.util.Buffer(String.fromCharCode(1),"utf8")]),s=o.util.crypto.hmac(n,i,"buffer","sha256");return s.slice(0,16)},e.prototype.getPasswordAuthenticationKey=function(e,t,n,i,s){var r=this;if(n.mod(this.N).equals(a.default.ZERO))throw new Error("B cannot be zero.");if(this.UValue=this.calculateU(this.largeAValue,n),this.UValue.equals(a.default.ZERO))throw new Error("U cannot be zero.");var u=""+this.poolName+e+":"+t,c=this.hash(u),l=new a.default(this.hexHash(this.padHex(i)+c),16);this.calculateS(l,n,function(e,t){e&&s(e,null);var n=r.computehkdf(new o.util.Buffer(r.padHex(t),"hex"),new o.util.Buffer(r.padHex(r.UValue.toString(16)),"hex"));s(null,n)})},e.prototype.calculateS=function(e,t,n){var i=this;this.g.modPow(e,this.N,function(s,o){s&&n(s,null);var r=t.subtract(i.k.multiply(o));r.modPow(i.smallAValue.add(i.UValue.multiply(e)),i.N,function(e,t){e&&n(e,null),n(null,t.mod(i.N))})})},e.prototype.getNewPasswordRequiredChallengeUserAttributePrefix=function(){return c},e.prototype.padHex=function(e){var t=e.toString(16);return t.length%2===1?t="0"+t:"89ABCDEFabcdef".indexOf(t[0])!==-1&&(t="00"+t),t},e}();t.default=l},function(e,t){"use strict";function n(e,t){null!=e&&this.fromString(e,t)}function i(){return new n(null)}function s(e,t,n,i,s,o){for(;--o>=0;){var r=t*this[e++]+n[i]+s;s=Math.floor(r/67108864),n[i++]=67108863&r}return s}function o(e,t,n,i,s,o){for(var r=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,l=a*u+c*r;u=r*u+((32767&l)<<15)+n[i]+(1073741823&s),s=(u>>>30)+(l>>>15)+a*c+(s>>>30),n[i++]=1073741823&u}return s}function r(e,t,n,i,s,o){for(var r=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,l=a*u+c*r;u=r*u+((16383&l)<<14)+n[i]+s,s=(u>>28)+(l>>14)+a*c,n[i++]=268435455&u}return s}function a(e){return z.charAt(e)}function u(e,t){var n=Q[e.charCodeAt(t)];return null==n?-1:n}function c(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function h(e){var t=i();return t.fromInt(e),t}function f(e,t){var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");i=2}this.t=0,this.s=0;for(var s=e.length,o=!1,r=0;--s>=0;){var a=u(e,s);a<0?"-"==e.charAt(s)&&(o=!0):(o=!1,0==r?this[this.t++]=a:r+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-r)-1)<<r,this[this.t++]=a>>this.DB-r):this[this.t-1]|=a<<r,r+=i,r>=this.DB&&(r-=this.DB))}this.clamp(),o&&n.ZERO.subTo(this,this)}function d(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function p(e){if(this.s<0)return"-"+this.negate().toString();var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");t=2}var n,i=(1<<t)-1,s=!1,o="",r=this.t,u=this.DB-r*this.DB%t;if(r-- >0)for(u<this.DB&&(n=this[r]>>u)>0&&(s=!0,o=a(n));r>=0;)u<t?(n=(this[r]&(1<<u)-1)<<t-u,n|=this[--r]>>(u+=this.DB-t)):(n=this[r]>>(u-=t)&i,u<=0&&(u+=this.DB,--r)),n>0&&(s=!0),s&&(o+=a(n));return s?o:"0"}function g(){var e=i();return n.ZERO.subTo(this,e),e}function S(){return this.s<0?this.negate():this}function v(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function m(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function C(){return this.t<=0?0:this.DB*(this.t-1)+m(this[this.t-1]^this.s&this.DM)}function y(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function U(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function A(e,t){var n,i=e%this.DB,s=this.DB-i,o=(1<<s)-1,r=Math.floor(e/this.DB),a=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)t[n+r+1]=this[n]>>s|a,a=(this[n]&o)<<i;for(n=r-1;n>=0;--n)t[n]=0;t[r]=a,t.t=this.t+r+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)return void(t.t=0);var i=e%this.DB,s=this.DB-i,o=(1<<i)-1;t[0]=this[n]>>i;for(var r=n+1;r<this.t;++r)t[r-n-1]|=(this[r]&o)<<s,t[r-n]=this[r]>>i;i>0&&(t[this.t-n-1]|=(this.s&o)<<s),t.t=this.t-n,t.clamp()}function T(e,t){for(var n=0,i=0,s=Math.min(e.t,this.t);n<s;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()}function D(e,t){var i=this.abs(),s=e.abs(),o=i.t;for(t.t=o+s.t;--o>=0;)t[o]=0;for(o=0;o<s.t;++o)t[o+i.t]=i.am(0,s[o],t,o,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&n.ZERO.subTo(t,t)}function I(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var i=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,i,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function E(e,t,s){var o=e.abs();if(!(o.t<=0)){var r=this.abs();if(r.t<o.t)return null!=t&&t.fromInt(0),void(null!=s&&this.copyTo(s));null==s&&(s=i());var a=i(),u=this.s,c=e.s,l=this.DB-m(o[o.t-1]);l>0?(o.lShiftTo(l,a),r.lShiftTo(l,s)):(o.copyTo(a),r.copyTo(s));var h=a.t,f=a[h-1];if(0!=f){var d=f*(1<<this.F1)+(h>1?a[h-2]>>this.F2:0),p=this.FV/d,g=(1<<this.F1)/d,S=1<<this.F2,v=s.t,C=v-h,y=null==t?i():t;for(a.dlShiftTo(C,y),s.compareTo(y)>=0&&(s[s.t++]=1,s.subTo(y,s)),n.ONE.dlShiftTo(h,y),y.subTo(a,a);a.t<h;)a[a.t++]=0;for(;--C>=0;){var U=s[--v]==f?this.DM:Math.floor(s[v]*p+(s[v-1]+S)*g);if((s[v]+=a.am(0,U,s,C,0,h))<U)for(a.dlShiftTo(C,y),s.subTo(y,s);s[v]<--U;)s.subTo(y,s)}null!=t&&(s.drShiftTo(h,t),u!=c&&n.ZERO.subTo(t,t)),s.t=h,s.clamp(),l>0&&s.rShiftTo(l,s),u<0&&n.ZERO.subTo(s,s)}}}function k(e){var t=i();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function F(e){return 0==this.compareTo(e)}function P(e,t){for(var n=0,i=0,s=Math.min(e.t,this.t);n<s;)i+=this[n]+e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i+=e[n],t[n++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[n++]=i:i<-1&&(t[n++]=this.DV+i),t.t=n,t.clamp()}function b(e){var t=i();return this.addTo(e,t),t}function _(e){var t=i();return this.subTo(e,t),t}function M(e){var t=i();return this.multiplyTo(e,t),t}function N(e){var t=i();return this.divRemTo(e,t,null),t}function B(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function x(e){var t=i();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(n.ZERO)>0&&this.m.subTo(t,t),t}function O(e){var t=i();return e.copyTo(t),this.reduce(t),t}function V(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],i=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,i,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function K(e,t){e.squareTo(t),this.reduce(t)}function q(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function j(e,t,n){var s,o=e.bitLength(),r=h(1),a=new B(t);if(o<=0)return r;s=o<18?1:o<48?3:o<144?4:o<768?5:6;var u=new Array,c=3,l=s-1,f=(1<<s)-1;if(u[1]=a.convert(this),s>1){var d=i();for(a.sqrTo(u[1],d);c<=f;)u[c]=i(),a.mulTo(d,u[c-2],u[c]),c+=2}var p,g,S=e.t-1,v=!0,C=i();for(o=m(e[S])-1;S>=0;){for(o>=l?p=e[S]>>o-l&f:(p=(e[S]&(1<<o+1)-1)<<l-o,S>0&&(p|=e[S-1]>>this.DB+o-l)),c=s;0==(1&p);)p>>=1,--c;if((o-=c)<0&&(o+=this.DB,--S),v)u[p].copyTo(r),v=!1;else{for(;c>1;)a.sqrTo(r,C),a.sqrTo(C,r),c-=2;c>0?a.sqrTo(r,C):(g=r,r=C,C=g),a.mulTo(C,u[p],r)}for(;S>=0&&0==(e[S]&1<<o);)a.sqrTo(r,C),g=r,r=C,C=g,--o<0&&(o=this.DB-1,--S)}var y=a.revert(r);return n(null,y),y}t.__esModule=!0,t.default=n;var H,L=0xdeadbeefcafe,J=15715070==(16777215&L),W="undefined"!=typeof navigator;W&&J&&"Microsoft Internet Explorer"==navigator.appName?(n.prototype.am=o,H=30):W&&J&&"Netscape"!=navigator.appName?(n.prototype.am=s,H=26):(n.prototype.am=r,H=28),n.prototype.DB=H,n.prototype.DM=(1<<H)-1,n.prototype.DV=1<<H;var G=52;n.prototype.FV=Math.pow(2,G),n.prototype.F1=G-H,n.prototype.F2=2*H-G;var Z,Y,z="0123456789abcdefghijklmnopqrstuvwxyz",Q=new Array;for(Z="0".charCodeAt(0),Y=0;Y<=9;++Y)Q[Z++]=Y;for(Z="a".charCodeAt(0),Y=10;Y<36;++Y)Q[Z++]=Y;for(Z="A".charCodeAt(0),Y=10;Y<36;++Y)Q[Z++]=Y;B.prototype.convert=x,B.prototype.revert=O,B.prototype.reduce=V,B.prototype.mulTo=q,B.prototype.sqrTo=K,n.prototype.copyTo=c,n.prototype.fromInt=l,n.prototype.fromString=f,n.prototype.clamp=d,n.prototype.dlShiftTo=y,n.prototype.drShiftTo=U,n.prototype.lShiftTo=A,n.prototype.rShiftTo=w,n.prototype.subTo=T,n.prototype.multiplyTo=D,n.prototype.squareTo=I,n.prototype.divRemTo=E,n.prototype.invDigit=R,n.prototype.addTo=P,n.prototype.toString=p,n.prototype.negate=g,n.prototype.abs=S,n.prototype.compareTo=v,n.prototype.bitLength=C,n.prototype.mod=k,n.prototype.equals=F,n.prototype.add=b,n.prototype.subtract=_,n.prototype.multiply=M,n.prototype.divide=N,n.prototype.modPow=j,n.ZERO=h(0),n.ONE=h(1)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(6),u=i(a),c=function(e){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.AccessToken;return s(this,t),o(this,e.call(this,i||""))}return r(t,e),t}(u.default);t.default=c},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(6),u=i(a),c=function(e){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.IdToken;return s(this,t),o(this,e.call(this,i||""))}return r(t,e),t}(u.default);t.default=c},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var s=n(1),o=function(){function e(t){i(this,e),this.jwtToken=t||"",this.payload=this.decodePayload()}return e.prototype.getJwtToken=function(){return this.jwtToken},e.prototype.getExpiration=function(){return this.payload.exp},e.prototype.getIssuedAt=function(){return this.payload.iat},e.prototype.decodePayload=function(){var e=this.jwtToken.split(".")[1];try{return JSON.parse(s.util.base64.decode(e).toString("utf8"))}catch(e){return{}}},e}();t.default=o},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;/*!
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("aws-sdk/global"),require("aws-sdk/clients/cognitoidentityserviceprovider")):"function"==typeof define&&define.amd?define(["aws-sdk/global","aws-sdk/clients/cognitoidentityserviceprovider"],t):"object"==typeof exports?exports.AmazonCognitoIdentity=t(require("aws-sdk/global"),require("aws-sdk/clients/cognitoidentityserviceprovider")):e.AmazonCognitoIdentity=t(e.AWSCognito,e.AWSCognito.CognitoIdentityServiceProvider)}(this,function(e,t){return function(e){function t(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return e[i].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function s(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=n(17);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var r=n(13),a=s(r),u=i(o);Object.keys(u).forEach(function(e){a.default[e]=u[e]})},function(t,n){t.exports=e},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=n(1),r=n(3),a=i(r),u="FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",c="userAttributes.",l=function(){function e(t){s(this,e),this.N=new a.default(u,16),this.g=new a.default("2",16),this.k=new a.default(this.hexHash("00"+this.N.toString(16)+"0"+this.g.toString(16)),16),this.smallAValue=this.generateRandomSmallA(),this.getLargeAValue(function(){}),this.infoBits=new o.util.Buffer("Caldera Derived Key","utf8"),this.poolName=t}return e.prototype.getSmallAValue=function(){return this.smallAValue},e.prototype.getLargeAValue=function(e){var t=this;this.largeAValue?e(null,this.largeAValue):this.calculateA(this.smallAValue,function(n,i){n&&e(n,null),t.largeAValue=i,e(null,t.largeAValue)})},e.prototype.generateRandomSmallA=function(){var e=o.util.crypto.lib.randomBytes(128).toString("hex"),t=new a.default(e,16),n=t.mod(this.N);return n},e.prototype.generateRandomString=function(){return o.util.crypto.lib.randomBytes(40).toString("base64")},e.prototype.getRandomPassword=function(){return this.randomPassword},e.prototype.getSaltDevices=function(){return this.SaltToHashDevices},e.prototype.getVerifierDevices=function(){return this.verifierDevices},e.prototype.generateHashDevice=function(e,t,n){var i=this;this.randomPassword=this.generateRandomString();var s=""+e+t+":"+this.randomPassword,r=this.hash(s),u=o.util.crypto.lib.randomBytes(16).toString("hex");this.SaltToHashDevices=this.padHex(new a.default(u,16)),this.g.modPow(new a.default(this.hexHash(this.SaltToHashDevices+r),16),this.N,function(e,t){e&&n(e,null),i.verifierDevices=i.padHex(t),n(null,null)})},e.prototype.calculateA=function(e,t){var n=this;this.g.modPow(e,this.N,function(e,i){e&&t(e,null),i.mod(n.N).equals(a.default.ZERO)&&t(new Error("Illegal paramater. A mod N cannot be 0."),null),t(null,i)})},e.prototype.calculateU=function(e,t){this.UHexHash=this.hexHash(this.padHex(e)+this.padHex(t));var n=new a.default(this.UHexHash,16);return n},e.prototype.hash=function(e){var t=o.util.crypto.sha256(e,"hex");return new Array(64-t.length).join("0")+t},e.prototype.hexHash=function(e){return this.hash(new o.util.Buffer(e,"hex"))},e.prototype.computehkdf=function(e,t){var n=o.util.crypto.hmac(t,e,"buffer","sha256"),i=o.util.buffer.concat([this.infoBits,new o.util.Buffer(String.fromCharCode(1),"utf8")]),s=o.util.crypto.hmac(n,i,"buffer","sha256");return s.slice(0,16)},e.prototype.getPasswordAuthenticationKey=function(e,t,n,i,s){var r=this;if(n.mod(this.N).equals(a.default.ZERO))throw new Error("B cannot be zero.");if(this.UValue=this.calculateU(this.largeAValue,n),this.UValue.equals(a.default.ZERO))throw new Error("U cannot be zero.");var u=""+this.poolName+e+":"+t,c=this.hash(u),l=new a.default(this.hexHash(this.padHex(i)+c),16);this.calculateS(l,n,function(e,t){e&&s(e,null);var n=r.computehkdf(new o.util.Buffer(r.padHex(t),"hex"),new o.util.Buffer(r.padHex(r.UValue.toString(16)),"hex"));s(null,n)})},e.prototype.calculateS=function(e,t,n){var i=this;this.g.modPow(e,this.N,function(s,o){s&&n(s,null);var r=t.subtract(i.k.multiply(o));r.modPow(i.smallAValue.add(i.UValue.multiply(e)),i.N,function(e,t){e&&n(e,null),n(null,t.mod(i.N))})})},e.prototype.getNewPasswordRequiredChallengeUserAttributePrefix=function(){return c},e.prototype.padHex=function(e){var t=e.toString(16);return t.length%2===1?t="0"+t:"89ABCDEFabcdef".indexOf(t[0])!==-1&&(t="00"+t),t},e}();t.default=l},function(e,t){"use strict";function n(e,t){null!=e&&this.fromString(e,t)}function i(){return new n(null)}function s(e,t,n,i,s,o){for(;--o>=0;){var r=t*this[e++]+n[i]+s;s=Math.floor(r/67108864),n[i++]=67108863&r}return s}function o(e,t,n,i,s,o){for(var r=32767&t,a=t>>15;--o>=0;){var u=32767&this[e],c=this[e++]>>15,l=a*u+c*r;u=r*u+((32767&l)<<15)+n[i]+(1073741823&s),s=(u>>>30)+(l>>>15)+a*c+(s>>>30),n[i++]=1073741823&u}return s}function r(e,t,n,i,s,o){for(var r=16383&t,a=t>>14;--o>=0;){var u=16383&this[e],c=this[e++]>>14,l=a*u+c*r;u=r*u+((16383&l)<<14)+n[i]+s,s=(u>>28)+(l>>14)+a*c,n[i++]=268435455&u}return s}function a(e){return z.charAt(e)}function u(e,t){var n=Q[e.charCodeAt(t)];return null==n?-1:n}function c(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function l(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function h(e){var t=i();return t.fromInt(e),t}function f(e,t){var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");i=2}this.t=0,this.s=0;for(var s=e.length,o=!1,r=0;--s>=0;){var a=u(e,s);a<0?"-"==e.charAt(s)&&(o=!0):(o=!1,0==r?this[this.t++]=a:r+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-r)-1)<<r,this[this.t++]=a>>this.DB-r):this[this.t-1]|=a<<r,r+=i,r>=this.DB&&(r-=this.DB))}this.clamp(),o&&n.ZERO.subTo(this,this)}function d(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function p(e){if(this.s<0)return"-"+this.negate().toString();var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)throw new Error("Only radix 2, 4, 8, 16, 32 are supported");t=2}var n,i=(1<<t)-1,s=!1,o="",r=this.t,u=this.DB-r*this.DB%t;if(r-- >0)for(u<this.DB&&(n=this[r]>>u)>0&&(s=!0,o=a(n));r>=0;)u<t?(n=(this[r]&(1<<u)-1)<<t-u,n|=this[--r]>>(u+=this.DB-t)):(n=this[r]>>(u-=t)&i,u<=0&&(u+=this.DB,--r)),n>0&&(s=!0),s&&(o+=a(n));return s?o:"0"}function g(){var e=i();return n.ZERO.subTo(this,e),e}function v(){return this.s<0?this.negate():this}function S(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function m(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function C(){return this.t<=0?0:this.DB*(this.t-1)+m(this[this.t-1]^this.s&this.DM)}function y(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function U(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function A(e,t){var n,i=e%this.DB,s=this.DB-i,o=(1<<s)-1,r=Math.floor(e/this.DB),a=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)t[n+r+1]=this[n]>>s|a,a=(this[n]&o)<<i;for(n=r-1;n>=0;--n)t[n]=0;t[r]=a,t.t=this.t+r+1,t.s=this.s,t.clamp()}function w(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)return void(t.t=0);var i=e%this.DB,s=this.DB-i,o=(1<<i)-1;t[0]=this[n]>>i;for(var r=n+1;r<this.t;++r)t[r-n-1]|=(this[r]&o)<<s,t[r-n]=this[r]>>i;i>0&&(t[this.t-n-1]|=(this.s&o)<<s),t.t=this.t-n,t.clamp()}function T(e,t){for(var n=0,i=0,s=Math.min(e.t,this.t);n<s;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()}function D(e,t){var i=this.abs(),s=e.abs(),o=i.t;for(t.t=o+s.t;--o>=0;)t[o]=0;for(o=0;o<s.t;++o)t[o+i.t]=i.am(0,s[o],t,o,0,i.t);t.s=0,t.clamp(),this.s!=e.s&&n.ZERO.subTo(t,t)}function I(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var i=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,i,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()}function E(e,t,s){var o=e.abs();if(!(o.t<=0)){var r=this.abs();if(r.t<o.t)return null!=t&&t.fromInt(0),void(null!=s&&this.copyTo(s));null==s&&(s=i());var a=i(),u=this.s,c=e.s,l=this.DB-m(o[o.t-1]);l>0?(o.lShiftTo(l,a),r.lShiftTo(l,s)):(o.copyTo(a),r.copyTo(s));var h=a.t,f=a[h-1];if(0!=f){var d=f*(1<<this.F1)+(h>1?a[h-2]>>this.F2:0),p=this.FV/d,g=(1<<this.F1)/d,v=1<<this.F2,S=s.t,C=S-h,y=null==t?i():t;for(a.dlShiftTo(C,y),s.compareTo(y)>=0&&(s[s.t++]=1,s.subTo(y,s)),n.ONE.dlShiftTo(h,y),y.subTo(a,a);a.t<h;)a[a.t++]=0;for(;--C>=0;){var U=s[--S]==f?this.DM:Math.floor(s[S]*p+(s[S-1]+v)*g);if((s[S]+=a.am(0,U,s,C,0,h))<U)for(a.dlShiftTo(C,y),s.subTo(y,s);s[S]<--U;)s.subTo(y,s)}null!=t&&(s.drShiftTo(h,t),u!=c&&n.ZERO.subTo(t,t)),s.t=h,s.clamp(),l>0&&s.rShiftTo(l,s),u<0&&n.ZERO.subTo(s,s)}}}function k(e){var t=i();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function F(e){return 0==this.compareTo(e)}function P(e,t){for(var n=0,i=0,s=Math.min(e.t,this.t);n<s;)i+=this[n]+e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i+=e[n],t[n++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[n++]=i:i<-1&&(t[n++]=this.DV+i),t.t=n,t.clamp()}function b(e){var t=i();return this.addTo(e,t),t}function _(e){var t=i();return this.subTo(e,t),t}function M(e){var t=i();return this.multiplyTo(e,t),t}function x(e){var t=i();return this.divRemTo(e,t,null),t}function N(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function B(e){var t=i();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(n.ZERO)>0&&this.m.subTo(t,t),t}function O(e){var t=i();return e.copyTo(t),this.reduce(t),t}function V(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],i=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e[n]+=this.m.am(0,i,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function K(e,t){e.squareTo(t),this.reduce(t)}function q(e,t,n){e.multiplyTo(t,n),this.reduce(n)}function j(e,t,n){var s,o=e.bitLength(),r=h(1),a=new N(t);if(o<=0)return r;s=o<18?1:o<48?3:o<144?4:o<768?5:6;var u=new Array,c=3,l=s-1,f=(1<<s)-1;if(u[1]=a.convert(this),s>1){var d=i();for(a.sqrTo(u[1],d);c<=f;)u[c]=i(),a.mulTo(d,u[c-2],u[c]),c+=2}var p,g,v=e.t-1,S=!0,C=i();for(o=m(e[v])-1;v>=0;){for(o>=l?p=e[v]>>o-l&f:(p=(e[v]&(1<<o+1)-1)<<l-o,v>0&&(p|=e[v-1]>>this.DB+o-l)),c=s;0==(1&p);)p>>=1,--c;if((o-=c)<0&&(o+=this.DB,--v),S)u[p].copyTo(r),S=!1;else{for(;c>1;)a.sqrTo(r,C),a.sqrTo(C,r),c-=2;c>0?a.sqrTo(r,C):(g=r,r=C,C=g),a.mulTo(C,u[p],r)}for(;v>=0&&0==(e[v]&1<<o);)a.sqrTo(r,C),g=r,r=C,C=g,--o<0&&(o=this.DB-1,--v)}var y=a.revert(r);return n(null,y),y}t.__esModule=!0,t.default=n;var H,L=0xdeadbeefcafe,J=15715070==(16777215&L),W="undefined"!=typeof navigator;W&&J&&"Microsoft Internet Explorer"==navigator.appName?(n.prototype.am=o,H=30):W&&J&&"Netscape"!=navigator.appName?(n.prototype.am=s,H=26):(n.prototype.am=r,H=28),n.prototype.DB=H,n.prototype.DM=(1<<H)-1,n.prototype.DV=1<<H;var G=52;n.prototype.FV=Math.pow(2,G),n.prototype.F1=G-H,n.prototype.F2=2*H-G;var Z,Y,z="0123456789abcdefghijklmnopqrstuvwxyz",Q=new Array;for(Z="0".charCodeAt(0),Y=0;Y<=9;++Y)Q[Z++]=Y;for(Z="a".charCodeAt(0),Y=10;Y<36;++Y)Q[Z++]=Y;for(Z="A".charCodeAt(0),Y=10;Y<36;++Y)Q[Z++]=Y;N.prototype.convert=B,N.prototype.revert=O,N.prototype.reduce=V,N.prototype.mulTo=q,N.prototype.sqrTo=K,n.prototype.copyTo=c,n.prototype.fromInt=l,n.prototype.fromString=f,n.prototype.clamp=d,n.prototype.dlShiftTo=y,n.prototype.drShiftTo=U,n.prototype.lShiftTo=A,n.prototype.rShiftTo=w,n.prototype.subTo=T,n.prototype.multiplyTo=D,n.prototype.squareTo=I,n.prototype.divRemTo=E,n.prototype.invDigit=R,n.prototype.addTo=P,n.prototype.toString=p,n.prototype.negate=g,n.prototype.abs=v,n.prototype.compareTo=S,n.prototype.bitLength=C,n.prototype.mod=k,n.prototype.equals=F,n.prototype.add=b,n.prototype.subtract=_,n.prototype.multiply=M,n.prototype.divide=x,n.prototype.modPow=j,n.ZERO=h(0),n.ONE=h(1)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(6),u=i(a),c=function(e){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.AccessToken;return s(this,t),o(this,e.call(this,i||""))}return r(t,e),t}(u.default);t.default=c},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=n(6),u=i(a),c=function(e){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.IdToken;return s(this,t),o(this,e.call(this,i||""))}return r(t,e),t}(u.default);t.default=c},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var s=n(1),o=function(){function e(t){i(this,e),this.jwtToken=t||"",this.payload=this.decodePayload()}return e.prototype.getJwtToken=function(){return this.jwtToken},e.prototype.getExpiration=function(){return this.payload.exp},e.prototype.getIssuedAt=function(){return this.payload.iat},e.prototype.decodePayload=function(){var e=this.jwtToken.split(".")[1];try{return JSON.parse(s.util.base64.decode(e).toString("utf8"))}catch(e){return{}}},e}();t.default=o},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;/*!
* Copyright 2016 Amazon.com,

@@ -34,3 +34,3 @@ * Inc. or its affiliates. All Rights Reserved.

*/
var i=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.RefreshToken;n(this,e),this.token=i||""}return e.prototype.getToken=function(){return this.token},e}();t.default=i},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=n(1),r=n(3),a=i(r),u=n(2),c=i(u),l=n(4),h=i(l),f=n(5),d=i(f),p=n(7),g=i(p),S=n(10),v=i(S),m=n(11),C=i(m),y=n(9),U=i(y),A=n(12),w=i(A),T=function(){function e(t){if(s(this,e),null==t||null==t.Username||null==t.Pool)throw new Error("Username and pool information are required.");this.username=t.Username||"",this.pool=t.Pool,this.Session=null,this.client=t.Pool.client,this.signInUserSession=null,this.authenticationFlowType="USER_SRP_AUTH",this.storage=t.Storage||(new w.default).getStorage()}return e.prototype.setSignInUserSession=function(e){this.clearCachedTokens(),this.signInUserSession=e,this.cacheTokens()},e.prototype.getSignInUserSession=function(){return this.signInUserSession},e.prototype.getUsername=function(){return this.username},e.prototype.getAuthenticationFlowType=function(){return this.authenticationFlowType},e.prototype.setAuthenticationFlowType=function(e){this.authenticationFlowType=e},e.prototype.initiateAuth=function(e,t){var n=this,i=e.getAuthParameters();i.USERNAME=this.username,this.client.makeUnauthenticatedRequest("initiateAuth",{AuthFlow:"CUSTOM_AUTH",ClientId:this.pool.getClientId(),AuthParameters:i,ClientMetadata:e.getValidationData(),UserContextData:this.getUserContextData()},function(e,i){if(e)return t.onFailure(e);var s=i.ChallengeName,o=i.ChallengeParameters;return"CUSTOM_CHALLENGE"===s?(n.Session=i.Session,t.customChallenge(o)):(n.signInUserSession=n.getCognitoUserSession(i.AuthenticationResult),n.cacheTokens(),t.onSuccess(n.signInUserSession))})},e.prototype.authenticateUser=function(e,t){var n=this,i=new c.default(this.pool.getUserPoolId().split("_")[1]),s=new C.default,r=void 0,u=void 0,l={};null!=this.deviceKey&&(l.DEVICE_KEY=this.deviceKey),l.USERNAME=this.username,i.getLargeAValue(function(c,h){c&&t.onFailure(c),l.SRP_A=h.toString(16),"CUSTOM_AUTH"===n.authenticationFlowType&&(l.CHALLENGE_NAME="SRP_A"),n.client.makeUnauthenticatedRequest("initiateAuth",{AuthFlow:n.authenticationFlowType,ClientId:n.pool.getClientId(),AuthParameters:l,ClientMetadata:e.getValidationData(),UserContextData:n.getUserContextData()},function(c,l){if(c)return t.onFailure(c);var h=l.ChallengeParameters;n.username=h.USER_ID_FOR_SRP,r=new a.default(h.SRP_B,16),u=new a.default(h.SALT,16),n.getCachedDeviceKeyAndPassword(),i.getPasswordAuthenticationKey(n.username,e.getPassword(),r,u,function(e,r){e&&t.onFailure(e);var a=s.getNowString(),u=o.util.crypto.hmac(r,o.util.buffer.concat([new o.util.Buffer(n.pool.getUserPoolId().split("_")[1],"utf8"),new o.util.Buffer(n.username,"utf8"),new o.util.Buffer(h.SECRET_BLOCK,"base64"),new o.util.Buffer(a,"utf8")]),"base64","sha256"),c={};c.USERNAME=n.username,c.PASSWORD_CLAIM_SECRET_BLOCK=h.SECRET_BLOCK,c.TIMESTAMP=a,c.PASSWORD_CLAIM_SIGNATURE=u,null!=n.deviceKey&&(c.DEVICE_KEY=n.deviceKey);var f=function e(t,i){return n.client.makeUnauthenticatedRequest("respondToAuthChallenge",t,function(s,o){return s&&"ResourceNotFoundException"===s.code&&s.message.toLowerCase().indexOf("device")!==-1?(c.DEVICE_KEY=null,n.deviceKey=null,n.randomPassword=null,n.deviceGroupKey=null,n.clearCachedDeviceKeyAndPassword(),e(t,i)):i(s,o)})};f({ChallengeName:"PASSWORD_VERIFIER",ClientId:n.pool.getClientId(),ChallengeResponses:c,Session:l.Session,UserContextData:n.getUserContextData()},function(e,s){if(e)return t.onFailure(e);var o=s.ChallengeName;if("NEW_PASSWORD_REQUIRED"===o){n.Session=s.Session;var r=null,a=null,u=[],c=i.getNewPasswordRequiredChallengeUserAttributePrefix();if(s.ChallengeParameters&&(r=JSON.parse(s.ChallengeParameters.userAttributes),a=JSON.parse(s.ChallengeParameters.requiredAttributes)),a)for(var l=0;l<a.length;l++)u[l]=a[l].substr(c.length);return t.newPasswordRequired(r,u)}return n.authenticateUserInternal(s,i,t)})})})})},e.prototype.authenticateUserInternal=function(e,t,n){var i=this,s=e.ChallengeName,r=e.ChallengeParameters;if("SMS_MFA"===s)return this.Session=e.Session,n.mfaRequired(s,r);if("SELECT_MFA_TYPE"===s)return this.Session=e.Session,n.selectMFAType(s,r);if("MFA_SETUP"===s)return this.Session=e.Session,n.mfaSetup(s,r);if("SOFTWARE_TOKEN_MFA"===s)return this.Session=e.Session,n.totpRequired(s,r);if("CUSTOM_CHALLENGE"===s)return this.Session=e.Session,n.customChallenge(r);if("DEVICE_SRP_AUTH"===s)return void this.getDeviceResponse(n);this.signInUserSession=this.getCognitoUserSession(e.AuthenticationResult),this.cacheTokens();var a=e.AuthenticationResult.NewDeviceMetadata;return null==a?n.onSuccess(this.signInUserSession):void t.generateHashDevice(e.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,e.AuthenticationResult.NewDeviceMetadata.DeviceKey,function(s){if(s)return n.onFailure(s);var r={Salt:new o.util.Buffer(t.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:new o.util.Buffer(t.getVerifierDevices(),"hex").toString("base64")};i.verifierDevices=r.PasswordVerifier,i.deviceGroupKey=a.DeviceGroupKey,i.randomPassword=t.getRandomPassword(),i.client.makeUnauthenticatedRequest("confirmDevice",{DeviceKey:a.DeviceKey,AccessToken:i.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:r,DeviceName:navigator.userAgent},function(t,s){return t?n.onFailure(t):(i.deviceKey=e.AuthenticationResult.NewDeviceMetadata.DeviceKey,i.cacheDeviceKeyAndPassword(),s.UserConfirmationNecessary===!0?n.onSuccess(i.signInUserSession,s.UserConfirmationNecessary):n.onSuccess(i.signInUserSession))})})},e.prototype.completeNewPasswordChallenge=function(e,t,n){var i=this;if(!e)return n.onFailure(new Error("New password is required."));var s=new c.default(this.pool.getUserPoolId().split("_")[1]),o=s.getNewPasswordRequiredChallengeUserAttributePrefix(),r={};t&&Object.keys(t).forEach(function(e){r[o+e]=t[e]}),r.NEW_PASSWORD=e,r.USERNAME=this.username,this.client.makeUnauthenticatedRequest("respondToAuthChallenge",{ChallengeName:"NEW_PASSWORD_REQUIRED",ClientId:this.pool.getClientId(),ChallengeResponses:r,Session:this.Session,UserContextData:this.getUserContextData()},function(e,t){return e?n.onFailure(e):i.authenticateUserInternal(t,s,n)})},e.prototype.getDeviceResponse=function(e){var t=this,n=new c.default(this.deviceGroupKey),i=new C.default,s={};s.USERNAME=this.username,s.DEVICE_KEY=this.deviceKey,n.getLargeAValue(function(r,u){r&&e.onFailure(r),s.SRP_A=u.toString(16),t.client.makeUnauthenticatedRequest("respondToAuthChallenge",{ChallengeName:"DEVICE_SRP_AUTH",ClientId:t.pool.getClientId(),ChallengeResponses:s,UserContextData:t.getUserContextData()},function(s,r){if(s)return e.onFailure(s);var u=r.ChallengeParameters,c=new a.default(u.SRP_B,16),l=new a.default(u.SALT,16);n.getPasswordAuthenticationKey(t.deviceKey,t.randomPassword,c,l,function(n,s){if(n)return e.onFailure(n);var a=i.getNowString(),c=o.util.crypto.hmac(s,o.util.buffer.concat([new o.util.Buffer(t.deviceGroupKey,"utf8"),new o.util.Buffer(t.deviceKey,"utf8"),new o.util.Buffer(u.SECRET_BLOCK,"base64"),new o.util.Buffer(a,"utf8")]),"base64","sha256"),l={};l.USERNAME=t.username,l.PASSWORD_CLAIM_SECRET_BLOCK=u.SECRET_BLOCK,l.TIMESTAMP=a,l.PASSWORD_CLAIM_SIGNATURE=c,l.DEVICE_KEY=t.deviceKey,t.client.makeUnauthenticatedRequest("respondToAuthChallenge",{ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:t.pool.getClientId(),ChallengeResponses:l,Session:r.Session,UserContextData:t.getUserContextData()},function(n,i){return n?e.onFailure(n):(t.signInUserSession=t.getCognitoUserSession(i.AuthenticationResult),t.cacheTokens(),e.onSuccess(t.signInUserSession))})})})})},e.prototype.confirmRegistration=function(e,t,n){this.client.makeUnauthenticatedRequest("confirmSignUp",{ClientId:this.pool.getClientId(),ConfirmationCode:e,Username:this.username,ForceAliasCreation:t,UserContextData:this.getUserContextData()},function(e){return e?n(e,null):n(null,"SUCCESS")})},e.prototype.sendCustomChallengeAnswer=function(e,t){var n=this,i={};i.USERNAME=this.username,i.ANSWER=e,this.client.makeUnauthenticatedRequest("respondToAuthChallenge",{ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:i,ClientId:this.pool.getClientId(),Session:this.Session,UserContextData:this.getUserContextData()},function(e,i){if(e)return t.onFailure(e);var s=i.ChallengeName;return"CUSTOM_CHALLENGE"===s?(n.Session=i.Session,t.customChallenge(i.ChallengeParameters)):(n.signInUserSession=n.getCognitoUserSession(i.AuthenticationResult),n.cacheTokens(),t.onSuccess(n.signInUserSession))})},e.prototype.sendMFACode=function(e,t,n){var i=this,s={};s.USERNAME=this.username,s.SMS_MFA_CODE=e;var r=n||"SMS_MFA";"SOFTWARE_TOKEN_MFA"===r&&(s.SOFTWARE_TOKEN_MFA_CODE=e),null!=this.deviceKey&&(s.DEVICE_KEY=this.deviceKey),this.client.makeUnauthenticatedRequest("respondToAuthChallenge",{ChallengeName:r,ChallengeResponses:s,ClientId:this.pool.getClientId(),Session:this.Session,UserContextData:this.getUserContextData()},function(e,n){if(e)return t.onFailure(e);var s=n.ChallengeName;if("DEVICE_SRP_AUTH"===s)return void i.getDeviceResponse(t);if(i.signInUserSession=i.getCognitoUserSession(n.AuthenticationResult),i.cacheTokens(),null==n.AuthenticationResult.NewDeviceMetadata)return t.onSuccess(i.signInUserSession);var r=new c.default(i.pool.getUserPoolId().split("_")[1]);r.generateHashDevice(n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,n.AuthenticationResult.NewDeviceMetadata.DeviceKey,function(e){if(e)return t.onFailure(e);var s={Salt:new o.util.Buffer(r.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:new o.util.Buffer(r.getVerifierDevices(),"hex").toString("base64")};i.verifierDevices=s.PasswordVerifier,i.deviceGroupKey=n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,i.randomPassword=r.getRandomPassword(),i.client.makeUnauthenticatedRequest("confirmDevice",{DeviceKey:n.AuthenticationResult.NewDeviceMetadata.DeviceKey,AccessToken:i.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:navigator.userAgent},function(e,s){return e?t.onFailure(e):(i.deviceKey=n.AuthenticationResult.NewDeviceMetadata.DeviceKey,i.cacheDeviceKeyAndPassword(),s.UserConfirmationNecessary===!0?t.onSuccess(i.signInUserSession,s.UserConfirmationNecessary):t.onSuccess(i.signInUserSession))})})})},e.prototype.changePassword=function(e,t,n){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("changePassword",{PreviousPassword:e,ProposedPassword:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e){return e?n(e,null):n(null,"SUCCESS")}):n(new Error("User is not authenticated"),null)},e.prototype.enableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);var t=[],n={DeliveryMedium:"SMS",AttributeName:"phone_number"};t.push(n),this.client.makeUnauthenticatedRequest("setUserSettings",{MFAOptions:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t){return t?e(t,null):e(null,"SUCCESS")})},e.prototype.setUserMfaPreference=function(e,t,n){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("setUserMFAPreference",{SMSMfaSettings:e,SoftwareTokenMfaSettings:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e){return e?n(e,null):n(null,"SUCCESS")}):n(new Error("User is not authenticated"),null)},e.prototype.disableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);var t=[];this.client.makeUnauthenticatedRequest("setUserSettings",{MFAOptions:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t){return t?e(t,null):e(null,"SUCCESS")})},e.prototype.deleteUser=function(e){var t=this;return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("deleteUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(n){return n?e(n,null):(t.clearCachedTokens(),e(null,"SUCCESS"))}):e(new Error("User is not authenticated"),null)},e.prototype.updateAttributes=function(e,t){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("updateUserAttributes",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserAttributes:e},function(e){return e?t(e,null):t(null,"SUCCESS")}):t(new Error("User is not authenticated"),null)},e.prototype.getUserAttributes=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("getUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t,n){if(t)return e(t,null);for(var i=[],s=0;s<n.UserAttributes.length;s++){var o={Name:n.UserAttributes[s].Name,Value:n.UserAttributes[s].Value},r=new U.default(o);i.push(r)}return e(null,i)}):e(new Error("User is not authenticated"),null)},e.prototype.getMFAOptions=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("getUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t,n){return t?e(t,null):e(null,n.MFAOptions)}):e(new Error("User is not authenticated"),null)},e.prototype.deleteAttributes=function(e,t){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("deleteUserAttributes",{UserAttributeNames:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e){return e?t(e,null):t(null,"SUCCESS")}):t(new Error("User is not authenticated"),null)},e.prototype.resendConfirmationCode=function(e){this.client.makeUnauthenticatedRequest("resendConfirmationCode",{ClientId:this.pool.getClientId(),Username:this.username,UserContextData:this.getUserContextData()},function(t,n){return t?e(t,null):e(null,n)})},e.prototype.getSession=function(e){if(null==this.username)return e(new Error("Username is null. Cannot retrieve a new session"),null);if(null!=this.signInUserSession&&this.signInUserSession.isValid())return e(null,this.signInUserSession);var t="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,n=t+".idToken",i=t+".accessToken",s=t+".refreshToken",o=t+".clockDrift";if(this.storage.getItem(n)){var r=new d.default({IdToken:this.storage.getItem(n)}),a=new h.default({AccessToken:this.storage.getItem(i)}),u=new g.default({RefreshToken:this.storage.getItem(s)}),c=parseInt(this.storage.getItem(o),0)||0,l={IdToken:r,AccessToken:a,RefreshToken:u,ClockDrift:c},f=new v.default(l);if(f.isValid())return this.signInUserSession=f,e(null,this.signInUserSession);if(null==u.getToken())return e(new Error("Cannot retrieve a new session. Please authenticate."),null);this.refreshSession(u,e)}else e(new Error("Local storage is missing an ID Token, Please authenticate"),null)},e.prototype.refreshSession=function(e,t){var n=this,i={};i.REFRESH_TOKEN=e.getToken();var s="CognitoIdentityServiceProvider."+this.pool.getClientId(),o=s+".LastAuthUser";if(this.storage.getItem(o)){this.username=this.storage.getItem(o);var r=s+"."+this.username+".deviceKey";this.deviceKey=this.storage.getItem(r),i.DEVICE_KEY=this.deviceKey}this.client.makeUnauthenticatedRequest("initiateAuth",{ClientId:this.pool.getClientId(),AuthFlow:"REFRESH_TOKEN_AUTH",AuthParameters:i,UserContextData:this.getUserContextData()},function(i,s){if(i)return"NotAuthorizedException"===i.code&&n.clearCachedTokens(),t(i,null);if(s){var o=s.AuthenticationResult;return Object.prototype.hasOwnProperty.call(o,"RefreshToken")||(o.RefreshToken=e.getToken()),n.signInUserSession=n.getCognitoUserSession(o),n.cacheTokens(),t(null,n.signInUserSession)}})},e.prototype.cacheTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",i=e+"."+this.username+".refreshToken",s=e+"."+this.username+".clockDrift",o=e+".LastAuthUser";this.storage.setItem(t,this.signInUserSession.getIdToken().getJwtToken()),this.storage.setItem(n,this.signInUserSession.getAccessToken().getJwtToken()),this.storage.setItem(i,this.signInUserSession.getRefreshToken().getToken()),this.storage.setItem(s,""+this.signInUserSession.getClockDrift()),this.storage.setItem(o,this.username)},e.prototype.cacheDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",i=e+".deviceGroupKey";this.storage.setItem(t,this.deviceKey),this.storage.setItem(n,this.randomPassword),this.storage.setItem(i,this.deviceGroupKey)},e.prototype.getCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",i=e+".deviceGroupKey";this.storage.getItem(t)&&(this.deviceKey=this.storage.getItem(t),this.randomPassword=this.storage.getItem(n),this.deviceGroupKey=this.storage.getItem(i))},e.prototype.clearCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",i=e+".deviceGroupKey";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(i)},e.prototype.clearCachedTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",i=e+"."+this.username+".refreshToken",s=e+".LastAuthUser";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(i),this.storage.removeItem(s)},e.prototype.getCognitoUserSession=function(e){var t=new d.default(e),n=new h.default(e),i=new g.default(e),s={IdToken:t,AccessToken:n,RefreshToken:i};return new v.default(s)},e.prototype.forgotPassword=function(e){this.client.makeUnauthenticatedRequest("forgotPassword",{ClientId:this.pool.getClientId(),Username:this.username,UserContextData:this.getUserContextData()},function(t,n){return t?e.onFailure(t):"function"==typeof e.inputVerificationCode?e.inputVerificationCode(n):e.onSuccess(n)})},e.prototype.confirmPassword=function(e,t,n){this.client.makeUnauthenticatedRequest("confirmForgotPassword",{ClientId:this.pool.getClientId(),Username:this.username,ConfirmationCode:e,Password:t,UserContextData:this.getUserContextData()},function(e){return e?n.onFailure(e):n.onSuccess()})},e.prototype.getAttributeVerificationCode=function(e,t){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("getUserAttributeVerificationCode",{AttributeName:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e,n){return e?t.onFailure(e):"function"==typeof t.inputVerificationCode?t.inputVerificationCode(n):t.onSuccess()}):t.onFailure(new Error("User is not authenticated"))},e.prototype.verifyAttribute=function(e,t,n){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("verifyUserAttribute",{AttributeName:e,Code:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}):n.onFailure(new Error("User is not authenticated"))},e.prototype.getDevice=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("getDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey},function(t,n){return t?e.onFailure(t):e.onSuccess(n)}):e.onFailure(new Error("User is not authenticated"))},e.prototype.forgetSpecificDevice=function(e,t){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("forgetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:e},function(e){return e?t.onFailure(e):t.onSuccess("SUCCESS")}):t.onFailure(new Error("User is not authenticated"))},e.prototype.forgetDevice=function(e){var t=this;this.forgetSpecificDevice(this.deviceKey,{onFailure:e.onFailure,onSuccess:function(n){return t.deviceKey=null,t.deviceGroupKey=null,t.randomPassword=null,t.clearCachedDeviceKeyAndPassword(),e.onSuccess(n)}})},e.prototype.setDeviceStatusRemembered=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("updateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"remembered"},function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}):e.onFailure(new Error("User is not authenticated"))},e.prototype.setDeviceStatusNotRemembered=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("updateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"not_remembered"},function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}):e.onFailure(new Error("User is not authenticated"))},e.prototype.listDevices=function(e,t,n){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("listDevices",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),Limit:e,PaginationToken:t},function(e,t){return e?n.onFailure(e):n.onSuccess(t)}):n.onFailure(new Error("User is not authenticated"))},e.prototype.globalSignOut=function(e){var t=this;return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("globalSignOut",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(n){return n?e.onFailure(n):(t.clearCachedTokens(),e.onSuccess("SUCCESS"))}):e.onFailure(new Error("User is not authenticated"))},e.prototype.signOut=function(){this.signInUserSession=null,this.clearCachedTokens()},e.prototype.sendMFASelectionAnswer=function(e,t){var n=this,i={};i.USERNAME=this.username,i.ANSWER=e,this.client.makeUnauthenticatedRequest("respondToAuthChallenge",{ChallengeName:"SELECT_MFA_TYPE",ChallengeResponses:i,ClientId:this.pool.getClientId(),Session:this.Session,UserContextData:this.getUserContextData()},function(i,s){return i?t.onFailure(i):(n.Session=s.Session,"SMS_MFA"===e?t.mfaRequired(s.challengeName,s.challengeParameters):"SOFTWARE_TOKEN_MFA"===e?t.totpRequired(s.challengeName,s.challengeParameters):void 0)})},e.prototype.getUserContextData=function(){var e=this.pool;return e.getUserContextData(this.username)},e.prototype.associateSoftwareToken=function(e){var t=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.makeUnauthenticatedRequest("associateSoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t,n){return t?e.onFailure(t):e.associateSecretCode(n.SecretCode)}):this.client.makeUnauthenticatedRequest("associateSoftwareToken",{Session:this.Session},function(n,i){return n?e.onFailure(n):(t.Session=i.Session,e.associateSecretCode(i.SecretCode))})},e.prototype.verifySoftwareToken=function(e,t,n){var i=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.makeUnauthenticatedRequest("verifySoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserCode:e,FriendlyDeviceName:t},function(e,t){if(e)return n.onFailure(e);i.Session=t.Session;var s={};s.USERNAME=i.username,i.client.makeUnauthenticatedRequest("respondToAuthChallenge",{ChallengeName:"MFA_SETUP",ClientId:i.pool.getClientId(),ChallengeResponses:s,Session:i.Session,UserContextData:i.getUserContextData()},function(e,t){return e?n.onFailure(e):(i.signInUserSession=i.getCognitoUserSession(t.AuthenticationResult),i.cacheTokens(),n.onSuccess(i.signInUserSession))})}):this.client.makeUnauthenticatedRequest("verifySoftwareToken",{Session:this.Session,UserCode:e,FriendlyDeviceName:t},function(e,t){if(e)return n.onFailure(e);i.Session=t.Session;var s={};s.USERNAME=i.username,i.client.makeUnauthenticatedRequest("respondToAuthChallenge",{ChallengeName:"MFA_SETUP",ClientId:i.pool.getClientId(),ChallengeResponses:s,Session:i.Session,UserContextData:i.getUserContextData()},function(e,t){return e?n.onFailure(e):(i.signInUserSession=i.getCognitoUserSession(t.AuthenticationResult),i.cacheTokens(),n.onSuccess(i.signInUserSession))})})},e}();t.default=T},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;/*!
var i=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.RefreshToken;n(this,e),this.token=i||""}return e.prototype.getToken=function(){return this.token},e}();t.default=i},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=n(1),r=n(3),a=i(r),u=n(2),c=i(u),l=n(4),h=i(l),f=n(5),d=i(f),p=n(7),g=i(p),v=n(10),S=i(v),m=n(11),C=i(m),y=n(9),U=i(y),A=n(12),w=i(A),T=function(){function e(t){if(s(this,e),null==t||null==t.Username||null==t.Pool)throw new Error("Username and pool information are required.");this.username=t.Username||"",this.pool=t.Pool,this.Session=null,this.client=t.Pool.client,this.signInUserSession=null,this.authenticationFlowType="USER_SRP_AUTH",this.storage=t.Storage||(new w.default).getStorage()}return e.prototype.setSignInUserSession=function(e){this.clearCachedTokens(),this.signInUserSession=e,this.cacheTokens()},e.prototype.getSignInUserSession=function(){return this.signInUserSession},e.prototype.getUsername=function(){return this.username},e.prototype.getAuthenticationFlowType=function(){return this.authenticationFlowType},e.prototype.setAuthenticationFlowType=function(e){this.authenticationFlowType=e},e.prototype.initiateAuth=function(e,t){var n=this,i=e.getAuthParameters();i.USERNAME=this.username;var s={AuthFlow:"CUSTOM_AUTH",ClientId:this.pool.getClientId(),AuthParameters:i,ClientMetadata:e.getValidationData()};this.getUserContextData()&&(s.UserContextData=this.getUserContextData()),this.client.makeUnauthenticatedRequest("initiateAuth",s,function(e,i){if(e)return t.onFailure(e);var s=i.ChallengeName,o=i.ChallengeParameters;return"CUSTOM_CHALLENGE"===s?(n.Session=i.Session,t.customChallenge(o)):(n.signInUserSession=n.getCognitoUserSession(i.AuthenticationResult),n.cacheTokens(),t.onSuccess(n.signInUserSession))})},e.prototype.authenticateUser=function(e,t){var n=this,i=new c.default(this.pool.getUserPoolId().split("_")[1]),s=new C.default,r=void 0,u=void 0,l={};null!=this.deviceKey&&(l.DEVICE_KEY=this.deviceKey),l.USERNAME=this.username,i.getLargeAValue(function(c,h){c&&t.onFailure(c),l.SRP_A=h.toString(16),"CUSTOM_AUTH"===n.authenticationFlowType&&(l.CHALLENGE_NAME="SRP_A");var f={AuthFlow:n.authenticationFlowType,ClientId:n.pool.getClientId(),AuthParameters:l,ClientMetadata:e.getValidationData()};n.getUserContextData(n.username)&&(f.UserContextData=n.getUserContextData(n.username)),n.client.makeUnauthenticatedRequest("initiateAuth",f,function(c,l){if(c)return t.onFailure(c);var h=l.ChallengeParameters;n.username=h.USER_ID_FOR_SRP,r=new a.default(h.SRP_B,16),u=new a.default(h.SALT,16),n.getCachedDeviceKeyAndPassword(),i.getPasswordAuthenticationKey(n.username,e.getPassword(),r,u,function(e,r){e&&t.onFailure(e);var a=s.getNowString(),u=o.util.crypto.hmac(r,o.util.buffer.concat([new o.util.Buffer(n.pool.getUserPoolId().split("_")[1],"utf8"),new o.util.Buffer(n.username,"utf8"),new o.util.Buffer(h.SECRET_BLOCK,"base64"),new o.util.Buffer(a,"utf8")]),"base64","sha256"),c={};c.USERNAME=n.username,c.PASSWORD_CLAIM_SECRET_BLOCK=h.SECRET_BLOCK,c.TIMESTAMP=a,c.PASSWORD_CLAIM_SIGNATURE=u,null!=n.deviceKey&&(c.DEVICE_KEY=n.deviceKey);var f=function e(t,i){return n.client.makeUnauthenticatedRequest("respondToAuthChallenge",t,function(s,o){return s&&"ResourceNotFoundException"===s.code&&s.message.toLowerCase().indexOf("device")!==-1?(c.DEVICE_KEY=null,n.deviceKey=null,n.randomPassword=null,n.deviceGroupKey=null,n.clearCachedDeviceKeyAndPassword(),e(t,i)):i(s,o)})},d={ChallengeName:"PASSWORD_VERIFIER",ClientId:n.pool.getClientId(),ChallengeResponses:c,Session:l.Session};n.getUserContextData()&&(d.UserContextData=n.getUserContextData()),f(d,function(e,s){if(e)return t.onFailure(e);var o=s.ChallengeName;if("NEW_PASSWORD_REQUIRED"===o){n.Session=s.Session;var r=null,a=null,u=[],c=i.getNewPasswordRequiredChallengeUserAttributePrefix();if(s.ChallengeParameters&&(r=JSON.parse(s.ChallengeParameters.userAttributes),a=JSON.parse(s.ChallengeParameters.requiredAttributes)),a)for(var l=0;l<a.length;l++)u[l]=a[l].substr(c.length);return t.newPasswordRequired(r,u)}return n.authenticateUserInternal(s,i,t)})})})})},e.prototype.authenticateUserInternal=function(e,t,n){var i=this,s=e.ChallengeName,r=e.ChallengeParameters;if("SMS_MFA"===s)return this.Session=e.Session,n.mfaRequired(s,r);if("SELECT_MFA_TYPE"===s)return this.Session=e.Session,n.selectMFAType(s,r);if("MFA_SETUP"===s)return this.Session=e.Session,n.mfaSetup(s,r);if("SOFTWARE_TOKEN_MFA"===s)return this.Session=e.Session,n.totpRequired(s,r);if("CUSTOM_CHALLENGE"===s)return this.Session=e.Session,n.customChallenge(r);if("DEVICE_SRP_AUTH"===s)return void this.getDeviceResponse(n);this.signInUserSession=this.getCognitoUserSession(e.AuthenticationResult),this.cacheTokens();var a=e.AuthenticationResult.NewDeviceMetadata;return null==a?n.onSuccess(this.signInUserSession):void t.generateHashDevice(e.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,e.AuthenticationResult.NewDeviceMetadata.DeviceKey,function(s){if(s)return n.onFailure(s);var r={Salt:new o.util.Buffer(t.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:new o.util.Buffer(t.getVerifierDevices(),"hex").toString("base64")};i.verifierDevices=r.PasswordVerifier,i.deviceGroupKey=a.DeviceGroupKey,i.randomPassword=t.getRandomPassword(),i.client.makeUnauthenticatedRequest("confirmDevice",{DeviceKey:a.DeviceKey,AccessToken:i.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:r,DeviceName:navigator.userAgent},function(t,s){return t?n.onFailure(t):(i.deviceKey=e.AuthenticationResult.NewDeviceMetadata.DeviceKey,i.cacheDeviceKeyAndPassword(),s.UserConfirmationNecessary===!0?n.onSuccess(i.signInUserSession,s.UserConfirmationNecessary):n.onSuccess(i.signInUserSession))})})},e.prototype.completeNewPasswordChallenge=function(e,t,n){var i=this;if(!e)return n.onFailure(new Error("New password is required."));var s=new c.default(this.pool.getUserPoolId().split("_")[1]),o=s.getNewPasswordRequiredChallengeUserAttributePrefix(),r={};t&&Object.keys(t).forEach(function(e){r[o+e]=t[e]}),r.NEW_PASSWORD=e,r.USERNAME=this.username;var a={ChallengeName:"NEW_PASSWORD_REQUIRED",ClientId:this.pool.getClientId(),ChallengeResponses:r,Session:this.Session};this.getUserContextData()&&(a.UserContextData=this.getUserContextData()),this.client.makeUnauthenticatedRequest("respondToAuthChallenge",a,function(e,t){return e?n.onFailure(e):i.authenticateUserInternal(t,s,n)})},e.prototype.getDeviceResponse=function(e){var t=this,n=new c.default(this.deviceGroupKey),i=new C.default,s={};s.USERNAME=this.username,s.DEVICE_KEY=this.deviceKey,n.getLargeAValue(function(r,u){r&&e.onFailure(r),s.SRP_A=u.toString(16);var c={ChallengeName:"DEVICE_SRP_AUTH",ClientId:t.pool.getClientId(),ChallengeResponses:s};t.getUserContextData()&&(c.UserContextData=t.getUserContextData()),t.client.makeUnauthenticatedRequest("respondToAuthChallenge",c,function(s,r){if(s)return e.onFailure(s);var u=r.ChallengeParameters,c=new a.default(u.SRP_B,16),l=new a.default(u.SALT,16);n.getPasswordAuthenticationKey(t.deviceKey,t.randomPassword,c,l,function(n,s){if(n)return e.onFailure(n);var a=i.getNowString(),c=o.util.crypto.hmac(s,o.util.buffer.concat([new o.util.Buffer(t.deviceGroupKey,"utf8"),new o.util.Buffer(t.deviceKey,"utf8"),new o.util.Buffer(u.SECRET_BLOCK,"base64"),new o.util.Buffer(a,"utf8")]),"base64","sha256"),l={};l.USERNAME=t.username,l.PASSWORD_CLAIM_SECRET_BLOCK=u.SECRET_BLOCK,l.TIMESTAMP=a,l.PASSWORD_CLAIM_SIGNATURE=c,l.DEVICE_KEY=t.deviceKey;var h={ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:t.pool.getClientId(),ChallengeResponses:l,Session:r.Session};t.getUserContextData()&&(h.UserContextData=t.getUserContextData()),t.client.makeUnauthenticatedRequest("respondToAuthChallenge",h,function(n,i){return n?e.onFailure(n):(t.signInUserSession=t.getCognitoUserSession(i.AuthenticationResult),t.cacheTokens(),e.onSuccess(t.signInUserSession))})})})})},e.prototype.confirmRegistration=function(e,t,n){var i={ClientId:this.pool.getClientId(),ConfirmationCode:e,Username:this.username,ForceAliasCreation:t};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.makeUnauthenticatedRequest("confirmSignUp",i,function(e){return e?n(e,null):n(null,"SUCCESS")})},e.prototype.sendCustomChallengeAnswer=function(e,t){var n=this,i={};i.USERNAME=this.username,i.ANSWER=e;var s={ChallengeName:"CUSTOM_CHALLENGE",ChallengeResponses:i,ClientId:this.pool.getClientId(),Session:this.Session};this.getUserContextData()&&(s.UserContextData=this.getUserContextData()),this.client.makeUnauthenticatedRequest("respondToAuthChallenge",s,function(e,i){if(e)return t.onFailure(e);var s=i.ChallengeName;return"CUSTOM_CHALLENGE"===s?(n.Session=i.Session,t.customChallenge(i.ChallengeParameters)):(n.signInUserSession=n.getCognitoUserSession(i.AuthenticationResult),n.cacheTokens(),t.onSuccess(n.signInUserSession))})},e.prototype.sendMFACode=function(e,t,n){var i=this,s={};s.USERNAME=this.username,s.SMS_MFA_CODE=e;var r=n||"SMS_MFA";"SOFTWARE_TOKEN_MFA"===r&&(s.SOFTWARE_TOKEN_MFA_CODE=e),null!=this.deviceKey&&(s.DEVICE_KEY=this.deviceKey);var a={ChallengeName:r,ChallengeResponses:s,ClientId:this.pool.getClientId(),Session:this.Session};this.getUserContextData()&&(a.UserContextData=this.getUserContextData()),this.client.makeUnauthenticatedRequest("respondToAuthChallenge",a,function(e,n){if(e)return t.onFailure(e);var s=n.ChallengeName;if("DEVICE_SRP_AUTH"===s)return void i.getDeviceResponse(t);if(i.signInUserSession=i.getCognitoUserSession(n.AuthenticationResult),i.cacheTokens(),null==n.AuthenticationResult.NewDeviceMetadata)return t.onSuccess(i.signInUserSession);var r=new c.default(i.pool.getUserPoolId().split("_")[1]);r.generateHashDevice(n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,n.AuthenticationResult.NewDeviceMetadata.DeviceKey,function(e){if(e)return t.onFailure(e);var s={Salt:new o.util.Buffer(r.getSaltDevices(),"hex").toString("base64"),PasswordVerifier:new o.util.Buffer(r.getVerifierDevices(),"hex").toString("base64")};i.verifierDevices=s.PasswordVerifier,i.deviceGroupKey=n.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,i.randomPassword=r.getRandomPassword(),i.client.makeUnauthenticatedRequest("confirmDevice",{DeviceKey:n.AuthenticationResult.NewDeviceMetadata.DeviceKey,AccessToken:i.signInUserSession.getAccessToken().getJwtToken(),DeviceSecretVerifierConfig:s,DeviceName:navigator.userAgent},function(e,s){return e?t.onFailure(e):(i.deviceKey=n.AuthenticationResult.NewDeviceMetadata.DeviceKey,i.cacheDeviceKeyAndPassword(),s.UserConfirmationNecessary===!0?t.onSuccess(i.signInUserSession,s.UserConfirmationNecessary):t.onSuccess(i.signInUserSession))})})})},e.prototype.changePassword=function(e,t,n){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("changePassword",{PreviousPassword:e,ProposedPassword:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e){return e?n(e,null):n(null,"SUCCESS")}):n(new Error("User is not authenticated"),null)},e.prototype.enableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);var t=[],n={DeliveryMedium:"SMS",AttributeName:"phone_number"};t.push(n),this.client.makeUnauthenticatedRequest("setUserSettings",{MFAOptions:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t){return t?e(t,null):e(null,"SUCCESS")})},e.prototype.setUserMfaPreference=function(e,t,n){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("setUserMFAPreference",{SMSMfaSettings:e,SoftwareTokenMfaSettings:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e){return e?n(e,null):n(null,"SUCCESS")}):n(new Error("User is not authenticated"),null)},e.prototype.disableMFA=function(e){if(null==this.signInUserSession||!this.signInUserSession.isValid())return e(new Error("User is not authenticated"),null);var t=[];this.client.makeUnauthenticatedRequest("setUserSettings",{MFAOptions:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t){return t?e(t,null):e(null,"SUCCESS")})},e.prototype.deleteUser=function(e){var t=this;return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("deleteUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(n){return n?e(n,null):(t.clearCachedTokens(),e(null,"SUCCESS"))}):e(new Error("User is not authenticated"),null)},e.prototype.updateAttributes=function(e,t){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("updateUserAttributes",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserAttributes:e},function(e){return e?t(e,null):t(null,"SUCCESS")}):t(new Error("User is not authenticated"),null)},e.prototype.getUserAttributes=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("getUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t,n){if(t)return e(t,null);for(var i=[],s=0;s<n.UserAttributes.length;s++){var o={Name:n.UserAttributes[s].Name,Value:n.UserAttributes[s].Value},r=new U.default(o);i.push(r)}return e(null,i)}):e(new Error("User is not authenticated"),null)},e.prototype.getMFAOptions=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("getUser",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t,n){return t?e(t,null):e(null,n.MFAOptions)}):e(new Error("User is not authenticated"),null)},e.prototype.deleteAttributes=function(e,t){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("deleteUserAttributes",{UserAttributeNames:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e){return e?t(e,null):t(null,"SUCCESS")}):t(new Error("User is not authenticated"),null)},e.prototype.resendConfirmationCode=function(e){var t={ClientId:this.pool.getClientId(),Username:this.username};this.client.makeUnauthenticatedRequest("resendConfirmationCode",t,function(t,n){return t?e(t,null):e(null,n)})},e.prototype.getSession=function(e){if(null==this.username)return e(new Error("Username is null. Cannot retrieve a new session"),null);if(null!=this.signInUserSession&&this.signInUserSession.isValid())return e(null,this.signInUserSession);var t="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,n=t+".idToken",i=t+".accessToken",s=t+".refreshToken",o=t+".clockDrift";if(this.storage.getItem(n)){var r=new d.default({IdToken:this.storage.getItem(n)}),a=new h.default({AccessToken:this.storage.getItem(i)}),u=new g.default({RefreshToken:this.storage.getItem(s)}),c=parseInt(this.storage.getItem(o),0)||0,l={IdToken:r,AccessToken:a,RefreshToken:u,ClockDrift:c},f=new S.default(l);if(f.isValid())return this.signInUserSession=f,e(null,this.signInUserSession);if(null==u.getToken())return e(new Error("Cannot retrieve a new session. Please authenticate."),null);this.refreshSession(u,e)}else e(new Error("Local storage is missing an ID Token, Please authenticate"),null)},e.prototype.refreshSession=function(e,t){var n=this,i={};i.REFRESH_TOKEN=e.getToken();var s="CognitoIdentityServiceProvider."+this.pool.getClientId(),o=s+".LastAuthUser";if(this.storage.getItem(o)){this.username=this.storage.getItem(o);var r=s+"."+this.username+".deviceKey";this.deviceKey=this.storage.getItem(r),i.DEVICE_KEY=this.deviceKey}var a={ClientId:this.pool.getClientId(),AuthFlow:"REFRESH_TOKEN_AUTH",AuthParameters:i};this.getUserContextData()&&(a.UserContextData=this.getUserContextData()),this.client.makeUnauthenticatedRequest("initiateAuth",a,function(i,s){if(i)return"NotAuthorizedException"===i.code&&n.clearCachedTokens(),t(i,null);if(s){var o=s.AuthenticationResult;return Object.prototype.hasOwnProperty.call(o,"RefreshToken")||(o.RefreshToken=e.getToken()),n.signInUserSession=n.getCognitoUserSession(o),n.cacheTokens(),t(null,n.signInUserSession)}})},e.prototype.cacheTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",i=e+"."+this.username+".refreshToken",s=e+"."+this.username+".clockDrift",o=e+".LastAuthUser";this.storage.setItem(t,this.signInUserSession.getIdToken().getJwtToken()),this.storage.setItem(n,this.signInUserSession.getAccessToken().getJwtToken()),this.storage.setItem(i,this.signInUserSession.getRefreshToken().getToken()),this.storage.setItem(s,""+this.signInUserSession.getClockDrift()),this.storage.setItem(o,this.username)},e.prototype.cacheDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",i=e+".deviceGroupKey";this.storage.setItem(t,this.deviceKey),this.storage.setItem(n,this.randomPassword),this.storage.setItem(i,this.deviceGroupKey)},e.prototype.getCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",i=e+".deviceGroupKey";this.storage.getItem(t)&&(this.deviceKey=this.storage.getItem(t),this.randomPassword=this.storage.getItem(n),this.deviceGroupKey=this.storage.getItem(i))},e.prototype.clearCachedDeviceKeyAndPassword=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId()+"."+this.username,t=e+".deviceKey",n=e+".randomPasswordKey",i=e+".deviceGroupKey";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(i)},e.prototype.clearCachedTokens=function(){var e="CognitoIdentityServiceProvider."+this.pool.getClientId(),t=e+"."+this.username+".idToken",n=e+"."+this.username+".accessToken",i=e+"."+this.username+".refreshToken",s=e+".LastAuthUser";this.storage.removeItem(t),this.storage.removeItem(n),this.storage.removeItem(i),this.storage.removeItem(s)},e.prototype.getCognitoUserSession=function(e){var t=new d.default(e),n=new h.default(e),i=new g.default(e),s={IdToken:t,AccessToken:n,RefreshToken:i};return new S.default(s)},e.prototype.forgotPassword=function(e){var t={ClientId:this.pool.getClientId(),Username:this.username};this.getUserContextData()&&(t.UserContextData=this.getUserContextData()),this.client.makeUnauthenticatedRequest("forgotPassword",t,function(t,n){return t?e.onFailure(t):"function"==typeof e.inputVerificationCode?e.inputVerificationCode(n):e.onSuccess(n)})},e.prototype.confirmPassword=function(e,t,n){var i={ClientId:this.pool.getClientId(),Username:this.username,ConfirmationCode:e,Password:t};this.getUserContextData()&&(i.UserContextData=this.getUserContextData()),this.client.makeUnauthenticatedRequest("confirmForgotPassword",i,function(e){return e?n.onFailure(e):n.onSuccess()})},e.prototype.getAttributeVerificationCode=function(e,t){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("getUserAttributeVerificationCode",{AttributeName:e,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e,n){return e?t.onFailure(e):"function"==typeof t.inputVerificationCode?t.inputVerificationCode(n):t.onSuccess()}):t.onFailure(new Error("User is not authenticated"))},e.prototype.verifyAttribute=function(e,t,n){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("verifyUserAttribute",{AttributeName:e,Code:t,AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(e){return e?n.onFailure(e):n.onSuccess("SUCCESS")}):n.onFailure(new Error("User is not authenticated"))},e.prototype.getDevice=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("getDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey},function(t,n){return t?e.onFailure(t):e.onSuccess(n)}):e.onFailure(new Error("User is not authenticated"))},e.prototype.forgetSpecificDevice=function(e,t){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("forgetDevice",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:e},function(e){return e?t.onFailure(e):t.onSuccess("SUCCESS")}):t.onFailure(new Error("User is not authenticated"))},e.prototype.forgetDevice=function(e){var t=this;this.forgetSpecificDevice(this.deviceKey,{onFailure:e.onFailure,onSuccess:function(n){return t.deviceKey=null,t.deviceGroupKey=null,t.randomPassword=null,t.clearCachedDeviceKeyAndPassword(),e.onSuccess(n)}})},e.prototype.setDeviceStatusRemembered=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("updateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"remembered"},function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}):e.onFailure(new Error("User is not authenticated"))},e.prototype.setDeviceStatusNotRemembered=function(e){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("updateDeviceStatus",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),DeviceKey:this.deviceKey,DeviceRememberedStatus:"not_remembered"},function(t){return t?e.onFailure(t):e.onSuccess("SUCCESS")}):e.onFailure(new Error("User is not authenticated"))},e.prototype.listDevices=function(e,t,n){return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("listDevices",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),Limit:e,PaginationToken:t},function(e,t){return e?n.onFailure(e):n.onSuccess(t)}):n.onFailure(new Error("User is not authenticated"))},e.prototype.globalSignOut=function(e){var t=this;return null!=this.signInUserSession&&this.signInUserSession.isValid()?void this.client.makeUnauthenticatedRequest("globalSignOut",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(n){return n?e.onFailure(n):(t.clearCachedTokens(),e.onSuccess("SUCCESS"))}):e.onFailure(new Error("User is not authenticated"))},e.prototype.signOut=function(){this.signInUserSession=null,this.clearCachedTokens()},e.prototype.sendMFASelectionAnswer=function(e,t){var n=this,i={};i.USERNAME=this.username,i.ANSWER=e;var s={ChallengeName:"SELECT_MFA_TYPE",ChallengeResponses:i,ClientId:this.pool.getClientId(),Session:this.Session};this.getUserContextData()&&(s.UserContextData=this.getUserContextData()),this.client.makeUnauthenticatedRequest("respondToAuthChallenge",s,function(i,s){return i?t.onFailure(i):(n.Session=s.Session,"SMS_MFA"===e?t.mfaRequired(s.challengeName,s.challengeParameters):"SOFTWARE_TOKEN_MFA"===e?t.totpRequired(s.challengeName,s.challengeParameters):void 0)})},e.prototype.getUserContextData=function(){var e=this.pool;return e.getUserContextData(this.username)},e.prototype.associateSoftwareToken=function(e){var t=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.makeUnauthenticatedRequest("associateSoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken()},function(t,n){return t?e.onFailure(t):e.associateSecretCode(n.SecretCode)}):this.client.makeUnauthenticatedRequest("associateSoftwareToken",{Session:this.Session},function(n,i){return n?e.onFailure(n):(t.Session=i.Session,e.associateSecretCode(i.SecretCode))})},e.prototype.verifySoftwareToken=function(e,t,n){var i=this;null!=this.signInUserSession&&this.signInUserSession.isValid()?this.client.makeUnauthenticatedRequest("verifySoftwareToken",{AccessToken:this.signInUserSession.getAccessToken().getJwtToken(),UserCode:e,FriendlyDeviceName:t},function(e,t){if(e)return n.onFailure(e);i.Session=t.Session;var s={};s.USERNAME=i.username;var o={ChallengeName:"MFA_SETUP",ClientId:i.pool.getClientId(),ChallengeResponses:s,Session:i.Session};i.getUserContextData()&&(o.UserContextData=i.getUserContextData()),i.client.makeUnauthenticatedRequest("respondToAuthChallenge",o,function(e,t){return e?n.onFailure(e):(i.signInUserSession=i.getCognitoUserSession(t.AuthenticationResult),i.cacheTokens(),n.onSuccess(i.signInUserSession))})}):this.client.makeUnauthenticatedRequest("verifySoftwareToken",{Session:this.Session,UserCode:e,FriendlyDeviceName:t},function(e,t){if(e)return n.onFailure(e);i.Session=t.Session;var s={};s.USERNAME=i.username;var o={ChallengeName:"MFA_SETUP",ClientId:i.pool.getClientId(),ChallengeResponses:s,Session:i.Session};i.getUserContextData()&&(o.UserContextData=i.getUserContextData()),i.client.makeUnauthenticatedRequest("respondToAuthChallenge",o,function(e,t){return e?n.onFailure(e):(i.signInUserSession=i.getCognitoUserSession(t.AuthenticationResult),i.cacheTokens(),n.onSuccess(i.signInUserSession))})})},e}();t.default=T},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;/*!
* Copyright 2016 Amazon.com,

@@ -115,3 +115,3 @@ * Inc. or its affiliates. All Rights Reserved.

*/
var i=function(){function e(t){n(this,e);var i=t||{},s=i.ValidationData,o=i.Username,r=i.Password,a=i.AuthParameters;this.validationData=s||[],this.authParameters=a||[],this.username=o,this.password=r}return e.prototype.getUsername=function(){return this.username},e.prototype.getPassword=function(){return this.password},e.prototype.getValidationData=function(){return this.validationData},e.prototype.getAuthParameters=function(){return this.authParameters},e}();t.default=i},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=n(13),r=i(o),a=n(8),u=i(a),c=n(12),l=i(c),h=function(){function e(t){s(this,e);var n=t||{},i=n.UserPoolId,o=n.ClientId,a=n.endpoint,u=n.AdvancedSecurityDataCollectionFlag;if(!i||!o)throw new Error("Both UserPoolId and ClientId are required.");if(!/^[\w-]+_.+$/.test(i))throw new Error("Invalid UserPoolId format.");var c=i.split("_")[0];this.userPoolId=i,this.clientId=o,this.client=new r.default({apiVersion:"2016-04-19",region:c,endpoint:a}),this.advancedSecurityDataCollectionFlag=!0,u&&(this.advancedSecurityDataCollectionFlag=u),this.storage=t.Storage||(new l.default).getStorage()}return e.prototype.getUserPoolId=function(){return this.userPoolId},e.prototype.getClientId=function(){return this.clientId},e.prototype.signUp=function(e,t,n,i,s){var o=this;this.client.makeUnauthenticatedRequest("signUp",{ClientId:this.clientId,Username:e,Password:t,UserAttributes:n,ValidationData:i,UserContextData:this.getUserContextData(e)},function(t,n){if(t)return s(t,null);var i={Username:e,Pool:o,Storage:o.storage},r={user:new u.default(i),userConfirmed:n.UserConfirmed,userSub:n.UserSub};return s(null,r)})},e.prototype.getCurrentUser=function(){var e="CognitoIdentityServiceProvider."+this.clientId+".LastAuthUser",t=this.storage.getItem(e);if(t){var n={Username:t,Pool:this,Storage:this.storage};return new u.default(n)}return null},e.prototype.getUserContextData=function(e){if("undefined"==typeof AmazonCognitoAdvancedSecurityData)return{};var t=AmazonCognitoAdvancedSecurityData;if(this.advancedSecurityDataCollectionFlag){var n=t.getData(e,this.userPoolId,this.clientId);if(n){var i={EncodedData:n};return i}}return{}},e}();t.default=h},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=n(18),r=i(o),a=function(){function e(t){s(this,e),this.domain=t.domain,t.path?this.path=t.path:this.path="/",Object.prototype.hasOwnProperty.call(t,"expires")?this.expires=t.expires:this.expires=365,Object.prototype.hasOwnProperty.call(t,"secure")?this.secure=t.secure:this.secure=!0}return e.prototype.setItem=function(e,t){return r.set(e,t,{path:this.path,expires:this.expires,domain:this.domain}),r.get(e)},e.prototype.getItem=function(e){return r.get(e)},e.prototype.removeItem=function(e){return r.remove(e,{path:this.path,domain:this.domain,secure:this.secure})},e.prototype.clear=function(){var e=r.get(),t=void 0;for(t=0;t<e.length;++t)r.remove(e[t]);return{}},e}();t.default=a},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var s=n(14);Object.defineProperty(t,"AuthenticationDetails",{enumerable:!0,get:function(){return i(s).default}});var o=n(2);Object.defineProperty(t,"AuthenticationHelper",{enumerable:!0,get:function(){return i(o).default}});var r=n(4);Object.defineProperty(t,"CognitoAccessToken",{enumerable:!0,get:function(){return i(r).default}});var a=n(5);Object.defineProperty(t,"CognitoIdToken",{enumerable:!0,get:function(){return i(a).default}});var u=n(7);Object.defineProperty(t,"CognitoRefreshToken",{enumerable:!0,get:function(){return i(u).default}});var c=n(8);Object.defineProperty(t,"CognitoUser",{enumerable:!0,get:function(){return i(c).default}});var l=n(9);Object.defineProperty(t,"CognitoUserAttribute",{enumerable:!0,get:function(){return i(l).default}});var h=n(15);Object.defineProperty(t,"CognitoUserPool",{enumerable:!0,get:function(){return i(h).default}});var f=n(10);Object.defineProperty(t,"CognitoUserSession",{enumerable:!0,get:function(){return i(f).default}});var d=n(16);Object.defineProperty(t,"CookieStorage",{enumerable:!0,get:function(){return i(d).default}});var p=n(11);Object.defineProperty(t,"DateHelper",{enumerable:!0,get:function(){return i(p).default}}),"undefined"!=typeof window&&!window.crypto&&window.msCrypto&&(window.crypto=window.msCrypto)},function(e,t,n){var i,s;!function(o){var r=!1;if(i=o,s="function"==typeof i?i.call(t,n,t,e):i,!(void 0!==s&&(e.exports=s)),r=!0,e.exports=o(),r=!0,!r){var a=window.Cookies,u=window.Cookies=o();u.noConflict=function(){return window.Cookies=a,u}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var i in n)t[i]=n[i]}return t}function t(n){function i(t,s,o){var r;if("undefined"!=typeof document){if(arguments.length>1){if(o=e({path:"/"},i.defaults,o),"number"==typeof o.expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*o.expires),o.expires=a}o.expires=o.expires?o.expires.toUTCString():"";try{r=JSON.stringify(s),/^[\{\[]/.test(r)&&(s=r)}catch(e){}s=n.write?n.write(s,t):encodeURIComponent(String(s)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)),t=t.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),t=t.replace(/[\(\)]/g,escape);var u="";for(var c in o)o[c]&&(u+="; "+c,o[c]!==!0&&(u+="="+o[c]));return document.cookie=t+"="+s+u}t||(r={});for(var l=document.cookie?document.cookie.split("; "):[],h=/(%[0-9A-Z]{2})+/g,f=0;f<l.length;f++){var d=l[f].split("="),p=d.slice(1).join("=");this.json||'"'!==p.charAt(0)||(p=p.slice(1,-1));try{var g=d[0].replace(h,decodeURIComponent);if(p=n.read?n.read(p,g):n(p,g)||p.replace(h,decodeURIComponent),this.json)try{p=JSON.parse(p)}catch(e){}if(t===g){r=p;break}t||(r[g]=p)}catch(e){}}return r}}return i.set=i,i.get=function(e){return i.call(i,e)},i.getJSON=function(){return i.apply({json:!0},[].slice.call(arguments))},i.defaults={},i.remove=function(t,n){i(t,"",e(n,{expires:-1}))},i.withConverter=t,i}return t(function(){})})}])});
var i=function(){function e(t){n(this,e);var i=t||{},s=i.ValidationData,o=i.Username,r=i.Password,a=i.AuthParameters;this.validationData=s||[],this.authParameters=a||[],this.username=o,this.password=r}return e.prototype.getUsername=function(){return this.username},e.prototype.getPassword=function(){return this.password},e.prototype.getValidationData=function(){return this.validationData},e.prototype.getAuthParameters=function(){return this.authParameters},e}();t.default=i},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=n(13),r=i(o),a=n(8),u=i(a),c=n(12),l=i(c),h=function(){function e(t){s(this,e);var n=t||{},i=n.UserPoolId,o=n.ClientId,a=n.endpoint,u=n.AdvancedSecurityDataCollectionFlag;if(!i||!o)throw new Error("Both UserPoolId and ClientId are required.");if(!/^[\w-]+_.+$/.test(i))throw new Error("Invalid UserPoolId format.");var c=i.split("_")[0];this.userPoolId=i,this.clientId=o,this.client=new r.default({apiVersion:"2016-04-19",region:c,endpoint:a}),this.advancedSecurityDataCollectionFlag=!0,u&&(this.advancedSecurityDataCollectionFlag=u),this.storage=t.Storage||(new l.default).getStorage()}return e.prototype.getUserPoolId=function(){return this.userPoolId},e.prototype.getClientId=function(){return this.clientId},e.prototype.signUp=function(e,t,n,i,s){var o=this,r={ClientId:this.clientId,Username:e,Password:t,UserAttributes:n,ValidationData:i};this.getUserContextData(e)&&(r.UserContextData=this.getUserContextData(e)),this.client.makeUnauthenticatedRequest("signUp",r,function(t,n){if(t)return s(t,null);var i={Username:e,Pool:o,Storage:o.storage},r={user:new u.default(i),userConfirmed:n.UserConfirmed,userSub:n.UserSub};return s(null,r)})},e.prototype.getCurrentUser=function(){var e="CognitoIdentityServiceProvider."+this.clientId+".LastAuthUser",t=this.storage.getItem(e);if(t){var n={Username:t,Pool:this,Storage:this.storage};return new u.default(n)}return null},e.prototype.getUserContextData=function(e){if("undefined"!=typeof AmazonCognitoAdvancedSecurityData){var t=AmazonCognitoAdvancedSecurityData;if(this.advancedSecurityDataCollectionFlag){var n=t.getData(e,this.userPoolId,this.clientId);if(n){var i={EncodedData:n};return i}}return{}}},e}();t.default=h},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=n(18),r=i(o),a=function(){function e(t){s(this,e),this.domain=t.domain,t.path?this.path=t.path:this.path="/",Object.prototype.hasOwnProperty.call(t,"expires")?this.expires=t.expires:this.expires=365,Object.prototype.hasOwnProperty.call(t,"secure")?this.secure=t.secure:this.secure=!0}return e.prototype.setItem=function(e,t){return r.set(e,t,{path:this.path,expires:this.expires,domain:this.domain}),r.get(e)},e.prototype.getItem=function(e){return r.get(e)},e.prototype.removeItem=function(e){return r.remove(e,{path:this.path,domain:this.domain,secure:this.secure})},e.prototype.clear=function(){var e=r.get(),t=void 0;for(t=0;t<e.length;++t)r.remove(e[t]);return{}},e}();t.default=a},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var s=n(14);Object.defineProperty(t,"AuthenticationDetails",{enumerable:!0,get:function(){return i(s).default}});var o=n(2);Object.defineProperty(t,"AuthenticationHelper",{enumerable:!0,get:function(){return i(o).default}});var r=n(4);Object.defineProperty(t,"CognitoAccessToken",{enumerable:!0,get:function(){return i(r).default}});var a=n(5);Object.defineProperty(t,"CognitoIdToken",{enumerable:!0,get:function(){return i(a).default}});var u=n(7);Object.defineProperty(t,"CognitoRefreshToken",{enumerable:!0,get:function(){return i(u).default}});var c=n(8);Object.defineProperty(t,"CognitoUser",{enumerable:!0,get:function(){return i(c).default}});var l=n(9);Object.defineProperty(t,"CognitoUserAttribute",{enumerable:!0,get:function(){return i(l).default}});var h=n(15);Object.defineProperty(t,"CognitoUserPool",{enumerable:!0,get:function(){return i(h).default}});var f=n(10);Object.defineProperty(t,"CognitoUserSession",{enumerable:!0,get:function(){return i(f).default}});var d=n(16);Object.defineProperty(t,"CookieStorage",{enumerable:!0,get:function(){return i(d).default}});var p=n(11);Object.defineProperty(t,"DateHelper",{enumerable:!0,get:function(){return i(p).default}}),"undefined"!=typeof window&&!window.crypto&&window.msCrypto&&(window.crypto=window.msCrypto)},function(e,t,n){var i,s;!function(o){var r=!1;if(i=o,s="function"==typeof i?i.call(t,n,t,e):i,!(void 0!==s&&(e.exports=s)),r=!0,e.exports=o(),r=!0,!r){var a=window.Cookies,u=window.Cookies=o();u.noConflict=function(){return window.Cookies=a,u}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var i in n)t[i]=n[i]}return t}function t(n){function i(t,s,o){var r;if("undefined"!=typeof document){if(arguments.length>1){if(o=e({path:"/"},i.defaults,o),"number"==typeof o.expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*o.expires),o.expires=a}o.expires=o.expires?o.expires.toUTCString():"";try{r=JSON.stringify(s),/^[\{\[]/.test(r)&&(s=r)}catch(e){}s=n.write?n.write(s,t):encodeURIComponent(String(s)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)),t=t.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),t=t.replace(/[\(\)]/g,escape);var u="";for(var c in o)o[c]&&(u+="; "+c,o[c]!==!0&&(u+="="+o[c]));return document.cookie=t+"="+s+u}t||(r={});for(var l=document.cookie?document.cookie.split("; "):[],h=/(%[0-9A-Z]{2})+/g,f=0;f<l.length;f++){var d=l[f].split("="),p=d.slice(1).join("=");this.json||'"'!==p.charAt(0)||(p=p.slice(1,-1));try{var g=d[0].replace(h,decodeURIComponent);if(p=n.read?n.read(p,g):n(p,g)||p.replace(h,decodeURIComponent),this.json)try{p=JSON.parse(p)}catch(e){}if(t===g){r=p;break}t||(r[g]=p)}catch(e){}}return r}}return i.set=i,i.get=function(e){return i.call(i,e)},i.getJSON=function(){return i.apply({json:!0},[].slice.call(arguments))},i.defaults={},i.remove=function(t,n){i(t,"",e(n,{expires:-1}))},i.withConverter=t,i}return t(function(){})})}])});
//# sourceMappingURL=amazon-cognito-identity.min.js.map

@@ -169,9 +169,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

this.client.makeUnauthenticatedRequest('initiateAuth', {
var jsonReq = {
AuthFlow: 'CUSTOM_AUTH',
ClientId: this.pool.getClientId(),
AuthParameters: authParameters,
ClientMetadata: authDetails.getValidationData(),
UserContextData: this.getUserContextData()
}, function (err, data) {
ClientMetadata: authDetails.getValidationData()
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, function (err, data) {
if (err) {

@@ -237,9 +241,13 @@ return callback.onFailure(err);

_this2.client.makeUnauthenticatedRequest('initiateAuth', {
var jsonReq = {
AuthFlow: _this2.authenticationFlowType,
ClientId: _this2.pool.getClientId(),
AuthParameters: authParameters,
ClientMetadata: authDetails.getValidationData(),
UserContextData: _this2.getUserContextData()
}, function (err, data) {
ClientMetadata: authDetails.getValidationData()
};
if (_this2.getUserContextData(_this2.username)) {
jsonReq.UserContextData = _this2.getUserContextData(_this2.username);
}
_this2.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, function (err, data) {
if (err) {

@@ -291,9 +299,12 @@ return callback.onFailure(err);

respondToAuthChallenge({
var jsonReqResp = {
ChallengeName: 'PASSWORD_VERIFIER',
ClientId: _this2.pool.getClientId(),
ChallengeResponses: challengeResponses,
Session: data.Session,
UserContextData: _this2.getUserContextData()
}, function (errAuthenticate, dataAuthenticate) {
Session: data.Session
};
if (_this2.getUserContextData()) {
jsonReqResp.UserContextData = _this2.getUserContextData();
}
respondToAuthChallenge(jsonReqResp, function (errAuthenticate, dataAuthenticate) {
if (errAuthenticate) {

@@ -458,9 +469,13 @@ return callback.onFailure(errAuthenticate);

finalUserAttributes.USERNAME = this.username;
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
var jsonReq = {
ChallengeName: 'NEW_PASSWORD_REQUIRED',
ClientId: this.pool.getClientId(),
ChallengeResponses: finalUserAttributes,
Session: this.Session,
UserContextData: this.getUserContextData()
}, function (errAuthenticate, dataAuthenticate) {
Session: this.Session
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (errAuthenticate, dataAuthenticate) {
if (errAuthenticate) {

@@ -504,8 +519,11 @@ return callback.onFailure(errAuthenticate);

_this5.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
var jsonReq = {
ChallengeName: 'DEVICE_SRP_AUTH',
ClientId: _this5.pool.getClientId(),
ChallengeResponses: authParameters,
UserContextData: _this5.getUserContextData()
}, function (err, data) {
ChallengeResponses: authParameters
};
if (_this5.getUserContextData()) {
jsonReq.UserContextData = _this5.getUserContextData();
}
_this5.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, data) {
if (err) {

@@ -538,9 +556,13 @@ return callback.onFailure(err);

_this5.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
var jsonReqResp = {
ChallengeName: 'DEVICE_PASSWORD_VERIFIER',
ClientId: _this5.pool.getClientId(),
ChallengeResponses: challengeResponses,
Session: data.Session,
UserContextData: _this5.getUserContextData()
}, function (errAuthenticate, dataAuthenticate) {
Session: data.Session
};
if (_this5.getUserContextData()) {
jsonReqResp.UserContextData = _this5.getUserContextData();
}
_this5.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReqResp, function (errAuthenticate, dataAuthenticate) {
if (errAuthenticate) {

@@ -574,9 +596,12 @@ return callback.onFailure(errAuthenticate);

CognitoUser.prototype.confirmRegistration = function confirmRegistration(confirmationCode, forceAliasCreation, callback) {
this.client.makeUnauthenticatedRequest('confirmSignUp', {
var jsonReq = {
ClientId: this.pool.getClientId(),
ConfirmationCode: confirmationCode,
Username: this.username,
ForceAliasCreation: forceAliasCreation,
UserContextData: this.getUserContextData()
}, function (err) {
ForceAliasCreation: forceAliasCreation
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('confirmSignUp', jsonReq, function (err) {
if (err) {

@@ -607,10 +632,12 @@ return callback(err, null);

challengeResponses.ANSWER = answerChallenge;
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
var jsonReq = {
ChallengeName: 'CUSTOM_CHALLENGE',
ChallengeResponses: challengeResponses,
ClientId: this.pool.getClientId(),
Session: this.Session,
UserContextData: this.getUserContextData()
}, function (err, data) {
Session: this.Session
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, data) {
if (err) {

@@ -659,9 +686,13 @@ return callback.onFailure(err);

this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
var jsonReq = {
ChallengeName: mfaTypeSelection,
ChallengeResponses: challengeResponses,
ClientId: this.pool.getClientId(),
Session: this.Session,
UserContextData: this.getUserContextData()
}, function (err, dataAuthenticate) {
Session: this.Session
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, dataAuthenticate) {
if (err) {

@@ -980,7 +1011,8 @@ return callback.onFailure(err);

CognitoUser.prototype.resendConfirmationCode = function resendConfirmationCode(callback) {
this.client.makeUnauthenticatedRequest('resendConfirmationCode', {
var jsonReq = {
ClientId: this.pool.getClientId(),
Username: this.username,
UserContextData: this.getUserContextData()
}, function (err, result) {
Username: this.username
};
this.client.makeUnauthenticatedRequest('resendConfirmationCode', jsonReq, function (err, result) {
if (err) {

@@ -1076,8 +1108,11 @@ return callback(err, null);

this.client.makeUnauthenticatedRequest('initiateAuth', {
var jsonReq = {
ClientId: this.pool.getClientId(),
AuthFlow: 'REFRESH_TOKEN_AUTH',
AuthParameters: authParameters,
UserContextData: this.getUserContextData()
}, function (err, authResult) {
AuthParameters: authParameters
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, function (err, authResult) {
if (err) {

@@ -1229,7 +1264,10 @@ if (err.code === 'NotAuthorizedException') {

CognitoUser.prototype.forgotPassword = function forgotPassword(callback) {
this.client.makeUnauthenticatedRequest('forgotPassword', {
var jsonReq = {
ClientId: this.pool.getClientId(),
Username: this.username,
UserContextData: this.getUserContextData()
}, function (err, data) {
Username: this.username
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('forgotPassword', jsonReq, function (err, data) {
if (err) {

@@ -1257,9 +1295,12 @@ return callback.onFailure(err);

CognitoUser.prototype.confirmPassword = function confirmPassword(confirmationCode, newPassword, callback) {
this.client.makeUnauthenticatedRequest('confirmForgotPassword', {
var jsonReq = {
ClientId: this.pool.getClientId(),
Username: this.username,
ConfirmationCode: confirmationCode,
Password: newPassword,
UserContextData: this.getUserContextData()
}, function (err) {
Password: newPassword
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('confirmForgotPassword', jsonReq, function (err) {
if (err) {

@@ -1546,9 +1587,12 @@ return callback.onFailure(err);

this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
var jsonReq = {
ChallengeName: 'SELECT_MFA_TYPE',
ChallengeResponses: challengeResponses,
ClientId: this.pool.getClientId(),
Session: this.Session,
UserContextData: this.getUserContextData()
}, function (err, data) {
Session: this.Session
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (err, data) {
if (err) {

@@ -1635,10 +1679,12 @@ return callback.onFailure(err);

challengeResponses.USERNAME = _this14.username;
_this14.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
var jsonReq = {
ChallengeName: 'MFA_SETUP',
ClientId: _this14.pool.getClientId(),
ChallengeResponses: challengeResponses,
Session: _this14.Session,
UserContextData: _this14.getUserContextData()
}, function (errRespond, dataRespond) {
Session: _this14.Session
};
if (_this14.getUserContextData()) {
jsonReq.UserContextData = _this14.getUserContextData();
}
_this14.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (errRespond, dataRespond) {
if (errRespond) {

@@ -1665,10 +1711,12 @@ return callback.onFailure(errRespond);

challengeResponses.USERNAME = _this14.username;
_this14.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
var jsonReq = {
ChallengeName: 'MFA_SETUP',
ClientId: _this14.pool.getClientId(),
ChallengeResponses: challengeResponses,
Session: _this14.Session,
UserContextData: _this14.getUserContextData()
}, function (errRespond, dataRespond) {
Session: _this14.Session
};
if (_this14.getUserContextData()) {
jsonReq.UserContextData = _this14.getUserContextData();
}
_this14.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, function (errRespond, dataRespond) {
if (errRespond) {

@@ -1675,0 +1723,0 @@ return callback.onFailure(errRespond);

@@ -113,3 +113,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

this.client.makeUnauthenticatedRequest('signUp', {
var jsonReq = {
ClientId: this.clientId,

@@ -119,5 +119,8 @@ Username: username,

UserAttributes: userAttributes,
ValidationData: validationData,
UserContextData: this.getUserContextData(username)
}, function (err, data) {
ValidationData: validationData
};
if (this.getUserContextData(username)) {
jsonReq.UserContextData = this.getUserContextData(username);
}
this.client.makeUnauthenticatedRequest('signUp', jsonReq, function (err, data) {
if (err) {

@@ -179,3 +182,3 @@ return callback(err, null);

if (typeof AmazonCognitoAdvancedSecurityData === 'undefined') {
return {};
return undefined;
}

@@ -182,0 +185,0 @@ /* eslint-disable */

@@ -123,3 +123,3 @@ 'use strict';

this.client.makeUnauthenticatedRequest('signUp', {
var jsonReq = {
ClientId: this.clientId,

@@ -129,5 +129,8 @@ Username: username,

UserAttributes: userAttributes,
ValidationData: validationData,
UserContextData: this.getUserContextData(username)
}, function (err, data) {
ValidationData: validationData
};
if (this.getUserContextData(username)) {
jsonReq.UserContextData = this.getUserContextData(username);
}
this.client.makeUnauthenticatedRequest('signUp', jsonReq, function (err, data) {
if (err) {

@@ -189,3 +192,3 @@ return callback(err, null);

if (typeof AmazonCognitoAdvancedSecurityData === 'undefined') {
return {};
return undefined;
}

@@ -192,0 +195,0 @@ /* eslint-disable */

{
"name": "amazon-cognito-identity-js",
"description": "Amazon Cognito Identity Provider JavaScript SDK",
"version": "1.27.0",
"version": "1.28.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Amazon Web Services",

@@ -825,2 +825,6 @@ # Amazon Cognito Identity SDK for JavaScript

**v1.28.0:**
* What has changed
* Not sending UserContextData if it is not available.
**v1.27.0:**

@@ -827,0 +831,0 @@ * What has changed

@@ -152,3 +152,3 @@ /*!

this.client.makeUnauthenticatedRequest('initiateAuth', {
const jsonReq = {
AuthFlow: 'CUSTOM_AUTH',

@@ -158,4 +158,8 @@ ClientId: this.pool.getClientId(),

ClientMetadata: authDetails.getValidationData(),
UserContextData: this.getUserContextData(),
}, (err, data) => {
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, (err, data) => {
if (err) {

@@ -218,3 +222,3 @@ return callback.onFailure(err);

this.client.makeUnauthenticatedRequest('initiateAuth', {
const jsonReq = {
AuthFlow: this.authenticationFlowType,

@@ -224,4 +228,8 @@ ClientId: this.pool.getClientId(),

ClientMetadata: authDetails.getValidationData(),
UserContextData: this.getUserContextData(),
}, (err, data) => {
};
if (this.getUserContextData(this.username)) {
jsonReq.UserContextData = this.getUserContextData(this.username);
}
this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, (err, data) => {
if (err) {

@@ -284,3 +292,3 @@ return callback.onFailure(err);

respondToAuthChallenge({
const jsonReqResp = {
ChallengeName: 'PASSWORD_VERIFIER',

@@ -290,4 +298,7 @@ ClientId: this.pool.getClientId(),

Session: data.Session,
UserContextData: this.getUserContextData(),
}, (errAuthenticate, dataAuthenticate) => {
};
if (this.getUserContextData()) {
jsonReqResp.UserContextData = this.getUserContextData();
}
respondToAuthChallenge(jsonReqResp, (errAuthenticate, dataAuthenticate) => {
if (errAuthenticate) {

@@ -463,3 +474,3 @@ return callback.onFailure(errAuthenticate);

finalUserAttributes.USERNAME = this.username;
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
const jsonReq = {
ChallengeName: 'NEW_PASSWORD_REQUIRED',

@@ -469,9 +480,14 @@ ClientId: this.pool.getClientId(),

Session: this.Session,
UserContextData: this.getUserContextData(),
}, (errAuthenticate, dataAuthenticate) => {
if (errAuthenticate) {
return callback.onFailure(errAuthenticate);
}
return this.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);
});
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge',
jsonReq, (errAuthenticate, dataAuthenticate) => {
if (errAuthenticate) {
return callback.onFailure(errAuthenticate);
}
return this.authenticateUserInternal(dataAuthenticate, authenticationHelper, callback);
});
return undefined;

@@ -507,8 +523,11 @@ }

this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
const jsonReq = {
ChallengeName: 'DEVICE_SRP_AUTH',
ClientId: this.pool.getClientId(),
ChallengeResponses: authParameters,
UserContextData: this.getUserContextData(),
}, (err, data) => {
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, (err, data) => {
if (err) {

@@ -551,3 +570,3 @@ return callback.onFailure(err);

this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
const jsonReqResp = {
ChallengeName: 'DEVICE_PASSWORD_VERIFIER',

@@ -557,15 +576,20 @@ ClientId: this.pool.getClientId(),

Session: data.Session,
UserContextData: this.getUserContextData(),
}, (errAuthenticate, dataAuthenticate) => {
if (errAuthenticate) {
return callback.onFailure(errAuthenticate);
}
};
if (this.getUserContextData()) {
jsonReqResp.UserContextData = this.getUserContextData();
}
this.signInUserSession = this.getCognitoUserSession(
dataAuthenticate.AuthenticationResult
);
this.cacheTokens();
this.client.makeUnauthenticatedRequest('respondToAuthChallenge',
jsonReqResp, (errAuthenticate, dataAuthenticate) => {
if (errAuthenticate) {
return callback.onFailure(errAuthenticate);
}
return callback.onSuccess(this.signInUserSession);
});
this.signInUserSession = this.getCognitoUserSession(
dataAuthenticate.AuthenticationResult
);
this.cacheTokens();
return callback.onSuccess(this.signInUserSession);
});
return undefined;

@@ -588,3 +612,3 @@ // getPasswordAuthenticationKey callback end

confirmRegistration(confirmationCode, forceAliasCreation, callback) {
this.client.makeUnauthenticatedRequest('confirmSignUp', {
const jsonReq = {
ClientId: this.pool.getClientId(),

@@ -594,4 +618,7 @@ ConfirmationCode: confirmationCode,

ForceAliasCreation: forceAliasCreation,
UserContextData: this.getUserContextData(),
}, err => {
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('confirmSignUp', jsonReq, err => {
if (err) {

@@ -618,4 +645,3 @@ return callback(err, null);

challengeResponses.ANSWER = answerChallenge;
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
const jsonReq = {
ChallengeName: 'CUSTOM_CHALLENGE',

@@ -625,4 +651,7 @@ ChallengeResponses: challengeResponses,

Session: this.Session,
UserContextData: this.getUserContextData(),
}, (err, data) => {
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, (err, data) => {
if (err) {

@@ -667,3 +696,3 @@ return callback.onFailure(err);

this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
const jsonReq = {
ChallengeName: mfaTypeSelection,

@@ -673,69 +702,75 @@ ChallengeResponses: challengeResponses,

Session: this.Session,
UserContextData: this.getUserContextData(),
}, (err, dataAuthenticate) => {
if (err) {
return callback.onFailure(err);
}
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
const challengeName = dataAuthenticate.ChallengeName;
this.client.makeUnauthenticatedRequest('respondToAuthChallenge',
jsonReq, (err, dataAuthenticate) => {
if (err) {
return callback.onFailure(err);
}
if (challengeName === 'DEVICE_SRP_AUTH') {
this.getDeviceResponse(callback);
return undefined;
}
const challengeName = dataAuthenticate.ChallengeName;
this.signInUserSession = this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);
this.cacheTokens();
if (challengeName === 'DEVICE_SRP_AUTH') {
this.getDeviceResponse(callback);
return undefined;
}
if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {
return callback.onSuccess(this.signInUserSession);
}
this.signInUserSession =
this.getCognitoUserSession(dataAuthenticate.AuthenticationResult);
this.cacheTokens();
const authenticationHelper = new AuthenticationHelper(
this.pool.getUserPoolId().split('_')[1]);
authenticationHelper.generateHashDevice(
dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,
dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,
(errGenHash) => {
if (errGenHash) {
return callback.onFailure(errGenHash);
if (dataAuthenticate.AuthenticationResult.NewDeviceMetadata == null) {
return callback.onSuccess(this.signInUserSession);
}
const deviceSecretVerifierConfig = {
Salt: new util.Buffer(
authenticationHelper.getSaltDevices(), 'hex'
).toString('base64'),
PasswordVerifier: new util.Buffer(
authenticationHelper.getVerifierDevices(), 'hex'
).toString('base64'),
};
const authenticationHelper = new AuthenticationHelper(
this.pool.getUserPoolId().split('_')[1]);
authenticationHelper.generateHashDevice(
dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceGroupKey,
dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,
(errGenHash) => {
if (errGenHash) {
return callback.onFailure(errGenHash);
}
this.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;
this.deviceGroupKey = dataAuthenticate.AuthenticationResult
.NewDeviceMetadata.DeviceGroupKey;
this.randomPassword = authenticationHelper.getRandomPassword();
const deviceSecretVerifierConfig = {
Salt: new util.Buffer(
authenticationHelper.getSaltDevices(), 'hex'
).toString('base64'),
PasswordVerifier: new util.Buffer(
authenticationHelper.getVerifierDevices(), 'hex'
).toString('base64'),
};
this.client.makeUnauthenticatedRequest('confirmDevice', {
DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,
AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),
DeviceSecretVerifierConfig: deviceSecretVerifierConfig,
DeviceName: navigator.userAgent,
}, (errConfirm, dataConfirm) => {
if (errConfirm) {
return callback.onFailure(errConfirm);
}
this.verifierDevices = deviceSecretVerifierConfig.PasswordVerifier;
this.deviceGroupKey = dataAuthenticate.AuthenticationResult
.NewDeviceMetadata.DeviceGroupKey;
this.randomPassword = authenticationHelper.getRandomPassword();
this.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;
this.cacheDeviceKeyAndPassword();
if (dataConfirm.UserConfirmationNecessary === true) {
return callback.onSuccess(
this.signInUserSession,
dataConfirm.UserConfirmationNecessary);
}
return callback.onSuccess(this.signInUserSession);
});
this.client.makeUnauthenticatedRequest('confirmDevice', {
DeviceKey: dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey,
AccessToken: this.signInUserSession.getAccessToken().getJwtToken(),
DeviceSecretVerifierConfig: deviceSecretVerifierConfig,
DeviceName: navigator.userAgent,
}, (errConfirm, dataConfirm) => {
if (errConfirm) {
return callback.onFailure(errConfirm);
}
this.deviceKey = dataAuthenticate.AuthenticationResult.NewDeviceMetadata.DeviceKey;
this.cacheDeviceKeyAndPassword();
if (dataConfirm.UserConfirmationNecessary === true) {
return callback.onSuccess(
this.signInUserSession,
dataConfirm.UserConfirmationNecessary);
}
return callback.onSuccess(this.signInUserSession);
});
return undefined;
});
return undefined;
});
return undefined;
});
}

@@ -979,7 +1014,8 @@

resendConfirmationCode(callback) {
this.client.makeUnauthenticatedRequest('resendConfirmationCode', {
const jsonReq = {
ClientId: this.pool.getClientId(),
Username: this.username,
UserContextData: this.getUserContextData(),
}, (err, result) => {
};
this.client.makeUnauthenticatedRequest('resendConfirmationCode', jsonReq, (err, result) => {
if (err) {

@@ -1070,8 +1106,11 @@ return callback(err, null);

this.client.makeUnauthenticatedRequest('initiateAuth', {
const jsonReq = {
ClientId: this.pool.getClientId(),
AuthFlow: 'REFRESH_TOKEN_AUTH',
AuthParameters: authParameters,
UserContextData: this.getUserContextData(),
}, (err, authResult) => {
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('initiateAuth', jsonReq, (err, authResult) => {
if (err) {

@@ -1209,7 +1248,10 @@ if (err.code === 'NotAuthorizedException') {

forgotPassword(callback) {
this.client.makeUnauthenticatedRequest('forgotPassword', {
const jsonReq = {
ClientId: this.pool.getClientId(),
Username: this.username,
UserContextData: this.getUserContextData(),
}, (err, data) => {
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('forgotPassword', jsonReq, (err, data) => {
if (err) {

@@ -1235,3 +1277,3 @@ return callback.onFailure(err);

confirmPassword(confirmationCode, newPassword, callback) {
this.client.makeUnauthenticatedRequest('confirmForgotPassword', {
const jsonReq = {
ClientId: this.pool.getClientId(),

@@ -1241,4 +1283,7 @@ Username: this.username,

Password: newPassword,
UserContextData: this.getUserContextData(),
}, err => {
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('confirmForgotPassword', jsonReq, err => {
if (err) {

@@ -1497,3 +1542,3 @@ return callback.onFailure(err);

this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
const jsonReq = {
ChallengeName: 'SELECT_MFA_TYPE',

@@ -1503,4 +1548,7 @@ ChallengeResponses: challengeResponses,

Session: this.Session,
UserContextData: this.getUserContextData(),
}, (err, data) => {
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', jsonReq, (err, data) => {
if (err) {

@@ -1577,4 +1625,3 @@ return callback.onFailure(err);

challengeResponses.USERNAME = this.username;
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
const jsonReq = {
ChallengeName: 'MFA_SETUP',

@@ -1584,11 +1631,15 @@ ClientId: this.pool.getClientId(),

Session: this.Session,
UserContextData: this.getUserContextData(),
}, (errRespond, dataRespond) => {
if (errRespond) {
return callback.onFailure(errRespond);
}
this.signInUserSession = this.getCognitoUserSession(dataRespond.AuthenticationResult);
this.cacheTokens();
return callback.onSuccess(this.signInUserSession);
});
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge',
jsonReq, (errRespond, dataRespond) => {
if (errRespond) {
return callback.onFailure(errRespond);
}
this.signInUserSession = this.getCognitoUserSession(dataRespond.AuthenticationResult);
this.cacheTokens();
return callback.onSuccess(this.signInUserSession);
});
return undefined;

@@ -1608,4 +1659,3 @@ });

challengeResponses.USERNAME = this.username;
this.client.makeUnauthenticatedRequest('respondToAuthChallenge', {
const jsonReq = {
ChallengeName: 'MFA_SETUP',

@@ -1615,11 +1665,15 @@ ClientId: this.pool.getClientId(),

Session: this.Session,
UserContextData: this.getUserContextData(),
}, (errRespond, dataRespond) => {
if (errRespond) {
return callback.onFailure(errRespond);
}
this.signInUserSession = this.getCognitoUserSession(dataRespond.AuthenticationResult);
this.cacheTokens();
return callback.onSuccess(this.signInUserSession);
});
};
if (this.getUserContextData()) {
jsonReq.UserContextData = this.getUserContextData();
}
this.client.makeUnauthenticatedRequest('respondToAuthChallenge',
jsonReq, (errRespond, dataRespond) => {
if (errRespond) {
return callback.onFailure(errRespond);
}
this.signInUserSession = this.getCognitoUserSession(dataRespond.AuthenticationResult);
this.cacheTokens();
return callback.onSuccess(this.signInUserSession);
});
return undefined;

@@ -1626,0 +1680,0 @@ });

@@ -95,3 +95,3 @@ /*!

signUp(username, password, userAttributes, validationData, callback) {
this.client.makeUnauthenticatedRequest('signUp', {
const jsonReq = {
ClientId: this.clientId,

@@ -102,4 +102,7 @@ Username: username,

ValidationData: validationData,
UserContextData: this.getUserContextData(username),
}, (err, data) => {
};
if (this.getUserContextData(username)) {
jsonReq.UserContextData = this.getUserContextData(username);
}
this.client.makeUnauthenticatedRequest('signUp', jsonReq, (err, data) => {
if (err) {

@@ -158,3 +161,3 @@ return callback(err, null);

if (typeof AmazonCognitoAdvancedSecurityData === 'undefined') {
return {};
return undefined;
}

@@ -161,0 +164,0 @@ /* eslint-disable */

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc