diff --git a/dist/aws-sig.cjs.js b/dist/aws-sig.cjs.js index c8b187c..ebfb0d2 100644 --- a/dist/aws-sig.cjs.js +++ b/dist/aws-sig.cjs.js @@ -1,4 +1,4 @@ -/*! aws-sig@2.0.0 !*/ +/*! aws-sig@2.0.1 !*/ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/aws-sig.umd.js b/dist/aws-sig.umd.js index 5267231..0c01fe4 100644 --- a/dist/aws-sig.umd.js +++ b/dist/aws-sig.umd.js @@ -1,3 +1,3 @@ -/*! aws-sig@2.0.0 !*/ +/*! aws-sig@2.0.1 !*/ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["aws-sig"]={})}(this,(function(e){"use strict";var t=function(e){return e.toString().trim().replace(/\s+/g," ")},r=function(e){return e.map((function(e){return e[0]})).join(";")},n=function(e){var t=e.headers;return void 0===t&&(t={}),Object.keys(t).map((function(e){return[e.toLowerCase(),t[e]]})).sort((function(e,t){var r=e[0],n=t[0];return r.localeCompare(n)}))},i=function(e){var t=e.accessKeyId,r=e.date,n=e.region,i=e.service;return t+"/"+r.short+"/"+n+"/"+i+"/aws4_request"},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},a=s.lib={},u=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=a.WordArray=u.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(o=0;o>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=Math.ceil(t/4)},clone:function(){var e=u.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t,r=[],n=function(e){e=e;var t=987654321,r=4294967295;return function(){var n=((t=36969*(65535&t)+(t>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r;return n/=4294967296,(n+=.5)*(Math.random()>.5?1:-1)}},i=0;i>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=f.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},l=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},g=a.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,r=t.words,n=t.sigBytes,i=this.blockSize,o=n/(4*i),s=(o=e?Math.ceil(o):Math.max((0|o)-this._minBufferSize,0))*i,a=Math.min(4*s,n);if(s){for(var u=0;un&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),s=i.words,a=o.words,u=0;u>>7)^(d<<14|d>>>18)^d>>>3,g=b[h-2],p=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;b[h]=l+b[h-7]+p+b[h-16]}var v=n&i^n&o^i&o,y=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),m=f+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&c)+j[h]+b[h];f=c,c=u,u=a,a=s+m|0,s=o,o=i,i=n,n=m+(y+v)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+c|0,r[7]=r[7]+f|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=A.clone.call(this);return e._hash=this._hash.clone(),e}}),M=A._createHelper(H),x=A._createHmacHelper(H),C=function(e){return M(e).toString()},k=x,O=function(e){return encodeURIComponent(e).replace(/[*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))},T=function(e,t){return e.localeCompare(t)};function D(e){var t=e.url,r={},n=[];return t.searchParams.forEach((function(e,t){r[t]||(r[t]=[]),r[t].push(e)})),Object.keys(r).sort(T).forEach((function(e){r[e].sort(T).forEach((function(t){n.push(O(e)+"="+O(t))}))})),n.join("&")}var E=/\/\/+/g;function I(e,t){var r=e.algorithm,n=e.date,i=e.region,o=e.service;return[r,n.long,n.short+"/"+i+"/"+o+"/aws4_request",C(t)].join("\n")}var U=["url"],X=["accessKeyId","region","secretAccessKey","service"],q=/[:\-]|\.\d{3}/g,K=function(e){var t=e.headers,r=t["X-Amz-Date"],n=t.Date,i=r||new Date(n||Date.now()).toISOString().replace(q,"");return{short:i.split("T")[0],long:i}},P=function(e,i,o){var s=o.before,a=o.after;!function(e,t){if(!e)throw new Error("Missing request object");if(!t)throw new Error("Missing config object");var r=U.filter((function(t){return!e[t]}));if(r.length)throw new Error("Missing required request fields: "+r.join(", "));if((r=X.filter((function(e){return!t[e]}))).length)throw new Error("Missing required config fields: "+r.join(", "))}(e,i),e.headers||(e.headers={});var u=Object.assign(Object.create(null),{method:"GET"},e,i,{url:new URL(e.url),algorithm:"AWS4-HMAC-SHA256",date:K(e),sortedHeaders:n(e)}),c=function(e){var n,i,o,s,a=e.method,u=e.body,c=e.sortedHeaders;return[a.toUpperCase(),(i=e,o=i.service,s=i.url,"s3"===o?s.pathname:s.pathname.replace(E,"/").split("/").map(O).join("/")),D(e),(n=c,n.length?n.map((function(e){var r=e[0],n=e[1];return r+":"+(Array.isArray(n)?n.map(t).join(","):t(n))})).join("\n"):""),"",r(c),C("string"==typeof u?u.trim():u)].join("\n")}(u=s(u)),f=function(e,t){var r=e.date,n=e.secretAccessKey,i=e.region,o=e.service,s=k(r.short,"AWS4"+n),a=k(i,s),u=k(o,a),c=k("aws4_request",u);return k(t,c)}(u,I(u,c));return u.signed={canonical:c,stringToSign:I,signature:f},{url:(u=a(u)).url.toString(),headers:u.headers,method:u.method,body:u.body}},R=function(e){return e},W=function(e){var t=function(e){var t=e.algorithm,n=e.sortedHeaders,o=e.signed.signature;return[t+" Credential="+i(e),"SignedHeaders="+r(n),"Signature="+o].join(", ")}(e);return e.headers["X-Amz-Date"]=e.date.long,e.sessionToken&&(e.headers["X-Amz-Security-Token"]=e.sessionToken),e.headers.Authorization=t,e},F=function(e){var t=e.url;e.headers.host=t.host,e.sortedHeaders=n(e);var r=[["X-Amz-Algorithm",e.algorithm],["X-Amz-Credential",i(e)],["X-Amz-Date",e.date.long],!!e.sessionToken&&["X-Amz-Security-Token",e.sessionToken],["X-Amz-SignedHeaders",e.sortedHeaders.map((function(e){return e[0]})).join(",")]].filter(Boolean).map((function(e){var t=e[0],r=e[1];return t+"="+O(r)})).join("&");return t.search=t.search.length?t.search+"&"+r:r,e},L=function(e){var t=e.url,r=e.signed,n="X-Amz-Signature="+O(r.signature);return t.search=t.search+"&"+n,e.url=t.toString(),e};e.signedHeaders=function(e,t){return P(e,t,{before:R,after:W})},e.signedQuery=function(e,t){return P(e,t,{before:F,after:L})},Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=aws-sig.umd.js.map diff --git a/package-lock.json b/package-lock.json index 6310608..7006142 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "aws-sig", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 41ca03c..1035c65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aws-sig", - "version": "2.0.0", + "version": "2.0.1", "description": "AWS sigv4 signing, optimized for size", "author": "Pat Cavit ", "license": "MIT",