diff --git a/build/aws.js b/build/aws.js index 68e349d..c8d7268 100644 --- a/build/aws.js +++ b/build/aws.js @@ -1,2 +1,2 @@ -(()=>{var e={393:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;rc});var c=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"awsConfig",void 0),i(this,"serviceName",void 0),i(this,"_host",void 0),i(this,"_scheme",void 0),this.awsConfig=t,this.serviceName=r}var t,r,n;return t=e,(r=[{key:"host",get:function(){return null==this._host&&(this._host="".concat(this.serviceName,".").concat(this.awsConfig.region,".").concat(this.awsConfig.endpoint)),this._host},set:function(e){this._host=e}},{key:"scheme",get:function(){return null==this._scheme&&(this._scheme=this.awsConfig.scheme),this._scheme},set:function(e){this._scheme=e}}])&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},223:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function i(e){var t="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},i(e)}function a(e,t,r){return a=c()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&s(o,r.prototype),o},a.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;rv,o:()=>d});var d=function(){function e(t){if(f(this,e),p(this,"region",void 0),p(this,"accessKeyId",void 0),p(this,"secretAccessKey",void 0),p(this,"sessionToken",void 0),p(this,"scheme","https"),p(this,"endpoint","amazonaws.com"),!t.region||""===t.region)throw new v('invalid AWS region; reason: expected a valid AWS region name (e.g. "us-east-1"), got `'.concat(t.region,"`"));if(!t.accessKeyId||""===t.accessKeyId)throw new v("invalid AWS access key ID; reason: expected a non empty string, got `".concat(t.accessKeyId,"`"));if(t.accessKeyId.length<16||t.accessKeyId.length>128)throw new v("invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ".concat(t.accessKeyId.length));if(!t.secretAccessKey||""===t.secretAccessKey)throw new v("invalid AWS secret access key; reason: expected a non empty string, got `".concat(t.secretAccessKey,"`"));if(t.secretAccessKey.length<16||t.secretAccessKey.length>128)throw new v("invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ".concat(t.secretAccessKey.length));this.region=t.region,this.accessKeyId=t.accessKeyId,this.secretAccessKey=t.secretAccessKey,void 0!==t.sessionToken&&(this.sessionToken=t.sessionToken),void 0!==t.scheme&&(this.scheme=t.scheme),void 0!==t.endpoint&&(this.endpoint=t.endpoint)}return h(e,null,[{key:"fromEnvironment",value:function(t){return new e({region:__ENV.AWS_REGION,accessKeyId:__ENV.AWS_ACCESS_KEY_ID,secretAccessKey:__ENV.AWS_SECRET_ACCESS_KEY,sessionToken:__ENV.AWS_SESSION_TOKEN,scheme:null==t?void 0:t.scheme,endpoint:null==t?void 0:t.endpoint})}}]),e}(),v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(i,e);var t,r,n=(t=i,r=c(),function(){var e,n=u(t);if(r){var i=u(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return o(this,e)});function i(e){return f(this,i),n.call(this,e)}return h(i)}(i(Error))},592:(e,t,r)=>{"use strict";r.d(t,{$l:()=>o,Aq:()=>m,B3:()=>v,Dz:()=>d,K0:()=>n,NL:()=>u,Qk:()=>i,R$:()=>f,SG:()=>w,U4:()=>h,VR:()=>s,a_:()=>l,al:()=>g,cG:()=>c,mc:()=>p,md:()=>b,n8:()=>j,sH:()=>S,th:()=>O,w1:()=>y,zC:()=>a});var n="X-Amz-Algorithm",o="X-Amz-Credential",i="X-Amz-Date",a="X-Amz-Expires",c="X-Amz-Signature",s="X-Amz-SignedHeaders",u="X-Amz-Security-Token",f="x-amz-content-sha256",l=i.toLowerCase(),h=c.toLowerCase(),p="X-Amz-Target".toLowerCase(),y=u.toLowerCase(),d="authorization",v=[d,l,"date"],b="host",m={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},g="aws4_request",w="AWS4-HMAC-SHA256",O=604800,S="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",j="UNSIGNED-PAYLOAD"},380:(e,t,r)=>{"use strict";r.d(t,{t:()=>y});var n=r(255);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var r=0;r{"use strict";function n(e,t){e=e.toLowerCase();for(var r=0,n=Object.keys(t);rn})},137:(e,t,r)=>{"use strict";r.d(t,{L:()=>j,w:()=>P});var n=r(400),o=r.n(n),i=r(592),a=r(380),c=r(491),s=r(23);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(t){var o=p(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h(this,r)}}function h(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1&&delete e.headers[O]}e.headers[i.a_]=p,this.credentials.sessionToken&&(e.headers[i.w1]=this.credentials.sessionToken),ArrayBuffer.isView(e.body)&&(e.body=e.body.buffer),e.body||(e.body="");var S=this.computePayloadHash(e);!(0,c.L)(i.R$,e.headers)&&this.applyChecksum&&(e.headers[i.R$]=S);var j=this.computeCanonicalHeaders(e,u,l),P=this.calculateSignature(p,m,this.deriveSigningKey(this.credentials,d,v,y),this.createCanonicalRequest(e,j,S));e.headers[i.Dz]="".concat(i.SG," ")+"Credential=".concat(this.credentials.accessKeyId,"/").concat(m,", ")+"SignedHeaders=".concat(Object.keys(j).sort().join(";"),", ")+"Signature=".concat(P);var _="".concat(e.protocol,"://").concat(e.hostname);return e.path&&(_+=e.path),e.query&&(_+="?".concat(this.serializeQueryParameters(e.query))),b({url:_},e)}},{key:"presign",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.signingDate,n=void 0===r?new Date:r,o=t.expiresIn,a=void 0===o?3600:o,c=t.unsignableHeaders,s=t.unhoistableHeaders,u=t.signableHeaders,f=t.signingRegion,l=t.signingService,h=k(n),p=h.longDate,y=h.shortDate,d=f||this.region,v=l||this.service;if(a>i.th)throw new P("Signature version 4 presigned URLs can't be valid for more than 7 days");var m="".concat(y,"/").concat(d,"/").concat(v,"/").concat(i.al),g=this.moveHeadersToQuery(e,{unhoistableHeaders:s});g.headers[i.md]=e.hostname,this.credentials.sessionToken&&(g.query[i.NL]=this.credentials.sessionToken),g.query[i.K0]=i.SG,g.query[i.$l]="".concat(this.credentials.accessKeyId,"/").concat(m),g.query[i.Qk]=p,g.query[i.zC]=a.toString(10);var w=this.computeCanonicalHeaders(g,c,u);g.query[i.VR]=Object.keys(w).sort().join(";");var O=this.deriveSigningKey(this.credentials,v,d,y),S=this.computePayloadHash(e),j=this.createCanonicalRequest(g,w,S);g.query[i.cG]=this.calculateSignature(p,m,O,j);var _="".concat(g.protocol,"://").concat(g.hostname);return g.path&&(_+=g.path),g.query&&(_+="?".concat(this.serializeQueryParameters(g.query))),b({url:_},g)}},{key:"createCanonicalRequest",value:function(e,t,r){var n=Object.keys(t).sort(),o=n.map((function(e){return"".concat(e,":").concat(t[e])})).join("\n"),i=n.join(";");return"".concat(e.method,"\n")+"".concat(this.computeCanonicalURI(e),"\n")+"".concat(this.computeCanonicalQuerystring(e),"\n")+"".concat(o,"\n\n")+"".concat(i,"\n")+"".concat(r)}},{key:"createStringToSign",value:function(e,t,r){var n=o().sha256(r,"hex");return"".concat(i.SG,"\n")+"".concat(e,"\n")+"".concat(t,"\n")+"".concat(n)}},{key:"calculateSignature",value:function(e,t,r,n){var i=this.createStringToSign(e,t,n);return o().hmac("sha256",r,i,"hex")}},{key:"deriveSigningKey",value:function(e,t,r,n){var i=e.secretAccessKey,a=o().hmac("sha256","AWS4"+i,n,"binary"),c=o().hmac("sha256",a,r,"binary"),s=o().hmac("sha256",c,t,"binary");return o().hmac("sha256",s,"aws4_request","binary")}},{key:"computeCanonicalURI",value:function(e){var t=e.path;if(this.uriEscapePath){var r,n=[],o=y(t.split("/"));try{for(o.s();!(r=o.n()).done;){var i=r.value;0!==(null==i?void 0:i.length)&&("."!==i&&(".."===i?n.pop():n.push(i)))}}catch(e){o.e(e)}finally{o.f()}var a=null!=t&&t.startsWith("/")?"/":"",c=n.join("/"),s=n.length>0&&null!=t&&t.endsWith("/")?"/":"",u="".concat(a).concat(c).concat(s);return encodeURIComponent(u).replace(/%2F/g,"/")}return t}},{key:"computeCanonicalQuerystring",value:function(e){var t,r=e.query,n=void 0===r?{}:r,o=[],a={},c=function(e){if(e.toLowerCase()===i.U4)return"continue";o.push(e);var t=n[e];"string"==typeof t?a[e]="".concat(_(e),"=").concat(_(t)):Array.isArray(t)&&(a[e]=t.slice(0).sort().reduce((function(t,r){return t.concat(["".concat(_(e),"=").concat(_(r))])}),[]).join("&"))},s=y(Object.keys(n).sort());try{for(s.s();!(t=s.n()).done;)c(t.value)}catch(e){s.e(e)}finally{s.f()}return o.map((function(e){return a[e]})).filter((function(e){return e})).join("&")}},{key:"computeCanonicalHeaders",value:function(e,t,r){var n,o=e.headers,a={},c=y(Object.keys(o).sort());try{for(c.s();!(n=c.n()).done;){var s=n.value;if(null!=o[s]){var u=s.toLowerCase();(u in i.Aq||null!=t&&t.has(u))&&(!r||r&&!r.has(u))||(a[u]=o[s].trim().replace(/\s+/g," "))}}}catch(e){c.e(e)}finally{c.f()}return a}},{key:"computePayloadHash",value:function(e){var t=e.headers,r=e.body;return t[i.R$]?t[i.R$]:null==r?i.sH:"string"==typeof r||(0,s.e)(r)?o().sha256(r,"hex").toLowerCase():ArrayBuffer.isView(r)?o().sha256(r.buffer,"hex").toLowerCase():i.n8}},{key:"moveHeadersToQuery",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=JSON.parse(JSON.stringify(e)),n=r.headers,o=r.query,i=void 0===o?{}:o,a=0,c=Object.keys(n);a{"use strict";function n(e){return"function"==typeof ArrayBuffer&&(e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e))}function o(e){return Object.keys(e).reduce((function(t,r){var n=e[r];return null!=n&&t.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(n))),t}),[]).join("&")}r.d(t,{C:()=>o,e:()=>n})},41:(e,t,r)=>{"use strict";r.d(t,{SQSClient:()=>P});r(223);var n=r(137),o=r(393),i=r(409),a=r.n(i),c=r(23),s=r(380);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{},n="POST",o={Action:"SendMessage",Version:j,QueueUrl:e,MessageBody:t};void 0!==r.messageDeduplicationId&&(o=l(l({},o),{},{MessageDeduplicationId:r.messageDeduplicationId})),void 0!==r.messageGroupId&&(o=l(l({},o),{},{MessageGroupId:r.messageGroupId}));var i=this.signature.sign({method:"POST",protocol:"https",hostname:this.host,path:"/",headers:l({},this.commonHeaders),body:(0,c.C)(o)},{}),s=a().request(n,i.url,i.body||"",{headers:i.headers});this._handleError("SendMessage",s);var u=s.html("SendMessageResponse > SendMessageResult");return new _(u.find("MessageId").text(),u.find("MD5OfMessageBody").text())}},{key:"listQueues",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="POST",r={Action:"ListQueues",Version:j};void 0!==(null==e?void 0:e.maxResults)&&(r=l(l({},r),{},{MaxResults:e.maxResults})),void 0!==(null==e?void 0:e.nextToken)&&(r=l(l({},r),{},{NextToken:e.nextToken})),void 0!==(null==e?void 0:e.queueNamePrefix)&&(r=l(l({},r),{},{QueueNamePrefix:e.queueNamePrefix}));var n=this.signature.sign({method:"POST",protocol:"https",hostname:this.host,path:"/",headers:l(l({},this.commonHeaders),{},{Host:this.host}),body:(0,c.C)(r)},{}),o=a().request(t,n.url,n.body||"",{headers:n.headers});this._handleError("ListQueues",o);var i=o.html();return{urls:i.find("QueueUrl").toArray().map((function(e){return e.text()})),nextToken:i.find("NextToken").text()||void 0}}},{key:"_handleError",value:function(e,t){var r=t.error_code;if(""!=t.error||0!==r){var o=s.t.parseXML(t.body);if("AuthorizationHeaderMalformed"===o.code)throw new n.w(o.message,o.code);throw new k(o.message,o.code||"unknown",e)}}}]),r}(o.k),_=y((function e(t,r){h(this,e),O(this,"id",void 0),O(this,"bodyMD5",void 0),this.id=t,this.bodyMD5=r})),k=function(e){d(r,e);var t=b(r);function r(e,n,o){var i;return h(this,r),O(g(i=t.call(this,e,n)),"operation",void 0),i.name="SQSServiceError",i.operation=o,i}return y(r)}(s.t)},877:(e,t,r)=>{var n=r(570),o=r(171),i=o;i.v1=n,i.v4=o,e.exports=i},327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},570:(e,t,r)=>{var n,o,i=r(217),a=r(327),c=0,s=0;e.exports=function(e,t,r){var u=t&&r||0,f=t||[],l=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:o;if(null==l||null==h){var p=i();null==l&&(l=n=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==h&&(h=o=16383&(p[6]<<8|p[7]))}var y=void 0!==e.msecs?e.msecs:(new Date).getTime(),d=void 0!==e.nsecs?e.nsecs:s+1,v=y-c+(d-s)/1e4;if(v<0&&void 0===e.clockseq&&(h=h+1&16383),(v<0||y>c)&&void 0===e.nsecs&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=y,s=d,o=h;var b=(1e4*(268435455&(y+=122192928e5))+d)%4294967296;f[u++]=b>>>24&255,f[u++]=b>>>16&255,f[u++]=b>>>8&255,f[u++]=255&b;var m=y/4294967296*1e4&268435455;f[u++]=m>>>8&255,f[u++]=255&m,f[u++]=m>>>24&15|16,f[u++]=m>>>16&255,f[u++]=h>>>8|128,f[u++]=255&h;for(var g=0;g<6;++g)f[u+g]=l[g];return t||a(f)}},171:(e,t,r)=>{var n=r(217),o=r(327);e.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var c=0;c<16;++c)t[i+c]=a[c];return t||o(a)}},400:e=>{"use strict";e.exports=require("k6/crypto")},255:e=>{"use strict";e.exports=require("k6/html")},409:e=>{"use strict";e.exports=require("k6/http")}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{AMZ_CONTENT_SHA256_HEADER:()=>o.R$,AWSConfig:()=>t.o,InvalidAWSConfigError:()=>t.l,InvalidSignatureError:()=>e.w,KMSClient:()=>_,KMSDataKey:()=>C,KMSServiceError:()=>E,S3Bucket:()=>G,S3Client:()=>B,S3Object:()=>U,S3ServiceError:()=>J,SQSClient:()=>De.SQSClient,Secret:()=>le,SecretsManagerClient:()=>fe,SecretsManagerServiceError:()=>he,SignatureV4:()=>e.L,SystemsManagerClient:()=>Ee,SystemsManagerParameter:()=>Te,SystemsManagerServiceError:()=>Ae,UNSIGNED_PAYLOAD:()=>o.n8});var e=r(137),t=r(223),o=r(592),i=r(409),a=r.n(i),c=r(393),s=r(380);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:P.Size256,r=this.signature.sign({method:this.method,protocol:this.awsConfig.scheme,hostname:this.host,path:"/",headers:l(l({},this.commonHeaders),{},O({},o.mc,"TrentService.GenerateDataKey")),body:JSON.stringify({KeyId:e,NumberOfBytes:t})},{}),n=a().request(this.method,r.url,r.body,{headers:r.headers});return this._handle_error(j.GenerateDataKey,n),C.fromJSON(n.json())}},{key:"_handle_error",value:function(t,r){var n=r.error_code;if(0!==n){var o=r.json();if(n>=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new E(i,o.__type,t)}if(1500===n)throw new E("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),k=function(){function e(t,r){h(this,e),O(this,"keyArn",void 0),O(this,"keyId",void 0),this.keyArn=t,this.keyId=r}return y(e,null,[{key:"fromJSON",value:function(t){return new e(t.KeyArn,t.KeyId)}}]),e}(),C=function(){function e(t,r,n){h(this,e),O(this,"id",void 0),O(this,"ciphertextBlob",void 0),O(this,"plaintext",void 0),this.ciphertextBlob=t,this.id=r,this.plaintext=n}return y(e,null,[{key:"fromJSON",value:function(t){return new e(t.CiphertextBlob,t.KeyId,t.Plaintext)}}]),e}(),E=function(e){d(r,e);var t=b(r);function r(e,n,o){var i;return h(this,r),O(g(i=t.call(this,e,n)),"operation",void 0),i.name="KMSServiceError",i.operation=o,i}return y(r)}(s.t);!function(e){e.GenerateDataKey="GenerateDataKey",e.ListKeys="ListKeys"}(j||(j={})),function(e){e[e.Size256=32]="Size256",e[e.Size512=64]="Size512"}(P||(P={}));var T=r(255);function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function D(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R(e,t){for(var r=0;r".concat(e.partNumber,"").concat(e.eTag,"")})).join(""),""),u=this.signature.sign({method:o,protocol:"https",hostname:i,path:"/".concat(t,"?").concat(c),headers:{},body:s},{}),f=a().request(o,u.url,u.body||"",{headers:u.headers});this._handle_error("CompleteMultipartUpload",f)}},{key:"abortMultipartUpload",value:function(e,t,r){var n="DELETE",o="".concat(e,".").concat(this.host),i="uploadId=".concat(r),c=this.signature.sign({method:n,protocol:"https",hostname:o,path:"/".concat(t,"?").concat(i),headers:{}},{}),s=a().request(n,c.url,c.body||"",{headers:c.headers});this._handle_error("AbortMultipartUpload",s)}},{key:"_handle_error",value:function(t,r){var n=r.status,o=r.error_code,i=r.error;if(!(n>=200&&n<300&&""==i&&0===o)){if(301==n||i&&i.startsWith("301"))throw new J("Resource not found","ResourceNotFound",t);var a=s.t.parseXML(r.body);if("AuthorizationHeaderMalformed"===a.code)throw new e.w(a.message,a.code);throw new J(a.message,a.code||"unknown",t)}}}]),n}(c.k),G=x((function e(t,r){D(this,e),H(this,"name",void 0),H(this,"creationDate",void 0),this.name=t,this.creationDate=r})),U=x((function e(t,r,n,o,i,a){D(this,e),H(this,"key",void 0),H(this,"lastModified",void 0),H(this,"etag",void 0),H(this,"size",void 0),H(this,"storageClass",void 0),H(this,"data",void 0),this.key=t,this.lastModified=r,this.etag=n,this.size=o,this.storageClass=i,this.data=a})),V=x((function e(t,r){D(this,e),H(this,"key",void 0),H(this,"uploadId",void 0),this.key=t,this.uploadId=r})),W=x((function e(t,r){D(this,e),H(this,"partNumber",void 0),H(this,"eTag",void 0),this.partNumber=t,this.eTag=r})),J=function(e){N(r,e);var t=K(r);function r(e,n,o){var i;return D(this,r),H(L(i=t.call(this,e,n)),"operation",void 0),i.name="S3ServiceError",i.operation=o,i}return x(r)}(s.t),Q=r(877);function X(e){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(e)}function $(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new he(i,o.__type,t)}if(1500===n)throw new he("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),le=function(){function e(t,r,n,o,i,a){var c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[];Y(this,e),ce(this,"name",void 0),ce(this,"arn",void 0),ce(this,"secret",void 0),ce(this,"createdDate",void 0),ce(this,"lastAccessedDate",void 0),ce(this,"lastChangedDate",void 0),ce(this,"tags",void 0),this.name=t,this.arn=r,this.secret=n,this.createdDate=o,this.lastAccessedDate=i,this.lastChangedDate=a,this.tags=c}return ee(e,null,[{key:"fromJSON",value:function(t){return new e(t.Name,t.ARN,t.SecretString,t.CreatedDate,t.LastAccessedDate,t.LastChangedDate,t.Tags)}}]),e}(),he=function(e){te(r,e);var t=ne(r);function r(e,n,o){var i;return Y(this,r),ce(ie(i=t.call(this,e,n)),"operation",void 0),i.name="SecretsManagerServiceError",i.operation=o,i}return ee(r)}(s.t);function pe(e){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pe(e)}function ye(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function de(e){for(var t=1;t1&&void 0!==arguments[1]&&arguments[1],r=this.signature.sign({method:this.method,protocol:this.awsConfig.scheme,hostname:this.host,path:"/",headers:de(de({},this.commonHeaders),{},_e({},o.mc,"AmazonSSM.GetParameter")),body:JSON.stringify({Name:e,WithDecryption:t})},{}),n=a().request(this.method,r.url,r.body,{headers:r.headers});return this._handle_error(Ce.GetParameter,n),Te.fromJSON(n.json())}},{key:"_handle_error",value:function(t,r){var n=r.error_code;if(0!==n){var o=r.json();if(n>=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new Ae(i,o.__type,t)}if(1500===n)throw new Ae("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),Te=function(){function e(t,r,n,o,i,a,c,s,u){ve(this,e),_e(this,"arn",void 0),_e(this,"dataType",void 0),_e(this,"lastModifiedDate",void 0),_e(this,"name",void 0),_e(this,"selector",void 0),_e(this,"sourceResult",void 0),_e(this,"type",void 0),_e(this,"value",void 0),_e(this,"version",void 0),this.arn=t,this.dataType=r,this.lastModifiedDate=n,this.name=o,this.selector=i,this.sourceResult=a,this.type=c,this.value=s,this.version=u}return me(e,null,[{key:"fromJSON",value:function(t){var r=t.Parameter;return new e(r.ARN,r.DataType,r.LastModifiedDate,r.Name,r.Selector,r.SourceResult,r.Type,r.Value,r.Version)}}]),e}(),Ae=function(e){ge(r,e);var t=Oe(r);function r(e,n,o){var i;return ve(this,r),_e(je(i=t.call(this,e,n)),"operation",void 0),i.name="SystemsManagerServiceError",i.operation=o,i}return me(r)}(s.t);!function(e){e.GetParameter="GetParameter"}(Ce||(Ce={}));var De=r(41)})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); +(()=>{var e={393:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;rc});var c=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"awsConfig",void 0),i(this,"serviceName",void 0),i(this,"_host",void 0),i(this,"_scheme",void 0),this.awsConfig=t,this.serviceName=r}var t,r,n;return t=e,(r=[{key:"host",get:function(){return null==this._host&&(this._host="".concat(this.serviceName,".").concat(this.awsConfig.region,".").concat(this.awsConfig.endpoint)),this._host},set:function(e){this._host=e}},{key:"scheme",get:function(){return null==this._scheme&&(this._scheme=this.awsConfig.scheme),this._scheme},set:function(e){this._scheme=e}}])&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},223:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function i(e){var t="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},i(e)}function a(e,t,r){return a=c()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&s(o,r.prototype),o},a.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;rv,o:()=>d});var d=function(){function e(t){if(f(this,e),y(this,"region",void 0),y(this,"accessKeyId",void 0),y(this,"secretAccessKey",void 0),y(this,"sessionToken",void 0),y(this,"scheme","https"),y(this,"endpoint","amazonaws.com"),!t.region||""===t.region)throw new v('invalid AWS region; reason: expected a valid AWS region name (e.g. "us-east-1"), got `'.concat(t.region,"`"));if(!t.accessKeyId||""===t.accessKeyId)throw new v("invalid AWS access key ID; reason: expected a non empty string, got `".concat(t.accessKeyId,"`"));if(t.accessKeyId.length<16||t.accessKeyId.length>128)throw new v("invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ".concat(t.accessKeyId.length));if(!t.secretAccessKey||""===t.secretAccessKey)throw new v("invalid AWS secret access key; reason: expected a non empty string, got `".concat(t.secretAccessKey,"`"));if(t.secretAccessKey.length<16||t.secretAccessKey.length>128)throw new v("invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ".concat(t.secretAccessKey.length));this.region=t.region,this.accessKeyId=t.accessKeyId,this.secretAccessKey=t.secretAccessKey,void 0!==t.sessionToken&&(this.sessionToken=t.sessionToken),void 0!==t.scheme&&(this.scheme=t.scheme),void 0!==t.endpoint&&(this.endpoint=t.endpoint)}return h(e,null,[{key:"fromEnvironment",value:function(t){return new e({region:__ENV.AWS_REGION,accessKeyId:__ENV.AWS_ACCESS_KEY_ID,secretAccessKey:__ENV.AWS_SECRET_ACCESS_KEY,sessionToken:__ENV.AWS_SESSION_TOKEN,scheme:null==t?void 0:t.scheme,endpoint:null==t?void 0:t.endpoint})}}]),e}(),v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(i,e);var t,r,n=(t=i,r=c(),function(){var e,n=u(t);if(r){var i=u(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return o(this,e)});function i(e){return f(this,i),n.call(this,e)}return h(i)}(i(Error))},592:(e,t,r)=>{"use strict";r.d(t,{$l:()=>o,Aq:()=>m,B3:()=>v,Dz:()=>d,K0:()=>n,NL:()=>u,Qk:()=>i,R$:()=>f,SG:()=>w,U4:()=>h,VR:()=>s,a_:()=>l,al:()=>g,cG:()=>c,mc:()=>y,md:()=>b,n8:()=>j,sH:()=>S,th:()=>O,w1:()=>p,zC:()=>a});var n="X-Amz-Algorithm",o="X-Amz-Credential",i="X-Amz-Date",a="X-Amz-Expires",c="X-Amz-Signature",s="X-Amz-SignedHeaders",u="X-Amz-Security-Token",f="x-amz-content-sha256",l=i.toLowerCase(),h=c.toLowerCase(),y="X-Amz-Target".toLowerCase(),p=u.toLowerCase(),d="authorization",v=[d,l,"date"],b="host",m={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},g="aws4_request",w="AWS4-HMAC-SHA256",O=604800,S="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",j="UNSIGNED-PAYLOAD"},380:(e,t,r)=>{"use strict";r.d(t,{t:()=>p});var n=r(255);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var r=0;r{"use strict";function n(e,t){e=e.toLowerCase();for(var r=0,n=Object.keys(t);rn})},137:(e,t,r)=>{"use strict";r.d(t,{L:()=>j,w:()=>P});var n=r(400),o=r.n(n),i=r(592),a=r(380),c=r(491),s=r(23);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=y(e);if(t){var o=y(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h(this,r)}}function h(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function p(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1&&delete e.headers[O]}e.headers[i.a_]=y,this.credentials.sessionToken&&(e.headers[i.w1]=this.credentials.sessionToken),ArrayBuffer.isView(e.body)&&(e.body=e.body.buffer),e.body||(e.body="");var S=this.computePayloadHash(e);!(0,c.L)(i.R$,e.headers)&&this.applyChecksum&&(e.headers[i.R$]=S);var j=this.computeCanonicalHeaders(e,u,l),P=this.calculateSignature(y,m,this.deriveSigningKey(this.credentials,d,v,p),this.createCanonicalRequest(e,j,S));e.headers[i.Dz]="".concat(i.SG," ")+"Credential=".concat(this.credentials.accessKeyId,"/").concat(m,", ")+"SignedHeaders=".concat(Object.keys(j).sort().join(";"),", ")+"Signature=".concat(P);var _="".concat(e.protocol,"://").concat(e.hostname);return e.path&&(_+=e.path),e.query&&(_+="?".concat(this.serializeQueryParameters(e.query))),b({url:_},e)}},{key:"presign",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.signingDate,n=void 0===r?new Date:r,o=t.expiresIn,a=void 0===o?3600:o,c=t.unsignableHeaders,s=t.unhoistableHeaders,u=t.signableHeaders,f=t.signingRegion,l=t.signingService,h=k(n),y=h.longDate,p=h.shortDate,d=f||this.region,v=l||this.service;if(a>i.th)throw new P("Signature version 4 presigned URLs can't be valid for more than 7 days");var m="".concat(p,"/").concat(d,"/").concat(v,"/").concat(i.al),g=this.moveHeadersToQuery(e,{unhoistableHeaders:s});g.headers[i.md]=e.hostname,this.credentials.sessionToken&&(g.query[i.NL]=this.credentials.sessionToken),g.query[i.K0]=i.SG,g.query[i.$l]="".concat(this.credentials.accessKeyId,"/").concat(m),g.query[i.Qk]=y,g.query[i.zC]=a.toString(10);var w=this.computeCanonicalHeaders(g,c,u);g.query[i.VR]=Object.keys(w).sort().join(";");var O=this.deriveSigningKey(this.credentials,v,d,p),S=this.computePayloadHash(e),j=this.createCanonicalRequest(g,w,S);g.query[i.cG]=this.calculateSignature(y,m,O,j);var _="".concat(g.protocol,"://").concat(g.hostname);return g.path&&(_+=g.path),g.query&&(_+="?".concat(this.serializeQueryParameters(g.query))),b({url:_},g)}},{key:"createCanonicalRequest",value:function(e,t,r){var n=Object.keys(t).sort(),o=n.map((function(e){return"".concat(e,":").concat(t[e])})).join("\n"),i=n.join(";");return"".concat(e.method,"\n")+"".concat(this.computeCanonicalURI(e),"\n")+"".concat(this.computeCanonicalQuerystring(e),"\n")+"".concat(o,"\n\n")+"".concat(i,"\n")+"".concat(r)}},{key:"createStringToSign",value:function(e,t,r){var n=o().sha256(r,"hex");return"".concat(i.SG,"\n")+"".concat(e,"\n")+"".concat(t,"\n")+"".concat(n)}},{key:"calculateSignature",value:function(e,t,r,n){var i=this.createStringToSign(e,t,n);return o().hmac("sha256",r,i,"hex")}},{key:"deriveSigningKey",value:function(e,t,r,n){var i=e.secretAccessKey,a=o().hmac("sha256","AWS4"+i,n,"binary"),c=o().hmac("sha256",a,r,"binary"),s=o().hmac("sha256",c,t,"binary");return o().hmac("sha256",s,"aws4_request","binary")}},{key:"computeCanonicalURI",value:function(e){var t=e.path;if(this.uriEscapePath){var r,n=[],o=p(t.split("/"));try{for(o.s();!(r=o.n()).done;){var i=r.value;0!==(null==i?void 0:i.length)&&("."!==i&&(".."===i?n.pop():n.push(i)))}}catch(e){o.e(e)}finally{o.f()}var a=null!=t&&t.startsWith("/")?"/":"",c=n.join("/"),s=n.length>0&&null!=t&&t.endsWith("/")?"/":"",u="".concat(a).concat(c).concat(s);return encodeURIComponent(u).replace(/%2F/g,"/")}return t}},{key:"computeCanonicalQuerystring",value:function(e){var t,r=e.query,n=void 0===r?{}:r,o=[],a={},c=function(e){if(e.toLowerCase()===i.U4)return"continue";o.push(e);var t=n[e];"string"==typeof t?a[e]="".concat(_(e),"=").concat(_(t)):Array.isArray(t)&&(a[e]=t.slice(0).sort().reduce((function(t,r){return t.concat(["".concat(_(e),"=").concat(_(r))])}),[]).join("&"))},s=p(Object.keys(n).sort());try{for(s.s();!(t=s.n()).done;)c(t.value)}catch(e){s.e(e)}finally{s.f()}return o.map((function(e){return a[e]})).filter((function(e){return e})).join("&")}},{key:"computeCanonicalHeaders",value:function(e,t,r){var n,o=e.headers,a={},c=p(Object.keys(o).sort());try{for(c.s();!(n=c.n()).done;){var s=n.value;if(null!=o[s]){var u=s.toLowerCase();(u in i.Aq||null!=t&&t.has(u))&&(!r||r&&!r.has(u))||(a[u]=o[s].trim().replace(/\s+/g," "))}}}catch(e){c.e(e)}finally{c.f()}return a}},{key:"computePayloadHash",value:function(e){var t=e.headers,r=e.body;return t[i.R$]?t[i.R$]:null==r?i.sH:"string"==typeof r||(0,s.e)(r)?o().sha256(r,"hex").toLowerCase():ArrayBuffer.isView(r)?o().sha256(r.buffer,"hex").toLowerCase():i.n8}},{key:"moveHeadersToQuery",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=JSON.parse(JSON.stringify(e)),n=r.headers,o=r.query,i=void 0===o?{}:o,a=0,c=Object.keys(n);a{"use strict";function n(e){return"function"==typeof ArrayBuffer&&(e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e))}function o(e){return Object.keys(e).reduce((function(t,r){var n=e[r];return null!=n&&t.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(n))),t}),[]).join("&")}r.d(t,{C:()=>o,e:()=>n})},41:(e,t,r)=>{"use strict";r.d(t,{SQSClient:()=>P});r(223);var n=r(137),o=r(393),i=r(409),a=r.n(i),c=r(23),s=r(380);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{},n="POST",o={Action:"SendMessage",Version:j,QueueUrl:e,MessageBody:t};void 0!==r.messageDeduplicationId&&(o=l(l({},o),{},{MessageDeduplicationId:r.messageDeduplicationId})),void 0!==r.messageGroupId&&(o=l(l({},o),{},{MessageGroupId:r.messageGroupId}));var i=this.signature.sign({method:"POST",protocol:"https",hostname:this.host,path:"/",headers:l({},this.commonHeaders),body:(0,c.C)(o)},{}),s=a().request(n,i.url,i.body||"",{headers:i.headers});this._handleError("SendMessage",s);var u=s.html("SendMessageResponse > SendMessageResult");return new _(u.find("MessageId").text(),u.find("MD5OfMessageBody").text())}},{key:"listQueues",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="POST",r={Action:"ListQueues",Version:j};void 0!==(null==e?void 0:e.maxResults)&&(r=l(l({},r),{},{MaxResults:e.maxResults})),void 0!==(null==e?void 0:e.nextToken)&&(r=l(l({},r),{},{NextToken:e.nextToken})),void 0!==(null==e?void 0:e.queueNamePrefix)&&(r=l(l({},r),{},{QueueNamePrefix:e.queueNamePrefix}));var n=this.signature.sign({method:"POST",protocol:"https",hostname:this.host,path:"/",headers:l(l({},this.commonHeaders),{},{Host:this.host}),body:(0,c.C)(r)},{}),o=a().request(t,n.url,n.body||"",{headers:n.headers});this._handleError("ListQueues",o);var i=o.html();return{urls:i.find("QueueUrl").toArray().map((function(e){return e.text()})),nextToken:i.find("NextToken").text()||void 0}}},{key:"_handleError",value:function(e,t){var r=t.error_code;if(""!=t.error||0!==r){var o=s.t.parseXML(t.body);if("AuthorizationHeaderMalformed"===o.code)throw new n.w(o.message,o.code);throw new k(o.message,o.code||"unknown",e)}}}]),r}(o.k),_=p((function e(t,r){h(this,e),O(this,"id",void 0),O(this,"bodyMD5",void 0),this.id=t,this.bodyMD5=r})),k=function(e){d(r,e);var t=b(r);function r(e,n,o){var i;return h(this,r),O(g(i=t.call(this,e,n)),"operation",void 0),i.name="SQSServiceError",i.operation=o,i}return p(r)}(s.t)},877:(e,t,r)=>{var n=r(570),o=r(171),i=o;i.v1=n,i.v4=o,e.exports=i},327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},570:(e,t,r)=>{var n,o,i=r(217),a=r(327),c=0,s=0;e.exports=function(e,t,r){var u=t&&r||0,f=t||[],l=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:o;if(null==l||null==h){var y=i();null==l&&(l=n=[1|y[0],y[1],y[2],y[3],y[4],y[5]]),null==h&&(h=o=16383&(y[6]<<8|y[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),d=void 0!==e.nsecs?e.nsecs:s+1,v=p-c+(d-s)/1e4;if(v<0&&void 0===e.clockseq&&(h=h+1&16383),(v<0||p>c)&&void 0===e.nsecs&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=p,s=d,o=h;var b=(1e4*(268435455&(p+=122192928e5))+d)%4294967296;f[u++]=b>>>24&255,f[u++]=b>>>16&255,f[u++]=b>>>8&255,f[u++]=255&b;var m=p/4294967296*1e4&268435455;f[u++]=m>>>8&255,f[u++]=255&m,f[u++]=m>>>24&15|16,f[u++]=m>>>16&255,f[u++]=h>>>8|128,f[u++]=255&h;for(var g=0;g<6;++g)f[u+g]=l[g];return t||a(f)}},171:(e,t,r)=>{var n=r(217),o=r(327);e.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var c=0;c<16;++c)t[i+c]=a[c];return t||o(a)}},400:e=>{"use strict";e.exports=require("k6/crypto")},255:e=>{"use strict";e.exports=require("k6/html")},409:e=>{"use strict";e.exports=require("k6/http")}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{AMZ_CONTENT_SHA256_HEADER:()=>o.R$,AWSConfig:()=>t.o,InvalidAWSConfigError:()=>t.l,InvalidSignatureError:()=>e.w,KMSClient:()=>_,KMSDataKey:()=>C,KMSServiceError:()=>E,S3Bucket:()=>G,S3Client:()=>B,S3Object:()=>U,S3ServiceError:()=>J,SQSClient:()=>De.SQSClient,Secret:()=>le,SecretsManagerClient:()=>fe,SecretsManagerServiceError:()=>he,SignatureV4:()=>e.L,SystemsManagerClient:()=>Ee,SystemsManagerParameter:()=>Te,SystemsManagerServiceError:()=>Ae,UNSIGNED_PAYLOAD:()=>o.n8});var e=r(137),t=r(223),o=r(592),i=r(409),a=r.n(i),c=r(393),s=r(380);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:P.Size256,r=this.signature.sign({method:this.method,protocol:this.awsConfig.scheme,hostname:this.host,path:"/",headers:l(l({},this.commonHeaders),{},O({},o.mc,"TrentService.GenerateDataKey")),body:JSON.stringify({KeyId:e,NumberOfBytes:t})},{}),n=a().request(this.method,r.url,r.body,{headers:r.headers});return this._handle_error(j.GenerateDataKey,n),C.fromJSON(n.json())}},{key:"_handle_error",value:function(t,r){var n=r.error_code;if(0!==n){var o=r.json();if(n>=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new E(i,o.__type,t)}if(1500===n)throw new E("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),k=function(){function e(t,r){h(this,e),O(this,"keyArn",void 0),O(this,"keyId",void 0),this.keyArn=t,this.keyId=r}return p(e,null,[{key:"fromJSON",value:function(t){return new e(t.KeyArn,t.KeyId)}}]),e}(),C=function(){function e(t,r,n){h(this,e),O(this,"id",void 0),O(this,"ciphertextBlob",void 0),O(this,"plaintext",void 0),this.ciphertextBlob=t,this.id=r,this.plaintext=n}return p(e,null,[{key:"fromJSON",value:function(t){return new e(t.CiphertextBlob,t.KeyId,t.Plaintext)}}]),e}(),E=function(e){d(r,e);var t=b(r);function r(e,n,o){var i;return h(this,r),O(g(i=t.call(this,e,n)),"operation",void 0),i.name="KMSServiceError",i.operation=o,i}return p(r)}(s.t);!function(e){e.GenerateDataKey="GenerateDataKey",e.ListKeys="ListKeys"}(j||(j={})),function(e){e[e.Size256=32]="Size256",e[e.Size512=64]="Size512"}(P||(P={}));var T=r(255);function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function D(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R(e,t){for(var r=0;r".concat(e.partNumber,"").concat(e.eTag,"")})).join(""),""),s=this.signature.sign({method:o,protocol:this.scheme,hostname:i,path:"/".concat(t),headers:{},body:c,query:{uploadId:"".concat(r)}},{}),u=a().request(o,s.url,s.body||"",{headers:s.headers});this._handle_error("CompleteMultipartUpload",u)}},{key:"abortMultipartUpload",value:function(e,t,r){var n="DELETE",o="".concat(e,".").concat(this.host),i=this.signature.sign({method:n,protocol:this.scheme,hostname:o,path:"/".concat(t),headers:{},query:{uploadId:"".concat(r)}},{}),c=a().request(n,i.url,i.body||"",{headers:i.headers});this._handle_error("AbortMultipartUpload",c)}},{key:"_handle_error",value:function(t,r){var n=r.status,o=r.error_code,i=r.error;if(!(n>=200&&n<300&&""==i&&0===o)){if(301==n||i&&i.startsWith("301"))throw new J("Resource not found","ResourceNotFound",t);var a=s.t.parseXML(r.body);if("AuthorizationHeaderMalformed"===a.code)throw new e.w(a.message,a.code);throw new J(a.message,a.code||"unknown",t)}}}]),n}(c.k),G=x((function e(t,r){D(this,e),H(this,"name",void 0),H(this,"creationDate",void 0),this.name=t,this.creationDate=r})),U=x((function e(t,r,n,o,i,a){D(this,e),H(this,"key",void 0),H(this,"lastModified",void 0),H(this,"etag",void 0),H(this,"size",void 0),H(this,"storageClass",void 0),H(this,"data",void 0),this.key=t,this.lastModified=r,this.etag=n,this.size=o,this.storageClass=i,this.data=a})),V=x((function e(t,r){D(this,e),H(this,"key",void 0),H(this,"uploadId",void 0),this.key=t,this.uploadId=r})),W=x((function e(t,r){D(this,e),H(this,"partNumber",void 0),H(this,"eTag",void 0),this.partNumber=t,this.eTag=r})),J=function(e){N(r,e);var t=K(r);function r(e,n,o){var i;return D(this,r),H(q(i=t.call(this,e,n)),"operation",void 0),i.name="S3ServiceError",i.operation=o,i}return x(r)}(s.t),Q=r(877);function X(e){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(e)}function $(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new he(i,o.__type,t)}if(1500===n)throw new he("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),le=function(){function e(t,r,n,o,i,a){var c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[];Y(this,e),ce(this,"name",void 0),ce(this,"arn",void 0),ce(this,"secret",void 0),ce(this,"createdDate",void 0),ce(this,"lastAccessedDate",void 0),ce(this,"lastChangedDate",void 0),ce(this,"tags",void 0),this.name=t,this.arn=r,this.secret=n,this.createdDate=o,this.lastAccessedDate=i,this.lastChangedDate=a,this.tags=c}return ee(e,null,[{key:"fromJSON",value:function(t){return new e(t.Name,t.ARN,t.SecretString,t.CreatedDate,t.LastAccessedDate,t.LastChangedDate,t.Tags)}}]),e}(),he=function(e){te(r,e);var t=ne(r);function r(e,n,o){var i;return Y(this,r),ce(ie(i=t.call(this,e,n)),"operation",void 0),i.name="SecretsManagerServiceError",i.operation=o,i}return ee(r)}(s.t);function ye(e){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ye(e)}function pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function de(e){for(var t=1;t1&&void 0!==arguments[1]&&arguments[1],r=this.signature.sign({method:this.method,protocol:this.awsConfig.scheme,hostname:this.host,path:"/",headers:de(de({},this.commonHeaders),{},_e({},o.mc,"AmazonSSM.GetParameter")),body:JSON.stringify({Name:e,WithDecryption:t})},{}),n=a().request(this.method,r.url,r.body,{headers:r.headers});return this._handle_error(Ce.GetParameter,n),Te.fromJSON(n.json())}},{key:"_handle_error",value:function(t,r){var n=r.error_code;if(0!==n){var o=r.json();if(n>=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new Ae(i,o.__type,t)}if(1500===n)throw new Ae("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),Te=function(){function e(t,r,n,o,i,a,c,s,u){ve(this,e),_e(this,"arn",void 0),_e(this,"dataType",void 0),_e(this,"lastModifiedDate",void 0),_e(this,"name",void 0),_e(this,"selector",void 0),_e(this,"sourceResult",void 0),_e(this,"type",void 0),_e(this,"value",void 0),_e(this,"version",void 0),this.arn=t,this.dataType=r,this.lastModifiedDate=n,this.name=o,this.selector=i,this.sourceResult=a,this.type=c,this.value=s,this.version=u}return me(e,null,[{key:"fromJSON",value:function(t){var r=t.Parameter;return new e(r.ARN,r.DataType,r.LastModifiedDate,r.Name,r.Selector,r.SourceResult,r.Type,r.Value,r.Version)}}]),e}(),Ae=function(e){ge(r,e);var t=Oe(r);function r(e,n,o){var i;return ve(this,r),_e(je(i=t.call(this,e,n)),"operation",void 0),i.name="SystemsManagerServiceError",i.operation=o,i}return me(r)}(s.t);!function(e){e.GetParameter="GetParameter"}(Ce||(Ce={}));var De=r(41)})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); //# sourceMappingURL=aws.js.map \ No newline at end of file diff --git a/build/aws.js.map b/build/aws.js.map index 3672803..83ac4d2 100644 --- a/build/aws.js.map +++ b/build/aws.js.map @@ -1 +1 @@ -{"version":3,"file":"aws.js","mappings":"04BAUO,IAAMA,EAAS,WAWlB,WAAYC,EAAsBC,I,4FAAqB,iHACnDC,KAAKF,UAAYA,EACjBE,KAAKD,YAAcA,CACvB,C,UAiCD,O,EA/BC,G,EAAA,iBAIA,WAII,OAHkBE,MAAdD,KAAKE,QACPF,KAAKE,MAAQ,GAAH,OAAMF,KAAKD,YAAW,YAAIC,KAAKF,UAAUK,OAAM,YAAIH,KAAKF,UAAUM,WAEvEJ,KAAKE,KAChB,EAAC,IAED,SAAgBG,GACZL,KAAKE,MAAQG,CACjB,GAEE,kBAKF,WAKE,OAHoBJ,MAAhBD,KAAKM,UACPN,KAAKM,QAAUN,KAAKF,UAAUS,QAEzBP,KAAKM,OACd,EAEA,IACA,SAAkBC,GAChBP,KAAKM,QAAUC,CACnB,M,8EAAC,EA/CmB,E,ijFCPf,IAAMC,EAAS,WAsFlB,WAAYC,GACR,GADmC,8IApDlB,SAAO,kBAST,kBA4CVA,EAAQN,QAA6B,KAAnBM,EAAQN,OAC3B,MAAM,IAAIO,EAAsB,yFAAD,OAC+DD,EAAQN,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AmU,EACAC,EACAC,EACA5O,EACA6O,GACF,yPACE7X,KAAKwW,IAAMA,EACXxW,KAAKwX,SAAWA,EAChBxX,KAAKyX,iBAAmBA,EACxBzX,KAAKuD,KAAOA,EACZvD,KAAK0X,SAAWA,EAChB1X,KAAK2X,aAAeA,EACpB3X,KAAK4X,KAAOA,EACZ5X,KAAKgJ,MAAQA,EACbhJ,KAAK6X,QAAUA,CACnB,CAwBC,OAtBD,iCAQA,SAAgBpG,GACZ,IAAMqG,EAAYrG,EAAKsG,UAEvB,OAAO,IAAIT,EACPQ,EAAUjB,IACViB,EAAUE,SACVF,EAAUG,iBACVH,EAAUlC,KACVkC,EAAUI,SACVJ,EAAUK,aACVL,EAAUM,KACVN,EAAUO,MACVP,EAAUvM,QAElB,KAAC,EA5G+B,GA+GvBgM,GAA0B,gCAUnC,WAAYnW,EAAiBkC,EAAc0J,GAAoC,MAGjD,OAHiD,WACvD,MAApB,cAAM5L,EAASkC,IAAK,oBACpB,EAAKC,KAAO,6BACZ,EAAKyJ,UAAYA,EAAS,CAC9B,CAAC,aAdkC,CAAS3J,EAAAA,IAoBpB,SAAvB4T,GAAAA,EAAuB,6BAAvBA,KAAAA,GAAuB,K","sources":["webpack://k6-jslib-aws/./src/internal/client.ts","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/./src/internal/sqs.ts","webpack://k6-jslib-aws/./node_modules/uuid/index.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/bytesToUuid.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/rng-browser.js","webpack://k6-jslib-aws/./node_modules/uuid/v1.js","webpack://k6-jslib-aws/./node_modules/uuid/v4.js","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/kms.ts","webpack://k6-jslib-aws/./src/internal/s3.ts","webpack://k6-jslib-aws/./src/internal/secrets-manager.ts","webpack://k6-jslib-aws/./src/internal/ssm.ts"],"sourcesContent":["import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","import { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { SignatureV4, InvalidSignatureError } from './signature'\nimport { HTTPHeaders, SignedHTTPRequest } from './http'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\nimport { toFormUrlEncoded } from './utils'\nimport { AWSError } from './error'\n\nconst API_VERSION = '2012-11-05'\n\nexport class SQSClient extends AWSClient {\n private readonly signature: SignatureV4\n private readonly commonHeaders: HTTPHeaders\n\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'sqs')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken\n },\n uriEscapePath: true,\n applyChecksum: true\n })\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }\n }\n\n /**\n * Delivers a message to the specified queue.\n *\n * @param {string} queueUrl - The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive.\n * @param {string} messageBody - The message to send. The minimum size is one character. The maximum size is 256 KB.\n * @param {Object} options - Options for the request\n * @param {string} [options.messageDeduplicationId] - The message deduplication id.\n * @param {string} [options.messageGroupId] - The message group ID for FIFO queues\n * @returns {Message} - The message that was sent.\n */\n sendMessage(queueUrl: string, messageBody: string, options: { messageDeduplicationId?: string; messageGroupId?: string} = {}): Message {\n const method = 'POST'\n\n let body: any = {\n Action: 'SendMessage',\n Version: API_VERSION,\n QueueUrl: queueUrl,\n MessageBody: messageBody,\n }\n\n if (typeof(options.messageDeduplicationId) !== 'undefined') {\n body = { ...body,\n MessageDeduplicationId: options.messageDeduplicationId\n }\n }\n\n if (typeof(options.messageGroupId) !== 'undefined') {\n body = { ...body,\n MessageGroupId: options.messageGroupId\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('SendMessage', res)\n\n const parsed = res.html('SendMessageResponse > SendMessageResult')\n return new Message(\n parsed.find('MessageId').text(),\n parsed.find('MD5OfMessageBody').text()\n )\n }\n\n /**\n * Returns a list of your queues in the current region.\n *\n * @param {ListQueuesRequestParameters} [parameters={}] request parameters\n * @param {number} [ListQueuesRequestParameters.maxResults] Maximum number of results to include in the response. Value range is 1 to 1000. You must set maxResults to receive a value for nextToken in the response.\n * @param {string} [ListQueuesRequestParameters.nextToken] Pagination token to request the next set of results.\n * @param {string} [ListQueuesRequestParameters.queueNamePrefix] A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * @returns {Object}\n * @returns {string[]} Object.queueUrls - A list of queue URLs, up to 1000 entries.\n * @returns {string} [Object.nextToken] - In the future, you can use NextToken to request the next set of results.\n */\n listQueues(parameters: ListQueuesRequestParameters = {}): ListQueuesResponse {\n const method = 'POST'\n\n let body: any = {\n Action: 'ListQueues',\n Version: API_VERSION,\n }\n\n if (typeof(parameters?.maxResults) !== 'undefined') {\n body = { ...body,\n MaxResults: parameters.maxResults\n }\n }\n\n if (typeof(parameters?.nextToken) !== 'undefined') {\n body = { ...body,\n NextToken: parameters.nextToken\n }\n }\n\n if (typeof(parameters?.queueNamePrefix) !== 'undefined') {\n body = { ...body,\n QueueNamePrefix: parameters.queueNamePrefix\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n 'Host': this.host\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('ListQueues', res)\n\n let parsed = res.html()\n return {\n urls: parsed.find('QueueUrl').toArray().map(e => e.text()),\n nextToken: parsed.find('NextToken').text() || undefined\n }\n }\n\n private _handleError(operation: SQSOperation, response: RefinedResponse) {\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n if (errorMessage == '' && errorCode === 0) {\n return\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new SQSServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/**\n * An Amazon SQS message.\n */\nexport class Message {\n /**\n * A unique identifier for the message.\n * A MessageIdis considered unique across all AWS accounts for an extended period of time.\n */\n id: string\n\n /**\n * An MD5 digest of the non-URL-encoded message body string.\n */\n bodyMD5: string\n\n /**\n * Instantiates a new Message object.\n *\n * @param id\n * @param md5Ofbody\n */\n constructor(id: string, bodyMD5: string) {\n this.id = id\n this.bodyMD5 = bodyMD5\n }\n}\n\n/**\n * SQSServiceError indicates an error occurred while interacting with the SQS API.\n */\nexport class SQSServiceError extends AWSError {\n operation: SQSOperation;\n\n constructor(message: string, code: string, operation: SQSOperation) {\n super(message, code)\n this.name = 'SQSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SQSOperation describes possible SQS operations.\n */\ntype SQSOperation = 'ListQueues' | 'SendMessage'\n\nexport interface SendMessageOptions {\n /*\n * The message deduplication ID for FIFO queues\n */\n messageDeduplicationId?: string\n\n /*\n * The message group ID for FIFO queues\n */\n messageGroupId?: string\n}\n\nexport interface ListQueuesRequestParameters {\n /**\n * Maximum number of results to include in the response. Value range is 1 to 1000.\n */\n maxResults?: number\n /**\n * Pagination token to request the next set of results.\n */\n nextToken?: string\n /**\n * A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * Queue URLs and names are case-sensitive.\n */\n queueNamePrefix?: string\n}\n\nexport interface ListQueuesResponse {\n /**\n * A list of queue URLs, up to 1,000 entries, or the value of MaxResults you sent in the request.\n */\n urls: string[]\n /**\n * Pagination token to include in the next request.\n */\n nextToken?: string\n}","var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","module.exports = require(\"k6/crypto\");","module.exports = require(\"k6/html\");","module.exports = require(\"k6/http\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's KMS service\n */\nexport class KMSClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a KMSClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'kms')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the KMS service\n // are made via the GET or POST method.\n this.method = 'POST'\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Gets a list of all the KMS keys in the caller's AWS\n * account and region.\n *\n * @returns an array of all the available keys\n */\n listKeys(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.ListKeys`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.ListKeys, res)\n\n const json: JSONArray = res.json('Keys') as JSONArray\n return json.map((k) => KMSKey.fromJSON(k as JSONObject))\n }\n\n /**\n * GenerateDataKey returns a unique symmetric data key for use outside of AWS KMS.\n *\n * This operation returns a plaintext copy of the data key and a copy that is encrypted under a symmetric encryption KMS key that you specify.\n * The bytes in the plaintext key are random; they are not related to the caller or the KMS key.\n * You can use the plaintext key to encrypt your data outside of AWS KMS and store the encrypted data key with the encrypted data.\n *\n * To generate a data key, specify the symmetric encryption KMS key that will be used to encrypt the data key.\n * You cannot use an asymmetric KMS key to encrypt data keys.\n *\n * Used to generate data key with the KMS key defined\n * @param {string} id - Specifies the symmetric encryption KMS key that encrypts the data key. Use its key ID, key ARN, alias name, or alias ARN.\n * @param {KMKeySize} size - Specifies the length of the data key in bytes. For example, use the value 64 to generate a 512-bit data key (64 bytes is 512 bits). Default is 32, and generates a 256-bit data key.\n * @throws {KMSServiceError}\n * @throws {InvalidSignatureError}\n * @returns {KMSDataKey} - The generated data key.\n */\n generateDataKey(id: string, size: KMSKeySize = KMSKeySize.Size256): KMSDataKey | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.GenerateDataKey`,\n },\n body: JSON.stringify({ KeyId: id, NumberOfBytes: size }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.GenerateDataKey, res)\n\n return KMSDataKey.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(operation: KMSOperation, response: RefinedResponse) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new KMSServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new KMSServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a KMS key\n */\nexport class KMSKey {\n /**\n * ARN of the key\n */\n keyArn: string\n\n /**\n * Unique identifier of the key\n */\n keyId: string\n\n constructor(keyArn: string, KeyId: string) {\n this.keyArn = keyArn\n this.keyId = KeyId\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSKey(json.KeyArn as string, json.KeyId as string)\n }\n}\n\n/**\n * Class representing a data key\n */\nexport class KMSDataKey {\n /**\n * The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.\n */\n id: string\n\n /**\n * The (base64-encoded) encrypted copy of the data key.\n */\n ciphertextBlob: string\n\n /**\n * The plaintext data key.\n * Use this data key to encrypt your data outside of KMS. Then, remove it from memory as soon as possible.\n */\n plaintext: string\n\n constructor(CiphertextBlob: string, KeyId: string, Plaintext: string) {\n this.ciphertextBlob = CiphertextBlob\n this.id = KeyId\n this.plaintext = Plaintext\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSDataKey(\n json.CiphertextBlob as string,\n json.KeyId as string,\n json.Plaintext as string\n )\n }\n}\n\nexport class KMSServiceError extends AWSError {\n operation: KMSOperation\n\n /**\n * Constructs a KMSServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: KMSOperation) {\n super(message, code)\n this.name = 'KMSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * KMSOperation defines all currently implemented KMS Service operations.\n */\nenum KMSOperation {\n GenerateDataKey = 'GenerateDataKey',\n ListKeys = 'ListKeys',\n}\n\n/**\n * KMSKeyLength describes possible key lenght values for KMS API data key operations.\n */\nenum KMSKeySize {\n Size256 = 32,\n Size512 = 64,\n}\n","import { bytes } from 'k6'\nimport { parseHTML } from 'k6/html'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AWSError } from './error'\nimport { SignedHTTPRequest } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n\n/** Class allowing to interact with Amazon AWS's S3 service */\nexport class S3Client extends AWSClient {\n signature: SignatureV4\n\n /**\n * Create a S3Client\n *\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 's3')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: false,\n applyChecksum: true,\n })\n }\n\n /**\n * Returns a list of all buckets owned by the authenticated sender of the request.\n * To use this operation, you must have the s3:ListAllMyBuckets permission.\n *\n * @return {Array.} buckets - An array of objects describing S3 buckets\n * with the following fields: name, and creationDate.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listBuckets(): Array {\n const method = 'GET'\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: this.host,\n path: '/',\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListBuckets', res)\n\n let buckets: Array = []\n\n const doc = parseHTML(res.body as string)\n\n doc.find('Buckets')\n .children()\n .each((_, bucketDefinition) => {\n let bucket = {}\n\n bucketDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'name':\n Object.assign(bucket, { name: child.textContent() })\n break\n case 'creationdate':\n Object.assign(bucket, {\n creationDate: Date.parse(child.textContent()),\n })\n }\n })\n\n buckets.push(bucket as S3Bucket)\n })\n\n return buckets\n }\n\n /**\n * Returns some or all (up to 1,000) of the objects in a bucket.\n *\n * @param {string} bucketName - Bucket name to list.\n * @param {string?} prefix='' - Limits the response to keys that begin with the specified prefix.\n * @return {Array.} - returns an array of objects describing S3 objects\n * with the following fields: key, lastModified, etag, size and storageClass.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listObjects(bucketName: string, prefix?: string): Array {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/`,\n query: {\n 'list-type': '2',\n prefix: prefix || '',\n },\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListObjectsV2', res)\n\n let objects: Array = []\n\n // Extract the objects definition from\n // the XML response\n parseHTML(res.body as string)\n .find('Contents')\n .each((_, objectDefinition) => {\n let obj = {}\n\n objectDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'key':\n Object.assign(obj, { key: child.textContent() })\n break\n case 'lastmodified':\n Object.assign(obj, { lastModified: Date.parse(child.textContent()) })\n break\n case 'etag':\n Object.assign(obj, { etag: child.textContent() })\n break\n case 'size':\n Object.assign(obj, { size: parseInt(child.textContent()) })\n break\n case 'storageclass':\n Object.assign(obj, { storageClass: child.textContent() })\n }\n })\n\n objects.push(obj as S3Object)\n })\n\n return objects\n }\n /**\n * Retrieves an Object from Amazon S3.\n *\n * To use getObject, you must have `READ` access to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to get.\n * @return {S3Object} - returns the content of the fetched S3 Object.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n getObject(bucketName: string, objectKey: string): S3Object {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('GetObject', res)\n\n return new S3Object(\n objectKey,\n Date.parse(res.headers['Last-Modified']),\n res.headers['ETag'],\n parseInt(res.headers['Content-Length']),\n\n // The X-Amz-Storage-Class header is only set if the storage class is\n // not the default 'STANDARD' one.\n (res.headers['X-Amz-Storage-Class'] ?? 'STANDARD') as StorageClass,\n\n res.body\n )\n }\n /**\n * Adds an object to a bucket.\n *\n * You must have WRITE permissions on a bucket to add an object to it.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to put.\n * @param {string | ArrayBuffer} data - the content of the S3 Object to upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n putObject(bucketName: string, objectKey: string, data: string | ArrayBuffer) {\n // Prepare request\n const method = 'PUT'\n const host = `${this.host}`\n \n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {\n Host: host,\n },\n body: data,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error('PutObject', res)\n }\n\n /**\n * Removes the null version (if there is one) of an object and inserts a delete marker,\n * which becomes the latest version of the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteObject(bucketName: string, objectKey: string): void {\n // Prepare request\n const method = 'DELETE'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('DeleteObject', res)\n }\n\n /**\n * Creates a new multipart upload for a given objectKey.\n * The uploadId returned can be used to upload parts to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @return {S3MultipartUpload} - returns the uploadId of the newly created multipart upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n createMultipartUpload(bucketName: string, objectKey: string): S3MultipartUpload {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n const query = 'uploads'\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('CreateMultipartUpload', res)\n\n return new S3MultipartUpload(\n objectKey,\n parseHTML(res.body as string)\n .find('UploadId')\n .text()\n )\n }\n\n /**\n * Uploads a part in a multipart upload.\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload.\n * @param {number} partNumber - The part number of the part to upload.\n * @param {string | ArrayBuffer} data - The content of the part to upload.\n * @return {S3Part} - returns the ETag of the uploaded part.\n * @throws {S3ServiceError}\n */\n uploadPart(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n partNumber: number,\n data: string | ArrayBuffer\n ): S3Part {\n // Prepare request\n const method = 'PUT'\n const host = `${bucketName}.${this.host}`\n const query = `partNumber=${partNumber}&uploadId=${uploadId}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n body: data,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('UploadPart', res)\n\n return new S3Part(partNumber, res.headers['Etag'])\n }\n\n /**\n * Completes a multipart upload by assembling previously uploaded parts.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to complete.\n * @param {S3Part[]} parts - The parts to assemble.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n completeMultipartUpload(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n parts: S3Part[]\n ) {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n const query = `uploadId=${uploadId}`\n const body = `${parts\n .map(\n (part) =>\n `${part.partNumber}${part.eTag}`\n )\n .join('')}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n body: body,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n\n this._handle_error('CompleteMultipartUpload', res)\n }\n\n /**\n * Aborts a multipart upload.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to abort.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n abortMultipartUpload(bucketName: string, objectKey: string, uploadId: string) {\n // Prepare request\n const method = 'DELETE'\n const host = `${bucketName}.${this.host}`\n const query = `uploadId=${uploadId}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('AbortMultipartUpload', res)\n }\n\n _handle_error(operation: S3Operation, response: RefinedResponse) {\n const status: number = response.status\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n // We consider codes 200-299 as success\n if (status >= 200 && status < 300 && errorMessage == '' && errorCode === 0) {\n return\n }\n\n // A 301 response is returned when the bucket is not found.\n // Generally meaning that either the bucket name is wrong or the\n // region is wrong.\n //\n // See: https://github.com/grafana/k6/issues/2474\n // See: https://github.com/golang/go/issues/49281\n if (status == 301 || (errorMessage && errorMessage.startsWith('301'))) {\n throw new S3ServiceError('Resource not found', 'ResourceNotFound', operation)\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new S3ServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/** Class representing a S3 Bucket */\nexport class S3Bucket {\n name: string\n creationDate: Date\n\n /**\n * Create an S3 Bucket\n *\n * @param {string} name - S3 bucket's name\n * @param {Date} creationDate - S3 bucket's creation date\n */\n constructor(name: string, creationDate: Date) {\n this.name = name\n this.creationDate = creationDate\n }\n}\n\n/** Class representing an S3 Object */\nexport class S3Object {\n key: string\n lastModified: number\n etag: string\n size: number\n storageClass: StorageClass\n data?: string | bytes | null\n\n /**\n * Create an S3 Object\n *\n * @param {string} key - S3 object's key\n * @param {Date} lastModified - S3 object last modification date\n * @param {string} etag - S3 object's etag\n * @param {number} size - S3 object's size\n * @param {StorageClass} storageClass - S3 object's storage class\n * @param {string | bytes | null} data=null - S3 Object's data\n */\n constructor(\n key: string,\n lastModified: number,\n etag: string,\n size: number,\n storageClass: StorageClass,\n data?: string | bytes | null\n ) {\n this.key = key\n this.lastModified = lastModified\n this.etag = etag\n this.size = size\n this.storageClass = storageClass\n this.data = data\n }\n}\n\n/** Class representing a S3 Multipart Upload */\nexport class S3MultipartUpload {\n key: string\n uploadId: string\n\n /**\n * Create an S3 Multipart Upload\n * @param {string} key - S3 object's key\n * @param {string} uploadId - S3 multipart upload id\n */\n\n constructor(key: string, uploadId: string) {\n this.key = key\n this.uploadId = uploadId\n }\n}\n\n/** Class representing a S3 Part */\nexport class S3Part {\n partNumber: number\n eTag: string\n\n /**\n * Create an S3 Part\n * @param {number} partNumber - Part number\n * @param {string} eTag - Part's etag\n */\n\n constructor(partNumber: number, eTag: string) {\n this.partNumber = partNumber\n this.eTag = eTag\n }\n}\n\n/**\n * Error indicating a S3 operation failed\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class S3ServiceError extends AWSError {\n operation: string\n\n /**\n * Constructs a S3ServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: string) {\n super(message, code)\n this.name = 'S3ServiceError'\n this.operation = operation\n }\n}\n\n/**\n * S3Operation describes possible values for S3 API operations,\n * as defined by AWS APIs.\n */\ntype S3Operation =\n | 'ListBuckets'\n | 'ListObjectsV2'\n | 'GetObject'\n | 'PutObject'\n | 'DeleteObject'\n | 'CreateMultipartUpload'\n | 'CompleteMultipartUpload'\n | 'UploadPart'\n | 'AbortMultipartUpload'\n\n/**\n * Describes the class of storage used to store a S3 object.\n */\ntype StorageClass =\n | 'STANDARD'\n | 'REDUCED_REDUNDANCY'\n | 'GLACIER'\n | 'STANDARD_IA'\n | 'INTELLIGENT_TIERING'\n | 'DEEP_ARCHIVE'\n | 'OUTPOSTS'\n | 'GLACIER_IR'\n | undefined\n","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { v4 as uuidv4 } from 'uuid'\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's SecretsManager service\n */\nexport class SecretsManagerClient extends AWSClient {\n /**\n * HTTP Method to use when interacting with the Secrets Manager service.\n */\n method: HTTPMethod\n\n /**\n * HTTP headers to use accross all requests to the Secrets Manager service.\n */\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a SecretsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'secretsmanager')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the Secrets Manager service\n // are made via the GET or POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Returns a list of all secrets owned by the authenticated sender of the request.\n * To use this operation, you must have the secretsmanager:ListSecrets permission.\n *\n * @return {Array.} secrets - An array of objects describing Secret Manager's secrets\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n listSecrets(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.ListSecrets`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.ListSecrets, res)\n const json: JSONArray = res.json('SecretList') as JSONArray\n\n return json.map((s) => Secret.fromJSON(s as JSONObject))\n }\n\n /**\n * Retrieves a secret from Amazon Sercets Manager\n *\n * @param {string} id - The ARN or name of the secret to retrieve.\n * @returns {Secret} - returns the content of the fetched Secret object.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getSecret(id: string): Secret | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.GetSecretValue`,\n },\n body: JSON.stringify({ SecretId: id }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n\n this._handle_error(SecretsManagerOperation.GetSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Creates a new secret\n *\n * Note that this method only supports string-based values at the moment.\n *\n * @param {string} name - The name of the new secret.\n * The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {string} description - The description of the secret.\n * @param {string} versionID=null - Version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * algorithm.\n * @param {Array.} tags=[] - A list of tags to attach to the secret. Each tag is a key and\n * value pair of strings in a JSON text string. Note that tag key names are case sensitive.\n * @returns {Secret} - returns the created secret\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n createSecret(\n name: string,\n secret: string,\n description: string,\n versionID?: string,\n tags?: Array\n ): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.CreateSecret`,\n },\n body: JSON.stringify({\n Name: name,\n Description: description,\n SecretString: secret,\n ClientRequestToken: versionID,\n Tags: tags,\n }),\n },\n {}\n )\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n // headers['X-Amz-Target'] = `${this.serviceName}.CreateSecret`\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.CreateSecret, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n /**\n * Update a secret's value.\n *\n * Note that this method only support string-based values at the moment.\n *\n * @param {string} id - The ARN or name of the secret to update.\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {} versionID=null - A unique identifier for the new version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n putSecretValue(id: string, secret: string, versionID?: string): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.PutSecretValue`,\n },\n body: JSON.stringify({\n SecretId: id,\n SecretString: secret,\n ClientRequestToken: versionID,\n }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.PutSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Deletes a secret and all of its versions.\n *\n * You can specify a recovery window during which you can restore the secret.\n * The minimum recovery window is 7 days. The default recovery window is 30 days.\n *\n * @param {string} secretID - The ARN or name of the secret to delete.\n * @param {number} recoveryWindow - The number of days from 7 to 30 that Secrets Manager\n * waits before permanently deleting the secret.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteSecret(\n id: string,\n { recoveryWindow = 30, noRecovery = false }: { recoveryWindow: number; noRecovery: boolean }\n ) {\n const payload: { [key: string]: string | boolean | number } = {\n SecretId: id,\n }\n\n // noRecovery and recoveryWindow are exclusive parameters\n if (noRecovery === true) {\n payload['ForceDeleteWithoutRecovery'] = true\n } else {\n payload['RecoveryWindowInDays'] = recoveryWindow\n }\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.DeleteSecret`,\n },\n body: JSON.stringify(payload),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.DeleteSecret, res)\n }\n\n _handle_error(\n operation: SecretsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SecretsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SecretsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n// TODO: create a Tags type\n\n/**\n * Class representing a Secret Manager's secret\n */\nexport class Secret {\n name: string\n arn: string\n secret: string\n createdDate: number\n lastAccessedDate: number\n lastChangedDate: number\n tags: Array<{ [key: string]: string }>\n\n /**\n * Constructs a Secret Manager's Secret\n *\n * @param {string} name - The friendly name of the secret.\n * @param {string} arn - The ARN of the secret.\n * @param {number} createdDate - The date and time that this version of the secret was created.\n * @param {number} lastAccessedDate - The last date that this secret was accessed. This value is\n * truncated to midnight of the date and therefore shows only the date, not the time.\n * @param {number} lastChangedDate - The last date and time that this secret was modified in any way.\n * @param {Array.} tags - The list of user-defined tags associated with the secret.\n */\n constructor(\n name: string,\n arn: string,\n secretString: string,\n createdDate: number,\n lastAccessedDate: number,\n lastChangedDate: number,\n tags: Array<{ [key: string]: string }> = []\n ) {\n this.name = name\n this.arn = arn\n this.secret = secretString\n this.createdDate = createdDate\n this.lastAccessedDate = lastAccessedDate\n this.lastChangedDate = lastChangedDate\n this.tags = tags\n }\n\n /**\n * Parses and constructs a Secret Manager's Secret from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {Secret}\n */\n static fromJSON(json: JSONObject) {\n return new Secret(\n json.Name as string,\n json.ARN as string,\n json.SecretString as string,\n json.CreatedDate as number,\n json.LastAccessedDate as number,\n json.LastChangedDate as number,\n json.Tags as Array<{ [key: string]: string }>\n )\n }\n}\n\nexport class SecretsManagerServiceError extends AWSError {\n operation: SecretsManagerOperation\n\n /**\n * Constructs a SecretsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SecretsManagerOperation) {\n super(message, code)\n this.name = 'SecretsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SecretsManagerOperation defines all currently implemented Secrets Manager Service operations.\n */\nenum SecretsManagerOperation {\n ListSecrets = 'ListSecrets',\n GetSecretValue = 'GetSecretValue',\n CreateSecret = 'CreateSecret',\n PutSecretValue = 'PutSecretValue',\n DeleteSecret = 'DeleteSecret',\n}\n","import { JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's Systems Manager service\n */\nexport class SystemsManagerClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n signature: SignatureV4\n\n /**\n * Create a SystemsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'ssm')\n\n // All interactions with the Systems Manager service\n // are made via the POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n }\n\n /**\n * Retrieves a parameter from Amazon Systems Manager\n *\n * @param {string} name - The ARN or name of the parameter to retrieve.\n * @param {boolean} withDecryption - whether returned secure string parameters should be decrypted.\n * @returns {SystemsManagerParameter} - returns the fetched Parameter object.\n * @throws {SystemsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getParameter(\n name: string,\n withDecryption: boolean = false\n ): SystemsManagerParameter | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `AmazonSSM.GetParameter`,\n },\n body: JSON.stringify({ Name: name, WithDecryption: withDecryption }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SystemsManagerOperation.GetParameter, res)\n\n return SystemsManagerParameter.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(\n operation: SystemsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SystemsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SystemsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a Systems Manager's Parameter\n */\nexport class SystemsManagerParameter {\n /**\n * The Amazon Resource Name (ARN) of the parameter.\n */\n arn: string\n\n /**\n * The data type of the parameter, such as text or aws:ec2:image.\n * The default is text.\n */\n dataType: string\n\n /**\n * Date the parameter was last changed or updated and the parameter version was created.\n */\n lastModifiedDate: number\n\n /**\n * The friendly name of the parameter.\n */\n name: string\n\n /**\n * Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n */\n selector: string\n\n /**\n * plies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n */\n sourceResult: string\n\n /**\n * The type of parameter. Valid values include the following: String, StringList, and SecureString.\n */\n type: string\n\n /**\n * The parameter value.\n */\n value: string\n\n /**\n * The parameter version.\n */\n version: number\n\n /**\n * Constructs a Systems Manager's Parameter\n *\n * @param {string} arn - The Amazon Resource Name (ARN) of the parameter.\n * @param {string} dataType - The data type of the parameter, such as text or aws:ec2:image. The default is text.\n * @param {number} lastModifiedDate - Date the parameter was last changed or updated and the parameter version was created.\n * @param {string} name - The friendly name of the parameter.\n * @param {string} selector - Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n * @param {string} sourceResult - Applies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n * @param {string} type - The type of parameter. Valid values include the following: String, StringList, and SecureString.\n * @param {string} value - The parameter value.\n * @param {number} version - The parameter version.\n */\n constructor(\n arn: string,\n dataType: string,\n lastModifiedDate: number,\n name: string,\n selector: string,\n sourceResult: string,\n type: string,\n value: string,\n version: number\n ) {\n this.arn = arn\n this.dataType = dataType\n this.lastModifiedDate = lastModifiedDate\n this.name = name\n this.selector = selector\n this.sourceResult = sourceResult\n this.type = type\n this.value = value\n this.version = version\n }\n\n /**\n * Parses and constructs a Systems Manager's Parameter from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {SystemsManagerParameter}\n */\n static fromJSON(json: JSONObject): SystemsManagerParameter {\n const parameter = json.Parameter as JSONObject\n\n return new SystemsManagerParameter(\n parameter.ARN as string,\n parameter.DataType as string,\n parameter.LastModifiedDate as number,\n parameter.Name as string,\n parameter.Selector as string,\n parameter.SourceResult as string,\n parameter.Type as string,\n parameter.Value as string,\n parameter.Version as number\n )\n }\n}\n\nexport class SystemsManagerServiceError extends AWSError {\n operation: SystemsManagerOperation\n\n /**\n * Constructs a SystemsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {SystemsManagerOperation} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SystemsManagerOperation) {\n super(message, code)\n this.name = 'SystemsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SystemsManagerOperation defines all currently implemented Systems Manager operations.\n */\nenum SystemsManagerOperation {\n GetParameter = 'GetParameter',\n}\n"],"names":["AWSClient","awsConfig","serviceName","this","undefined","_host","region","endpoint","host","_scheme","scheme","AWSConfig","options","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","sessionToken","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","EMPTY_SHA256","UNSIGNED_PAYLOAD","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","hasHeader","soughtHeader","headers","Object","keys","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","hostname","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","key","value","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","isArrayBuffer","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","prototype","call","toFormUrlEncoded","form","params","API_VERSION","SQSClient","commonHeaders","queueUrl","messageBody","Action","Version","QueueUrl","MessageBody","messageDeduplicationId","MessageDeduplicationId","messageGroupId","MessageGroupId","signedRequest","sign","res","http","_handleError","parsed","html","Message","parameters","maxResults","MaxResults","nextToken","NextToken","queueNamePrefix","QueueNamePrefix","urls","toArray","e","operation","response","errorCode","error_code","error","awsError","SQSServiceError","id","bodyMD5","v1","v4","uuid","module","exports","byteToHex","i","substr","buf","offset","bth","getRandomValues","bind","window","msCrypto","rnds8","Uint8Array","rnds","r","Math","random","_nodeId","_clockseq","rng","bytesToUuid","_lastMSecs","_lastNSecs","b","node","clockseq","seedBytes","msecs","getTime","nsecs","dt","tl","tmh","n","ii","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","__esModule","d","a","definition","o","defineProperty","enumerable","get","obj","prop","hasOwnProperty","Symbol","toStringTag","KMSOperation","KMSKeySize","KMSClient","_handle_error","ListKeys","json","k","KMSKey","fromJSON","size","Size256","KeyId","NumberOfBytes","GenerateDataKey","KMSDataKey","errorMessage","__type","KMSServiceError","keyArn","keyId","KeyArn","CiphertextBlob","Plaintext","ciphertextBlob","plaintext","S3Client","buckets","children","each","_","bucketDefinition","bucket","forEach","child","nodeName","assign","textContent","creationDate","bucketName","prefix","objects","objectDefinition","lastModified","etag","parseInt","storageClass","objectKey","S3Object","data","Host","S3MultipartUpload","uploadId","partNumber","S3Part","parts","part","eTag","status","S3ServiceError","S3Bucket","SecretsManagerOperation","SecretsManagerClient","ListSecrets","s","Secret","SecretId","GetSecretValue","secret","description","versionID","tags","uuidv4","Name","Description","SecretString","ClientRequestToken","Tags","CreateSecret","PutSecretValue","recoveryWindow","noRecovery","payload","DeleteSecret","SecretsManagerServiceError","arn","secretString","createdDate","lastAccessedDate","lastChangedDate","ARN","CreatedDate","LastAccessedDate","LastChangedDate","SystemsManagerOperation","SystemsManagerClient","withDecryption","WithDecryption","GetParameter","SystemsManagerParameter","SystemsManagerServiceError","dataType","lastModifiedDate","selector","sourceResult","type","version","parameter","Parameter","DataType","LastModifiedDate","Selector","SourceResult","Type","Value"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"aws.js","mappings":"04BAUO,IAAMA,EAAS,WAWlB,WAAYC,EAAsBC,I,4FAAqB,iHACnDC,KAAKF,UAAYA,EACjBE,KAAKD,YAAcA,CACvB,C,UAiCD,O,EA/BC,G,EAAA,iBAIA,WAII,OAHkBE,MAAdD,KAAKE,QACPF,KAAKE,MAAQ,GAAH,OAAMF,KAAKD,YAAW,YAAIC,KAAKF,UAAUK,OAAM,YAAIH,KAAKF,UAAUM,WAEvEJ,KAAKE,KAChB,EAAC,IAED,SAAgBG,GACZL,KAAKE,MAAQG,CACjB,GAEE,kBAKF,WAKE,OAHoBJ,MAAhBD,KAAKM,UACPN,KAAKM,QAAUN,KAAKF,UAAUS,QAEzBP,KAAKM,OACd,EAEA,IACA,SAAkBC,GAChBP,KAAKM,QAAUC,CACnB,M,8EAAC,EA/CmB,E,ijFCPf,IAAMC,EAAS,WAsFlB,WAAYC,GACR,GADmC,8IApDlB,SAAO,kBAST,kBA4CVA,EAAQN,QAA6B,KAAnBM,EAAQN,OAC3B,MAAM,IAAIO,EAAsB,yFAAD,OAC+DD,EAAQN,OAAM,MAIhH,IAAKM,EAAQE,aAAuC,KAAxBF,EAAQE,YAChC,MAAM,IAAID,EAAsB,wEAAD,OAC8CD,EAAQE,YAAW,MAIpG,GAAIF,EAAQE,YAAYC,OAAS,IAAMH,EAAQE,YAAYC,OAAS,IAChE,MAAM,IAAIF,EAAsB,wFAAD,OAC6DD,EAAQE,YAAYC,SAIpH,IAAKH,EAAQI,iBAA+C,KAA5BJ,EAAQI,gBACpC,MAAM,IAAIH,EAAsB,4EAAD,OACkDD,EAAQI,gBAAe,MAI5G,GAAIJ,EAAQI,gBAAgBD,OAAS,IAAMH,EAAQI,gBAAgBD,OAAS,IACxE,MAAM,IAAIF,EAAsB,4FAAD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IACViB,EAAUE,SACVF,EAAUG,iBACVH,EAAUlC,KACVkC,EAAUI,SACVJ,EAAUK,aACVL,EAAUM,KACVN,EAAUO,MACVP,EAAUxM,QAElB,KAAC,EA5G+B,GA+GvBiM,GAA0B,gCAUnC,WAAYpW,EAAiBkC,EAAc0J,GAAoC,MAGjD,OAHiD,WACvD,MAApB,cAAM5L,EAASkC,IAAK,oBACpB,EAAKC,KAAO,6BACZ,EAAKyJ,UAAYA,EAAS,CAC9B,CAAC,aAdkC,CAAS3J,EAAAA,IAoBpB,SAAvB6T,GAAAA,EAAuB,6BAAvBA,KAAAA,GAAuB,K","sources":["webpack://k6-jslib-aws/./src/internal/client.ts","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/./src/internal/sqs.ts","webpack://k6-jslib-aws/./node_modules/uuid/index.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/bytesToUuid.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/rng-browser.js","webpack://k6-jslib-aws/./node_modules/uuid/v1.js","webpack://k6-jslib-aws/./node_modules/uuid/v4.js","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/kms.ts","webpack://k6-jslib-aws/./src/internal/s3.ts","webpack://k6-jslib-aws/./src/internal/secrets-manager.ts","webpack://k6-jslib-aws/./src/internal/ssm.ts"],"sourcesContent":["import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","import { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { SignatureV4, InvalidSignatureError } from './signature'\nimport { HTTPHeaders, SignedHTTPRequest } from './http'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\nimport { toFormUrlEncoded } from './utils'\nimport { AWSError } from './error'\n\nconst API_VERSION = '2012-11-05'\n\nexport class SQSClient extends AWSClient {\n private readonly signature: SignatureV4\n private readonly commonHeaders: HTTPHeaders\n\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'sqs')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken\n },\n uriEscapePath: true,\n applyChecksum: true\n })\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }\n }\n\n /**\n * Delivers a message to the specified queue.\n *\n * @param {string} queueUrl - The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive.\n * @param {string} messageBody - The message to send. The minimum size is one character. The maximum size is 256 KB.\n * @param {Object} options - Options for the request\n * @param {string} [options.messageDeduplicationId] - The message deduplication id.\n * @param {string} [options.messageGroupId] - The message group ID for FIFO queues\n * @returns {Message} - The message that was sent.\n */\n sendMessage(queueUrl: string, messageBody: string, options: { messageDeduplicationId?: string; messageGroupId?: string} = {}): Message {\n const method = 'POST'\n\n let body: any = {\n Action: 'SendMessage',\n Version: API_VERSION,\n QueueUrl: queueUrl,\n MessageBody: messageBody,\n }\n\n if (typeof(options.messageDeduplicationId) !== 'undefined') {\n body = { ...body,\n MessageDeduplicationId: options.messageDeduplicationId\n }\n }\n\n if (typeof(options.messageGroupId) !== 'undefined') {\n body = { ...body,\n MessageGroupId: options.messageGroupId\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('SendMessage', res)\n\n const parsed = res.html('SendMessageResponse > SendMessageResult')\n return new Message(\n parsed.find('MessageId').text(),\n parsed.find('MD5OfMessageBody').text()\n )\n }\n\n /**\n * Returns a list of your queues in the current region.\n *\n * @param {ListQueuesRequestParameters} [parameters={}] request parameters\n * @param {number} [ListQueuesRequestParameters.maxResults] Maximum number of results to include in the response. Value range is 1 to 1000. You must set maxResults to receive a value for nextToken in the response.\n * @param {string} [ListQueuesRequestParameters.nextToken] Pagination token to request the next set of results.\n * @param {string} [ListQueuesRequestParameters.queueNamePrefix] A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * @returns {Object}\n * @returns {string[]} Object.queueUrls - A list of queue URLs, up to 1000 entries.\n * @returns {string} [Object.nextToken] - In the future, you can use NextToken to request the next set of results.\n */\n listQueues(parameters: ListQueuesRequestParameters = {}): ListQueuesResponse {\n const method = 'POST'\n\n let body: any = {\n Action: 'ListQueues',\n Version: API_VERSION,\n }\n\n if (typeof(parameters?.maxResults) !== 'undefined') {\n body = { ...body,\n MaxResults: parameters.maxResults\n }\n }\n\n if (typeof(parameters?.nextToken) !== 'undefined') {\n body = { ...body,\n NextToken: parameters.nextToken\n }\n }\n\n if (typeof(parameters?.queueNamePrefix) !== 'undefined') {\n body = { ...body,\n QueueNamePrefix: parameters.queueNamePrefix\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n 'Host': this.host\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('ListQueues', res)\n\n let parsed = res.html()\n return {\n urls: parsed.find('QueueUrl').toArray().map(e => e.text()),\n nextToken: parsed.find('NextToken').text() || undefined\n }\n }\n\n private _handleError(operation: SQSOperation, response: RefinedResponse) {\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n if (errorMessage == '' && errorCode === 0) {\n return\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new SQSServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/**\n * An Amazon SQS message.\n */\nexport class Message {\n /**\n * A unique identifier for the message.\n * A MessageIdis considered unique across all AWS accounts for an extended period of time.\n */\n id: string\n\n /**\n * An MD5 digest of the non-URL-encoded message body string.\n */\n bodyMD5: string\n\n /**\n * Instantiates a new Message object.\n *\n * @param id\n * @param md5Ofbody\n */\n constructor(id: string, bodyMD5: string) {\n this.id = id\n this.bodyMD5 = bodyMD5\n }\n}\n\n/**\n * SQSServiceError indicates an error occurred while interacting with the SQS API.\n */\nexport class SQSServiceError extends AWSError {\n operation: SQSOperation;\n\n constructor(message: string, code: string, operation: SQSOperation) {\n super(message, code)\n this.name = 'SQSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SQSOperation describes possible SQS operations.\n */\ntype SQSOperation = 'ListQueues' | 'SendMessage'\n\nexport interface SendMessageOptions {\n /*\n * The message deduplication ID for FIFO queues\n */\n messageDeduplicationId?: string\n\n /*\n * The message group ID for FIFO queues\n */\n messageGroupId?: string\n}\n\nexport interface ListQueuesRequestParameters {\n /**\n * Maximum number of results to include in the response. Value range is 1 to 1000.\n */\n maxResults?: number\n /**\n * Pagination token to request the next set of results.\n */\n nextToken?: string\n /**\n * A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * Queue URLs and names are case-sensitive.\n */\n queueNamePrefix?: string\n}\n\nexport interface ListQueuesResponse {\n /**\n * A list of queue URLs, up to 1,000 entries, or the value of MaxResults you sent in the request.\n */\n urls: string[]\n /**\n * Pagination token to include in the next request.\n */\n nextToken?: string\n}","var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","module.exports = require(\"k6/crypto\");","module.exports = require(\"k6/html\");","module.exports = require(\"k6/http\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's KMS service\n */\nexport class KMSClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a KMSClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'kms')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the KMS service\n // are made via the GET or POST method.\n this.method = 'POST'\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Gets a list of all the KMS keys in the caller's AWS\n * account and region.\n *\n * @returns an array of all the available keys\n */\n listKeys(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.ListKeys`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.ListKeys, res)\n\n const json: JSONArray = res.json('Keys') as JSONArray\n return json.map((k) => KMSKey.fromJSON(k as JSONObject))\n }\n\n /**\n * GenerateDataKey returns a unique symmetric data key for use outside of AWS KMS.\n *\n * This operation returns a plaintext copy of the data key and a copy that is encrypted under a symmetric encryption KMS key that you specify.\n * The bytes in the plaintext key are random; they are not related to the caller or the KMS key.\n * You can use the plaintext key to encrypt your data outside of AWS KMS and store the encrypted data key with the encrypted data.\n *\n * To generate a data key, specify the symmetric encryption KMS key that will be used to encrypt the data key.\n * You cannot use an asymmetric KMS key to encrypt data keys.\n *\n * Used to generate data key with the KMS key defined\n * @param {string} id - Specifies the symmetric encryption KMS key that encrypts the data key. Use its key ID, key ARN, alias name, or alias ARN.\n * @param {KMKeySize} size - Specifies the length of the data key in bytes. For example, use the value 64 to generate a 512-bit data key (64 bytes is 512 bits). Default is 32, and generates a 256-bit data key.\n * @throws {KMSServiceError}\n * @throws {InvalidSignatureError}\n * @returns {KMSDataKey} - The generated data key.\n */\n generateDataKey(id: string, size: KMSKeySize = KMSKeySize.Size256): KMSDataKey | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.GenerateDataKey`,\n },\n body: JSON.stringify({ KeyId: id, NumberOfBytes: size }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.GenerateDataKey, res)\n\n return KMSDataKey.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(operation: KMSOperation, response: RefinedResponse) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new KMSServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new KMSServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a KMS key\n */\nexport class KMSKey {\n /**\n * ARN of the key\n */\n keyArn: string\n\n /**\n * Unique identifier of the key\n */\n keyId: string\n\n constructor(keyArn: string, KeyId: string) {\n this.keyArn = keyArn\n this.keyId = KeyId\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSKey(json.KeyArn as string, json.KeyId as string)\n }\n}\n\n/**\n * Class representing a data key\n */\nexport class KMSDataKey {\n /**\n * The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.\n */\n id: string\n\n /**\n * The (base64-encoded) encrypted copy of the data key.\n */\n ciphertextBlob: string\n\n /**\n * The plaintext data key.\n * Use this data key to encrypt your data outside of KMS. Then, remove it from memory as soon as possible.\n */\n plaintext: string\n\n constructor(CiphertextBlob: string, KeyId: string, Plaintext: string) {\n this.ciphertextBlob = CiphertextBlob\n this.id = KeyId\n this.plaintext = Plaintext\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSDataKey(\n json.CiphertextBlob as string,\n json.KeyId as string,\n json.Plaintext as string\n )\n }\n}\n\nexport class KMSServiceError extends AWSError {\n operation: KMSOperation\n\n /**\n * Constructs a KMSServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: KMSOperation) {\n super(message, code)\n this.name = 'KMSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * KMSOperation defines all currently implemented KMS Service operations.\n */\nenum KMSOperation {\n GenerateDataKey = 'GenerateDataKey',\n ListKeys = 'ListKeys',\n}\n\n/**\n * KMSKeyLength describes possible key lenght values for KMS API data key operations.\n */\nenum KMSKeySize {\n Size256 = 32,\n Size512 = 64,\n}\n","import { bytes } from 'k6'\nimport { parseHTML } from 'k6/html'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AWSError } from './error'\nimport { SignedHTTPRequest } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n\n/** Class allowing to interact with Amazon AWS's S3 service */\nexport class S3Client extends AWSClient {\n signature: SignatureV4\n\n /**\n * Create a S3Client\n *\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 's3')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: false,\n applyChecksum: true,\n })\n }\n\n /**\n * Returns a list of all buckets owned by the authenticated sender of the request.\n * To use this operation, you must have the s3:ListAllMyBuckets permission.\n *\n * @return {Array.} buckets - An array of objects describing S3 buckets\n * with the following fields: name, and creationDate.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listBuckets(): Array {\n const method = 'GET'\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: this.host,\n path: '/',\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListBuckets', res)\n\n let buckets: Array = []\n\n const doc = parseHTML(res.body as string)\n\n doc.find('Buckets')\n .children()\n .each((_, bucketDefinition) => {\n let bucket = {}\n\n bucketDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'name':\n Object.assign(bucket, { name: child.textContent() })\n break\n case 'creationdate':\n Object.assign(bucket, {\n creationDate: Date.parse(child.textContent()),\n })\n }\n })\n\n buckets.push(bucket as S3Bucket)\n })\n\n return buckets\n }\n\n /**\n * Returns some or all (up to 1,000) of the objects in a bucket.\n *\n * @param {string} bucketName - Bucket name to list.\n * @param {string?} prefix='' - Limits the response to keys that begin with the specified prefix.\n * @return {Array.} - returns an array of objects describing S3 objects\n * with the following fields: key, lastModified, etag, size and storageClass.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listObjects(bucketName: string, prefix?: string): Array {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/`,\n query: {\n 'list-type': '2',\n prefix: prefix || '',\n },\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListObjectsV2', res)\n\n let objects: Array = []\n\n // Extract the objects definition from\n // the XML response\n parseHTML(res.body as string)\n .find('Contents')\n .each((_, objectDefinition) => {\n let obj = {}\n\n objectDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'key':\n Object.assign(obj, { key: child.textContent() })\n break\n case 'lastmodified':\n Object.assign(obj, { lastModified: Date.parse(child.textContent()) })\n break\n case 'etag':\n Object.assign(obj, { etag: child.textContent() })\n break\n case 'size':\n Object.assign(obj, { size: parseInt(child.textContent()) })\n break\n case 'storageclass':\n Object.assign(obj, { storageClass: child.textContent() })\n }\n })\n\n objects.push(obj as S3Object)\n })\n\n return objects\n }\n /**\n * Retrieves an Object from Amazon S3.\n *\n * To use getObject, you must have `READ` access to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to get.\n * @return {S3Object} - returns the content of the fetched S3 Object.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n getObject(bucketName: string, objectKey: string): S3Object {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('GetObject', res)\n\n return new S3Object(\n objectKey,\n Date.parse(res.headers['Last-Modified']),\n res.headers['ETag'],\n parseInt(res.headers['Content-Length']),\n\n // The X-Amz-Storage-Class header is only set if the storage class is\n // not the default 'STANDARD' one.\n (res.headers['X-Amz-Storage-Class'] ?? 'STANDARD') as StorageClass,\n\n res.body\n )\n }\n /**\n * Adds an object to a bucket.\n *\n * You must have WRITE permissions on a bucket to add an object to it.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to put.\n * @param {string | ArrayBuffer} data - the content of the S3 Object to upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n putObject(bucketName: string, objectKey: string, data: string | ArrayBuffer) {\n // Prepare request\n const method = 'PUT'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {\n Host: host,\n },\n body: data,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error('PutObject', res)\n }\n\n /**\n * Removes the null version (if there is one) of an object and inserts a delete marker,\n * which becomes the latest version of the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteObject(bucketName: string, objectKey: string): void {\n // Prepare request\n const method = 'DELETE'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('DeleteObject', res)\n }\n\n /**\n * Creates a new multipart upload for a given objectKey.\n * The uploadId returned can be used to upload parts to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to upload.\n * @return {S3MultipartUpload} - returns the uploadId of the newly created multipart upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n createMultipartUpload(bucketName: string, objectKey: string): S3MultipartUpload {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n query: { uploads: '' },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('CreateMultipartUpload', res)\n\n return new S3MultipartUpload(\n objectKey,\n parseHTML(res.body as string)\n .find('UploadId')\n .text()\n )\n }\n\n /**\n * Uploads a part in a multipart upload.\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to upload.\n * @param {string} uploadId - The uploadId of the multipart upload.\n * @param {number} partNumber - The part number of the part to upload.\n * @param {string | ArrayBuffer} data - The content of the part to upload.\n * @return {S3Part} - returns the ETag of the uploaded part.\n * @throws {S3ServiceError}\n */\n uploadPart(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n partNumber: number,\n data: string | ArrayBuffer\n ): S3Part {\n // Prepare request\n const method = 'PUT'\n const host = `${bucketName}.${this.host}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n body: data,\n query: {\n partNumber: `${partNumber}`,\n uploadId: `${uploadId}`,\n },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('UploadPart', res)\n\n return new S3Part(partNumber, res.headers['Etag'])\n }\n\n /**\n * Completes a multipart upload by assembling previously uploaded parts.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to complete.\n * @param {S3Part[]} parts - The parts to assemble.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n completeMultipartUpload(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n parts: S3Part[]\n ) {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n const body = `${parts\n .map(\n (part) =>\n `${part.partNumber}${part.eTag}`\n )\n .join('')}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n body: body,\n query: {\n uploadId: `${uploadId}`,\n },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n\n this._handle_error('CompleteMultipartUpload', res)\n }\n\n /**\n * Aborts a multipart upload.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to abort.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n abortMultipartUpload(bucketName: string, objectKey: string, uploadId: string) {\n // Prepare request\n const method = 'DELETE'\n const host = `${bucketName}.${this.host}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n query: {\n uploadId: `${uploadId}`,\n },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('AbortMultipartUpload', res)\n }\n\n _handle_error(operation: S3Operation, response: RefinedResponse) {\n const status: number = response.status\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n // We consider codes 200-299 as success\n if (status >= 200 && status < 300 && errorMessage == '' && errorCode === 0) {\n return\n }\n\n // A 301 response is returned when the bucket is not found.\n // Generally meaning that either the bucket name is wrong or the\n // region is wrong.\n //\n // See: https://github.com/grafana/k6/issues/2474\n // See: https://github.com/golang/go/issues/49281\n if (status == 301 || (errorMessage && errorMessage.startsWith('301'))) {\n throw new S3ServiceError('Resource not found', 'ResourceNotFound', operation)\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new S3ServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/** Class representing a S3 Bucket */\nexport class S3Bucket {\n name: string\n creationDate: Date\n\n /**\n * Create an S3 Bucket\n *\n * @param {string} name - S3 bucket's name\n * @param {Date} creationDate - S3 bucket's creation date\n */\n constructor(name: string, creationDate: Date) {\n this.name = name\n this.creationDate = creationDate\n }\n}\n\n/** Class representing an S3 Object */\nexport class S3Object {\n key: string\n lastModified: number\n etag: string\n size: number\n storageClass: StorageClass\n data?: string | bytes | null\n\n /**\n * Create an S3 Object\n *\n * @param {string} key - S3 object's key\n * @param {Date} lastModified - S3 object last modification date\n * @param {string} etag - S3 object's etag\n * @param {number} size - S3 object's size\n * @param {StorageClass} storageClass - S3 object's storage class\n * @param {string | bytes | null} data=null - S3 Object's data\n */\n constructor(\n key: string,\n lastModified: number,\n etag: string,\n size: number,\n storageClass: StorageClass,\n data?: string | bytes | null\n ) {\n this.key = key\n this.lastModified = lastModified\n this.etag = etag\n this.size = size\n this.storageClass = storageClass\n this.data = data\n }\n}\n\n/** Class representing a S3 Multipart Upload */\nexport class S3MultipartUpload {\n key: string\n uploadId: string\n\n /**\n * Create an S3 Multipart Upload\n * @param {string} key - S3 object's key\n * @param {string} uploadId - S3 multipart upload id\n */\n\n constructor(key: string, uploadId: string) {\n this.key = key\n this.uploadId = uploadId\n }\n}\n\n/** Class representing a S3 Part */\nexport class S3Part {\n partNumber: number\n eTag: string\n\n /**\n * Create an S3 Part\n * @param {number} partNumber - Part number\n * @param {string} eTag - Part's etag\n */\n\n constructor(partNumber: number, eTag: string) {\n this.partNumber = partNumber\n this.eTag = eTag\n }\n}\n\n/**\n * Error indicating a S3 operation failed\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class S3ServiceError extends AWSError {\n operation: string\n\n /**\n * Constructs a S3ServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: string) {\n super(message, code)\n this.name = 'S3ServiceError'\n this.operation = operation\n }\n}\n\n/**\n * S3Operation describes possible values for S3 API operations,\n * as defined by AWS APIs.\n */\ntype S3Operation =\n | 'ListBuckets'\n | 'ListObjectsV2'\n | 'GetObject'\n | 'PutObject'\n | 'DeleteObject'\n | 'CreateMultipartUpload'\n | 'CompleteMultipartUpload'\n | 'UploadPart'\n | 'AbortMultipartUpload'\n\n/**\n * Describes the class of storage used to store a S3 object.\n */\ntype StorageClass =\n | 'STANDARD'\n | 'REDUCED_REDUNDANCY'\n | 'GLACIER'\n | 'STANDARD_IA'\n | 'INTELLIGENT_TIERING'\n | 'DEEP_ARCHIVE'\n | 'OUTPOSTS'\n | 'GLACIER_IR'\n | undefined\n","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { v4 as uuidv4 } from 'uuid'\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's SecretsManager service\n */\nexport class SecretsManagerClient extends AWSClient {\n /**\n * HTTP Method to use when interacting with the Secrets Manager service.\n */\n method: HTTPMethod\n\n /**\n * HTTP headers to use accross all requests to the Secrets Manager service.\n */\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a SecretsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'secretsmanager')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the Secrets Manager service\n // are made via the GET or POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Returns a list of all secrets owned by the authenticated sender of the request.\n * To use this operation, you must have the secretsmanager:ListSecrets permission.\n *\n * @return {Array.} secrets - An array of objects describing Secret Manager's secrets\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n listSecrets(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.ListSecrets`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.ListSecrets, res)\n const json: JSONArray = res.json('SecretList') as JSONArray\n\n return json.map((s) => Secret.fromJSON(s as JSONObject))\n }\n\n /**\n * Retrieves a secret from Amazon Sercets Manager\n *\n * @param {string} id - The ARN or name of the secret to retrieve.\n * @returns {Secret} - returns the content of the fetched Secret object.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getSecret(id: string): Secret | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.GetSecretValue`,\n },\n body: JSON.stringify({ SecretId: id }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n\n this._handle_error(SecretsManagerOperation.GetSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Creates a new secret\n *\n * Note that this method only supports string-based values at the moment.\n *\n * @param {string} name - The name of the new secret.\n * The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {string} description - The description of the secret.\n * @param {string} versionID=null - Version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * algorithm.\n * @param {Array.} tags=[] - A list of tags to attach to the secret. Each tag is a key and\n * value pair of strings in a JSON text string. Note that tag key names are case sensitive.\n * @returns {Secret} - returns the created secret\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n createSecret(\n name: string,\n secret: string,\n description: string,\n versionID?: string,\n tags?: Array\n ): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.CreateSecret`,\n },\n body: JSON.stringify({\n Name: name,\n Description: description,\n SecretString: secret,\n ClientRequestToken: versionID,\n Tags: tags,\n }),\n },\n {}\n )\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n // headers['X-Amz-Target'] = `${this.serviceName}.CreateSecret`\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.CreateSecret, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n /**\n * Update a secret's value.\n *\n * Note that this method only support string-based values at the moment.\n *\n * @param {string} id - The ARN or name of the secret to update.\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {} versionID=null - A unique identifier for the new version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n putSecretValue(id: string, secret: string, versionID?: string): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.PutSecretValue`,\n },\n body: JSON.stringify({\n SecretId: id,\n SecretString: secret,\n ClientRequestToken: versionID,\n }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.PutSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Deletes a secret and all of its versions.\n *\n * You can specify a recovery window during which you can restore the secret.\n * The minimum recovery window is 7 days. The default recovery window is 30 days.\n *\n * @param {string} secretID - The ARN or name of the secret to delete.\n * @param {number} recoveryWindow - The number of days from 7 to 30 that Secrets Manager\n * waits before permanently deleting the secret.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteSecret(\n id: string,\n { recoveryWindow = 30, noRecovery = false }: { recoveryWindow: number; noRecovery: boolean }\n ) {\n const payload: { [key: string]: string | boolean | number } = {\n SecretId: id,\n }\n\n // noRecovery and recoveryWindow are exclusive parameters\n if (noRecovery === true) {\n payload['ForceDeleteWithoutRecovery'] = true\n } else {\n payload['RecoveryWindowInDays'] = recoveryWindow\n }\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.DeleteSecret`,\n },\n body: JSON.stringify(payload),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.DeleteSecret, res)\n }\n\n _handle_error(\n operation: SecretsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SecretsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SecretsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n// TODO: create a Tags type\n\n/**\n * Class representing a Secret Manager's secret\n */\nexport class Secret {\n name: string\n arn: string\n secret: string\n createdDate: number\n lastAccessedDate: number\n lastChangedDate: number\n tags: Array<{ [key: string]: string }>\n\n /**\n * Constructs a Secret Manager's Secret\n *\n * @param {string} name - The friendly name of the secret.\n * @param {string} arn - The ARN of the secret.\n * @param {number} createdDate - The date and time that this version of the secret was created.\n * @param {number} lastAccessedDate - The last date that this secret was accessed. This value is\n * truncated to midnight of the date and therefore shows only the date, not the time.\n * @param {number} lastChangedDate - The last date and time that this secret was modified in any way.\n * @param {Array.} tags - The list of user-defined tags associated with the secret.\n */\n constructor(\n name: string,\n arn: string,\n secretString: string,\n createdDate: number,\n lastAccessedDate: number,\n lastChangedDate: number,\n tags: Array<{ [key: string]: string }> = []\n ) {\n this.name = name\n this.arn = arn\n this.secret = secretString\n this.createdDate = createdDate\n this.lastAccessedDate = lastAccessedDate\n this.lastChangedDate = lastChangedDate\n this.tags = tags\n }\n\n /**\n * Parses and constructs a Secret Manager's Secret from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {Secret}\n */\n static fromJSON(json: JSONObject) {\n return new Secret(\n json.Name as string,\n json.ARN as string,\n json.SecretString as string,\n json.CreatedDate as number,\n json.LastAccessedDate as number,\n json.LastChangedDate as number,\n json.Tags as Array<{ [key: string]: string }>\n )\n }\n}\n\nexport class SecretsManagerServiceError extends AWSError {\n operation: SecretsManagerOperation\n\n /**\n * Constructs a SecretsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SecretsManagerOperation) {\n super(message, code)\n this.name = 'SecretsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SecretsManagerOperation defines all currently implemented Secrets Manager Service operations.\n */\nenum SecretsManagerOperation {\n ListSecrets = 'ListSecrets',\n GetSecretValue = 'GetSecretValue',\n CreateSecret = 'CreateSecret',\n PutSecretValue = 'PutSecretValue',\n DeleteSecret = 'DeleteSecret',\n}\n","import { JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's Systems Manager service\n */\nexport class SystemsManagerClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n signature: SignatureV4\n\n /**\n * Create a SystemsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'ssm')\n\n // All interactions with the Systems Manager service\n // are made via the POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n }\n\n /**\n * Retrieves a parameter from Amazon Systems Manager\n *\n * @param {string} name - The ARN or name of the parameter to retrieve.\n * @param {boolean} withDecryption - whether returned secure string parameters should be decrypted.\n * @returns {SystemsManagerParameter} - returns the fetched Parameter object.\n * @throws {SystemsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getParameter(\n name: string,\n withDecryption: boolean = false\n ): SystemsManagerParameter | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `AmazonSSM.GetParameter`,\n },\n body: JSON.stringify({ Name: name, WithDecryption: withDecryption }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SystemsManagerOperation.GetParameter, res)\n\n return SystemsManagerParameter.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(\n operation: SystemsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SystemsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SystemsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a Systems Manager's Parameter\n */\nexport class SystemsManagerParameter {\n /**\n * The Amazon Resource Name (ARN) of the parameter.\n */\n arn: string\n\n /**\n * The data type of the parameter, such as text or aws:ec2:image.\n * The default is text.\n */\n dataType: string\n\n /**\n * Date the parameter was last changed or updated and the parameter version was created.\n */\n lastModifiedDate: number\n\n /**\n * The friendly name of the parameter.\n */\n name: string\n\n /**\n * Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n */\n selector: string\n\n /**\n * plies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n */\n sourceResult: string\n\n /**\n * The type of parameter. Valid values include the following: String, StringList, and SecureString.\n */\n type: string\n\n /**\n * The parameter value.\n */\n value: string\n\n /**\n * The parameter version.\n */\n version: number\n\n /**\n * Constructs a Systems Manager's Parameter\n *\n * @param {string} arn - The Amazon Resource Name (ARN) of the parameter.\n * @param {string} dataType - The data type of the parameter, such as text or aws:ec2:image. The default is text.\n * @param {number} lastModifiedDate - Date the parameter was last changed or updated and the parameter version was created.\n * @param {string} name - The friendly name of the parameter.\n * @param {string} selector - Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n * @param {string} sourceResult - Applies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n * @param {string} type - The type of parameter. Valid values include the following: String, StringList, and SecureString.\n * @param {string} value - The parameter value.\n * @param {number} version - The parameter version.\n */\n constructor(\n arn: string,\n dataType: string,\n lastModifiedDate: number,\n name: string,\n selector: string,\n sourceResult: string,\n type: string,\n value: string,\n version: number\n ) {\n this.arn = arn\n this.dataType = dataType\n this.lastModifiedDate = lastModifiedDate\n this.name = name\n this.selector = selector\n this.sourceResult = sourceResult\n this.type = type\n this.value = value\n this.version = version\n }\n\n /**\n * Parses and constructs a Systems Manager's Parameter from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {SystemsManagerParameter}\n */\n static fromJSON(json: JSONObject): SystemsManagerParameter {\n const parameter = json.Parameter as JSONObject\n\n return new SystemsManagerParameter(\n parameter.ARN as string,\n parameter.DataType as string,\n parameter.LastModifiedDate as number,\n parameter.Name as string,\n parameter.Selector as string,\n parameter.SourceResult as string,\n parameter.Type as string,\n parameter.Value as string,\n parameter.Version as number\n )\n }\n}\n\nexport class SystemsManagerServiceError extends AWSError {\n operation: SystemsManagerOperation\n\n /**\n * Constructs a SystemsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {SystemsManagerOperation} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SystemsManagerOperation) {\n super(message, code)\n this.name = 'SystemsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SystemsManagerOperation defines all currently implemented Systems Manager operations.\n */\nenum SystemsManagerOperation {\n GetParameter = 'GetParameter',\n}\n"],"names":["AWSClient","awsConfig","serviceName","this","undefined","_host","region","endpoint","host","_scheme","scheme","AWSConfig","options","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","sessionToken","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","EMPTY_SHA256","UNSIGNED_PAYLOAD","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","hasHeader","soughtHeader","headers","Object","keys","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","hostname","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","key","value","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","isArrayBuffer","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","prototype","call","toFormUrlEncoded","form","params","API_VERSION","SQSClient","commonHeaders","queueUrl","messageBody","Action","Version","QueueUrl","MessageBody","messageDeduplicationId","MessageDeduplicationId","messageGroupId","MessageGroupId","signedRequest","sign","res","http","_handleError","parsed","html","Message","parameters","maxResults","MaxResults","nextToken","NextToken","queueNamePrefix","QueueNamePrefix","urls","toArray","e","operation","response","errorCode","error_code","error","awsError","SQSServiceError","id","bodyMD5","v1","v4","uuid","module","exports","byteToHex","i","substr","buf","offset","bth","getRandomValues","bind","window","msCrypto","rnds8","Uint8Array","rnds","r","Math","random","_nodeId","_clockseq","rng","bytesToUuid","_lastMSecs","_lastNSecs","b","node","clockseq","seedBytes","msecs","getTime","nsecs","dt","tl","tmh","n","ii","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","__esModule","d","a","definition","o","defineProperty","enumerable","get","obj","prop","hasOwnProperty","Symbol","toStringTag","KMSOperation","KMSKeySize","KMSClient","_handle_error","ListKeys","json","k","KMSKey","fromJSON","size","Size256","KeyId","NumberOfBytes","GenerateDataKey","KMSDataKey","errorMessage","__type","KMSServiceError","keyArn","keyId","KeyArn","CiphertextBlob","Plaintext","ciphertextBlob","plaintext","S3Client","buckets","children","each","_","bucketDefinition","bucket","forEach","child","nodeName","assign","textContent","creationDate","bucketName","prefix","objects","objectDefinition","lastModified","etag","parseInt","storageClass","objectKey","S3Object","data","Host","uploads","S3MultipartUpload","uploadId","partNumber","S3Part","parts","part","eTag","status","S3ServiceError","S3Bucket","SecretsManagerOperation","SecretsManagerClient","ListSecrets","s","Secret","SecretId","GetSecretValue","secret","description","versionID","tags","uuidv4","Name","Description","SecretString","ClientRequestToken","Tags","CreateSecret","PutSecretValue","recoveryWindow","noRecovery","payload","DeleteSecret","SecretsManagerServiceError","arn","secretString","createdDate","lastAccessedDate","lastChangedDate","ARN","CreatedDate","LastAccessedDate","LastChangedDate","SystemsManagerOperation","SystemsManagerClient","withDecryption","WithDecryption","GetParameter","SystemsManagerParameter","SystemsManagerServiceError","dataType","lastModifiedDate","selector","sourceResult","type","version","parameter","Parameter","DataType","LastModifiedDate","Selector","SourceResult","Type","Value"],"sourceRoot":""} \ No newline at end of file diff --git a/build/index.js b/build/index.js index 037e72a..1f3c463 100644 --- a/build/index.js +++ b/build/index.js @@ -1,2 +1,2 @@ -(()=>{var e={393:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;rc});var c=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"awsConfig",void 0),i(this,"serviceName",void 0),i(this,"_host",void 0),i(this,"_scheme",void 0),this.awsConfig=t,this.serviceName=r}var t,r,n;return t=e,(r=[{key:"host",get:function(){return null==this._host&&(this._host="".concat(this.serviceName,".").concat(this.awsConfig.region,".").concat(this.awsConfig.endpoint)),this._host},set:function(e){this._host=e}},{key:"scheme",get:function(){return null==this._scheme&&(this._scheme=this.awsConfig.scheme),this._scheme},set:function(e){this._scheme=e}}])&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},223:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function i(e){var t="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},i(e)}function a(e,t,r){return a=c()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&s(o,r.prototype),o},a.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;rv,o:()=>d});var d=function(){function e(t){if(f(this,e),p(this,"region",void 0),p(this,"accessKeyId",void 0),p(this,"secretAccessKey",void 0),p(this,"sessionToken",void 0),p(this,"scheme","https"),p(this,"endpoint","amazonaws.com"),!t.region||""===t.region)throw new v('invalid AWS region; reason: expected a valid AWS region name (e.g. "us-east-1"), got `'.concat(t.region,"`"));if(!t.accessKeyId||""===t.accessKeyId)throw new v("invalid AWS access key ID; reason: expected a non empty string, got `".concat(t.accessKeyId,"`"));if(t.accessKeyId.length<16||t.accessKeyId.length>128)throw new v("invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ".concat(t.accessKeyId.length));if(!t.secretAccessKey||""===t.secretAccessKey)throw new v("invalid AWS secret access key; reason: expected a non empty string, got `".concat(t.secretAccessKey,"`"));if(t.secretAccessKey.length<16||t.secretAccessKey.length>128)throw new v("invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ".concat(t.secretAccessKey.length));this.region=t.region,this.accessKeyId=t.accessKeyId,this.secretAccessKey=t.secretAccessKey,void 0!==t.sessionToken&&(this.sessionToken=t.sessionToken),void 0!==t.scheme&&(this.scheme=t.scheme),void 0!==t.endpoint&&(this.endpoint=t.endpoint)}return h(e,null,[{key:"fromEnvironment",value:function(t){return new e({region:__ENV.AWS_REGION,accessKeyId:__ENV.AWS_ACCESS_KEY_ID,secretAccessKey:__ENV.AWS_SECRET_ACCESS_KEY,sessionToken:__ENV.AWS_SESSION_TOKEN,scheme:null==t?void 0:t.scheme,endpoint:null==t?void 0:t.endpoint})}}]),e}(),v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(i,e);var t,r,n=(t=i,r=c(),function(){var e,n=u(t);if(r){var i=u(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return o(this,e)});function i(e){return f(this,i),n.call(this,e)}return h(i)}(i(Error))},592:(e,t,r)=>{"use strict";r.d(t,{$l:()=>o,Aq:()=>m,B3:()=>v,Dz:()=>d,K0:()=>n,NL:()=>u,Qk:()=>i,R$:()=>f,SG:()=>w,U4:()=>h,VR:()=>s,a_:()=>l,al:()=>g,cG:()=>c,mc:()=>p,md:()=>b,n8:()=>j,sH:()=>S,th:()=>O,w1:()=>y,zC:()=>a});var n="X-Amz-Algorithm",o="X-Amz-Credential",i="X-Amz-Date",a="X-Amz-Expires",c="X-Amz-Signature",s="X-Amz-SignedHeaders",u="X-Amz-Security-Token",f="x-amz-content-sha256",l=i.toLowerCase(),h=c.toLowerCase(),p="X-Amz-Target".toLowerCase(),y=u.toLowerCase(),d="authorization",v=[d,l,"date"],b="host",m={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},g="aws4_request",w="AWS4-HMAC-SHA256",O=604800,S="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",j="UNSIGNED-PAYLOAD"},380:(e,t,r)=>{"use strict";r.d(t,{t:()=>y});var n=r(255);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var r=0;r{"use strict";function n(e,t){e=e.toLowerCase();for(var r=0,n=Object.keys(t);rn})},137:(e,t,r)=>{"use strict";r.d(t,{L:()=>j,w:()=>P});var n=r(400),o=r.n(n),i=r(592),a=r(380),c=r(491),s=r(23);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(t){var o=p(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h(this,r)}}function h(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1&&delete e.headers[O]}e.headers[i.a_]=p,this.credentials.sessionToken&&(e.headers[i.w1]=this.credentials.sessionToken),ArrayBuffer.isView(e.body)&&(e.body=e.body.buffer),e.body||(e.body="");var S=this.computePayloadHash(e);!(0,c.L)(i.R$,e.headers)&&this.applyChecksum&&(e.headers[i.R$]=S);var j=this.computeCanonicalHeaders(e,u,l),P=this.calculateSignature(p,m,this.deriveSigningKey(this.credentials,d,v,y),this.createCanonicalRequest(e,j,S));e.headers[i.Dz]="".concat(i.SG," ")+"Credential=".concat(this.credentials.accessKeyId,"/").concat(m,", ")+"SignedHeaders=".concat(Object.keys(j).sort().join(";"),", ")+"Signature=".concat(P);var _="".concat(e.protocol,"://").concat(e.hostname);return e.path&&(_+=e.path),e.query&&(_+="?".concat(this.serializeQueryParameters(e.query))),b({url:_},e)}},{key:"presign",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.signingDate,n=void 0===r?new Date:r,o=t.expiresIn,a=void 0===o?3600:o,c=t.unsignableHeaders,s=t.unhoistableHeaders,u=t.signableHeaders,f=t.signingRegion,l=t.signingService,h=k(n),p=h.longDate,y=h.shortDate,d=f||this.region,v=l||this.service;if(a>i.th)throw new P("Signature version 4 presigned URLs can't be valid for more than 7 days");var m="".concat(y,"/").concat(d,"/").concat(v,"/").concat(i.al),g=this.moveHeadersToQuery(e,{unhoistableHeaders:s});g.headers[i.md]=e.hostname,this.credentials.sessionToken&&(g.query[i.NL]=this.credentials.sessionToken),g.query[i.K0]=i.SG,g.query[i.$l]="".concat(this.credentials.accessKeyId,"/").concat(m),g.query[i.Qk]=p,g.query[i.zC]=a.toString(10);var w=this.computeCanonicalHeaders(g,c,u);g.query[i.VR]=Object.keys(w).sort().join(";");var O=this.deriveSigningKey(this.credentials,v,d,y),S=this.computePayloadHash(e),j=this.createCanonicalRequest(g,w,S);g.query[i.cG]=this.calculateSignature(p,m,O,j);var _="".concat(g.protocol,"://").concat(g.hostname);return g.path&&(_+=g.path),g.query&&(_+="?".concat(this.serializeQueryParameters(g.query))),b({url:_},g)}},{key:"createCanonicalRequest",value:function(e,t,r){var n=Object.keys(t).sort(),o=n.map((function(e){return"".concat(e,":").concat(t[e])})).join("\n"),i=n.join(";");return"".concat(e.method,"\n")+"".concat(this.computeCanonicalURI(e),"\n")+"".concat(this.computeCanonicalQuerystring(e),"\n")+"".concat(o,"\n\n")+"".concat(i,"\n")+"".concat(r)}},{key:"createStringToSign",value:function(e,t,r){var n=o().sha256(r,"hex");return"".concat(i.SG,"\n")+"".concat(e,"\n")+"".concat(t,"\n")+"".concat(n)}},{key:"calculateSignature",value:function(e,t,r,n){var i=this.createStringToSign(e,t,n);return o().hmac("sha256",r,i,"hex")}},{key:"deriveSigningKey",value:function(e,t,r,n){var i=e.secretAccessKey,a=o().hmac("sha256","AWS4"+i,n,"binary"),c=o().hmac("sha256",a,r,"binary"),s=o().hmac("sha256",c,t,"binary");return o().hmac("sha256",s,"aws4_request","binary")}},{key:"computeCanonicalURI",value:function(e){var t=e.path;if(this.uriEscapePath){var r,n=[],o=y(t.split("/"));try{for(o.s();!(r=o.n()).done;){var i=r.value;0!==(null==i?void 0:i.length)&&("."!==i&&(".."===i?n.pop():n.push(i)))}}catch(e){o.e(e)}finally{o.f()}var a=null!=t&&t.startsWith("/")?"/":"",c=n.join("/"),s=n.length>0&&null!=t&&t.endsWith("/")?"/":"",u="".concat(a).concat(c).concat(s);return encodeURIComponent(u).replace(/%2F/g,"/")}return t}},{key:"computeCanonicalQuerystring",value:function(e){var t,r=e.query,n=void 0===r?{}:r,o=[],a={},c=function(e){if(e.toLowerCase()===i.U4)return"continue";o.push(e);var t=n[e];"string"==typeof t?a[e]="".concat(_(e),"=").concat(_(t)):Array.isArray(t)&&(a[e]=t.slice(0).sort().reduce((function(t,r){return t.concat(["".concat(_(e),"=").concat(_(r))])}),[]).join("&"))},s=y(Object.keys(n).sort());try{for(s.s();!(t=s.n()).done;)c(t.value)}catch(e){s.e(e)}finally{s.f()}return o.map((function(e){return a[e]})).filter((function(e){return e})).join("&")}},{key:"computeCanonicalHeaders",value:function(e,t,r){var n,o=e.headers,a={},c=y(Object.keys(o).sort());try{for(c.s();!(n=c.n()).done;){var s=n.value;if(null!=o[s]){var u=s.toLowerCase();(u in i.Aq||null!=t&&t.has(u))&&(!r||r&&!r.has(u))||(a[u]=o[s].trim().replace(/\s+/g," "))}}}catch(e){c.e(e)}finally{c.f()}return a}},{key:"computePayloadHash",value:function(e){var t=e.headers,r=e.body;return t[i.R$]?t[i.R$]:null==r?i.sH:"string"==typeof r||(0,s.e)(r)?o().sha256(r,"hex").toLowerCase():ArrayBuffer.isView(r)?o().sha256(r.buffer,"hex").toLowerCase():i.n8}},{key:"moveHeadersToQuery",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=JSON.parse(JSON.stringify(e)),n=r.headers,o=r.query,i=void 0===o?{}:o,a=0,c=Object.keys(n);a{"use strict";function n(e){return"function"==typeof ArrayBuffer&&(e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e))}function o(e){return Object.keys(e).reduce((function(t,r){var n=e[r];return null!=n&&t.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(n))),t}),[]).join("&")}r.d(t,{C:()=>o,e:()=>n})},41:(e,t,r)=>{"use strict";r.d(t,{SQSClient:()=>P});r(223);var n=r(137),o=r(393),i=r(409),a=r.n(i),c=r(23),s=r(380);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{},n="POST",o={Action:"SendMessage",Version:j,QueueUrl:e,MessageBody:t};void 0!==r.messageDeduplicationId&&(o=l(l({},o),{},{MessageDeduplicationId:r.messageDeduplicationId})),void 0!==r.messageGroupId&&(o=l(l({},o),{},{MessageGroupId:r.messageGroupId}));var i=this.signature.sign({method:"POST",protocol:"https",hostname:this.host,path:"/",headers:l({},this.commonHeaders),body:(0,c.C)(o)},{}),s=a().request(n,i.url,i.body||"",{headers:i.headers});this._handleError("SendMessage",s);var u=s.html("SendMessageResponse > SendMessageResult");return new _(u.find("MessageId").text(),u.find("MD5OfMessageBody").text())}},{key:"listQueues",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="POST",r={Action:"ListQueues",Version:j};void 0!==(null==e?void 0:e.maxResults)&&(r=l(l({},r),{},{MaxResults:e.maxResults})),void 0!==(null==e?void 0:e.nextToken)&&(r=l(l({},r),{},{NextToken:e.nextToken})),void 0!==(null==e?void 0:e.queueNamePrefix)&&(r=l(l({},r),{},{QueueNamePrefix:e.queueNamePrefix}));var n=this.signature.sign({method:"POST",protocol:"https",hostname:this.host,path:"/",headers:l(l({},this.commonHeaders),{},{Host:this.host}),body:(0,c.C)(r)},{}),o=a().request(t,n.url,n.body||"",{headers:n.headers});this._handleError("ListQueues",o);var i=o.html();return{urls:i.find("QueueUrl").toArray().map((function(e){return e.text()})),nextToken:i.find("NextToken").text()||void 0}}},{key:"_handleError",value:function(e,t){var r=t.error_code;if(""!=t.error||0!==r){var o=s.t.parseXML(t.body);if("AuthorizationHeaderMalformed"===o.code)throw new n.w(o.message,o.code);throw new k(o.message,o.code||"unknown",e)}}}]),r}(o.k),_=y((function e(t,r){h(this,e),O(this,"id",void 0),O(this,"bodyMD5",void 0),this.id=t,this.bodyMD5=r})),k=function(e){d(r,e);var t=b(r);function r(e,n,o){var i;return h(this,r),O(g(i=t.call(this,e,n)),"operation",void 0),i.name="SQSServiceError",i.operation=o,i}return y(r)}(s.t)},877:(e,t,r)=>{var n=r(570),o=r(171),i=o;i.v1=n,i.v4=o,e.exports=i},327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},570:(e,t,r)=>{var n,o,i=r(217),a=r(327),c=0,s=0;e.exports=function(e,t,r){var u=t&&r||0,f=t||[],l=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:o;if(null==l||null==h){var p=i();null==l&&(l=n=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==h&&(h=o=16383&(p[6]<<8|p[7]))}var y=void 0!==e.msecs?e.msecs:(new Date).getTime(),d=void 0!==e.nsecs?e.nsecs:s+1,v=y-c+(d-s)/1e4;if(v<0&&void 0===e.clockseq&&(h=h+1&16383),(v<0||y>c)&&void 0===e.nsecs&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=y,s=d,o=h;var b=(1e4*(268435455&(y+=122192928e5))+d)%4294967296;f[u++]=b>>>24&255,f[u++]=b>>>16&255,f[u++]=b>>>8&255,f[u++]=255&b;var m=y/4294967296*1e4&268435455;f[u++]=m>>>8&255,f[u++]=255&m,f[u++]=m>>>24&15|16,f[u++]=m>>>16&255,f[u++]=h>>>8|128,f[u++]=255&h;for(var g=0;g<6;++g)f[u+g]=l[g];return t||a(f)}},171:(e,t,r)=>{var n=r(217),o=r(327);e.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var c=0;c<16;++c)t[i+c]=a[c];return t||o(a)}},400:e=>{"use strict";e.exports=require("k6/crypto")},255:e=>{"use strict";e.exports=require("k6/html")},409:e=>{"use strict";e.exports=require("k6/http")}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{AMZ_CONTENT_SHA256_HEADER:()=>o.R$,AWSConfig:()=>t.o,InvalidAWSConfigError:()=>t.l,InvalidSignatureError:()=>e.w,KMSClient:()=>_,KMSDataKey:()=>C,KMSServiceError:()=>E,S3Bucket:()=>G,S3Client:()=>B,S3Object:()=>U,S3ServiceError:()=>J,SQSClient:()=>De.SQSClient,Secret:()=>le,SecretsManagerClient:()=>fe,SecretsManagerServiceError:()=>he,SignatureV4:()=>e.L,SystemsManagerClient:()=>Ee,SystemsManagerParameter:()=>Te,SystemsManagerServiceError:()=>Ae,UNSIGNED_PAYLOAD:()=>o.n8});var e=r(137),t=r(223),o=r(592),i=r(409),a=r.n(i),c=r(393),s=r(380);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:P.Size256,r=this.signature.sign({method:this.method,protocol:this.awsConfig.scheme,hostname:this.host,path:"/",headers:l(l({},this.commonHeaders),{},O({},o.mc,"TrentService.GenerateDataKey")),body:JSON.stringify({KeyId:e,NumberOfBytes:t})},{}),n=a().request(this.method,r.url,r.body,{headers:r.headers});return this._handle_error(j.GenerateDataKey,n),C.fromJSON(n.json())}},{key:"_handle_error",value:function(t,r){var n=r.error_code;if(0!==n){var o=r.json();if(n>=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new E(i,o.__type,t)}if(1500===n)throw new E("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),k=function(){function e(t,r){h(this,e),O(this,"keyArn",void 0),O(this,"keyId",void 0),this.keyArn=t,this.keyId=r}return y(e,null,[{key:"fromJSON",value:function(t){return new e(t.KeyArn,t.KeyId)}}]),e}(),C=function(){function e(t,r,n){h(this,e),O(this,"id",void 0),O(this,"ciphertextBlob",void 0),O(this,"plaintext",void 0),this.ciphertextBlob=t,this.id=r,this.plaintext=n}return y(e,null,[{key:"fromJSON",value:function(t){return new e(t.CiphertextBlob,t.KeyId,t.Plaintext)}}]),e}(),E=function(e){d(r,e);var t=b(r);function r(e,n,o){var i;return h(this,r),O(g(i=t.call(this,e,n)),"operation",void 0),i.name="KMSServiceError",i.operation=o,i}return y(r)}(s.t);!function(e){e.GenerateDataKey="GenerateDataKey",e.ListKeys="ListKeys"}(j||(j={})),function(e){e[e.Size256=32]="Size256",e[e.Size512=64]="Size512"}(P||(P={}));var T=r(255);function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function D(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R(e,t){for(var r=0;r".concat(e.partNumber,"").concat(e.eTag,"")})).join(""),""),u=this.signature.sign({method:o,protocol:"https",hostname:i,path:"/".concat(t,"?").concat(c),headers:{},body:s},{}),f=a().request(o,u.url,u.body||"",{headers:u.headers});this._handle_error("CompleteMultipartUpload",f)}},{key:"abortMultipartUpload",value:function(e,t,r){var n="DELETE",o="".concat(e,".").concat(this.host),i="uploadId=".concat(r),c=this.signature.sign({method:n,protocol:"https",hostname:o,path:"/".concat(t,"?").concat(i),headers:{}},{}),s=a().request(n,c.url,c.body||"",{headers:c.headers});this._handle_error("AbortMultipartUpload",s)}},{key:"_handle_error",value:function(t,r){var n=r.status,o=r.error_code,i=r.error;if(!(n>=200&&n<300&&""==i&&0===o)){if(301==n||i&&i.startsWith("301"))throw new J("Resource not found","ResourceNotFound",t);var a=s.t.parseXML(r.body);if("AuthorizationHeaderMalformed"===a.code)throw new e.w(a.message,a.code);throw new J(a.message,a.code||"unknown",t)}}}]),n}(c.k),G=x((function e(t,r){D(this,e),H(this,"name",void 0),H(this,"creationDate",void 0),this.name=t,this.creationDate=r})),U=x((function e(t,r,n,o,i,a){D(this,e),H(this,"key",void 0),H(this,"lastModified",void 0),H(this,"etag",void 0),H(this,"size",void 0),H(this,"storageClass",void 0),H(this,"data",void 0),this.key=t,this.lastModified=r,this.etag=n,this.size=o,this.storageClass=i,this.data=a})),V=x((function e(t,r){D(this,e),H(this,"key",void 0),H(this,"uploadId",void 0),this.key=t,this.uploadId=r})),W=x((function e(t,r){D(this,e),H(this,"partNumber",void 0),H(this,"eTag",void 0),this.partNumber=t,this.eTag=r})),J=function(e){N(r,e);var t=K(r);function r(e,n,o){var i;return D(this,r),H(L(i=t.call(this,e,n)),"operation",void 0),i.name="S3ServiceError",i.operation=o,i}return x(r)}(s.t),Q=r(877);function X(e){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(e)}function $(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new he(i,o.__type,t)}if(1500===n)throw new he("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),le=function(){function e(t,r,n,o,i,a){var c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[];Y(this,e),ce(this,"name",void 0),ce(this,"arn",void 0),ce(this,"secret",void 0),ce(this,"createdDate",void 0),ce(this,"lastAccessedDate",void 0),ce(this,"lastChangedDate",void 0),ce(this,"tags",void 0),this.name=t,this.arn=r,this.secret=n,this.createdDate=o,this.lastAccessedDate=i,this.lastChangedDate=a,this.tags=c}return ee(e,null,[{key:"fromJSON",value:function(t){return new e(t.Name,t.ARN,t.SecretString,t.CreatedDate,t.LastAccessedDate,t.LastChangedDate,t.Tags)}}]),e}(),he=function(e){te(r,e);var t=ne(r);function r(e,n,o){var i;return Y(this,r),ce(ie(i=t.call(this,e,n)),"operation",void 0),i.name="SecretsManagerServiceError",i.operation=o,i}return ee(r)}(s.t);function pe(e){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pe(e)}function ye(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function de(e){for(var t=1;t1&&void 0!==arguments[1]&&arguments[1],r=this.signature.sign({method:this.method,protocol:this.awsConfig.scheme,hostname:this.host,path:"/",headers:de(de({},this.commonHeaders),{},_e({},o.mc,"AmazonSSM.GetParameter")),body:JSON.stringify({Name:e,WithDecryption:t})},{}),n=a().request(this.method,r.url,r.body,{headers:r.headers});return this._handle_error(Ce.GetParameter,n),Te.fromJSON(n.json())}},{key:"_handle_error",value:function(t,r){var n=r.error_code;if(0!==n){var o=r.json();if(n>=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new Ae(i,o.__type,t)}if(1500===n)throw new Ae("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),Te=function(){function e(t,r,n,o,i,a,c,s,u){ve(this,e),_e(this,"arn",void 0),_e(this,"dataType",void 0),_e(this,"lastModifiedDate",void 0),_e(this,"name",void 0),_e(this,"selector",void 0),_e(this,"sourceResult",void 0),_e(this,"type",void 0),_e(this,"value",void 0),_e(this,"version",void 0),this.arn=t,this.dataType=r,this.lastModifiedDate=n,this.name=o,this.selector=i,this.sourceResult=a,this.type=c,this.value=s,this.version=u}return me(e,null,[{key:"fromJSON",value:function(t){var r=t.Parameter;return new e(r.ARN,r.DataType,r.LastModifiedDate,r.Name,r.Selector,r.SourceResult,r.Type,r.Value,r.Version)}}]),e}(),Ae=function(e){ge(r,e);var t=Oe(r);function r(e,n,o){var i;return ve(this,r),_e(je(i=t.call(this,e,n)),"operation",void 0),i.name="SystemsManagerServiceError",i.operation=o,i}return me(r)}(s.t);!function(e){e.GetParameter="GetParameter"}(Ce||(Ce={}));var De=r(41)})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); +(()=>{var e={393:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;rc});var c=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"awsConfig",void 0),i(this,"serviceName",void 0),i(this,"_host",void 0),i(this,"_scheme",void 0),this.awsConfig=t,this.serviceName=r}var t,r,n;return t=e,(r=[{key:"host",get:function(){return null==this._host&&(this._host="".concat(this.serviceName,".").concat(this.awsConfig.region,".").concat(this.awsConfig.endpoint)),this._host},set:function(e){this._host=e}},{key:"scheme",get:function(){return null==this._scheme&&(this._scheme=this.awsConfig.scheme),this._scheme},set:function(e){this._scheme=e}}])&&o(t.prototype,r),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},223:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function i(e){var t="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},i(e)}function a(e,t,r){return a=c()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&s(o,r.prototype),o},a.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;rv,o:()=>d});var d=function(){function e(t){if(f(this,e),y(this,"region",void 0),y(this,"accessKeyId",void 0),y(this,"secretAccessKey",void 0),y(this,"sessionToken",void 0),y(this,"scheme","https"),y(this,"endpoint","amazonaws.com"),!t.region||""===t.region)throw new v('invalid AWS region; reason: expected a valid AWS region name (e.g. "us-east-1"), got `'.concat(t.region,"`"));if(!t.accessKeyId||""===t.accessKeyId)throw new v("invalid AWS access key ID; reason: expected a non empty string, got `".concat(t.accessKeyId,"`"));if(t.accessKeyId.length<16||t.accessKeyId.length>128)throw new v("invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ".concat(t.accessKeyId.length));if(!t.secretAccessKey||""===t.secretAccessKey)throw new v("invalid AWS secret access key; reason: expected a non empty string, got `".concat(t.secretAccessKey,"`"));if(t.secretAccessKey.length<16||t.secretAccessKey.length>128)throw new v("invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ".concat(t.secretAccessKey.length));this.region=t.region,this.accessKeyId=t.accessKeyId,this.secretAccessKey=t.secretAccessKey,void 0!==t.sessionToken&&(this.sessionToken=t.sessionToken),void 0!==t.scheme&&(this.scheme=t.scheme),void 0!==t.endpoint&&(this.endpoint=t.endpoint)}return h(e,null,[{key:"fromEnvironment",value:function(t){return new e({region:__ENV.AWS_REGION,accessKeyId:__ENV.AWS_ACCESS_KEY_ID,secretAccessKey:__ENV.AWS_SECRET_ACCESS_KEY,sessionToken:__ENV.AWS_SESSION_TOKEN,scheme:null==t?void 0:t.scheme,endpoint:null==t?void 0:t.endpoint})}}]),e}(),v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(i,e);var t,r,n=(t=i,r=c(),function(){var e,n=u(t);if(r){var i=u(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return o(this,e)});function i(e){return f(this,i),n.call(this,e)}return h(i)}(i(Error))},592:(e,t,r)=>{"use strict";r.d(t,{$l:()=>o,Aq:()=>m,B3:()=>v,Dz:()=>d,K0:()=>n,NL:()=>u,Qk:()=>i,R$:()=>f,SG:()=>w,U4:()=>h,VR:()=>s,a_:()=>l,al:()=>g,cG:()=>c,mc:()=>y,md:()=>b,n8:()=>j,sH:()=>S,th:()=>O,w1:()=>p,zC:()=>a});var n="X-Amz-Algorithm",o="X-Amz-Credential",i="X-Amz-Date",a="X-Amz-Expires",c="X-Amz-Signature",s="X-Amz-SignedHeaders",u="X-Amz-Security-Token",f="x-amz-content-sha256",l=i.toLowerCase(),h=c.toLowerCase(),y="X-Amz-Target".toLowerCase(),p=u.toLowerCase(),d="authorization",v=[d,l,"date"],b="host",m={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},g="aws4_request",w="AWS4-HMAC-SHA256",O=604800,S="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",j="UNSIGNED-PAYLOAD"},380:(e,t,r)=>{"use strict";r.d(t,{t:()=>p});var n=r(255);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var r=0;r{"use strict";function n(e,t){e=e.toLowerCase();for(var r=0,n=Object.keys(t);rn})},137:(e,t,r)=>{"use strict";r.d(t,{L:()=>j,w:()=>P});var n=r(400),o=r.n(n),i=r(592),a=r(380),c=r(491),s=r(23);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=y(e);if(t){var o=y(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return h(this,r)}}function h(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function p(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1&&delete e.headers[O]}e.headers[i.a_]=y,this.credentials.sessionToken&&(e.headers[i.w1]=this.credentials.sessionToken),ArrayBuffer.isView(e.body)&&(e.body=e.body.buffer),e.body||(e.body="");var S=this.computePayloadHash(e);!(0,c.L)(i.R$,e.headers)&&this.applyChecksum&&(e.headers[i.R$]=S);var j=this.computeCanonicalHeaders(e,u,l),P=this.calculateSignature(y,m,this.deriveSigningKey(this.credentials,d,v,p),this.createCanonicalRequest(e,j,S));e.headers[i.Dz]="".concat(i.SG," ")+"Credential=".concat(this.credentials.accessKeyId,"/").concat(m,", ")+"SignedHeaders=".concat(Object.keys(j).sort().join(";"),", ")+"Signature=".concat(P);var _="".concat(e.protocol,"://").concat(e.hostname);return e.path&&(_+=e.path),e.query&&(_+="?".concat(this.serializeQueryParameters(e.query))),b({url:_},e)}},{key:"presign",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.signingDate,n=void 0===r?new Date:r,o=t.expiresIn,a=void 0===o?3600:o,c=t.unsignableHeaders,s=t.unhoistableHeaders,u=t.signableHeaders,f=t.signingRegion,l=t.signingService,h=k(n),y=h.longDate,p=h.shortDate,d=f||this.region,v=l||this.service;if(a>i.th)throw new P("Signature version 4 presigned URLs can't be valid for more than 7 days");var m="".concat(p,"/").concat(d,"/").concat(v,"/").concat(i.al),g=this.moveHeadersToQuery(e,{unhoistableHeaders:s});g.headers[i.md]=e.hostname,this.credentials.sessionToken&&(g.query[i.NL]=this.credentials.sessionToken),g.query[i.K0]=i.SG,g.query[i.$l]="".concat(this.credentials.accessKeyId,"/").concat(m),g.query[i.Qk]=y,g.query[i.zC]=a.toString(10);var w=this.computeCanonicalHeaders(g,c,u);g.query[i.VR]=Object.keys(w).sort().join(";");var O=this.deriveSigningKey(this.credentials,v,d,p),S=this.computePayloadHash(e),j=this.createCanonicalRequest(g,w,S);g.query[i.cG]=this.calculateSignature(y,m,O,j);var _="".concat(g.protocol,"://").concat(g.hostname);return g.path&&(_+=g.path),g.query&&(_+="?".concat(this.serializeQueryParameters(g.query))),b({url:_},g)}},{key:"createCanonicalRequest",value:function(e,t,r){var n=Object.keys(t).sort(),o=n.map((function(e){return"".concat(e,":").concat(t[e])})).join("\n"),i=n.join(";");return"".concat(e.method,"\n")+"".concat(this.computeCanonicalURI(e),"\n")+"".concat(this.computeCanonicalQuerystring(e),"\n")+"".concat(o,"\n\n")+"".concat(i,"\n")+"".concat(r)}},{key:"createStringToSign",value:function(e,t,r){var n=o().sha256(r,"hex");return"".concat(i.SG,"\n")+"".concat(e,"\n")+"".concat(t,"\n")+"".concat(n)}},{key:"calculateSignature",value:function(e,t,r,n){var i=this.createStringToSign(e,t,n);return o().hmac("sha256",r,i,"hex")}},{key:"deriveSigningKey",value:function(e,t,r,n){var i=e.secretAccessKey,a=o().hmac("sha256","AWS4"+i,n,"binary"),c=o().hmac("sha256",a,r,"binary"),s=o().hmac("sha256",c,t,"binary");return o().hmac("sha256",s,"aws4_request","binary")}},{key:"computeCanonicalURI",value:function(e){var t=e.path;if(this.uriEscapePath){var r,n=[],o=p(t.split("/"));try{for(o.s();!(r=o.n()).done;){var i=r.value;0!==(null==i?void 0:i.length)&&("."!==i&&(".."===i?n.pop():n.push(i)))}}catch(e){o.e(e)}finally{o.f()}var a=null!=t&&t.startsWith("/")?"/":"",c=n.join("/"),s=n.length>0&&null!=t&&t.endsWith("/")?"/":"",u="".concat(a).concat(c).concat(s);return encodeURIComponent(u).replace(/%2F/g,"/")}return t}},{key:"computeCanonicalQuerystring",value:function(e){var t,r=e.query,n=void 0===r?{}:r,o=[],a={},c=function(e){if(e.toLowerCase()===i.U4)return"continue";o.push(e);var t=n[e];"string"==typeof t?a[e]="".concat(_(e),"=").concat(_(t)):Array.isArray(t)&&(a[e]=t.slice(0).sort().reduce((function(t,r){return t.concat(["".concat(_(e),"=").concat(_(r))])}),[]).join("&"))},s=p(Object.keys(n).sort());try{for(s.s();!(t=s.n()).done;)c(t.value)}catch(e){s.e(e)}finally{s.f()}return o.map((function(e){return a[e]})).filter((function(e){return e})).join("&")}},{key:"computeCanonicalHeaders",value:function(e,t,r){var n,o=e.headers,a={},c=p(Object.keys(o).sort());try{for(c.s();!(n=c.n()).done;){var s=n.value;if(null!=o[s]){var u=s.toLowerCase();(u in i.Aq||null!=t&&t.has(u))&&(!r||r&&!r.has(u))||(a[u]=o[s].trim().replace(/\s+/g," "))}}}catch(e){c.e(e)}finally{c.f()}return a}},{key:"computePayloadHash",value:function(e){var t=e.headers,r=e.body;return t[i.R$]?t[i.R$]:null==r?i.sH:"string"==typeof r||(0,s.e)(r)?o().sha256(r,"hex").toLowerCase():ArrayBuffer.isView(r)?o().sha256(r.buffer,"hex").toLowerCase():i.n8}},{key:"moveHeadersToQuery",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=JSON.parse(JSON.stringify(e)),n=r.headers,o=r.query,i=void 0===o?{}:o,a=0,c=Object.keys(n);a{"use strict";function n(e){return"function"==typeof ArrayBuffer&&(e instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(e))}function o(e){return Object.keys(e).reduce((function(t,r){var n=e[r];return null!=n&&t.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(n))),t}),[]).join("&")}r.d(t,{C:()=>o,e:()=>n})},41:(e,t,r)=>{"use strict";r.d(t,{SQSClient:()=>P});r(223);var n=r(137),o=r(393),i=r(409),a=r.n(i),c=r(23),s=r(380);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{},n="POST",o={Action:"SendMessage",Version:j,QueueUrl:e,MessageBody:t};void 0!==r.messageDeduplicationId&&(o=l(l({},o),{},{MessageDeduplicationId:r.messageDeduplicationId})),void 0!==r.messageGroupId&&(o=l(l({},o),{},{MessageGroupId:r.messageGroupId}));var i=this.signature.sign({method:"POST",protocol:"https",hostname:this.host,path:"/",headers:l({},this.commonHeaders),body:(0,c.C)(o)},{}),s=a().request(n,i.url,i.body||"",{headers:i.headers});this._handleError("SendMessage",s);var u=s.html("SendMessageResponse > SendMessageResult");return new _(u.find("MessageId").text(),u.find("MD5OfMessageBody").text())}},{key:"listQueues",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="POST",r={Action:"ListQueues",Version:j};void 0!==(null==e?void 0:e.maxResults)&&(r=l(l({},r),{},{MaxResults:e.maxResults})),void 0!==(null==e?void 0:e.nextToken)&&(r=l(l({},r),{},{NextToken:e.nextToken})),void 0!==(null==e?void 0:e.queueNamePrefix)&&(r=l(l({},r),{},{QueueNamePrefix:e.queueNamePrefix}));var n=this.signature.sign({method:"POST",protocol:"https",hostname:this.host,path:"/",headers:l(l({},this.commonHeaders),{},{Host:this.host}),body:(0,c.C)(r)},{}),o=a().request(t,n.url,n.body||"",{headers:n.headers});this._handleError("ListQueues",o);var i=o.html();return{urls:i.find("QueueUrl").toArray().map((function(e){return e.text()})),nextToken:i.find("NextToken").text()||void 0}}},{key:"_handleError",value:function(e,t){var r=t.error_code;if(""!=t.error||0!==r){var o=s.t.parseXML(t.body);if("AuthorizationHeaderMalformed"===o.code)throw new n.w(o.message,o.code);throw new k(o.message,o.code||"unknown",e)}}}]),r}(o.k),_=p((function e(t,r){h(this,e),O(this,"id",void 0),O(this,"bodyMD5",void 0),this.id=t,this.bodyMD5=r})),k=function(e){d(r,e);var t=b(r);function r(e,n,o){var i;return h(this,r),O(g(i=t.call(this,e,n)),"operation",void 0),i.name="SQSServiceError",i.operation=o,i}return p(r)}(s.t)},877:(e,t,r)=>{var n=r(570),o=r(171),i=o;i.v1=n,i.v4=o,e.exports=i},327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},570:(e,t,r)=>{var n,o,i=r(217),a=r(327),c=0,s=0;e.exports=function(e,t,r){var u=t&&r||0,f=t||[],l=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:o;if(null==l||null==h){var y=i();null==l&&(l=n=[1|y[0],y[1],y[2],y[3],y[4],y[5]]),null==h&&(h=o=16383&(y[6]<<8|y[7]))}var p=void 0!==e.msecs?e.msecs:(new Date).getTime(),d=void 0!==e.nsecs?e.nsecs:s+1,v=p-c+(d-s)/1e4;if(v<0&&void 0===e.clockseq&&(h=h+1&16383),(v<0||p>c)&&void 0===e.nsecs&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=p,s=d,o=h;var b=(1e4*(268435455&(p+=122192928e5))+d)%4294967296;f[u++]=b>>>24&255,f[u++]=b>>>16&255,f[u++]=b>>>8&255,f[u++]=255&b;var m=p/4294967296*1e4&268435455;f[u++]=m>>>8&255,f[u++]=255&m,f[u++]=m>>>24&15|16,f[u++]=m>>>16&255,f[u++]=h>>>8|128,f[u++]=255&h;for(var g=0;g<6;++g)f[u+g]=l[g];return t||a(f)}},171:(e,t,r)=>{var n=r(217),o=r(327);e.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var c=0;c<16;++c)t[i+c]=a[c];return t||o(a)}},400:e=>{"use strict";e.exports=require("k6/crypto")},255:e=>{"use strict";e.exports=require("k6/html")},409:e=>{"use strict";e.exports=require("k6/http")}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{AMZ_CONTENT_SHA256_HEADER:()=>o.R$,AWSConfig:()=>t.o,InvalidAWSConfigError:()=>t.l,InvalidSignatureError:()=>e.w,KMSClient:()=>_,KMSDataKey:()=>C,KMSServiceError:()=>E,S3Bucket:()=>G,S3Client:()=>B,S3Object:()=>U,S3ServiceError:()=>J,SQSClient:()=>De.SQSClient,Secret:()=>le,SecretsManagerClient:()=>fe,SecretsManagerServiceError:()=>he,SignatureV4:()=>e.L,SystemsManagerClient:()=>Ee,SystemsManagerParameter:()=>Te,SystemsManagerServiceError:()=>Ae,UNSIGNED_PAYLOAD:()=>o.n8});var e=r(137),t=r(223),o=r(592),i=r(409),a=r.n(i),c=r(393),s=r(380);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:P.Size256,r=this.signature.sign({method:this.method,protocol:this.awsConfig.scheme,hostname:this.host,path:"/",headers:l(l({},this.commonHeaders),{},O({},o.mc,"TrentService.GenerateDataKey")),body:JSON.stringify({KeyId:e,NumberOfBytes:t})},{}),n=a().request(this.method,r.url,r.body,{headers:r.headers});return this._handle_error(j.GenerateDataKey,n),C.fromJSON(n.json())}},{key:"_handle_error",value:function(t,r){var n=r.error_code;if(0!==n){var o=r.json();if(n>=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new E(i,o.__type,t)}if(1500===n)throw new E("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),k=function(){function e(t,r){h(this,e),O(this,"keyArn",void 0),O(this,"keyId",void 0),this.keyArn=t,this.keyId=r}return p(e,null,[{key:"fromJSON",value:function(t){return new e(t.KeyArn,t.KeyId)}}]),e}(),C=function(){function e(t,r,n){h(this,e),O(this,"id",void 0),O(this,"ciphertextBlob",void 0),O(this,"plaintext",void 0),this.ciphertextBlob=t,this.id=r,this.plaintext=n}return p(e,null,[{key:"fromJSON",value:function(t){return new e(t.CiphertextBlob,t.KeyId,t.Plaintext)}}]),e}(),E=function(e){d(r,e);var t=b(r);function r(e,n,o){var i;return h(this,r),O(g(i=t.call(this,e,n)),"operation",void 0),i.name="KMSServiceError",i.operation=o,i}return p(r)}(s.t);!function(e){e.GenerateDataKey="GenerateDataKey",e.ListKeys="ListKeys"}(j||(j={})),function(e){e[e.Size256=32]="Size256",e[e.Size512=64]="Size512"}(P||(P={}));var T=r(255);function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function D(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R(e,t){for(var r=0;r".concat(e.partNumber,"").concat(e.eTag,"")})).join(""),""),s=this.signature.sign({method:o,protocol:this.scheme,hostname:i,path:"/".concat(t),headers:{},body:c,query:{uploadId:"".concat(r)}},{}),u=a().request(o,s.url,s.body||"",{headers:s.headers});this._handle_error("CompleteMultipartUpload",u)}},{key:"abortMultipartUpload",value:function(e,t,r){var n="DELETE",o="".concat(e,".").concat(this.host),i=this.signature.sign({method:n,protocol:this.scheme,hostname:o,path:"/".concat(t),headers:{},query:{uploadId:"".concat(r)}},{}),c=a().request(n,i.url,i.body||"",{headers:i.headers});this._handle_error("AbortMultipartUpload",c)}},{key:"_handle_error",value:function(t,r){var n=r.status,o=r.error_code,i=r.error;if(!(n>=200&&n<300&&""==i&&0===o)){if(301==n||i&&i.startsWith("301"))throw new J("Resource not found","ResourceNotFound",t);var a=s.t.parseXML(r.body);if("AuthorizationHeaderMalformed"===a.code)throw new e.w(a.message,a.code);throw new J(a.message,a.code||"unknown",t)}}}]),n}(c.k),G=x((function e(t,r){D(this,e),H(this,"name",void 0),H(this,"creationDate",void 0),this.name=t,this.creationDate=r})),U=x((function e(t,r,n,o,i,a){D(this,e),H(this,"key",void 0),H(this,"lastModified",void 0),H(this,"etag",void 0),H(this,"size",void 0),H(this,"storageClass",void 0),H(this,"data",void 0),this.key=t,this.lastModified=r,this.etag=n,this.size=o,this.storageClass=i,this.data=a})),V=x((function e(t,r){D(this,e),H(this,"key",void 0),H(this,"uploadId",void 0),this.key=t,this.uploadId=r})),W=x((function e(t,r){D(this,e),H(this,"partNumber",void 0),H(this,"eTag",void 0),this.partNumber=t,this.eTag=r})),J=function(e){N(r,e);var t=K(r);function r(e,n,o){var i;return D(this,r),H(q(i=t.call(this,e,n)),"operation",void 0),i.name="S3ServiceError",i.operation=o,i}return x(r)}(s.t),Q=r(877);function X(e){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(e)}function $(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new he(i,o.__type,t)}if(1500===n)throw new he("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),le=function(){function e(t,r,n,o,i,a){var c=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[];Y(this,e),ce(this,"name",void 0),ce(this,"arn",void 0),ce(this,"secret",void 0),ce(this,"createdDate",void 0),ce(this,"lastAccessedDate",void 0),ce(this,"lastChangedDate",void 0),ce(this,"tags",void 0),this.name=t,this.arn=r,this.secret=n,this.createdDate=o,this.lastAccessedDate=i,this.lastChangedDate=a,this.tags=c}return ee(e,null,[{key:"fromJSON",value:function(t){return new e(t.Name,t.ARN,t.SecretString,t.CreatedDate,t.LastAccessedDate,t.LastChangedDate,t.Tags)}}]),e}(),he=function(e){te(r,e);var t=ne(r);function r(e,n,o){var i;return Y(this,r),ce(ie(i=t.call(this,e,n)),"operation",void 0),i.name="SecretsManagerServiceError",i.operation=o,i}return ee(r)}(s.t);function ye(e){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ye(e)}function pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function de(e){for(var t=1;t1&&void 0!==arguments[1]&&arguments[1],r=this.signature.sign({method:this.method,protocol:this.awsConfig.scheme,hostname:this.host,path:"/",headers:de(de({},this.commonHeaders),{},_e({},o.mc,"AmazonSSM.GetParameter")),body:JSON.stringify({Name:e,WithDecryption:t})},{}),n=a().request(this.method,r.url,r.body,{headers:r.headers});return this._handle_error(Ce.GetParameter,n),Te.fromJSON(n.json())}},{key:"_handle_error",value:function(t,r){var n=r.error_code;if(0!==n){var o=r.json();if(n>=1400&&n<=1499){var i=o.Message||o.message||o.__type;if("InvalidSignatureException"===o.__type)throw new e.w(i,o.__type);throw new Ae(i,o.__type,t)}if(1500===n)throw new Ae("An error occured on the server side","InternalServiceError",t)}}}]),n}(c.k),Te=function(){function e(t,r,n,o,i,a,c,s,u){ve(this,e),_e(this,"arn",void 0),_e(this,"dataType",void 0),_e(this,"lastModifiedDate",void 0),_e(this,"name",void 0),_e(this,"selector",void 0),_e(this,"sourceResult",void 0),_e(this,"type",void 0),_e(this,"value",void 0),_e(this,"version",void 0),this.arn=t,this.dataType=r,this.lastModifiedDate=n,this.name=o,this.selector=i,this.sourceResult=a,this.type=c,this.value=s,this.version=u}return me(e,null,[{key:"fromJSON",value:function(t){var r=t.Parameter;return new e(r.ARN,r.DataType,r.LastModifiedDate,r.Name,r.Selector,r.SourceResult,r.Type,r.Value,r.Version)}}]),e}(),Ae=function(e){ge(r,e);var t=Oe(r);function r(e,n,o){var i;return ve(this,r),_e(je(i=t.call(this,e,n)),"operation",void 0),i.name="SystemsManagerServiceError",i.operation=o,i}return me(r)}(s.t);!function(e){e.GetParameter="GetParameter"}(Ce||(Ce={}));var De=r(41)})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/index.js.map b/build/index.js.map index ad4866b..646d01f 100644 --- a/build/index.js.map +++ b/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":"04BAUO,IAAMA,EAAS,WAWlB,WAAYC,EAAsBC,I,4FAAqB,iHACnDC,KAAKF,UAAYA,EACjBE,KAAKD,YAAcA,CACvB,C,UAiCD,O,EA/BC,G,EAAA,iBAIA,WAII,OAHkBE,MAAdD,KAAKE,QACPF,KAAKE,MAAQ,GAAH,OAAMF,KAAKD,YAAW,YAAIC,KAAKF,UAAUK,OAAM,YAAIH,KAAKF,UAAUM,WAEvEJ,KAAKE,KAChB,EAAC,IAED,SAAgBG,GACZL,KAAKE,MAAQG,CACjB,GAEE,kBAKF,WAKE,OAHoBJ,MAAhBD,KAAKM,UACPN,KAAKM,QAAUN,KAAKF,UAAUS,QAEzBP,KAAKM,OACd,EAEA,IACA,SAAkBC,GAChBP,KAAKM,QAAUC,CACnB,M,8EAAC,EA/CmB,E,ijFCPf,IAAMC,EAAS,WAsFlB,WAAYC,GACR,GADmC,8IApDlB,SAAO,kBAST,kBA4CVA,EAAQN,QAA6B,KAAnBM,EAAQN,OAC3B,MAAM,IAAIO,EAAsB,yFAAD,OAC+DD,EAAQN,OAAM,MAIhH,IAAKM,EAAQE,aAAuC,KAAxBF,EAAQE,YAChC,MAAM,IAAID,EAAsB,wEAAD,OAC8CD,EAAQE,YAAW,MAIpG,GAAIF,EAAQE,YAAYC,OAAS,IAAMH,EAAQE,YAAYC,OAAS,IAChE,MAAM,IAAIF,EAAsB,wFAAD,OAC6DD,EAAQE,YAAYC,SAIp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,EACbhJ,KAAK6X,QAAUA,CACnB,CAwBC,OAtBD,iCAQA,SAAgBpG,GACZ,IAAMqG,EAAYrG,EAAKsG,UAEvB,OAAO,IAAIT,EACPQ,EAAUjB,IACViB,EAAUE,SACVF,EAAUG,iBACVH,EAAUlC,KACVkC,EAAUI,SACVJ,EAAUK,aACVL,EAAUM,KACVN,EAAUO,MACVP,EAAUvM,QAElB,KAAC,EA5G+B,GA+GvBgM,GAA0B,gCAUnC,WAAYnW,EAAiBkC,EAAc0J,GAAoC,MAGjD,OAHiD,WACvD,MAApB,cAAM5L,EAASkC,IAAK,oBACpB,EAAKC,KAAO,6BACZ,EAAKyJ,UAAYA,EAAS,CAC9B,CAAC,aAdkC,CAAS3J,EAAAA,IAoBpB,SAAvB4T,GAAAA,EAAuB,6BAAvBA,KAAAA,GAAuB,K","sources":["webpack://k6-jslib-aws/./src/internal/client.ts","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/./src/internal/sqs.ts","webpack://k6-jslib-aws/./node_modules/uuid/index.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/bytesToUuid.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/rng-browser.js","webpack://k6-jslib-aws/./node_modules/uuid/v1.js","webpack://k6-jslib-aws/./node_modules/uuid/v4.js","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/kms.ts","webpack://k6-jslib-aws/./src/internal/s3.ts","webpack://k6-jslib-aws/./src/internal/secrets-manager.ts","webpack://k6-jslib-aws/./src/internal/ssm.ts"],"sourcesContent":["import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","import { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { SignatureV4, InvalidSignatureError } from './signature'\nimport { HTTPHeaders, SignedHTTPRequest } from './http'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\nimport { toFormUrlEncoded } from './utils'\nimport { AWSError } from './error'\n\nconst API_VERSION = '2012-11-05'\n\nexport class SQSClient extends AWSClient {\n private readonly signature: SignatureV4\n private readonly commonHeaders: HTTPHeaders\n\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'sqs')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken\n },\n uriEscapePath: true,\n applyChecksum: true\n })\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }\n }\n\n /**\n * Delivers a message to the specified queue.\n *\n * @param {string} queueUrl - The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive.\n * @param {string} messageBody - The message to send. The minimum size is one character. The maximum size is 256 KB.\n * @param {Object} options - Options for the request\n * @param {string} [options.messageDeduplicationId] - The message deduplication id.\n * @param {string} [options.messageGroupId] - The message group ID for FIFO queues\n * @returns {Message} - The message that was sent.\n */\n sendMessage(queueUrl: string, messageBody: string, options: { messageDeduplicationId?: string; messageGroupId?: string} = {}): Message {\n const method = 'POST'\n\n let body: any = {\n Action: 'SendMessage',\n Version: API_VERSION,\n QueueUrl: queueUrl,\n MessageBody: messageBody,\n }\n\n if (typeof(options.messageDeduplicationId) !== 'undefined') {\n body = { ...body,\n MessageDeduplicationId: options.messageDeduplicationId\n }\n }\n\n if (typeof(options.messageGroupId) !== 'undefined') {\n body = { ...body,\n MessageGroupId: options.messageGroupId\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('SendMessage', res)\n\n const parsed = res.html('SendMessageResponse > SendMessageResult')\n return new Message(\n parsed.find('MessageId').text(),\n parsed.find('MD5OfMessageBody').text()\n )\n }\n\n /**\n * Returns a list of your queues in the current region.\n *\n * @param {ListQueuesRequestParameters} [parameters={}] request parameters\n * @param {number} [ListQueuesRequestParameters.maxResults] Maximum number of results to include in the response. Value range is 1 to 1000. You must set maxResults to receive a value for nextToken in the response.\n * @param {string} [ListQueuesRequestParameters.nextToken] Pagination token to request the next set of results.\n * @param {string} [ListQueuesRequestParameters.queueNamePrefix] A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * @returns {Object}\n * @returns {string[]} Object.queueUrls - A list of queue URLs, up to 1000 entries.\n * @returns {string} [Object.nextToken] - In the future, you can use NextToken to request the next set of results.\n */\n listQueues(parameters: ListQueuesRequestParameters = {}): ListQueuesResponse {\n const method = 'POST'\n\n let body: any = {\n Action: 'ListQueues',\n Version: API_VERSION,\n }\n\n if (typeof(parameters?.maxResults) !== 'undefined') {\n body = { ...body,\n MaxResults: parameters.maxResults\n }\n }\n\n if (typeof(parameters?.nextToken) !== 'undefined') {\n body = { ...body,\n NextToken: parameters.nextToken\n }\n }\n\n if (typeof(parameters?.queueNamePrefix) !== 'undefined') {\n body = { ...body,\n QueueNamePrefix: parameters.queueNamePrefix\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n 'Host': this.host\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('ListQueues', res)\n\n let parsed = res.html()\n return {\n urls: parsed.find('QueueUrl').toArray().map(e => e.text()),\n nextToken: parsed.find('NextToken').text() || undefined\n }\n }\n\n private _handleError(operation: SQSOperation, response: RefinedResponse) {\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n if (errorMessage == '' && errorCode === 0) {\n return\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new SQSServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/**\n * An Amazon SQS message.\n */\nexport class Message {\n /**\n * A unique identifier for the message.\n * A MessageIdis considered unique across all AWS accounts for an extended period of time.\n */\n id: string\n\n /**\n * An MD5 digest of the non-URL-encoded message body string.\n */\n bodyMD5: string\n\n /**\n * Instantiates a new Message object.\n *\n * @param id\n * @param md5Ofbody\n */\n constructor(id: string, bodyMD5: string) {\n this.id = id\n this.bodyMD5 = bodyMD5\n }\n}\n\n/**\n * SQSServiceError indicates an error occurred while interacting with the SQS API.\n */\nexport class SQSServiceError extends AWSError {\n operation: SQSOperation;\n\n constructor(message: string, code: string, operation: SQSOperation) {\n super(message, code)\n this.name = 'SQSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SQSOperation describes possible SQS operations.\n */\ntype SQSOperation = 'ListQueues' | 'SendMessage'\n\nexport interface SendMessageOptions {\n /*\n * The message deduplication ID for FIFO queues\n */\n messageDeduplicationId?: string\n\n /*\n * The message group ID for FIFO queues\n */\n messageGroupId?: string\n}\n\nexport interface ListQueuesRequestParameters {\n /**\n * Maximum number of results to include in the response. Value range is 1 to 1000.\n */\n maxResults?: number\n /**\n * Pagination token to request the next set of results.\n */\n nextToken?: string\n /**\n * A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * Queue URLs and names are case-sensitive.\n */\n queueNamePrefix?: string\n}\n\nexport interface ListQueuesResponse {\n /**\n * A list of queue URLs, up to 1,000 entries, or the value of MaxResults you sent in the request.\n */\n urls: string[]\n /**\n * Pagination token to include in the next request.\n */\n nextToken?: string\n}","var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","module.exports = require(\"k6/crypto\");","module.exports = require(\"k6/html\");","module.exports = require(\"k6/http\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's KMS service\n */\nexport class KMSClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a KMSClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'kms')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the KMS service\n // are made via the GET or POST method.\n this.method = 'POST'\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Gets a list of all the KMS keys in the caller's AWS\n * account and region.\n *\n * @returns an array of all the available keys\n */\n listKeys(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.ListKeys`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.ListKeys, res)\n\n const json: JSONArray = res.json('Keys') as JSONArray\n return json.map((k) => KMSKey.fromJSON(k as JSONObject))\n }\n\n /**\n * GenerateDataKey returns a unique symmetric data key for use outside of AWS KMS.\n *\n * This operation returns a plaintext copy of the data key and a copy that is encrypted under a symmetric encryption KMS key that you specify.\n * The bytes in the plaintext key are random; they are not related to the caller or the KMS key.\n * You can use the plaintext key to encrypt your data outside of AWS KMS and store the encrypted data key with the encrypted data.\n *\n * To generate a data key, specify the symmetric encryption KMS key that will be used to encrypt the data key.\n * You cannot use an asymmetric KMS key to encrypt data keys.\n *\n * Used to generate data key with the KMS key defined\n * @param {string} id - Specifies the symmetric encryption KMS key that encrypts the data key. Use its key ID, key ARN, alias name, or alias ARN.\n * @param {KMKeySize} size - Specifies the length of the data key in bytes. For example, use the value 64 to generate a 512-bit data key (64 bytes is 512 bits). Default is 32, and generates a 256-bit data key.\n * @throws {KMSServiceError}\n * @throws {InvalidSignatureError}\n * @returns {KMSDataKey} - The generated data key.\n */\n generateDataKey(id: string, size: KMSKeySize = KMSKeySize.Size256): KMSDataKey | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.GenerateDataKey`,\n },\n body: JSON.stringify({ KeyId: id, NumberOfBytes: size }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.GenerateDataKey, res)\n\n return KMSDataKey.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(operation: KMSOperation, response: RefinedResponse) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new KMSServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new KMSServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a KMS key\n */\nexport class KMSKey {\n /**\n * ARN of the key\n */\n keyArn: string\n\n /**\n * Unique identifier of the key\n */\n keyId: string\n\n constructor(keyArn: string, KeyId: string) {\n this.keyArn = keyArn\n this.keyId = KeyId\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSKey(json.KeyArn as string, json.KeyId as string)\n }\n}\n\n/**\n * Class representing a data key\n */\nexport class KMSDataKey {\n /**\n * The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.\n */\n id: string\n\n /**\n * The (base64-encoded) encrypted copy of the data key.\n */\n ciphertextBlob: string\n\n /**\n * The plaintext data key.\n * Use this data key to encrypt your data outside of KMS. Then, remove it from memory as soon as possible.\n */\n plaintext: string\n\n constructor(CiphertextBlob: string, KeyId: string, Plaintext: string) {\n this.ciphertextBlob = CiphertextBlob\n this.id = KeyId\n this.plaintext = Plaintext\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSDataKey(\n json.CiphertextBlob as string,\n json.KeyId as string,\n json.Plaintext as string\n )\n }\n}\n\nexport class KMSServiceError extends AWSError {\n operation: KMSOperation\n\n /**\n * Constructs a KMSServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: KMSOperation) {\n super(message, code)\n this.name = 'KMSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * KMSOperation defines all currently implemented KMS Service operations.\n */\nenum KMSOperation {\n GenerateDataKey = 'GenerateDataKey',\n ListKeys = 'ListKeys',\n}\n\n/**\n * KMSKeyLength describes possible key lenght values for KMS API data key operations.\n */\nenum KMSKeySize {\n Size256 = 32,\n Size512 = 64,\n}\n","import { bytes } from 'k6'\nimport { parseHTML } from 'k6/html'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AWSError } from './error'\nimport { SignedHTTPRequest } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n\n/** Class allowing to interact with Amazon AWS's S3 service */\nexport class S3Client extends AWSClient {\n signature: SignatureV4\n\n /**\n * Create a S3Client\n *\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 's3')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: false,\n applyChecksum: true,\n })\n }\n\n /**\n * Returns a list of all buckets owned by the authenticated sender of the request.\n * To use this operation, you must have the s3:ListAllMyBuckets permission.\n *\n * @return {Array.} buckets - An array of objects describing S3 buckets\n * with the following fields: name, and creationDate.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listBuckets(): Array {\n const method = 'GET'\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: this.host,\n path: '/',\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListBuckets', res)\n\n let buckets: Array = []\n\n const doc = parseHTML(res.body as string)\n\n doc.find('Buckets')\n .children()\n .each((_, bucketDefinition) => {\n let bucket = {}\n\n bucketDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'name':\n Object.assign(bucket, { name: child.textContent() })\n break\n case 'creationdate':\n Object.assign(bucket, {\n creationDate: Date.parse(child.textContent()),\n })\n }\n })\n\n buckets.push(bucket as S3Bucket)\n })\n\n return buckets\n }\n\n /**\n * Returns some or all (up to 1,000) of the objects in a bucket.\n *\n * @param {string} bucketName - Bucket name to list.\n * @param {string?} prefix='' - Limits the response to keys that begin with the specified prefix.\n * @return {Array.} - returns an array of objects describing S3 objects\n * with the following fields: key, lastModified, etag, size and storageClass.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listObjects(bucketName: string, prefix?: string): Array {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/`,\n query: {\n 'list-type': '2',\n prefix: prefix || '',\n },\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListObjectsV2', res)\n\n let objects: Array = []\n\n // Extract the objects definition from\n // the XML response\n parseHTML(res.body as string)\n .find('Contents')\n .each((_, objectDefinition) => {\n let obj = {}\n\n objectDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'key':\n Object.assign(obj, { key: child.textContent() })\n break\n case 'lastmodified':\n Object.assign(obj, { lastModified: Date.parse(child.textContent()) })\n break\n case 'etag':\n Object.assign(obj, { etag: child.textContent() })\n break\n case 'size':\n Object.assign(obj, { size: parseInt(child.textContent()) })\n break\n case 'storageclass':\n Object.assign(obj, { storageClass: child.textContent() })\n }\n })\n\n objects.push(obj as S3Object)\n })\n\n return objects\n }\n /**\n * Retrieves an Object from Amazon S3.\n *\n * To use getObject, you must have `READ` access to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to get.\n * @return {S3Object} - returns the content of the fetched S3 Object.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n getObject(bucketName: string, objectKey: string): S3Object {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('GetObject', res)\n\n return new S3Object(\n objectKey,\n Date.parse(res.headers['Last-Modified']),\n res.headers['ETag'],\n parseInt(res.headers['Content-Length']),\n\n // The X-Amz-Storage-Class header is only set if the storage class is\n // not the default 'STANDARD' one.\n (res.headers['X-Amz-Storage-Class'] ?? 'STANDARD') as StorageClass,\n\n res.body\n )\n }\n /**\n * Adds an object to a bucket.\n *\n * You must have WRITE permissions on a bucket to add an object to it.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to put.\n * @param {string | ArrayBuffer} data - the content of the S3 Object to upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n putObject(bucketName: string, objectKey: string, data: string | ArrayBuffer) {\n // Prepare request\n const method = 'PUT'\n const host = `${this.host}`\n \n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {\n Host: host,\n },\n body: data,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error('PutObject', res)\n }\n\n /**\n * Removes the null version (if there is one) of an object and inserts a delete marker,\n * which becomes the latest version of the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteObject(bucketName: string, objectKey: string): void {\n // Prepare request\n const method = 'DELETE'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('DeleteObject', res)\n }\n\n /**\n * Creates a new multipart upload for a given objectKey.\n * The uploadId returned can be used to upload parts to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @return {S3MultipartUpload} - returns the uploadId of the newly created multipart upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n createMultipartUpload(bucketName: string, objectKey: string): S3MultipartUpload {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n const query = 'uploads'\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('CreateMultipartUpload', res)\n\n return new S3MultipartUpload(\n objectKey,\n parseHTML(res.body as string)\n .find('UploadId')\n .text()\n )\n }\n\n /**\n * Uploads a part in a multipart upload.\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload.\n * @param {number} partNumber - The part number of the part to upload.\n * @param {string | ArrayBuffer} data - The content of the part to upload.\n * @return {S3Part} - returns the ETag of the uploaded part.\n * @throws {S3ServiceError}\n */\n uploadPart(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n partNumber: number,\n data: string | ArrayBuffer\n ): S3Part {\n // Prepare request\n const method = 'PUT'\n const host = `${bucketName}.${this.host}`\n const query = `partNumber=${partNumber}&uploadId=${uploadId}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n body: data,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('UploadPart', res)\n\n return new S3Part(partNumber, res.headers['Etag'])\n }\n\n /**\n * Completes a multipart upload by assembling previously uploaded parts.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to complete.\n * @param {S3Part[]} parts - The parts to assemble.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n completeMultipartUpload(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n parts: S3Part[]\n ) {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n const query = `uploadId=${uploadId}`\n const body = `${parts\n .map(\n (part) =>\n `${part.partNumber}${part.eTag}`\n )\n .join('')}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n body: body,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n\n this._handle_error('CompleteMultipartUpload', res)\n }\n\n /**\n * Aborts a multipart upload.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to abort.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n abortMultipartUpload(bucketName: string, objectKey: string, uploadId: string) {\n // Prepare request\n const method = 'DELETE'\n const host = `${bucketName}.${this.host}`\n const query = `uploadId=${uploadId}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('AbortMultipartUpload', res)\n }\n\n _handle_error(operation: S3Operation, response: RefinedResponse) {\n const status: number = response.status\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n // We consider codes 200-299 as success\n if (status >= 200 && status < 300 && errorMessage == '' && errorCode === 0) {\n return\n }\n\n // A 301 response is returned when the bucket is not found.\n // Generally meaning that either the bucket name is wrong or the\n // region is wrong.\n //\n // See: https://github.com/grafana/k6/issues/2474\n // See: https://github.com/golang/go/issues/49281\n if (status == 301 || (errorMessage && errorMessage.startsWith('301'))) {\n throw new S3ServiceError('Resource not found', 'ResourceNotFound', operation)\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new S3ServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/** Class representing a S3 Bucket */\nexport class S3Bucket {\n name: string\n creationDate: Date\n\n /**\n * Create an S3 Bucket\n *\n * @param {string} name - S3 bucket's name\n * @param {Date} creationDate - S3 bucket's creation date\n */\n constructor(name: string, creationDate: Date) {\n this.name = name\n this.creationDate = creationDate\n }\n}\n\n/** Class representing an S3 Object */\nexport class S3Object {\n key: string\n lastModified: number\n etag: string\n size: number\n storageClass: StorageClass\n data?: string | bytes | null\n\n /**\n * Create an S3 Object\n *\n * @param {string} key - S3 object's key\n * @param {Date} lastModified - S3 object last modification date\n * @param {string} etag - S3 object's etag\n * @param {number} size - S3 object's size\n * @param {StorageClass} storageClass - S3 object's storage class\n * @param {string | bytes | null} data=null - S3 Object's data\n */\n constructor(\n key: string,\n lastModified: number,\n etag: string,\n size: number,\n storageClass: StorageClass,\n data?: string | bytes | null\n ) {\n this.key = key\n this.lastModified = lastModified\n this.etag = etag\n this.size = size\n this.storageClass = storageClass\n this.data = data\n }\n}\n\n/** Class representing a S3 Multipart Upload */\nexport class S3MultipartUpload {\n key: string\n uploadId: string\n\n /**\n * Create an S3 Multipart Upload\n * @param {string} key - S3 object's key\n * @param {string} uploadId - S3 multipart upload id\n */\n\n constructor(key: string, uploadId: string) {\n this.key = key\n this.uploadId = uploadId\n }\n}\n\n/** Class representing a S3 Part */\nexport class S3Part {\n partNumber: number\n eTag: string\n\n /**\n * Create an S3 Part\n * @param {number} partNumber - Part number\n * @param {string} eTag - Part's etag\n */\n\n constructor(partNumber: number, eTag: string) {\n this.partNumber = partNumber\n this.eTag = eTag\n }\n}\n\n/**\n * Error indicating a S3 operation failed\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class S3ServiceError extends AWSError {\n operation: string\n\n /**\n * Constructs a S3ServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: string) {\n super(message, code)\n this.name = 'S3ServiceError'\n this.operation = operation\n }\n}\n\n/**\n * S3Operation describes possible values for S3 API operations,\n * as defined by AWS APIs.\n */\ntype S3Operation =\n | 'ListBuckets'\n | 'ListObjectsV2'\n | 'GetObject'\n | 'PutObject'\n | 'DeleteObject'\n | 'CreateMultipartUpload'\n | 'CompleteMultipartUpload'\n | 'UploadPart'\n | 'AbortMultipartUpload'\n\n/**\n * Describes the class of storage used to store a S3 object.\n */\ntype StorageClass =\n | 'STANDARD'\n | 'REDUCED_REDUNDANCY'\n | 'GLACIER'\n | 'STANDARD_IA'\n | 'INTELLIGENT_TIERING'\n | 'DEEP_ARCHIVE'\n | 'OUTPOSTS'\n | 'GLACIER_IR'\n | undefined\n","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { v4 as uuidv4 } from 'uuid'\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's SecretsManager service\n */\nexport class SecretsManagerClient extends AWSClient {\n /**\n * HTTP Method to use when interacting with the Secrets Manager service.\n */\n method: HTTPMethod\n\n /**\n * HTTP headers to use accross all requests to the Secrets Manager service.\n */\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a SecretsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'secretsmanager')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the Secrets Manager service\n // are made via the GET or POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Returns a list of all secrets owned by the authenticated sender of the request.\n * To use this operation, you must have the secretsmanager:ListSecrets permission.\n *\n * @return {Array.} secrets - An array of objects describing Secret Manager's secrets\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n listSecrets(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.ListSecrets`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.ListSecrets, res)\n const json: JSONArray = res.json('SecretList') as JSONArray\n\n return json.map((s) => Secret.fromJSON(s as JSONObject))\n }\n\n /**\n * Retrieves a secret from Amazon Sercets Manager\n *\n * @param {string} id - The ARN or name of the secret to retrieve.\n * @returns {Secret} - returns the content of the fetched Secret object.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getSecret(id: string): Secret | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.GetSecretValue`,\n },\n body: JSON.stringify({ SecretId: id }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n\n this._handle_error(SecretsManagerOperation.GetSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Creates a new secret\n *\n * Note that this method only supports string-based values at the moment.\n *\n * @param {string} name - The name of the new secret.\n * The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {string} description - The description of the secret.\n * @param {string} versionID=null - Version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * algorithm.\n * @param {Array.} tags=[] - A list of tags to attach to the secret. Each tag is a key and\n * value pair of strings in a JSON text string. Note that tag key names are case sensitive.\n * @returns {Secret} - returns the created secret\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n createSecret(\n name: string,\n secret: string,\n description: string,\n versionID?: string,\n tags?: Array\n ): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.CreateSecret`,\n },\n body: JSON.stringify({\n Name: name,\n Description: description,\n SecretString: secret,\n ClientRequestToken: versionID,\n Tags: tags,\n }),\n },\n {}\n )\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n // headers['X-Amz-Target'] = `${this.serviceName}.CreateSecret`\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.CreateSecret, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n /**\n * Update a secret's value.\n *\n * Note that this method only support string-based values at the moment.\n *\n * @param {string} id - The ARN or name of the secret to update.\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {} versionID=null - A unique identifier for the new version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n putSecretValue(id: string, secret: string, versionID?: string): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.PutSecretValue`,\n },\n body: JSON.stringify({\n SecretId: id,\n SecretString: secret,\n ClientRequestToken: versionID,\n }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.PutSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Deletes a secret and all of its versions.\n *\n * You can specify a recovery window during which you can restore the secret.\n * The minimum recovery window is 7 days. The default recovery window is 30 days.\n *\n * @param {string} secretID - The ARN or name of the secret to delete.\n * @param {number} recoveryWindow - The number of days from 7 to 30 that Secrets Manager\n * waits before permanently deleting the secret.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteSecret(\n id: string,\n { recoveryWindow = 30, noRecovery = false }: { recoveryWindow: number; noRecovery: boolean }\n ) {\n const payload: { [key: string]: string | boolean | number } = {\n SecretId: id,\n }\n\n // noRecovery and recoveryWindow are exclusive parameters\n if (noRecovery === true) {\n payload['ForceDeleteWithoutRecovery'] = true\n } else {\n payload['RecoveryWindowInDays'] = recoveryWindow\n }\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.DeleteSecret`,\n },\n body: JSON.stringify(payload),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.DeleteSecret, res)\n }\n\n _handle_error(\n operation: SecretsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SecretsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SecretsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n// TODO: create a Tags type\n\n/**\n * Class representing a Secret Manager's secret\n */\nexport class Secret {\n name: string\n arn: string\n secret: string\n createdDate: number\n lastAccessedDate: number\n lastChangedDate: number\n tags: Array<{ [key: string]: string }>\n\n /**\n * Constructs a Secret Manager's Secret\n *\n * @param {string} name - The friendly name of the secret.\n * @param {string} arn - The ARN of the secret.\n * @param {number} createdDate - The date and time that this version of the secret was created.\n * @param {number} lastAccessedDate - The last date that this secret was accessed. This value is\n * truncated to midnight of the date and therefore shows only the date, not the time.\n * @param {number} lastChangedDate - The last date and time that this secret was modified in any way.\n * @param {Array.} tags - The list of user-defined tags associated with the secret.\n */\n constructor(\n name: string,\n arn: string,\n secretString: string,\n createdDate: number,\n lastAccessedDate: number,\n lastChangedDate: number,\n tags: Array<{ [key: string]: string }> = []\n ) {\n this.name = name\n this.arn = arn\n this.secret = secretString\n this.createdDate = createdDate\n this.lastAccessedDate = lastAccessedDate\n this.lastChangedDate = lastChangedDate\n this.tags = tags\n }\n\n /**\n * Parses and constructs a Secret Manager's Secret from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {Secret}\n */\n static fromJSON(json: JSONObject) {\n return new Secret(\n json.Name as string,\n json.ARN as string,\n json.SecretString as string,\n json.CreatedDate as number,\n json.LastAccessedDate as number,\n json.LastChangedDate as number,\n json.Tags as Array<{ [key: string]: string }>\n )\n }\n}\n\nexport class SecretsManagerServiceError extends AWSError {\n operation: SecretsManagerOperation\n\n /**\n * Constructs a SecretsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SecretsManagerOperation) {\n super(message, code)\n this.name = 'SecretsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SecretsManagerOperation defines all currently implemented Secrets Manager Service operations.\n */\nenum SecretsManagerOperation {\n ListSecrets = 'ListSecrets',\n GetSecretValue = 'GetSecretValue',\n CreateSecret = 'CreateSecret',\n PutSecretValue = 'PutSecretValue',\n DeleteSecret = 'DeleteSecret',\n}\n","import { JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's Systems Manager service\n */\nexport class SystemsManagerClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n signature: SignatureV4\n\n /**\n * Create a SystemsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'ssm')\n\n // All interactions with the Systems Manager service\n // are made via the POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n }\n\n /**\n * Retrieves a parameter from Amazon Systems Manager\n *\n * @param {string} name - The ARN or name of the parameter to retrieve.\n * @param {boolean} withDecryption - whether returned secure string parameters should be decrypted.\n * @returns {SystemsManagerParameter} - returns the fetched Parameter object.\n * @throws {SystemsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getParameter(\n name: string,\n withDecryption: boolean = false\n ): SystemsManagerParameter | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `AmazonSSM.GetParameter`,\n },\n body: JSON.stringify({ Name: name, WithDecryption: withDecryption }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SystemsManagerOperation.GetParameter, res)\n\n return SystemsManagerParameter.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(\n operation: SystemsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SystemsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SystemsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a Systems Manager's Parameter\n */\nexport class SystemsManagerParameter {\n /**\n * The Amazon Resource Name (ARN) of the parameter.\n */\n arn: string\n\n /**\n * The data type of the parameter, such as text or aws:ec2:image.\n * The default is text.\n */\n dataType: string\n\n /**\n * Date the parameter was last changed or updated and the parameter version was created.\n */\n lastModifiedDate: number\n\n /**\n * The friendly name of the parameter.\n */\n name: string\n\n /**\n * Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n */\n selector: string\n\n /**\n * plies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n */\n sourceResult: string\n\n /**\n * The type of parameter. Valid values include the following: String, StringList, and SecureString.\n */\n type: string\n\n /**\n * The parameter value.\n */\n value: string\n\n /**\n * The parameter version.\n */\n version: number\n\n /**\n * Constructs a Systems Manager's Parameter\n *\n * @param {string} arn - The Amazon Resource Name (ARN) of the parameter.\n * @param {string} dataType - The data type of the parameter, such as text or aws:ec2:image. The default is text.\n * @param {number} lastModifiedDate - Date the parameter was last changed or updated and the parameter version was created.\n * @param {string} name - The friendly name of the parameter.\n * @param {string} selector - Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n * @param {string} sourceResult - Applies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n * @param {string} type - The type of parameter. Valid values include the following: String, StringList, and SecureString.\n * @param {string} value - The parameter value.\n * @param {number} version - The parameter version.\n */\n constructor(\n arn: string,\n dataType: string,\n lastModifiedDate: number,\n name: string,\n selector: string,\n sourceResult: string,\n type: string,\n value: string,\n version: number\n ) {\n this.arn = arn\n this.dataType = dataType\n this.lastModifiedDate = lastModifiedDate\n this.name = name\n this.selector = selector\n this.sourceResult = sourceResult\n this.type = type\n this.value = value\n this.version = version\n }\n\n /**\n * Parses and constructs a Systems Manager's Parameter from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {SystemsManagerParameter}\n */\n static fromJSON(json: JSONObject): SystemsManagerParameter {\n const parameter = json.Parameter as JSONObject\n\n return new SystemsManagerParameter(\n parameter.ARN as string,\n parameter.DataType as string,\n parameter.LastModifiedDate as number,\n parameter.Name as string,\n parameter.Selector as string,\n parameter.SourceResult as string,\n parameter.Type as string,\n parameter.Value as string,\n parameter.Version as number\n )\n }\n}\n\nexport class SystemsManagerServiceError extends AWSError {\n operation: SystemsManagerOperation\n\n /**\n * Constructs a SystemsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {SystemsManagerOperation} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SystemsManagerOperation) {\n super(message, code)\n this.name = 'SystemsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SystemsManagerOperation defines all currently implemented Systems Manager operations.\n */\nenum SystemsManagerOperation {\n GetParameter = 'GetParameter',\n}\n"],"names":["AWSClient","awsConfig","serviceName","this","undefined","_host","region","endpoint","host","_scheme","scheme","AWSConfig","options","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","sessionToken","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","EMPTY_SHA256","UNSIGNED_PAYLOAD","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","hasHeader","soughtHeader","headers","Object","keys","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","hostname","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","key","value","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","isArrayBuffer","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","prototype","call","toFormUrlEncoded","form","params","API_VERSION","SQSClient","commonHeaders","queueUrl","messageBody","Action","Version","QueueUrl","MessageBody","messageDeduplicationId","MessageDeduplicationId","messageGroupId","MessageGroupId","signedRequest","sign","res","http","_handleError","parsed","html","Message","parameters","maxResults","MaxResults","nextToken","NextToken","queueNamePrefix","QueueNamePrefix","urls","toArray","e","operation","response","errorCode","error_code","error","awsError","SQSServiceError","id","bodyMD5","v1","v4","uuid","module","exports","byteToHex","i","substr","buf","offset","bth","getRandomValues","bind","window","msCrypto","rnds8","Uint8Array","rnds","r","Math","random","_nodeId","_clockseq","rng","bytesToUuid","_lastMSecs","_lastNSecs","b","node","clockseq","seedBytes","msecs","getTime","nsecs","dt","tl","tmh","n","ii","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","__esModule","d","a","definition","o","defineProperty","enumerable","get","obj","prop","hasOwnProperty","Symbol","toStringTag","KMSOperation","KMSKeySize","KMSClient","_handle_error","ListKeys","json","k","KMSKey","fromJSON","size","Size256","KeyId","NumberOfBytes","GenerateDataKey","KMSDataKey","errorMessage","__type","KMSServiceError","keyArn","keyId","KeyArn","CiphertextBlob","Plaintext","ciphertextBlob","plaintext","S3Client","buckets","children","each","_","bucketDefinition","bucket","forEach","child","nodeName","assign","textContent","creationDate","bucketName","prefix","objects","objectDefinition","lastModified","etag","parseInt","storageClass","objectKey","S3Object","data","Host","S3MultipartUpload","uploadId","partNumber","S3Part","parts","part","eTag","status","S3ServiceError","S3Bucket","SecretsManagerOperation","SecretsManagerClient","ListSecrets","s","Secret","SecretId","GetSecretValue","secret","description","versionID","tags","uuidv4","Name","Description","SecretString","ClientRequestToken","Tags","CreateSecret","PutSecretValue","recoveryWindow","noRecovery","payload","DeleteSecret","SecretsManagerServiceError","arn","secretString","createdDate","lastAccessedDate","lastChangedDate","ARN","CreatedDate","LastAccessedDate","LastChangedDate","SystemsManagerOperation","SystemsManagerClient","withDecryption","WithDecryption","GetParameter","SystemsManagerParameter","SystemsManagerServiceError","dataType","lastModifiedDate","selector","sourceResult","type","version","parameter","Parameter","DataType","LastModifiedDate","Selector","SourceResult","Type","Value"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":"04BAUO,IAAMA,EAAS,WAWlB,WAAYC,EAAsBC,I,4FAAqB,iHACnDC,KAAKF,UAAYA,EACjBE,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ASkC,IAAK,oBACpB,EAAKC,KAAO,6BACZ,EAAKyJ,UAAYA,EAAS,CAC9B,CAAC,aAdkC,CAAS3J,EAAAA,IAoBpB,SAAvB6T,GAAAA,EAAuB,6BAAvBA,KAAAA,GAAuB,K","sources":["webpack://k6-jslib-aws/./src/internal/client.ts","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/./src/internal/sqs.ts","webpack://k6-jslib-aws/./node_modules/uuid/index.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/bytesToUuid.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/rng-browser.js","webpack://k6-jslib-aws/./node_modules/uuid/v1.js","webpack://k6-jslib-aws/./node_modules/uuid/v4.js","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/kms.ts","webpack://k6-jslib-aws/./src/internal/s3.ts","webpack://k6-jslib-aws/./src/internal/secrets-manager.ts","webpack://k6-jslib-aws/./src/internal/ssm.ts"],"sourcesContent":["import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","import { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { SignatureV4, InvalidSignatureError } from './signature'\nimport { HTTPHeaders, SignedHTTPRequest } from './http'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\nimport { toFormUrlEncoded } from './utils'\nimport { AWSError } from './error'\n\nconst API_VERSION = '2012-11-05'\n\nexport class SQSClient extends AWSClient {\n private readonly signature: SignatureV4\n private readonly commonHeaders: HTTPHeaders\n\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'sqs')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken\n },\n uriEscapePath: true,\n applyChecksum: true\n })\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }\n }\n\n /**\n * Delivers a message to the specified queue.\n *\n * @param {string} queueUrl - The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive.\n * @param {string} messageBody - The message to send. The minimum size is one character. The maximum size is 256 KB.\n * @param {Object} options - Options for the request\n * @param {string} [options.messageDeduplicationId] - The message deduplication id.\n * @param {string} [options.messageGroupId] - The message group ID for FIFO queues\n * @returns {Message} - The message that was sent.\n */\n sendMessage(queueUrl: string, messageBody: string, options: { messageDeduplicationId?: string; messageGroupId?: string} = {}): Message {\n const method = 'POST'\n\n let body: any = {\n Action: 'SendMessage',\n Version: API_VERSION,\n QueueUrl: queueUrl,\n MessageBody: messageBody,\n }\n\n if (typeof(options.messageDeduplicationId) !== 'undefined') {\n body = { ...body,\n MessageDeduplicationId: options.messageDeduplicationId\n }\n }\n\n if (typeof(options.messageGroupId) !== 'undefined') {\n body = { ...body,\n MessageGroupId: options.messageGroupId\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('SendMessage', res)\n\n const parsed = res.html('SendMessageResponse > SendMessageResult')\n return new Message(\n parsed.find('MessageId').text(),\n parsed.find('MD5OfMessageBody').text()\n )\n }\n\n /**\n * Returns a list of your queues in the current region.\n *\n * @param {ListQueuesRequestParameters} [parameters={}] request parameters\n * @param {number} [ListQueuesRequestParameters.maxResults] Maximum number of results to include in the response. Value range is 1 to 1000. You must set maxResults to receive a value for nextToken in the response.\n * @param {string} [ListQueuesRequestParameters.nextToken] Pagination token to request the next set of results.\n * @param {string} [ListQueuesRequestParameters.queueNamePrefix] A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * @returns {Object}\n * @returns {string[]} Object.queueUrls - A list of queue URLs, up to 1000 entries.\n * @returns {string} [Object.nextToken] - In the future, you can use NextToken to request the next set of results.\n */\n listQueues(parameters: ListQueuesRequestParameters = {}): ListQueuesResponse {\n const method = 'POST'\n\n let body: any = {\n Action: 'ListQueues',\n Version: API_VERSION,\n }\n\n if (typeof(parameters?.maxResults) !== 'undefined') {\n body = { ...body,\n MaxResults: parameters.maxResults\n }\n }\n\n if (typeof(parameters?.nextToken) !== 'undefined') {\n body = { ...body,\n NextToken: parameters.nextToken\n }\n }\n\n if (typeof(parameters?.queueNamePrefix) !== 'undefined') {\n body = { ...body,\n QueueNamePrefix: parameters.queueNamePrefix\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n 'Host': this.host\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('ListQueues', res)\n\n let parsed = res.html()\n return {\n urls: parsed.find('QueueUrl').toArray().map(e => e.text()),\n nextToken: parsed.find('NextToken').text() || undefined\n }\n }\n\n private _handleError(operation: SQSOperation, response: RefinedResponse) {\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n if (errorMessage == '' && errorCode === 0) {\n return\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new SQSServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/**\n * An Amazon SQS message.\n */\nexport class Message {\n /**\n * A unique identifier for the message.\n * A MessageIdis considered unique across all AWS accounts for an extended period of time.\n */\n id: string\n\n /**\n * An MD5 digest of the non-URL-encoded message body string.\n */\n bodyMD5: string\n\n /**\n * Instantiates a new Message object.\n *\n * @param id\n * @param md5Ofbody\n */\n constructor(id: string, bodyMD5: string) {\n this.id = id\n this.bodyMD5 = bodyMD5\n }\n}\n\n/**\n * SQSServiceError indicates an error occurred while interacting with the SQS API.\n */\nexport class SQSServiceError extends AWSError {\n operation: SQSOperation;\n\n constructor(message: string, code: string, operation: SQSOperation) {\n super(message, code)\n this.name = 'SQSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SQSOperation describes possible SQS operations.\n */\ntype SQSOperation = 'ListQueues' | 'SendMessage'\n\nexport interface SendMessageOptions {\n /*\n * The message deduplication ID for FIFO queues\n */\n messageDeduplicationId?: string\n\n /*\n * The message group ID for FIFO queues\n */\n messageGroupId?: string\n}\n\nexport interface ListQueuesRequestParameters {\n /**\n * Maximum number of results to include in the response. Value range is 1 to 1000.\n */\n maxResults?: number\n /**\n * Pagination token to request the next set of results.\n */\n nextToken?: string\n /**\n * A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * Queue URLs and names are case-sensitive.\n */\n queueNamePrefix?: string\n}\n\nexport interface ListQueuesResponse {\n /**\n * A list of queue URLs, up to 1,000 entries, or the value of MaxResults you sent in the request.\n */\n urls: string[]\n /**\n * Pagination token to include in the next request.\n */\n nextToken?: string\n}","var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","module.exports = require(\"k6/crypto\");","module.exports = require(\"k6/html\");","module.exports = require(\"k6/http\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's KMS service\n */\nexport class KMSClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a KMSClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'kms')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the KMS service\n // are made via the GET or POST method.\n this.method = 'POST'\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Gets a list of all the KMS keys in the caller's AWS\n * account and region.\n *\n * @returns an array of all the available keys\n */\n listKeys(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.ListKeys`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.ListKeys, res)\n\n const json: JSONArray = res.json('Keys') as JSONArray\n return json.map((k) => KMSKey.fromJSON(k as JSONObject))\n }\n\n /**\n * GenerateDataKey returns a unique symmetric data key for use outside of AWS KMS.\n *\n * This operation returns a plaintext copy of the data key and a copy that is encrypted under a symmetric encryption KMS key that you specify.\n * The bytes in the plaintext key are random; they are not related to the caller or the KMS key.\n * You can use the plaintext key to encrypt your data outside of AWS KMS and store the encrypted data key with the encrypted data.\n *\n * To generate a data key, specify the symmetric encryption KMS key that will be used to encrypt the data key.\n * You cannot use an asymmetric KMS key to encrypt data keys.\n *\n * Used to generate data key with the KMS key defined\n * @param {string} id - Specifies the symmetric encryption KMS key that encrypts the data key. Use its key ID, key ARN, alias name, or alias ARN.\n * @param {KMKeySize} size - Specifies the length of the data key in bytes. For example, use the value 64 to generate a 512-bit data key (64 bytes is 512 bits). Default is 32, and generates a 256-bit data key.\n * @throws {KMSServiceError}\n * @throws {InvalidSignatureError}\n * @returns {KMSDataKey} - The generated data key.\n */\n generateDataKey(id: string, size: KMSKeySize = KMSKeySize.Size256): KMSDataKey | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.GenerateDataKey`,\n },\n body: JSON.stringify({ KeyId: id, NumberOfBytes: size }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.GenerateDataKey, res)\n\n return KMSDataKey.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(operation: KMSOperation, response: RefinedResponse) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new KMSServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new KMSServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a KMS key\n */\nexport class KMSKey {\n /**\n * ARN of the key\n */\n keyArn: string\n\n /**\n * Unique identifier of the key\n */\n keyId: string\n\n constructor(keyArn: string, KeyId: string) {\n this.keyArn = keyArn\n this.keyId = KeyId\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSKey(json.KeyArn as string, json.KeyId as string)\n }\n}\n\n/**\n * Class representing a data key\n */\nexport class KMSDataKey {\n /**\n * The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.\n */\n id: string\n\n /**\n * The (base64-encoded) encrypted copy of the data key.\n */\n ciphertextBlob: string\n\n /**\n * The plaintext data key.\n * Use this data key to encrypt your data outside of KMS. Then, remove it from memory as soon as possible.\n */\n plaintext: string\n\n constructor(CiphertextBlob: string, KeyId: string, Plaintext: string) {\n this.ciphertextBlob = CiphertextBlob\n this.id = KeyId\n this.plaintext = Plaintext\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSDataKey(\n json.CiphertextBlob as string,\n json.KeyId as string,\n json.Plaintext as string\n )\n }\n}\n\nexport class KMSServiceError extends AWSError {\n operation: KMSOperation\n\n /**\n * Constructs a KMSServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: KMSOperation) {\n super(message, code)\n this.name = 'KMSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * KMSOperation defines all currently implemented KMS Service operations.\n */\nenum KMSOperation {\n GenerateDataKey = 'GenerateDataKey',\n ListKeys = 'ListKeys',\n}\n\n/**\n * KMSKeyLength describes possible key lenght values for KMS API data key operations.\n */\nenum KMSKeySize {\n Size256 = 32,\n Size512 = 64,\n}\n","import { bytes } from 'k6'\nimport { parseHTML } from 'k6/html'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AWSError } from './error'\nimport { SignedHTTPRequest } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n\n/** Class allowing to interact with Amazon AWS's S3 service */\nexport class S3Client extends AWSClient {\n signature: SignatureV4\n\n /**\n * Create a S3Client\n *\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 's3')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: false,\n applyChecksum: true,\n })\n }\n\n /**\n * Returns a list of all buckets owned by the authenticated sender of the request.\n * To use this operation, you must have the s3:ListAllMyBuckets permission.\n *\n * @return {Array.} buckets - An array of objects describing S3 buckets\n * with the following fields: name, and creationDate.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listBuckets(): Array {\n const method = 'GET'\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: this.host,\n path: '/',\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListBuckets', res)\n\n let buckets: Array = []\n\n const doc = parseHTML(res.body as string)\n\n doc.find('Buckets')\n .children()\n .each((_, bucketDefinition) => {\n let bucket = {}\n\n bucketDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'name':\n Object.assign(bucket, { name: child.textContent() })\n break\n case 'creationdate':\n Object.assign(bucket, {\n creationDate: Date.parse(child.textContent()),\n })\n }\n })\n\n buckets.push(bucket as S3Bucket)\n })\n\n return buckets\n }\n\n /**\n * Returns some or all (up to 1,000) of the objects in a bucket.\n *\n * @param {string} bucketName - Bucket name to list.\n * @param {string?} prefix='' - Limits the response to keys that begin with the specified prefix.\n * @return {Array.} - returns an array of objects describing S3 objects\n * with the following fields: key, lastModified, etag, size and storageClass.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listObjects(bucketName: string, prefix?: string): Array {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/`,\n query: {\n 'list-type': '2',\n prefix: prefix || '',\n },\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListObjectsV2', res)\n\n let objects: Array = []\n\n // Extract the objects definition from\n // the XML response\n parseHTML(res.body as string)\n .find('Contents')\n .each((_, objectDefinition) => {\n let obj = {}\n\n objectDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'key':\n Object.assign(obj, { key: child.textContent() })\n break\n case 'lastmodified':\n Object.assign(obj, { lastModified: Date.parse(child.textContent()) })\n break\n case 'etag':\n Object.assign(obj, { etag: child.textContent() })\n break\n case 'size':\n Object.assign(obj, { size: parseInt(child.textContent()) })\n break\n case 'storageclass':\n Object.assign(obj, { storageClass: child.textContent() })\n }\n })\n\n objects.push(obj as S3Object)\n })\n\n return objects\n }\n /**\n * Retrieves an Object from Amazon S3.\n *\n * To use getObject, you must have `READ` access to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to get.\n * @return {S3Object} - returns the content of the fetched S3 Object.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n getObject(bucketName: string, objectKey: string): S3Object {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('GetObject', res)\n\n return new S3Object(\n objectKey,\n Date.parse(res.headers['Last-Modified']),\n res.headers['ETag'],\n parseInt(res.headers['Content-Length']),\n\n // The X-Amz-Storage-Class header is only set if the storage class is\n // not the default 'STANDARD' one.\n (res.headers['X-Amz-Storage-Class'] ?? 'STANDARD') as StorageClass,\n\n res.body\n )\n }\n /**\n * Adds an object to a bucket.\n *\n * You must have WRITE permissions on a bucket to add an object to it.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to put.\n * @param {string | ArrayBuffer} data - the content of the S3 Object to upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n putObject(bucketName: string, objectKey: string, data: string | ArrayBuffer) {\n // Prepare request\n const method = 'PUT'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {\n Host: host,\n },\n body: data,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error('PutObject', res)\n }\n\n /**\n * Removes the null version (if there is one) of an object and inserts a delete marker,\n * which becomes the latest version of the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteObject(bucketName: string, objectKey: string): void {\n // Prepare request\n const method = 'DELETE'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('DeleteObject', res)\n }\n\n /**\n * Creates a new multipart upload for a given objectKey.\n * The uploadId returned can be used to upload parts to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to upload.\n * @return {S3MultipartUpload} - returns the uploadId of the newly created multipart upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n createMultipartUpload(bucketName: string, objectKey: string): S3MultipartUpload {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n query: { uploads: '' },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('CreateMultipartUpload', res)\n\n return new S3MultipartUpload(\n objectKey,\n parseHTML(res.body as string)\n .find('UploadId')\n .text()\n )\n }\n\n /**\n * Uploads a part in a multipart upload.\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to upload.\n * @param {string} uploadId - The uploadId of the multipart upload.\n * @param {number} partNumber - The part number of the part to upload.\n * @param {string | ArrayBuffer} data - The content of the part to upload.\n * @return {S3Part} - returns the ETag of the uploaded part.\n * @throws {S3ServiceError}\n */\n uploadPart(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n partNumber: number,\n data: string | ArrayBuffer\n ): S3Part {\n // Prepare request\n const method = 'PUT'\n const host = `${bucketName}.${this.host}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n body: data,\n query: {\n partNumber: `${partNumber}`,\n uploadId: `${uploadId}`,\n },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('UploadPart', res)\n\n return new S3Part(partNumber, res.headers['Etag'])\n }\n\n /**\n * Completes a multipart upload by assembling previously uploaded parts.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to complete.\n * @param {S3Part[]} parts - The parts to assemble.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n completeMultipartUpload(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n parts: S3Part[]\n ) {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n const body = `${parts\n .map(\n (part) =>\n `${part.partNumber}${part.eTag}`\n )\n .join('')}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n body: body,\n query: {\n uploadId: `${uploadId}`,\n },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n\n this._handle_error('CompleteMultipartUpload', res)\n }\n\n /**\n * Aborts a multipart upload.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to abort.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n abortMultipartUpload(bucketName: string, objectKey: string, uploadId: string) {\n // Prepare request\n const method = 'DELETE'\n const host = `${bucketName}.${this.host}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n query: {\n uploadId: `${uploadId}`,\n },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('AbortMultipartUpload', res)\n }\n\n _handle_error(operation: S3Operation, response: RefinedResponse) {\n const status: number = response.status\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n // We consider codes 200-299 as success\n if (status >= 200 && status < 300 && errorMessage == '' && errorCode === 0) {\n return\n }\n\n // A 301 response is returned when the bucket is not found.\n // Generally meaning that either the bucket name is wrong or the\n // region is wrong.\n //\n // See: https://github.com/grafana/k6/issues/2474\n // See: https://github.com/golang/go/issues/49281\n if (status == 301 || (errorMessage && errorMessage.startsWith('301'))) {\n throw new S3ServiceError('Resource not found', 'ResourceNotFound', operation)\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new S3ServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/** Class representing a S3 Bucket */\nexport class S3Bucket {\n name: string\n creationDate: Date\n\n /**\n * Create an S3 Bucket\n *\n * @param {string} name - S3 bucket's name\n * @param {Date} creationDate - S3 bucket's creation date\n */\n constructor(name: string, creationDate: Date) {\n this.name = name\n this.creationDate = creationDate\n }\n}\n\n/** Class representing an S3 Object */\nexport class S3Object {\n key: string\n lastModified: number\n etag: string\n size: number\n storageClass: StorageClass\n data?: string | bytes | null\n\n /**\n * Create an S3 Object\n *\n * @param {string} key - S3 object's key\n * @param {Date} lastModified - S3 object last modification date\n * @param {string} etag - S3 object's etag\n * @param {number} size - S3 object's size\n * @param {StorageClass} storageClass - S3 object's storage class\n * @param {string | bytes | null} data=null - S3 Object's data\n */\n constructor(\n key: string,\n lastModified: number,\n etag: string,\n size: number,\n storageClass: StorageClass,\n data?: string | bytes | null\n ) {\n this.key = key\n this.lastModified = lastModified\n this.etag = etag\n this.size = size\n this.storageClass = storageClass\n this.data = data\n }\n}\n\n/** Class representing a S3 Multipart Upload */\nexport class S3MultipartUpload {\n key: string\n uploadId: string\n\n /**\n * Create an S3 Multipart Upload\n * @param {string} key - S3 object's key\n * @param {string} uploadId - S3 multipart upload id\n */\n\n constructor(key: string, uploadId: string) {\n this.key = key\n this.uploadId = uploadId\n }\n}\n\n/** Class representing a S3 Part */\nexport class S3Part {\n partNumber: number\n eTag: string\n\n /**\n * Create an S3 Part\n * @param {number} partNumber - Part number\n * @param {string} eTag - Part's etag\n */\n\n constructor(partNumber: number, eTag: string) {\n this.partNumber = partNumber\n this.eTag = eTag\n }\n}\n\n/**\n * Error indicating a S3 operation failed\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class S3ServiceError extends AWSError {\n operation: string\n\n /**\n * Constructs a S3ServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: string) {\n super(message, code)\n this.name = 'S3ServiceError'\n this.operation = operation\n }\n}\n\n/**\n * S3Operation describes possible values for S3 API operations,\n * as defined by AWS APIs.\n */\ntype S3Operation =\n | 'ListBuckets'\n | 'ListObjectsV2'\n | 'GetObject'\n | 'PutObject'\n | 'DeleteObject'\n | 'CreateMultipartUpload'\n | 'CompleteMultipartUpload'\n | 'UploadPart'\n | 'AbortMultipartUpload'\n\n/**\n * Describes the class of storage used to store a S3 object.\n */\ntype StorageClass =\n | 'STANDARD'\n | 'REDUCED_REDUNDANCY'\n | 'GLACIER'\n | 'STANDARD_IA'\n | 'INTELLIGENT_TIERING'\n | 'DEEP_ARCHIVE'\n | 'OUTPOSTS'\n | 'GLACIER_IR'\n | undefined\n","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { v4 as uuidv4 } from 'uuid'\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's SecretsManager service\n */\nexport class SecretsManagerClient extends AWSClient {\n /**\n * HTTP Method to use when interacting with the Secrets Manager service.\n */\n method: HTTPMethod\n\n /**\n * HTTP headers to use accross all requests to the Secrets Manager service.\n */\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a SecretsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'secretsmanager')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the Secrets Manager service\n // are made via the GET or POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Returns a list of all secrets owned by the authenticated sender of the request.\n * To use this operation, you must have the secretsmanager:ListSecrets permission.\n *\n * @return {Array.} secrets - An array of objects describing Secret Manager's secrets\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n listSecrets(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.ListSecrets`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.ListSecrets, res)\n const json: JSONArray = res.json('SecretList') as JSONArray\n\n return json.map((s) => Secret.fromJSON(s as JSONObject))\n }\n\n /**\n * Retrieves a secret from Amazon Sercets Manager\n *\n * @param {string} id - The ARN or name of the secret to retrieve.\n * @returns {Secret} - returns the content of the fetched Secret object.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getSecret(id: string): Secret | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.GetSecretValue`,\n },\n body: JSON.stringify({ SecretId: id }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n\n this._handle_error(SecretsManagerOperation.GetSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Creates a new secret\n *\n * Note that this method only supports string-based values at the moment.\n *\n * @param {string} name - The name of the new secret.\n * The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {string} description - The description of the secret.\n * @param {string} versionID=null - Version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * algorithm.\n * @param {Array.} tags=[] - A list of tags to attach to the secret. Each tag is a key and\n * value pair of strings in a JSON text string. Note that tag key names are case sensitive.\n * @returns {Secret} - returns the created secret\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n createSecret(\n name: string,\n secret: string,\n description: string,\n versionID?: string,\n tags?: Array\n ): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.CreateSecret`,\n },\n body: JSON.stringify({\n Name: name,\n Description: description,\n SecretString: secret,\n ClientRequestToken: versionID,\n Tags: tags,\n }),\n },\n {}\n )\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n // headers['X-Amz-Target'] = `${this.serviceName}.CreateSecret`\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.CreateSecret, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n /**\n * Update a secret's value.\n *\n * Note that this method only support string-based values at the moment.\n *\n * @param {string} id - The ARN or name of the secret to update.\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {} versionID=null - A unique identifier for the new version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n putSecretValue(id: string, secret: string, versionID?: string): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.PutSecretValue`,\n },\n body: JSON.stringify({\n SecretId: id,\n SecretString: secret,\n ClientRequestToken: versionID,\n }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.PutSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Deletes a secret and all of its versions.\n *\n * You can specify a recovery window during which you can restore the secret.\n * The minimum recovery window is 7 days. The default recovery window is 30 days.\n *\n * @param {string} secretID - The ARN or name of the secret to delete.\n * @param {number} recoveryWindow - The number of days from 7 to 30 that Secrets Manager\n * waits before permanently deleting the secret.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteSecret(\n id: string,\n { recoveryWindow = 30, noRecovery = false }: { recoveryWindow: number; noRecovery: boolean }\n ) {\n const payload: { [key: string]: string | boolean | number } = {\n SecretId: id,\n }\n\n // noRecovery and recoveryWindow are exclusive parameters\n if (noRecovery === true) {\n payload['ForceDeleteWithoutRecovery'] = true\n } else {\n payload['RecoveryWindowInDays'] = recoveryWindow\n }\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.DeleteSecret`,\n },\n body: JSON.stringify(payload),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.DeleteSecret, res)\n }\n\n _handle_error(\n operation: SecretsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SecretsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SecretsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n// TODO: create a Tags type\n\n/**\n * Class representing a Secret Manager's secret\n */\nexport class Secret {\n name: string\n arn: string\n secret: string\n createdDate: number\n lastAccessedDate: number\n lastChangedDate: number\n tags: Array<{ [key: string]: string }>\n\n /**\n * Constructs a Secret Manager's Secret\n *\n * @param {string} name - The friendly name of the secret.\n * @param {string} arn - The ARN of the secret.\n * @param {number} createdDate - The date and time that this version of the secret was created.\n * @param {number} lastAccessedDate - The last date that this secret was accessed. This value is\n * truncated to midnight of the date and therefore shows only the date, not the time.\n * @param {number} lastChangedDate - The last date and time that this secret was modified in any way.\n * @param {Array.} tags - The list of user-defined tags associated with the secret.\n */\n constructor(\n name: string,\n arn: string,\n secretString: string,\n createdDate: number,\n lastAccessedDate: number,\n lastChangedDate: number,\n tags: Array<{ [key: string]: string }> = []\n ) {\n this.name = name\n this.arn = arn\n this.secret = secretString\n this.createdDate = createdDate\n this.lastAccessedDate = lastAccessedDate\n this.lastChangedDate = lastChangedDate\n this.tags = tags\n }\n\n /**\n * Parses and constructs a Secret Manager's Secret from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {Secret}\n */\n static fromJSON(json: JSONObject) {\n return new Secret(\n json.Name as string,\n json.ARN as string,\n json.SecretString as string,\n json.CreatedDate as number,\n json.LastAccessedDate as number,\n json.LastChangedDate as number,\n json.Tags as Array<{ [key: string]: string }>\n )\n }\n}\n\nexport class SecretsManagerServiceError extends AWSError {\n operation: SecretsManagerOperation\n\n /**\n * Constructs a SecretsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SecretsManagerOperation) {\n super(message, code)\n this.name = 'SecretsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SecretsManagerOperation defines all currently implemented Secrets Manager Service operations.\n */\nenum SecretsManagerOperation {\n ListSecrets = 'ListSecrets',\n GetSecretValue = 'GetSecretValue',\n CreateSecret = 'CreateSecret',\n PutSecretValue = 'PutSecretValue',\n DeleteSecret = 'DeleteSecret',\n}\n","import { JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's Systems Manager service\n */\nexport class SystemsManagerClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n signature: SignatureV4\n\n /**\n * Create a SystemsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'ssm')\n\n // All interactions with the Systems Manager service\n // are made via the POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n }\n\n /**\n * Retrieves a parameter from Amazon Systems Manager\n *\n * @param {string} name - The ARN or name of the parameter to retrieve.\n * @param {boolean} withDecryption - whether returned secure string parameters should be decrypted.\n * @returns {SystemsManagerParameter} - returns the fetched Parameter object.\n * @throws {SystemsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getParameter(\n name: string,\n withDecryption: boolean = false\n ): SystemsManagerParameter | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `AmazonSSM.GetParameter`,\n },\n body: JSON.stringify({ Name: name, WithDecryption: withDecryption }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SystemsManagerOperation.GetParameter, res)\n\n return SystemsManagerParameter.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(\n operation: SystemsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SystemsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SystemsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a Systems Manager's Parameter\n */\nexport class SystemsManagerParameter {\n /**\n * The Amazon Resource Name (ARN) of the parameter.\n */\n arn: string\n\n /**\n * The data type of the parameter, such as text or aws:ec2:image.\n * The default is text.\n */\n dataType: string\n\n /**\n * Date the parameter was last changed or updated and the parameter version was created.\n */\n lastModifiedDate: number\n\n /**\n * The friendly name of the parameter.\n */\n name: string\n\n /**\n * Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n */\n selector: string\n\n /**\n * plies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n */\n sourceResult: string\n\n /**\n * The type of parameter. Valid values include the following: String, StringList, and SecureString.\n */\n type: string\n\n /**\n * The parameter value.\n */\n value: string\n\n /**\n * The parameter version.\n */\n version: number\n\n /**\n * Constructs a Systems Manager's Parameter\n *\n * @param {string} arn - The Amazon Resource Name (ARN) of the parameter.\n * @param {string} dataType - The data type of the parameter, such as text or aws:ec2:image. The default is text.\n * @param {number} lastModifiedDate - Date the parameter was last changed or updated and the parameter version was created.\n * @param {string} name - The friendly name of the parameter.\n * @param {string} selector - Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n * @param {string} sourceResult - Applies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n * @param {string} type - The type of parameter. Valid values include the following: String, StringList, and SecureString.\n * @param {string} value - The parameter value.\n * @param {number} version - The parameter version.\n */\n constructor(\n arn: string,\n dataType: string,\n lastModifiedDate: number,\n name: string,\n selector: string,\n sourceResult: string,\n type: string,\n value: string,\n version: number\n ) {\n this.arn = arn\n this.dataType = dataType\n this.lastModifiedDate = lastModifiedDate\n this.name = name\n this.selector = selector\n this.sourceResult = sourceResult\n this.type = type\n this.value = value\n this.version = version\n }\n\n /**\n * Parses and constructs a Systems Manager's Parameter from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {SystemsManagerParameter}\n */\n static fromJSON(json: JSONObject): SystemsManagerParameter {\n const parameter = json.Parameter as JSONObject\n\n return new SystemsManagerParameter(\n parameter.ARN as string,\n parameter.DataType as string,\n parameter.LastModifiedDate as number,\n parameter.Name as string,\n parameter.Selector as string,\n parameter.SourceResult as string,\n parameter.Type as string,\n parameter.Value as string,\n parameter.Version as number\n )\n }\n}\n\nexport class SystemsManagerServiceError extends AWSError {\n operation: SystemsManagerOperation\n\n /**\n * Constructs a SystemsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {SystemsManagerOperation} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SystemsManagerOperation) {\n super(message, code)\n this.name = 'SystemsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SystemsManagerOperation defines all currently implemented Systems Manager operations.\n */\nenum SystemsManagerOperation {\n GetParameter = 'GetParameter',\n}\n"],"names":["AWSClient","awsConfig","serviceName","this","undefined","_host","region","endpoint","host","_scheme","scheme","AWSConfig","options","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","sessionToken","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","EMPTY_SHA256","UNSIGNED_PAYLOAD","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","hasHeader","soughtHeader","headers","Object","keys","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","hostname","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","key","value","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","isArrayBuffer","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","prototype","call","toFormUrlEncoded","form","params","API_VERSION","SQSClient","commonHeaders","queueUrl","messageBody","Action","Version","QueueUrl","MessageBody","messageDeduplicationId","MessageDeduplicationId","messageGroupId","MessageGroupId","signedRequest","sign","res","http","_handleError","parsed","html","Message","parameters","maxResults","MaxResults","nextToken","NextToken","queueNamePrefix","QueueNamePrefix","urls","toArray","e","operation","response","errorCode","error_code","error","awsError","SQSServiceError","id","bodyMD5","v1","v4","uuid","module","exports","byteToHex","i","substr","buf","offset","bth","getRandomValues","bind","window","msCrypto","rnds8","Uint8Array","rnds","r","Math","random","_nodeId","_clockseq","rng","bytesToUuid","_lastMSecs","_lastNSecs","b","node","clockseq","seedBytes","msecs","getTime","nsecs","dt","tl","tmh","n","ii","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","__esModule","d","a","definition","o","defineProperty","enumerable","get","obj","prop","hasOwnProperty","Symbol","toStringTag","KMSOperation","KMSKeySize","KMSClient","_handle_error","ListKeys","json","k","KMSKey","fromJSON","size","Size256","KeyId","NumberOfBytes","GenerateDataKey","KMSDataKey","errorMessage","__type","KMSServiceError","keyArn","keyId","KeyArn","CiphertextBlob","Plaintext","ciphertextBlob","plaintext","S3Client","buckets","children","each","_","bucketDefinition","bucket","forEach","child","nodeName","assign","textContent","creationDate","bucketName","prefix","objects","objectDefinition","lastModified","etag","parseInt","storageClass","objectKey","S3Object","data","Host","uploads","S3MultipartUpload","uploadId","partNumber","S3Part","parts","part","eTag","status","S3ServiceError","S3Bucket","SecretsManagerOperation","SecretsManagerClient","ListSecrets","s","Secret","SecretId","GetSecretValue","secret","description","versionID","tags","uuidv4","Name","Description","SecretString","ClientRequestToken","Tags","CreateSecret","PutSecretValue","recoveryWindow","noRecovery","payload","DeleteSecret","SecretsManagerServiceError","arn","secretString","createdDate","lastAccessedDate","lastChangedDate","ARN","CreatedDate","LastAccessedDate","LastChangedDate","SystemsManagerOperation","SystemsManagerClient","withDecryption","WithDecryption","GetParameter","SystemsManagerParameter","SystemsManagerServiceError","dataType","lastModifiedDate","selector","sourceResult","type","version","parameter","Parameter","DataType","LastModifiedDate","Selector","SourceResult","Type","Value"],"sourceRoot":""} \ No newline at end of file diff --git a/build/kms.js.map b/build/kms.js.map index 1cb5590..597e941 100644 --- a/build/kms.js.map +++ b/build/kms.js.map @@ -1 +1 @@ -{"version":3,"file":"kms.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EA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,EAAeiB,GAAmB,6FAClErM,KAAKsM,eAAiBF,EACtBpM,KAAKiL,GAAKG,EACVpL,KAAKuM,UAAYF,CACrB,CAQC,OARA,iCAED,SAAgBxB,GACZ,OAAO,IAAIU,EACPV,EAAKuB,eACLvB,EAAKO,MACLP,EAAKwB,UAEb,KAAC,EA7BkB,GAgCVL,GAAe,gCAUxB,WAAYtL,EAAiBuC,EAAcuI,GAAyB,MAGtC,OAHsC,WAC5C,MAApB,cAAM9K,EAASuC,IAAK,oBACpB,EAAKC,KAAO,kBACZ,EAAKsI,UAAYA,EAAS,CAC9B,CAAC,aAduB,CAASxI,IAyBrC,SALKmH,GAAAA,EAAY,kCAAZA,EAAY,oBAKjB,CALKA,KAAAA,GAAY,KAQF,SAAVC,GAAAA,EAAAA,EAAU,sBAAVA,EAAAA,EAAU,uBAAVA,KAAAA,GAAU,K","sources":["webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/client.ts","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/./src/internal/kms.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's KMS service\n */\nexport class KMSClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a KMSClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'kms')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the KMS service\n // are made via the GET or POST method.\n this.method = 'POST'\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Gets a list of all the KMS keys in the caller's AWS\n * account and region.\n *\n * @returns an array of all the available keys\n */\n listKeys(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.ListKeys`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.ListKeys, res)\n\n const json: JSONArray = res.json('Keys') as JSONArray\n return json.map((k) => KMSKey.fromJSON(k as JSONObject))\n }\n\n /**\n * GenerateDataKey returns a unique symmetric data key for use outside of AWS KMS.\n *\n * This operation returns a plaintext copy of the data key and a copy that is encrypted under a symmetric encryption KMS key that you specify.\n * The bytes in the plaintext key are random; they are not related to the caller or the KMS key.\n * You can use the plaintext key to encrypt your data outside of AWS KMS and store the encrypted data key with the encrypted data.\n *\n * To generate a data key, specify the symmetric encryption KMS key that will be used to encrypt the data key.\n * You cannot use an asymmetric KMS key to encrypt data keys.\n *\n * Used to generate data key with the KMS key defined\n * @param {string} id - Specifies the symmetric encryption KMS key that encrypts the data key. Use its key ID, key ARN, alias name, or alias ARN.\n * @param {KMKeySize} size - Specifies the length of the data key in bytes. For example, use the value 64 to generate a 512-bit data key (64 bytes is 512 bits). Default is 32, and generates a 256-bit data key.\n * @throws {KMSServiceError}\n * @throws {InvalidSignatureError}\n * @returns {KMSDataKey} - The generated data key.\n */\n generateDataKey(id: string, size: KMSKeySize = KMSKeySize.Size256): KMSDataKey | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.GenerateDataKey`,\n },\n body: JSON.stringify({ KeyId: id, NumberOfBytes: size }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.GenerateDataKey, res)\n\n return KMSDataKey.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(operation: KMSOperation, response: RefinedResponse) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new KMSServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new KMSServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a KMS key\n */\nexport class KMSKey {\n /**\n * ARN of the key\n */\n keyArn: string\n\n /**\n * Unique identifier of the key\n */\n keyId: string\n\n constructor(keyArn: string, KeyId: string) {\n this.keyArn = keyArn\n this.keyId = KeyId\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSKey(json.KeyArn as string, json.KeyId as string)\n }\n}\n\n/**\n * Class representing a data key\n */\nexport class KMSDataKey {\n /**\n * The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.\n */\n id: string\n\n /**\n * The (base64-encoded) encrypted copy of the data key.\n */\n ciphertextBlob: string\n\n /**\n * The plaintext data key.\n * Use this data key to encrypt your data outside of KMS. Then, remove it from memory as soon as possible.\n */\n plaintext: string\n\n constructor(CiphertextBlob: string, KeyId: string, Plaintext: string) {\n this.ciphertextBlob = CiphertextBlob\n this.id = KeyId\n this.plaintext = Plaintext\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSDataKey(\n json.CiphertextBlob as string,\n json.KeyId as string,\n json.Plaintext as string\n )\n }\n}\n\nexport class KMSServiceError extends AWSError {\n operation: KMSOperation\n\n /**\n * Constructs a KMSServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: KMSOperation) {\n super(message, code)\n this.name = 'KMSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * KMSOperation defines all currently implemented KMS Service operations.\n */\nenum KMSOperation {\n GenerateDataKey = 'GenerateDataKey',\n ListKeys = 'ListKeys',\n}\n\n/**\n * KMSKeyLength describes possible key lenght values for KMS API data key operations.\n */\nenum KMSKeySize {\n Size256 = 32,\n Size512 = 64,\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AWSConfig","options","region","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","this","undefined","sessionToken","scheme","endpoint","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","require","AWSClient","awsConfig","serviceName","_host","host","_scheme","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","KMSOperation","KMSKeySize","KMSClient","commonHeaders","signedRequest","sign","res","http","_handle_error","ListKeys","json","k","KMSKey","fromJSON","id","size","Size256","KeyId","NumberOfBytes","GenerateDataKey","KMSDataKey","operation","response","errorCode","error_code","error","errorMessage","Message","__type","KMSServiceError","keyArn","keyId","KeyArn","CiphertextBlob","Plaintext","ciphertextBlob","plaintext"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"kms.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,mpFCFvD,IAAMC,EAAS,WAsFlB,WAAYC,GACR,GADmC,8IApDlB,SAAO,kBAST,kBA4CVA,EAAQC,QAA6B,KAAnBD,EAAQC,OAC3B,MAAM,IAAIC,EAAsB,yFAAD,OAC+DF,EAAQC,OAAM,MAIhH,IAAKD,EAAQG,aAAuC,KAAxBH,EAAQG,YAChC,MAAM,IAAID,EAAsB,wEAAD,OAC8CF,EAAQG,YAAW,MAIpG,GAAIH,EAAQG,YAAYC,OAAS,IAAMJ,EAAQG,YAAYC,OAAS,IAChE,MAAM,IAAIF,EAAsB,wFAAD,OAC6DF,EAAQG,YAAYC,SAIpH,IAAKJ,EAAQK,iBAA+C,KAA5BL,EA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,OACvB,GAAIa,GAAa,MAAQA,GAAa,KAAM,CAGxC,IAAMG,EACDD,EAAME,SAAuBF,EAAMlL,SAAuBkL,EAAMG,OAGrE,GAAqB,8BAAjBH,EAAMG,OACN,MAAM,IAAIzF,GAAsBuF,EAAcD,EAAMG,QAIxD,MAAM,IAAIC,GAAgBH,EAAcD,EAAMG,OAAkBP,EACpE,CAEA,GAAkB,OAAdE,EACA,MAAM,IAAIM,GACN,sCACA,uBACAR,EAtBR,CAyBJ,KAAC,EAxIiB,CAAS3K,GA8IlBkK,GAAM,WAWf,WAAYkB,EAAgBb,GAAe,4DACvCpL,KAAKiM,OAASA,EACdjM,KAAKkM,MAAQd,CACjB,CAIC,OAJA,iCAED,SAAgBP,GACZ,OAAO,IAAIE,EAAOF,EAAKsB,OAAkBtB,EAAKO,MAClD,KAAC,EAlBc,GAwBNG,GAAU,WAiBnB,WAAYa,EAAwBhB,EAAeiB,GAAmB,6FAClErM,KAAKsM,eAAiBF,EACtBpM,KAAKiL,GAAKG,EACVpL,KAAKuM,UAAYF,CACrB,CAQC,OARA,iCAED,SAAgBxB,GACZ,OAAO,IAAIU,EACPV,EAAKuB,eACLvB,EAAKO,MACLP,EAAKwB,UAEb,KAAC,EA7BkB,GAgCVL,GAAe,gCAUxB,WAAYtL,EAAiBuC,EAAcuI,GAAyB,MAGtC,OAHsC,WAC5C,MAApB,cAAM9K,EAASuC,IAAK,oBACpB,EAAKC,KAAO,kBACZ,EAAKsI,UAAYA,EAAS,CAC9B,CAAC,aAduB,CAASxI,IAyBrC,SALKmH,GAAAA,EAAY,kCAAZA,EAAY,oBAKjB,CALKA,KAAAA,GAAY,KAQF,SAAVC,GAAAA,EAAAA,EAAU,sBAAVA,EAAAA,EAAU,uBAAVA,KAAAA,GAAU,K","sources":["webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/client.ts","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/./src/internal/kms.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's KMS service\n */\nexport class KMSClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a KMSClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'kms')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the KMS service\n // are made via the GET or POST method.\n this.method = 'POST'\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Gets a list of all the KMS keys in the caller's AWS\n * account and region.\n *\n * @returns an array of all the available keys\n */\n listKeys(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.ListKeys`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.ListKeys, res)\n\n const json: JSONArray = res.json('Keys') as JSONArray\n return json.map((k) => KMSKey.fromJSON(k as JSONObject))\n }\n\n /**\n * GenerateDataKey returns a unique symmetric data key for use outside of AWS KMS.\n *\n * This operation returns a plaintext copy of the data key and a copy that is encrypted under a symmetric encryption KMS key that you specify.\n * The bytes in the plaintext key are random; they are not related to the caller or the KMS key.\n * You can use the plaintext key to encrypt your data outside of AWS KMS and store the encrypted data key with the encrypted data.\n *\n * To generate a data key, specify the symmetric encryption KMS key that will be used to encrypt the data key.\n * You cannot use an asymmetric KMS key to encrypt data keys.\n *\n * Used to generate data key with the KMS key defined\n * @param {string} id - Specifies the symmetric encryption KMS key that encrypts the data key. Use its key ID, key ARN, alias name, or alias ARN.\n * @param {KMKeySize} size - Specifies the length of the data key in bytes. For example, use the value 64 to generate a 512-bit data key (64 bytes is 512 bits). Default is 32, and generates a 256-bit data key.\n * @throws {KMSServiceError}\n * @throws {InvalidSignatureError}\n * @returns {KMSDataKey} - The generated data key.\n */\n generateDataKey(id: string, size: KMSKeySize = KMSKeySize.Size256): KMSDataKey | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n // For some reason, the base target is not kms...\n [AMZ_TARGET_HEADER]: `TrentService.GenerateDataKey`,\n },\n body: JSON.stringify({ KeyId: id, NumberOfBytes: size }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(KMSOperation.GenerateDataKey, res)\n\n return KMSDataKey.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(operation: KMSOperation, response: RefinedResponse) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new KMSServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new KMSServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a KMS key\n */\nexport class KMSKey {\n /**\n * ARN of the key\n */\n keyArn: string\n\n /**\n * Unique identifier of the key\n */\n keyId: string\n\n constructor(keyArn: string, KeyId: string) {\n this.keyArn = keyArn\n this.keyId = KeyId\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSKey(json.KeyArn as string, json.KeyId as string)\n }\n}\n\n/**\n * Class representing a data key\n */\nexport class KMSDataKey {\n /**\n * The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.\n */\n id: string\n\n /**\n * The (base64-encoded) encrypted copy of the data key.\n */\n ciphertextBlob: string\n\n /**\n * The plaintext data key.\n * Use this data key to encrypt your data outside of KMS. Then, remove it from memory as soon as possible.\n */\n plaintext: string\n\n constructor(CiphertextBlob: string, KeyId: string, Plaintext: string) {\n this.ciphertextBlob = CiphertextBlob\n this.id = KeyId\n this.plaintext = Plaintext\n }\n\n static fromJSON(json: JSONObject) {\n return new KMSDataKey(\n json.CiphertextBlob as string,\n json.KeyId as string,\n json.Plaintext as string\n )\n }\n}\n\nexport class KMSServiceError extends AWSError {\n operation: KMSOperation\n\n /**\n * Constructs a KMSServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: KMSOperation) {\n super(message, code)\n this.name = 'KMSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * KMSOperation defines all currently implemented KMS Service operations.\n */\nenum KMSOperation {\n GenerateDataKey = 'GenerateDataKey',\n ListKeys = 'ListKeys',\n}\n\n/**\n * KMSKeyLength describes possible key lenght values for KMS API data key operations.\n */\nenum KMSKeySize {\n Size256 = 32,\n Size512 = 64,\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AWSConfig","options","region","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","this","undefined","sessionToken","scheme","endpoint","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","require","AWSClient","awsConfig","serviceName","_host","host","_scheme","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","KMSOperation","KMSKeySize","KMSClient","commonHeaders","signedRequest","sign","res","http","_handle_error","ListKeys","json","k","KMSKey","fromJSON","id","size","Size256","KeyId","NumberOfBytes","GenerateDataKey","KMSDataKey","operation","response","errorCode","error_code","error","errorMessage","Message","__type","KMSServiceError","keyArn","keyId","KeyArn","CiphertextBlob","Plaintext","ciphertextBlob","plaintext"],"sourceRoot":""} \ No newline at end of file diff --git a/build/s3.js b/build/s3.js index 7ab5ddd..90f1bb9 100644 --- a/build/s3.js +++ b/build/s3.js @@ -1,2 +1,2 @@ -(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return i(e,arguments,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,e)},o(e)}function i(e,t,r){return i=a()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&c(o,r.prototype),o},i.apply(null,arguments)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;ry,InvalidAWSConfigError:()=>d,InvalidSignatureError:()=>ue,S3Bucket:()=>Re,S3Client:()=>Ae,S3MultipartUpload:()=>Ie,S3Object:()=>xe,S3Part:()=>De,S3ServiceError:()=>Ke});var y=function(){function e(t){if(u(this,e),h(this,"region",void 0),h(this,"accessKeyId",void 0),h(this,"secretAccessKey",void 0),h(this,"sessionToken",void 0),h(this,"scheme","https"),h(this,"endpoint","amazonaws.com"),!t.region||""===t.region)throw new d('invalid AWS region; reason: expected a valid AWS region name (e.g. "us-east-1"), got `'.concat(t.region,"`"));if(!t.accessKeyId||""===t.accessKeyId)throw new d("invalid AWS access key ID; reason: expected a non empty string, got `".concat(t.accessKeyId,"`"));if(t.accessKeyId.length<16||t.accessKeyId.length>128)throw new d("invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ".concat(t.accessKeyId.length));if(!t.secretAccessKey||""===t.secretAccessKey)throw new d("invalid AWS secret access key; reason: expected a non empty string, got `".concat(t.secretAccessKey,"`"));if(t.secretAccessKey.length<16||t.secretAccessKey.length>128)throw new d("invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ".concat(t.secretAccessKey.length));this.region=t.region,this.accessKeyId=t.accessKeyId,this.secretAccessKey=t.secretAccessKey,void 0!==t.sessionToken&&(this.sessionToken=t.sessionToken),void 0!==t.scheme&&(this.scheme=t.scheme),void 0!==t.endpoint&&(this.endpoint=t.endpoint)}return f(e,null,[{key:"fromEnvironment",value:function(t){return new e({region:__ENV.AWS_REGION,accessKeyId:__ENV.AWS_ACCESS_KEY_ID,secretAccessKey:__ENV.AWS_SECRET_ACCESS_KEY,sessionToken:__ENV.AWS_SESSION_TOKEN,scheme:null==t?void 0:t.scheme,endpoint:null==t?void 0:t.endpoint})}}]),e}(),d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(i,e);var t,r,o=(t=i,r=a(),function(){var e,o=s(t);if(r){var i=s(this).constructor;e=Reflect.construct(o,arguments,i)}else e=o.apply(this,arguments);return n(this,e)});function i(e){return u(this,i),o.call(this,e)}return f(i)}(o(Error));const b=require("k6/crypto");var v=e.n(b),m="X-Amz-Algorithm",g="X-Amz-Credential",w="X-Amz-Date",O="X-Amz-Expires",S="X-Amz-Signature",j="X-Amz-SignedHeaders",P="X-Amz-Security-Token",_="x-amz-content-sha256",k=w.toLowerCase(),C=S.toLowerCase(),E=("X-Amz-Target".toLowerCase(),P.toLowerCase()),T="authorization",A=[T,k,"date"],R="host",x={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},I="aws4_request",D="AWS4-HMAC-SHA256",K=604800;const q=require("k6/html");function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function N(e,t){for(var r=0;r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1&&delete e.headers[m]}e.headers[k]=f,this.credentials.sessionToken&&(e.headers[E]=this.credentials.sessionToken),ArrayBuffer.isView(e.body)&&(e.body=e.body.buffer),e.body||(e.body="");var g=this.computePayloadHash(e);!function(e,t){e=e.toLowerCase();for(var r=0,n=Object.keys(t);r1&&void 0!==arguments[1]?arguments[1]:{},r=t.signingDate,n=void 0===r?new Date:r,o=t.expiresIn,i=void 0===o?3600:o,a=t.unsignableHeaders,c=t.unhoistableHeaders,s=t.signableHeaders,u=t.signingRegion,l=t.signingService,f=fe(n),h=f.longDate,p=f.shortDate,y=u||this.region,d=l||this.service;if(i>K)throw new ue("Signature version 4 presigned URLs can't be valid for more than 7 days");var b="".concat(p,"/").concat(y,"/").concat(d,"/").concat(I),v=this.moveHeadersToQuery(e,{unhoistableHeaders:c});v.headers[R]=e.hostname,this.credentials.sessionToken&&(v.query[P]=this.credentials.sessionToken),v.query[m]=D,v.query[g]="".concat(this.credentials.accessKeyId,"/").concat(b),v.query[w]=h,v.query[O]=i.toString(10);var _=this.computeCanonicalHeaders(v,a,s);v.query[j]=Object.keys(_).sort().join(";");var k=this.deriveSigningKey(this.credentials,d,y,p),C=this.computePayloadHash(e),E=this.createCanonicalRequest(v,_,C);v.query[S]=this.calculateSignature(h,b,k,E);var T="".concat(v.protocol,"://").concat(v.hostname);return v.path&&(T+=v.path),v.query&&(T+="?".concat(this.serializeQueryParameters(v.query))),re({url:T},v)}},{key:"createCanonicalRequest",value:function(e,t,r){var n=Object.keys(t).sort(),o=n.map((function(e){return"".concat(e,":").concat(t[e])})).join("\n"),i=n.join(";");return"".concat(e.method,"\n")+"".concat(this.computeCanonicalURI(e),"\n")+"".concat(this.computeCanonicalQuerystring(e),"\n")+"".concat(o,"\n\n")+"".concat(i,"\n")+"".concat(r)}},{key:"createStringToSign",value:function(e,t,r){var n=v().sha256(r,"hex");return"".concat(D,"\n")+"".concat(e,"\n")+"".concat(t,"\n")+"".concat(n)}},{key:"calculateSignature",value:function(e,t,r,n){var o=this.createStringToSign(e,t,n);return v().hmac("sha256",r,o,"hex")}},{key:"deriveSigningKey",value:function(e,t,r,n){var o=e.secretAccessKey,i=v().hmac("sha256","AWS4"+o,n,"binary"),a=v().hmac("sha256",i,r,"binary"),c=v().hmac("sha256",a,t,"binary");return v().hmac("sha256",c,"aws4_request","binary")}},{key:"computeCanonicalURI",value:function(e){var t=e.path;if(this.uriEscapePath){var r,n=[],o=$(t.split("/"));try{for(o.s();!(r=o.n()).done;){var i=r.value;0!==(null==i?void 0:i.length)&&("."!==i&&(".."===i?n.pop():n.push(i)))}}catch(e){o.e(e)}finally{o.f()}var a=null!=t&&t.startsWith("/")?"/":"",c=n.join("/"),s=n.length>0&&null!=t&&t.endsWith("/")?"/":"",u="".concat(a).concat(c).concat(s);return encodeURIComponent(u).replace(/%2F/g,"/")}return t}},{key:"computeCanonicalQuerystring",value:function(e){var t,r=e.query,n=void 0===r?{}:r,o=[],i={},a=function(e){if(e.toLowerCase()===C)return"continue";o.push(e);var t=n[e];"string"==typeof t?i[e]="".concat(le(e),"=").concat(le(t)):Array.isArray(t)&&(i[e]=t.slice(0).sort().reduce((function(t,r){return t.concat(["".concat(le(e),"=").concat(le(r))])}),[]).join("&"))},c=$(Object.keys(n).sort());try{for(c.s();!(t=c.n()).done;)a(t.value)}catch(e){c.e(e)}finally{c.f()}return o.map((function(e){return i[e]})).filter((function(e){return e})).join("&")}},{key:"computeCanonicalHeaders",value:function(e,t,r){var n,o=e.headers,i={},a=$(Object.keys(o).sort());try{for(a.s();!(n=a.n()).done;){var c=n.value;if(null!=o[c]){var s=c.toLowerCase();(s in x||null!=t&&t.has(s))&&(!r||r&&!r.has(s))||(i[s]=o[c].trim().replace(/\s+/g," "))}}}catch(e){a.e(e)}finally{a.f()}return i}},{key:"computePayloadHash",value:function(e){var t,r=e.headers,n=e.body;return r[_]?r[_]:null==n?"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855":"string"==typeof n||(t=n,"function"==typeof ArrayBuffer&&(t instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(t)))?v().sha256(n,"hex").toLowerCase():ArrayBuffer.isView(n)?v().sha256(n.buffer,"hex").toLowerCase():"UNSIGNED-PAYLOAD"}},{key:"moveHeadersToQuery",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=JSON.parse(JSON.stringify(e)),n=r.headers,o=r.query,i=void 0===o?{}:o,a=0,c=Object.keys(n);a".concat(e.partNumber,"").concat(e.eTag,"")})).join(""),""),s=this.signature.sign({method:o,protocol:"https",hostname:i,path:"/".concat(t,"?").concat(a),headers:{},body:c},{}),u=pe().request(o,s.url,s.body||"",{headers:s.headers});this._handle_error("CompleteMultipartUpload",u)}},{key:"abortMultipartUpload",value:function(e,t,r){var n="DELETE",o="".concat(e,".").concat(this.host),i="uploadId=".concat(r),a=this.signature.sign({method:n,protocol:"https",hostname:o,path:"/".concat(t,"?").concat(i),headers:{}},{}),c=pe().request(n,a.url,a.body||"",{headers:a.headers});this._handle_error("AbortMultipartUpload",c)}},{key:"_handle_error",value:function(e,t){var r=t.status,n=t.error_code,o=t.error;if(!(r>=200&&r<300&&""==o&&0===n)){if(301==r||o&&o.startsWith("301"))throw new Ke("Resource not found","ResourceNotFound",e);var i=Q.parseXML(t.body);if("AuthorizationHeaderMalformed"===i.code)throw new ue(i.message,i.code);throw new Ke(i.message,i.code||"unknown",e)}}}]),r}(function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),be(this,"awsConfig",void 0),be(this,"serviceName",void 0),be(this,"_host",void 0),be(this,"_scheme",void 0),this.awsConfig=t,this.serviceName=r}var t,r,n;return t=e,(r=[{key:"host",get:function(){return null==this._host&&(this._host="".concat(this.serviceName,".").concat(this.awsConfig.region,".").concat(this.awsConfig.endpoint)),this._host},set:function(e){this._host=e}},{key:"scheme",get:function(){return null==this._scheme&&(this._scheme=this.awsConfig.scheme),this._scheme},set:function(e){this._scheme=e}}])&&de(t.prototype,r),n&&de(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()),Re=Oe((function e(t,r){ge(this,e),Ee(this,"name",void 0),Ee(this,"creationDate",void 0),this.name=t,this.creationDate=r})),xe=Oe((function e(t,r,n,o,i,a){ge(this,e),Ee(this,"key",void 0),Ee(this,"lastModified",void 0),Ee(this,"etag",void 0),Ee(this,"size",void 0),Ee(this,"storageClass",void 0),Ee(this,"data",void 0),this.key=t,this.lastModified=r,this.etag=n,this.size=o,this.storageClass=i,this.data=a})),Ie=Oe((function e(t,r){ge(this,e),Ee(this,"key",void 0),Ee(this,"uploadId",void 0),this.key=t,this.uploadId=r})),De=Oe((function e(t,r){ge(this,e),Ee(this,"partNumber",void 0),Ee(this,"eTag",void 0),this.partNumber=t,this.eTag=r})),Ke=function(e){Se(r,e);var t=Pe(r);function r(e,n,o){var i;return ge(this,r),Ee(ke(i=t.call(this,e,n)),"operation",void 0),i.name="S3ServiceError",i.operation=o,i}return Oe(r)}(Q),qe=exports;for(var Me in t)qe[Me]=t[Me];t.__esModule&&Object.defineProperty(qe,"__esModule",{value:!0})})(); +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function o(e){var t="function"==typeof Map?new Map:void 0;return o=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return i(e,arguments,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,e)},o(e)}function i(e,t,r){return i=a()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&c(o,r.prototype),o},i.apply(null,arguments)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;rp,InvalidAWSConfigError:()=>d,InvalidSignatureError:()=>ue,S3Bucket:()=>Re,S3Client:()=>Ae,S3MultipartUpload:()=>Ie,S3Object:()=>xe,S3Part:()=>De,S3ServiceError:()=>qe});var p=function(){function e(t){if(u(this,e),h(this,"region",void 0),h(this,"accessKeyId",void 0),h(this,"secretAccessKey",void 0),h(this,"sessionToken",void 0),h(this,"scheme","https"),h(this,"endpoint","amazonaws.com"),!t.region||""===t.region)throw new d('invalid AWS region; reason: expected a valid AWS region name (e.g. "us-east-1"), got `'.concat(t.region,"`"));if(!t.accessKeyId||""===t.accessKeyId)throw new d("invalid AWS access key ID; reason: expected a non empty string, got `".concat(t.accessKeyId,"`"));if(t.accessKeyId.length<16||t.accessKeyId.length>128)throw new d("invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ".concat(t.accessKeyId.length));if(!t.secretAccessKey||""===t.secretAccessKey)throw new d("invalid AWS secret access key; reason: expected a non empty string, got `".concat(t.secretAccessKey,"`"));if(t.secretAccessKey.length<16||t.secretAccessKey.length>128)throw new d("invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ".concat(t.secretAccessKey.length));this.region=t.region,this.accessKeyId=t.accessKeyId,this.secretAccessKey=t.secretAccessKey,void 0!==t.sessionToken&&(this.sessionToken=t.sessionToken),void 0!==t.scheme&&(this.scheme=t.scheme),void 0!==t.endpoint&&(this.endpoint=t.endpoint)}return f(e,null,[{key:"fromEnvironment",value:function(t){return new e({region:__ENV.AWS_REGION,accessKeyId:__ENV.AWS_ACCESS_KEY_ID,secretAccessKey:__ENV.AWS_SECRET_ACCESS_KEY,sessionToken:__ENV.AWS_SESSION_TOKEN,scheme:null==t?void 0:t.scheme,endpoint:null==t?void 0:t.endpoint})}}]),e}(),d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}(i,e);var t,r,o=(t=i,r=a(),function(){var e,o=s(t);if(r){var i=s(this).constructor;e=Reflect.construct(o,arguments,i)}else e=o.apply(this,arguments);return n(this,e)});function i(e){return u(this,i),o.call(this,e)}return f(i)}(o(Error));const b=require("k6/crypto");var v=e.n(b),m="X-Amz-Algorithm",g="X-Amz-Credential",w="X-Amz-Date",O="X-Amz-Expires",S="X-Amz-Signature",j="X-Amz-SignedHeaders",P="X-Amz-Security-Token",_="x-amz-content-sha256",k=w.toLowerCase(),C=S.toLowerCase(),E=("X-Amz-Target".toLowerCase(),P.toLowerCase()),T="authorization",A=[T,k,"date"],R="host",x={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},I="aws4_request",D="AWS4-HMAC-SHA256",q=604800;const K=require("k6/html");function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function N(e,t){for(var r=0;r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r-1&&delete e.headers[m]}e.headers[k]=f,this.credentials.sessionToken&&(e.headers[E]=this.credentials.sessionToken),ArrayBuffer.isView(e.body)&&(e.body=e.body.buffer),e.body||(e.body="");var g=this.computePayloadHash(e);!function(e,t){e=e.toLowerCase();for(var r=0,n=Object.keys(t);r1&&void 0!==arguments[1]?arguments[1]:{},r=t.signingDate,n=void 0===r?new Date:r,o=t.expiresIn,i=void 0===o?3600:o,a=t.unsignableHeaders,c=t.unhoistableHeaders,s=t.signableHeaders,u=t.signingRegion,l=t.signingService,f=fe(n),h=f.longDate,y=f.shortDate,p=u||this.region,d=l||this.service;if(i>q)throw new ue("Signature version 4 presigned URLs can't be valid for more than 7 days");var b="".concat(y,"/").concat(p,"/").concat(d,"/").concat(I),v=this.moveHeadersToQuery(e,{unhoistableHeaders:c});v.headers[R]=e.hostname,this.credentials.sessionToken&&(v.query[P]=this.credentials.sessionToken),v.query[m]=D,v.query[g]="".concat(this.credentials.accessKeyId,"/").concat(b),v.query[w]=h,v.query[O]=i.toString(10);var _=this.computeCanonicalHeaders(v,a,s);v.query[j]=Object.keys(_).sort().join(";");var k=this.deriveSigningKey(this.credentials,d,p,y),C=this.computePayloadHash(e),E=this.createCanonicalRequest(v,_,C);v.query[S]=this.calculateSignature(h,b,k,E);var T="".concat(v.protocol,"://").concat(v.hostname);return v.path&&(T+=v.path),v.query&&(T+="?".concat(this.serializeQueryParameters(v.query))),re({url:T},v)}},{key:"createCanonicalRequest",value:function(e,t,r){var n=Object.keys(t).sort(),o=n.map((function(e){return"".concat(e,":").concat(t[e])})).join("\n"),i=n.join(";");return"".concat(e.method,"\n")+"".concat(this.computeCanonicalURI(e),"\n")+"".concat(this.computeCanonicalQuerystring(e),"\n")+"".concat(o,"\n\n")+"".concat(i,"\n")+"".concat(r)}},{key:"createStringToSign",value:function(e,t,r){var n=v().sha256(r,"hex");return"".concat(D,"\n")+"".concat(e,"\n")+"".concat(t,"\n")+"".concat(n)}},{key:"calculateSignature",value:function(e,t,r,n){var o=this.createStringToSign(e,t,n);return v().hmac("sha256",r,o,"hex")}},{key:"deriveSigningKey",value:function(e,t,r,n){var o=e.secretAccessKey,i=v().hmac("sha256","AWS4"+o,n,"binary"),a=v().hmac("sha256",i,r,"binary"),c=v().hmac("sha256",a,t,"binary");return v().hmac("sha256",c,"aws4_request","binary")}},{key:"computeCanonicalURI",value:function(e){var t=e.path;if(this.uriEscapePath){var r,n=[],o=$(t.split("/"));try{for(o.s();!(r=o.n()).done;){var i=r.value;0!==(null==i?void 0:i.length)&&("."!==i&&(".."===i?n.pop():n.push(i)))}}catch(e){o.e(e)}finally{o.f()}var a=null!=t&&t.startsWith("/")?"/":"",c=n.join("/"),s=n.length>0&&null!=t&&t.endsWith("/")?"/":"",u="".concat(a).concat(c).concat(s);return encodeURIComponent(u).replace(/%2F/g,"/")}return t}},{key:"computeCanonicalQuerystring",value:function(e){var t,r=e.query,n=void 0===r?{}:r,o=[],i={},a=function(e){if(e.toLowerCase()===C)return"continue";o.push(e);var t=n[e];"string"==typeof t?i[e]="".concat(le(e),"=").concat(le(t)):Array.isArray(t)&&(i[e]=t.slice(0).sort().reduce((function(t,r){return t.concat(["".concat(le(e),"=").concat(le(r))])}),[]).join("&"))},c=$(Object.keys(n).sort());try{for(c.s();!(t=c.n()).done;)a(t.value)}catch(e){c.e(e)}finally{c.f()}return o.map((function(e){return i[e]})).filter((function(e){return e})).join("&")}},{key:"computeCanonicalHeaders",value:function(e,t,r){var n,o=e.headers,i={},a=$(Object.keys(o).sort());try{for(a.s();!(n=a.n()).done;){var c=n.value;if(null!=o[c]){var s=c.toLowerCase();(s in x||null!=t&&t.has(s))&&(!r||r&&!r.has(s))||(i[s]=o[c].trim().replace(/\s+/g," "))}}}catch(e){a.e(e)}finally{a.f()}return i}},{key:"computePayloadHash",value:function(e){var t,r=e.headers,n=e.body;return r[_]?r[_]:null==n?"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855":"string"==typeof n||(t=n,"function"==typeof ArrayBuffer&&(t instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(t)))?v().sha256(n,"hex").toLowerCase():ArrayBuffer.isView(n)?v().sha256(n.buffer,"hex").toLowerCase():"UNSIGNED-PAYLOAD"}},{key:"moveHeadersToQuery",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=JSON.parse(JSON.stringify(e)),n=r.headers,o=r.query,i=void 0===o?{}:o,a=0,c=Object.keys(n);a".concat(e.partNumber,"").concat(e.eTag,"")})).join(""),""),c=this.signature.sign({method:o,protocol:this.scheme,hostname:i,path:"/".concat(t),headers:{},body:a,query:{uploadId:"".concat(r)}},{}),s=ye().request(o,c.url,c.body||"",{headers:c.headers});this._handle_error("CompleteMultipartUpload",s)}},{key:"abortMultipartUpload",value:function(e,t,r){var n="DELETE",o="".concat(e,".").concat(this.host),i=this.signature.sign({method:n,protocol:this.scheme,hostname:o,path:"/".concat(t),headers:{},query:{uploadId:"".concat(r)}},{}),a=ye().request(n,i.url,i.body||"",{headers:i.headers});this._handle_error("AbortMultipartUpload",a)}},{key:"_handle_error",value:function(e,t){var r=t.status,n=t.error_code,o=t.error;if(!(r>=200&&r<300&&""==o&&0===n)){if(301==r||o&&o.startsWith("301"))throw new qe("Resource not found","ResourceNotFound",e);var i=Q.parseXML(t.body);if("AuthorizationHeaderMalformed"===i.code)throw new ue(i.message,i.code);throw new qe(i.message,i.code||"unknown",e)}}}]),r}(function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),be(this,"awsConfig",void 0),be(this,"serviceName",void 0),be(this,"_host",void 0),be(this,"_scheme",void 0),this.awsConfig=t,this.serviceName=r}var t,r,n;return t=e,(r=[{key:"host",get:function(){return null==this._host&&(this._host="".concat(this.serviceName,".").concat(this.awsConfig.region,".").concat(this.awsConfig.endpoint)),this._host},set:function(e){this._host=e}},{key:"scheme",get:function(){return null==this._scheme&&(this._scheme=this.awsConfig.scheme),this._scheme},set:function(e){this._scheme=e}}])&&de(t.prototype,r),n&&de(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()),Re=Oe((function e(t,r){ge(this,e),Ee(this,"name",void 0),Ee(this,"creationDate",void 0),this.name=t,this.creationDate=r})),xe=Oe((function e(t,r,n,o,i,a){ge(this,e),Ee(this,"key",void 0),Ee(this,"lastModified",void 0),Ee(this,"etag",void 0),Ee(this,"size",void 0),Ee(this,"storageClass",void 0),Ee(this,"data",void 0),this.key=t,this.lastModified=r,this.etag=n,this.size=o,this.storageClass=i,this.data=a})),Ie=Oe((function e(t,r){ge(this,e),Ee(this,"key",void 0),Ee(this,"uploadId",void 0),this.key=t,this.uploadId=r})),De=Oe((function e(t,r){ge(this,e),Ee(this,"partNumber",void 0),Ee(this,"eTag",void 0),this.partNumber=t,this.eTag=r})),qe=function(e){Se(r,e);var t=Pe(r);function r(e,n,o){var i;return ge(this,r),Ee(ke(i=t.call(this,e,n)),"operation",void 0),i.name="S3ServiceError",i.operation=o,i}return Oe(r)}(Q),Ke=exports;for(var Me in t)Ke[Me]=t[Me];t.__esModule&&Object.defineProperty(Ke,"__esModule",{value:!0})})(); //# sourceMappingURL=s3.js.map \ No newline at end of file diff --git a/build/s3.js.map b/build/s3.js.map index 0a4a909..72cb32e 100644 --- a/build/s3.js.map +++ b/build/s3.js.map @@ -1 +1 @@ -{"version":3,"file":"s3.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EA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AAM,YAAIK,KAAK6J,UAAUzJ,WAEvEJ,KAAK+M,KAChB,EAAC,IAED,SAAgB9C,GACZjK,KAAK+M,MAAQ9C,CACjB,GAEE,kBAKF,WAKE,OAHoBhK,MAAhBD,KAAKgN,UACPhN,KAAKgN,QAAUhN,KAAK6J,UAAU1J,QAEzBH,KAAKgN,OACd,EAEA,IACA,SAAkB7M,GAChBH,KAAKgN,QAAU7M,CACnB,M,gFAAC,EA/CmB,IDicT8M,GAAQ,IAUjB,WAAYtK,EAAcqI,GAAoB,iEAC1ChL,KAAK2C,KAAOA,EACZ3C,KAAKgL,aAAeA,CACxB,IAISW,GAAQ,IAkBjB,WACIhN,EACA0M,EACAC,EACAC,EACAE,EACAG,GACF,oKACE5L,KAAKrB,IAAMA,EACXqB,KAAKqL,aAAeA,EACpBrL,KAAKsL,KAAOA,EACZtL,KAAKuL,KAAOA,EACZvL,KAAKyL,aAAeA,EACpBzL,KAAK4L,KAAOA,CAChB,IAISE,GAAiB,IAU1B,WAAYnN,EAAaoN,GAAkB,4DACvC/L,KAAKrB,IAAMA,EACXqB,KAAK+L,SAAWA,CACpB,IAISE,GAAM,IAUf,WAAYD,EAAoBI,GAAc,+DAC1CpM,KAAKgM,WAAaA,EAClBhM,KAAKoM,KAAOA,CAChB,IAWSQ,GAAc,gCAUvB,WAAYlM,EAAiBgC,EAAc2J,GAAmB,MAGhC,OAHgC,WACtC,MAApB,cAAM3L,EAASgC,IAAK,oBACpB,EAAKC,KAAO,iBACZ,EAAK0J,UAAYA,EAAS,CAC9B,CAAC,aAdsB,CAAS5J,G","sources":["webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/s3.ts","webpack://k6-jslib-aws/./src/internal/client.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { bytes } from 'k6'\nimport { parseHTML } from 'k6/html'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AWSError } from './error'\nimport { SignedHTTPRequest } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n\n/** Class allowing to interact with Amazon AWS's S3 service */\nexport class S3Client extends AWSClient {\n signature: SignatureV4\n\n /**\n * Create a S3Client\n *\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 's3')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: false,\n applyChecksum: true,\n })\n }\n\n /**\n * Returns a list of all buckets owned by the authenticated sender of the request.\n * To use this operation, you must have the s3:ListAllMyBuckets permission.\n *\n * @return {Array.} buckets - An array of objects describing S3 buckets\n * with the following fields: name, and creationDate.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listBuckets(): Array {\n const method = 'GET'\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: this.host,\n path: '/',\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListBuckets', res)\n\n let buckets: Array = []\n\n const doc = parseHTML(res.body as string)\n\n doc.find('Buckets')\n .children()\n .each((_, bucketDefinition) => {\n let bucket = {}\n\n bucketDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'name':\n Object.assign(bucket, { name: child.textContent() })\n break\n case 'creationdate':\n Object.assign(bucket, {\n creationDate: Date.parse(child.textContent()),\n })\n }\n })\n\n buckets.push(bucket as S3Bucket)\n })\n\n return buckets\n }\n\n /**\n * Returns some or all (up to 1,000) of the objects in a bucket.\n *\n * @param {string} bucketName - Bucket name to list.\n * @param {string?} prefix='' - Limits the response to keys that begin with the specified prefix.\n * @return {Array.} - returns an array of objects describing S3 objects\n * with the following fields: key, lastModified, etag, size and storageClass.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listObjects(bucketName: string, prefix?: string): Array {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/`,\n query: {\n 'list-type': '2',\n prefix: prefix || '',\n },\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListObjectsV2', res)\n\n let objects: Array = []\n\n // Extract the objects definition from\n // the XML response\n parseHTML(res.body as string)\n .find('Contents')\n .each((_, objectDefinition) => {\n let obj = {}\n\n objectDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'key':\n Object.assign(obj, { key: child.textContent() })\n break\n case 'lastmodified':\n Object.assign(obj, { lastModified: Date.parse(child.textContent()) })\n break\n case 'etag':\n Object.assign(obj, { etag: child.textContent() })\n break\n case 'size':\n Object.assign(obj, { size: parseInt(child.textContent()) })\n break\n case 'storageclass':\n Object.assign(obj, { storageClass: child.textContent() })\n }\n })\n\n objects.push(obj as S3Object)\n })\n\n return objects\n }\n /**\n * Retrieves an Object from Amazon S3.\n *\n * To use getObject, you must have `READ` access to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to get.\n * @return {S3Object} - returns the content of the fetched S3 Object.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n getObject(bucketName: string, objectKey: string): S3Object {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('GetObject', res)\n\n return new S3Object(\n objectKey,\n Date.parse(res.headers['Last-Modified']),\n res.headers['ETag'],\n parseInt(res.headers['Content-Length']),\n\n // The X-Amz-Storage-Class header is only set if the storage class is\n // not the default 'STANDARD' one.\n (res.headers['X-Amz-Storage-Class'] ?? 'STANDARD') as StorageClass,\n\n res.body\n )\n }\n /**\n * Adds an object to a bucket.\n *\n * You must have WRITE permissions on a bucket to add an object to it.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to put.\n * @param {string | ArrayBuffer} data - the content of the S3 Object to upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n putObject(bucketName: string, objectKey: string, data: string | ArrayBuffer) {\n // Prepare request\n const method = 'PUT'\n const host = `${this.host}`\n \n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {\n Host: host,\n },\n body: data,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error('PutObject', res)\n }\n\n /**\n * Removes the null version (if there is one) of an object and inserts a delete marker,\n * which becomes the latest version of the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteObject(bucketName: string, objectKey: string): void {\n // Prepare request\n const method = 'DELETE'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('DeleteObject', res)\n }\n\n /**\n * Creates a new multipart upload for a given objectKey.\n * The uploadId returned can be used to upload parts to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @return {S3MultipartUpload} - returns the uploadId of the newly created multipart upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n createMultipartUpload(bucketName: string, objectKey: string): S3MultipartUpload {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n const query = 'uploads'\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('CreateMultipartUpload', res)\n\n return new S3MultipartUpload(\n objectKey,\n parseHTML(res.body as string)\n .find('UploadId')\n .text()\n )\n }\n\n /**\n * Uploads a part in a multipart upload.\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload.\n * @param {number} partNumber - The part number of the part to upload.\n * @param {string | ArrayBuffer} data - The content of the part to upload.\n * @return {S3Part} - returns the ETag of the uploaded part.\n * @throws {S3ServiceError}\n */\n uploadPart(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n partNumber: number,\n data: string | ArrayBuffer\n ): S3Part {\n // Prepare request\n const method = 'PUT'\n const host = `${bucketName}.${this.host}`\n const query = `partNumber=${partNumber}&uploadId=${uploadId}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n body: data,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('UploadPart', res)\n\n return new S3Part(partNumber, res.headers['Etag'])\n }\n\n /**\n * Completes a multipart upload by assembling previously uploaded parts.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to complete.\n * @param {S3Part[]} parts - The parts to assemble.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n completeMultipartUpload(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n parts: S3Part[]\n ) {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n const query = `uploadId=${uploadId}`\n const body = `${parts\n .map(\n (part) =>\n `${part.partNumber}${part.eTag}`\n )\n .join('')}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n body: body,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n\n this._handle_error('CompleteMultipartUpload', res)\n }\n\n /**\n * Aborts a multipart upload.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to abort.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n abortMultipartUpload(bucketName: string, objectKey: string, uploadId: string) {\n // Prepare request\n const method = 'DELETE'\n const host = `${bucketName}.${this.host}`\n const query = `uploadId=${uploadId}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: 'https',\n hostname: host,\n path: `/${objectKey}?${query}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('AbortMultipartUpload', res)\n }\n\n _handle_error(operation: S3Operation, response: RefinedResponse) {\n const status: number = response.status\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n // We consider codes 200-299 as success\n if (status >= 200 && status < 300 && errorMessage == '' && errorCode === 0) {\n return\n }\n\n // A 301 response is returned when the bucket is not found.\n // Generally meaning that either the bucket name is wrong or the\n // region is wrong.\n //\n // See: https://github.com/grafana/k6/issues/2474\n // See: https://github.com/golang/go/issues/49281\n if (status == 301 || (errorMessage && errorMessage.startsWith('301'))) {\n throw new S3ServiceError('Resource not found', 'ResourceNotFound', operation)\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new S3ServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/** Class representing a S3 Bucket */\nexport class S3Bucket {\n name: string\n creationDate: Date\n\n /**\n * Create an S3 Bucket\n *\n * @param {string} name - S3 bucket's name\n * @param {Date} creationDate - S3 bucket's creation date\n */\n constructor(name: string, creationDate: Date) {\n this.name = name\n this.creationDate = creationDate\n }\n}\n\n/** Class representing an S3 Object */\nexport class S3Object {\n key: string\n lastModified: number\n etag: string\n size: number\n storageClass: StorageClass\n data?: string | bytes | null\n\n /**\n * Create an S3 Object\n *\n * @param {string} key - S3 object's key\n * @param {Date} lastModified - S3 object last modification date\n * @param {string} etag - S3 object's etag\n * @param {number} size - S3 object's size\n * @param {StorageClass} storageClass - S3 object's storage class\n * @param {string | bytes | null} data=null - S3 Object's data\n */\n constructor(\n key: string,\n lastModified: number,\n etag: string,\n size: number,\n storageClass: StorageClass,\n data?: string | bytes | null\n ) {\n this.key = key\n this.lastModified = lastModified\n this.etag = etag\n this.size = size\n this.storageClass = storageClass\n this.data = data\n }\n}\n\n/** Class representing a S3 Multipart Upload */\nexport class S3MultipartUpload {\n key: string\n uploadId: string\n\n /**\n * Create an S3 Multipart Upload\n * @param {string} key - S3 object's key\n * @param {string} uploadId - S3 multipart upload id\n */\n\n constructor(key: string, uploadId: string) {\n this.key = key\n this.uploadId = uploadId\n }\n}\n\n/** Class representing a S3 Part */\nexport class S3Part {\n partNumber: number\n eTag: string\n\n /**\n * Create an S3 Part\n * @param {number} partNumber - Part number\n * @param {string} eTag - Part's etag\n */\n\n constructor(partNumber: number, eTag: string) {\n this.partNumber = partNumber\n this.eTag = eTag\n }\n}\n\n/**\n * Error indicating a S3 operation failed\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class S3ServiceError extends AWSError {\n operation: string\n\n /**\n * Constructs a S3ServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: string) {\n super(message, code)\n this.name = 'S3ServiceError'\n this.operation = operation\n }\n}\n\n/**\n * S3Operation describes possible values for S3 API operations,\n * as defined by AWS APIs.\n */\ntype S3Operation =\n | 'ListBuckets'\n | 'ListObjectsV2'\n | 'GetObject'\n | 'PutObject'\n | 'DeleteObject'\n | 'CreateMultipartUpload'\n | 'CompleteMultipartUpload'\n | 'UploadPart'\n | 'AbortMultipartUpload'\n\n/**\n * Describes the class of storage used to store a S3 object.\n */\ntype StorageClass =\n | 'STANDARD'\n | 'REDUCED_REDUNDANCY'\n | 'GLACIER'\n | 'STANDARD_IA'\n | 'INTELLIGENT_TIERING'\n | 'DEEP_ARCHIVE'\n | 'OUTPOSTS'\n | 'GLACIER_IR'\n | undefined\n","import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AWSConfig","options","region","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","this","undefined","sessionToken","scheme","endpoint","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","require","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","S3Client","awsConfig","serviceName","signedRequest","sign","host","res","http","_handle_error","buckets","children","each","_","bucketDefinition","bucket","forEach","child","nodeName","assign","textContent","creationDate","bucketName","prefix","objects","objectDefinition","lastModified","etag","size","parseInt","storageClass","objectKey","S3Object","data","Host","S3MultipartUpload","uploadId","partNumber","S3Part","parts","part","eTag","operation","response","status","errorCode","error_code","errorMessage","error","S3ServiceError","awsError","parseXML","_host","_scheme","S3Bucket"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"s3.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,ssFCFvD,IAAMC,EAAS,WAsFlB,WAAYC,GACR,GADmC,8IApDlB,SAAO,kBAST,kBA4CVA,EAAQC,QAA6B,KAAnBD,EAAQC,OAC3B,MAAM,IAAIC,EAAsB,yFAAD,OAC+DF,EAAQC,OAAM,MAIhH,IAAKD,EAAQG,aAAuC,KAAxBH,EAAQG,YAChC,MAAM,IAAID,EAAsB,wEAAD,OAC8CF,EAAQG,YAAW,MAIpG,GAAIH,EAAQG,YAAYC,OAAS,IAAMJ,EAAQG,YAAYC,OAAS,IAChE,MAAM,IAAIF,EAAsB,wFAAD,OAC6DF,E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qN,GAAkB,4DACvChM,KAAKrB,IAAMA,EACXqB,KAAKgM,SAAWA,CACpB,IAISE,GAAM,IAUf,WAAYD,EAAoBI,GAAc,+DAC1CrM,KAAKiM,WAAaA,EAClBjM,KAAKqM,KAAOA,CAChB,IAWSQ,GAAc,gCAUvB,WAAYnM,EAAiBgC,EAAc4J,GAAmB,MAGhC,OAHgC,WACtC,MAApB,cAAM5L,EAASgC,IAAK,oBACpB,EAAKC,KAAO,iBACZ,EAAK2J,UAAYA,EAAS,CAC9B,CAAC,aAdsB,CAAS7J,G","sources":["webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/s3.ts","webpack://k6-jslib-aws/./src/internal/client.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { bytes } from 'k6'\nimport { parseHTML } from 'k6/html'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AWSError } from './error'\nimport { SignedHTTPRequest } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n\n/** Class allowing to interact with Amazon AWS's S3 service */\nexport class S3Client extends AWSClient {\n signature: SignatureV4\n\n /**\n * Create a S3Client\n *\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 's3')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: false,\n applyChecksum: true,\n })\n }\n\n /**\n * Returns a list of all buckets owned by the authenticated sender of the request.\n * To use this operation, you must have the s3:ListAllMyBuckets permission.\n *\n * @return {Array.} buckets - An array of objects describing S3 buckets\n * with the following fields: name, and creationDate.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listBuckets(): Array {\n const method = 'GET'\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: this.host,\n path: '/',\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListBuckets', res)\n\n let buckets: Array = []\n\n const doc = parseHTML(res.body as string)\n\n doc.find('Buckets')\n .children()\n .each((_, bucketDefinition) => {\n let bucket = {}\n\n bucketDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'name':\n Object.assign(bucket, { name: child.textContent() })\n break\n case 'creationdate':\n Object.assign(bucket, {\n creationDate: Date.parse(child.textContent()),\n })\n }\n })\n\n buckets.push(bucket as S3Bucket)\n })\n\n return buckets\n }\n\n /**\n * Returns some or all (up to 1,000) of the objects in a bucket.\n *\n * @param {string} bucketName - Bucket name to list.\n * @param {string?} prefix='' - Limits the response to keys that begin with the specified prefix.\n * @return {Array.} - returns an array of objects describing S3 objects\n * with the following fields: key, lastModified, etag, size and storageClass.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listObjects(bucketName: string, prefix?: string): Array {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/`,\n query: {\n 'list-type': '2',\n prefix: prefix || '',\n },\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('ListObjectsV2', res)\n\n let objects: Array = []\n\n // Extract the objects definition from\n // the XML response\n parseHTML(res.body as string)\n .find('Contents')\n .each((_, objectDefinition) => {\n let obj = {}\n\n objectDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'key':\n Object.assign(obj, { key: child.textContent() })\n break\n case 'lastmodified':\n Object.assign(obj, { lastModified: Date.parse(child.textContent()) })\n break\n case 'etag':\n Object.assign(obj, { etag: child.textContent() })\n break\n case 'size':\n Object.assign(obj, { size: parseInt(child.textContent()) })\n break\n case 'storageclass':\n Object.assign(obj, { storageClass: child.textContent() })\n }\n })\n\n objects.push(obj as S3Object)\n })\n\n return objects\n }\n /**\n * Retrieves an Object from Amazon S3.\n *\n * To use getObject, you must have `READ` access to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to get.\n * @return {S3Object} - returns the content of the fetched S3 Object.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n getObject(bucketName: string, objectKey: string): S3Object {\n // Prepare request\n const method = 'GET'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: 'GET',\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('GetObject', res)\n\n return new S3Object(\n objectKey,\n Date.parse(res.headers['Last-Modified']),\n res.headers['ETag'],\n parseInt(res.headers['Content-Length']),\n\n // The X-Amz-Storage-Class header is only set if the storage class is\n // not the default 'STANDARD' one.\n (res.headers['X-Amz-Storage-Class'] ?? 'STANDARD') as StorageClass,\n\n res.body\n )\n }\n /**\n * Adds an object to a bucket.\n *\n * You must have WRITE permissions on a bucket to add an object to it.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to put.\n * @param {string | ArrayBuffer} data - the content of the S3 Object to upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n putObject(bucketName: string, objectKey: string, data: string | ArrayBuffer) {\n // Prepare request\n const method = 'PUT'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {\n Host: host,\n },\n body: data,\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error('PutObject', res)\n }\n\n /**\n * Removes the null version (if there is one) of an object and inserts a delete marker,\n * which becomes the latest version of the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteObject(bucketName: string, objectKey: string): void {\n // Prepare request\n const method = 'DELETE'\n const host = `${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${bucketName}/${objectKey}`,\n headers: {},\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('DeleteObject', res)\n }\n\n /**\n * Creates a new multipart upload for a given objectKey.\n * The uploadId returned can be used to upload parts to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to upload.\n * @return {S3MultipartUpload} - returns the uploadId of the newly created multipart upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n createMultipartUpload(bucketName: string, objectKey: string): S3MultipartUpload {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n query: { uploads: '' },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('CreateMultipartUpload', res)\n\n return new S3MultipartUpload(\n objectKey,\n parseHTML(res.body as string)\n .find('UploadId')\n .text()\n )\n }\n\n /**\n * Uploads a part in a multipart upload.\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to upload.\n * @param {string} uploadId - The uploadId of the multipart upload.\n * @param {number} partNumber - The part number of the part to upload.\n * @param {string | ArrayBuffer} data - The content of the part to upload.\n * @return {S3Part} - returns the ETag of the uploaded part.\n * @throws {S3ServiceError}\n */\n uploadPart(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n partNumber: number,\n data: string | ArrayBuffer\n ): S3Part {\n // Prepare request\n const method = 'PUT'\n const host = `${bucketName}.${this.host}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n body: data,\n query: {\n partNumber: `${partNumber}`,\n uploadId: `${uploadId}`,\n },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('UploadPart', res)\n\n return new S3Part(partNumber, res.headers['Etag'])\n }\n\n /**\n * Completes a multipart upload by assembling previously uploaded parts.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to complete.\n * @param {S3Part[]} parts - The parts to assemble.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n completeMultipartUpload(\n bucketName: string,\n objectKey: string,\n uploadId: string,\n parts: S3Part[]\n ) {\n // Prepare request\n const method = 'POST'\n const host = `${bucketName}.${this.host}`\n const body = `${parts\n .map(\n (part) =>\n `${part.partNumber}${part.eTag}`\n )\n .join('')}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n body: body,\n query: {\n uploadId: `${uploadId}`,\n },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n\n this._handle_error('CompleteMultipartUpload', res)\n }\n\n /**\n * Aborts a multipart upload.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @param {string} uploadId - The uploadId of the multipart upload to abort.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n abortMultipartUpload(bucketName: string, objectKey: string, uploadId: string) {\n // Prepare request\n const method = 'DELETE'\n const host = `${bucketName}.${this.host}`\n const signedRequest = this.signature.sign(\n {\n method: method,\n protocol: this.scheme,\n hostname: host,\n path: `/${objectKey}`,\n headers: {},\n query: {\n uploadId: `${uploadId}`,\n },\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers,\n })\n this._handle_error('AbortMultipartUpload', res)\n }\n\n _handle_error(operation: S3Operation, response: RefinedResponse) {\n const status: number = response.status\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n // We consider codes 200-299 as success\n if (status >= 200 && status < 300 && errorMessage == '' && errorCode === 0) {\n return\n }\n\n // A 301 response is returned when the bucket is not found.\n // Generally meaning that either the bucket name is wrong or the\n // region is wrong.\n //\n // See: https://github.com/grafana/k6/issues/2474\n // See: https://github.com/golang/go/issues/49281\n if (status == 301 || (errorMessage && errorMessage.startsWith('301'))) {\n throw new S3ServiceError('Resource not found', 'ResourceNotFound', operation)\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new S3ServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/** Class representing a S3 Bucket */\nexport class S3Bucket {\n name: string\n creationDate: Date\n\n /**\n * Create an S3 Bucket\n *\n * @param {string} name - S3 bucket's name\n * @param {Date} creationDate - S3 bucket's creation date\n */\n constructor(name: string, creationDate: Date) {\n this.name = name\n this.creationDate = creationDate\n }\n}\n\n/** Class representing an S3 Object */\nexport class S3Object {\n key: string\n lastModified: number\n etag: string\n size: number\n storageClass: StorageClass\n data?: string | bytes | null\n\n /**\n * Create an S3 Object\n *\n * @param {string} key - S3 object's key\n * @param {Date} lastModified - S3 object last modification date\n * @param {string} etag - S3 object's etag\n * @param {number} size - S3 object's size\n * @param {StorageClass} storageClass - S3 object's storage class\n * @param {string | bytes | null} data=null - S3 Object's data\n */\n constructor(\n key: string,\n lastModified: number,\n etag: string,\n size: number,\n storageClass: StorageClass,\n data?: string | bytes | null\n ) {\n this.key = key\n this.lastModified = lastModified\n this.etag = etag\n this.size = size\n this.storageClass = storageClass\n this.data = data\n }\n}\n\n/** Class representing a S3 Multipart Upload */\nexport class S3MultipartUpload {\n key: string\n uploadId: string\n\n /**\n * Create an S3 Multipart Upload\n * @param {string} key - S3 object's key\n * @param {string} uploadId - S3 multipart upload id\n */\n\n constructor(key: string, uploadId: string) {\n this.key = key\n this.uploadId = uploadId\n }\n}\n\n/** Class representing a S3 Part */\nexport class S3Part {\n partNumber: number\n eTag: string\n\n /**\n * Create an S3 Part\n * @param {number} partNumber - Part number\n * @param {string} eTag - Part's etag\n */\n\n constructor(partNumber: number, eTag: string) {\n this.partNumber = partNumber\n this.eTag = eTag\n }\n}\n\n/**\n * Error indicating a S3 operation failed\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class S3ServiceError extends AWSError {\n operation: string\n\n /**\n * Constructs a S3ServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: string) {\n super(message, code)\n this.name = 'S3ServiceError'\n this.operation = operation\n }\n}\n\n/**\n * S3Operation describes possible values for S3 API operations,\n * as defined by AWS APIs.\n */\ntype S3Operation =\n | 'ListBuckets'\n | 'ListObjectsV2'\n | 'GetObject'\n | 'PutObject'\n | 'DeleteObject'\n | 'CreateMultipartUpload'\n | 'CompleteMultipartUpload'\n | 'UploadPart'\n | 'AbortMultipartUpload'\n\n/**\n * Describes the class of storage used to store a S3 object.\n */\ntype StorageClass =\n | 'STANDARD'\n | 'REDUCED_REDUNDANCY'\n | 'GLACIER'\n | 'STANDARD_IA'\n | 'INTELLIGENT_TIERING'\n | 'DEEP_ARCHIVE'\n | 'OUTPOSTS'\n | 'GLACIER_IR'\n | undefined\n","import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AWSConfig","options","region","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","this","undefined","sessionToken","scheme","endpoint","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","require","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","S3Client","awsConfig","serviceName","signedRequest","sign","host","res","http","_handle_error","buckets","children","each","_","bucketDefinition","bucket","forEach","child","nodeName","assign","textContent","creationDate","bucketName","prefix","objects","objectDefinition","lastModified","etag","size","parseInt","storageClass","objectKey","S3Object","data","Host","uploads","S3MultipartUpload","uploadId","partNumber","S3Part","parts","part","eTag","operation","response","status","errorCode","error_code","errorMessage","error","S3ServiceError","awsError","parseXML","_host","_scheme","S3Bucket"],"sourceRoot":""} \ No newline at end of file diff --git a/build/secrets-manager.js.map b/build/secrets-manager.js.map index aa32559..5dfb154 100644 --- a/build/secrets-manager.js.map +++ b/build/secrets-manager.js.map @@ -1 +1 @@ -{"version":3,"file":"secrets-manager.js","mappings":"2BAAA,IAAIA,EAAK,EAAQ,KACbC,EAAK,EAAQ,KAEbC,EAAOD,EACXC,EAAKF,GAAKA,EACVE,EAAKD,GAAKA,EAEVE,EAAOC,QAAUF,C,UCFjB,IADA,IAAIG,EAAY,GACPC,EAAI,EAAGA,EAAI,MAAOA,EACzBD,EAAUC,IAAMA,EAAI,KAAOC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/uuid/index.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/bytesToUuid.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/rng-browser.js","webpack://k6-jslib-aws/./node_modules/uuid/v1.js","webpack://k6-jslib-aws/./node_modules/uuid/v4.js","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/secrets-manager.ts","webpack://k6-jslib-aws/./src/internal/client.ts"],"sourcesContent":["var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { v4 as uuidv4 } from 'uuid'\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's SecretsManager service\n */\nexport class SecretsManagerClient extends AWSClient {\n /**\n * HTTP Method to use when interacting with the Secrets Manager service.\n */\n method: HTTPMethod\n\n /**\n * HTTP headers to use accross all requests to the Secrets Manager service.\n */\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a SecretsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'secretsmanager')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the Secrets Manager service\n // are made via the GET or POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Returns a list of all secrets owned by the authenticated sender of the request.\n * To use this operation, you must have the secretsmanager:ListSecrets permission.\n *\n * @return {Array.} secrets - An array of objects describing Secret Manager's secrets\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n listSecrets(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.ListSecrets`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.ListSecrets, res)\n const json: JSONArray = res.json('SecretList') as JSONArray\n\n return json.map((s) => Secret.fromJSON(s as JSONObject))\n }\n\n /**\n * Retrieves a secret from Amazon Sercets Manager\n *\n * @param {string} id - The ARN or name of the secret to retrieve.\n * @returns {Secret} - returns the content of the fetched Secret object.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getSecret(id: string): Secret | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.GetSecretValue`,\n },\n body: JSON.stringify({ SecretId: id }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n\n this._handle_error(SecretsManagerOperation.GetSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Creates a new secret\n *\n * Note that this method only supports string-based values at the moment.\n *\n * @param {string} name - The name of the new secret.\n * The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {string} description - The description of the secret.\n * @param {string} versionID=null - Version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * algorithm.\n * @param {Array.} tags=[] - A list of tags to attach to the secret. Each tag is a key and\n * value pair of strings in a JSON text string. Note that tag key names are case sensitive.\n * @returns {Secret} - returns the created secret\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n createSecret(\n name: string,\n secret: string,\n description: string,\n versionID?: string,\n tags?: Array\n ): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.CreateSecret`,\n },\n body: JSON.stringify({\n Name: name,\n Description: description,\n SecretString: secret,\n ClientRequestToken: versionID,\n Tags: tags,\n }),\n },\n {}\n )\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n // headers['X-Amz-Target'] = `${this.serviceName}.CreateSecret`\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.CreateSecret, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n /**\n * Update a secret's value.\n *\n * Note that this method only support string-based values at the moment.\n *\n * @param {string} id - The ARN or name of the secret to update.\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {} versionID=null - A unique identifier for the new version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n putSecretValue(id: string, secret: string, versionID?: string): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.PutSecretValue`,\n },\n body: JSON.stringify({\n SecretId: id,\n SecretString: secret,\n ClientRequestToken: versionID,\n }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.PutSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Deletes a secret and all of its versions.\n *\n * You can specify a recovery window during which you can restore the secret.\n * The minimum recovery window is 7 days. The default recovery window is 30 days.\n *\n * @param {string} secretID - The ARN or name of the secret to delete.\n * @param {number} recoveryWindow - The number of days from 7 to 30 that Secrets Manager\n * waits before permanently deleting the secret.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteSecret(\n id: string,\n { recoveryWindow = 30, noRecovery = false }: { recoveryWindow: number; noRecovery: boolean }\n ) {\n const payload: { [key: string]: string | boolean | number } = {\n SecretId: id,\n }\n\n // noRecovery and recoveryWindow are exclusive parameters\n if (noRecovery === true) {\n payload['ForceDeleteWithoutRecovery'] = true\n } else {\n payload['RecoveryWindowInDays'] = recoveryWindow\n }\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.DeleteSecret`,\n },\n body: JSON.stringify(payload),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.DeleteSecret, res)\n }\n\n _handle_error(\n operation: SecretsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SecretsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SecretsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n// TODO: create a Tags type\n\n/**\n * Class representing a Secret Manager's secret\n */\nexport class Secret {\n name: string\n arn: string\n secret: string\n createdDate: number\n lastAccessedDate: number\n lastChangedDate: number\n tags: Array<{ [key: string]: string }>\n\n /**\n * Constructs a Secret Manager's Secret\n *\n * @param {string} name - The friendly name of the secret.\n * @param {string} arn - The ARN of the secret.\n * @param {number} createdDate - The date and time that this version of the secret was created.\n * @param {number} lastAccessedDate - The last date that this secret was accessed. This value is\n * truncated to midnight of the date and therefore shows only the date, not the time.\n * @param {number} lastChangedDate - The last date and time that this secret was modified in any way.\n * @param {Array.} tags - The list of user-defined tags associated with the secret.\n */\n constructor(\n name: string,\n arn: string,\n secretString: string,\n createdDate: number,\n lastAccessedDate: number,\n lastChangedDate: number,\n tags: Array<{ [key: string]: string }> = []\n ) {\n this.name = name\n this.arn = arn\n this.secret = secretString\n this.createdDate = createdDate\n this.lastAccessedDate = lastAccessedDate\n this.lastChangedDate = lastChangedDate\n this.tags = tags\n }\n\n /**\n * Parses and constructs a Secret Manager's Secret from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {Secret}\n */\n static fromJSON(json: JSONObject) {\n return new Secret(\n json.Name as string,\n json.ARN as string,\n json.SecretString as string,\n json.CreatedDate as number,\n json.LastAccessedDate as number,\n json.LastChangedDate as number,\n json.Tags as Array<{ [key: string]: string }>\n )\n }\n}\n\nexport class SecretsManagerServiceError extends AWSError {\n operation: SecretsManagerOperation\n\n /**\n * Constructs a SecretsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SecretsManagerOperation) {\n super(message, code)\n this.name = 'SecretsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SecretsManagerOperation defines all currently implemented Secrets Manager Service operations.\n */\nenum SecretsManagerOperation {\n ListSecrets = 'ListSecrets',\n GetSecretValue = 'GetSecretValue',\n CreateSecret = 'CreateSecret',\n PutSecretValue = 'PutSecretValue',\n DeleteSecret = 'DeleteSecret',\n}\n","import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n"],"names":["v1","v4","uuid","module","exports","byteToHex","i","toString","substr","buf","offset","bth","join","getRandomValues","crypto","bind","window","msCrypto","rnds8","Uint8Array","rnds","Array","r","Math","random","_nodeId","_clockseq","rng","bytesToUuid","_lastMSecs","_lastNSecs","options","b","node","clockseq","undefined","seedBytes","msecs","Date","getTime","nsecs","dt","Error","tl","tmh","n","ii","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AWSConfig","region","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","this","sessionToken","scheme","endpoint","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","require","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","SecretsManagerOperation","SecretsManagerClient","awsConfig","serviceName","commonHeaders","signedRequest","sign","host","res","http","_handle_error","ListSecrets","json","s","Secret","fromJSON","id","SecretId","GetSecretValue","secret","description","versionID","tags","uuidv4","Name","Description","SecretString","ClientRequestToken","Tags","CreateSecret","PutSecretValue","recoveryWindow","noRecovery","payload","DeleteSecret","operation","response","errorCode","error_code","error","errorMessage","Message","__type","SecretsManagerServiceError","_host","_scheme","arn","secretString","createdDate","lastAccessedDate","lastChangedDate","ARN","CreatedDate","LastAccessedDate","LastChangedDate"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"secrets-manager.js","mappings":"2BAAA,IAAIA,EAAK,EAAQ,KACbC,EAAK,EAAQ,KAEbC,EAAOD,EACXC,EAAKF,GAAKA,EACVE,EAAKD,GAAKA,EAEVE,EAAOC,QAAUF,C,UCFjB,IADA,IAAIG,EAAY,GACPC,EAAI,EAAGA,EAAI,MAAOA,EACzBD,EAAUC,IAAMA,EAAI,KAAOC,SAAS,IAAIC,OAAO,GAmBjDL,EAAOC,QAhBP,SAAqBK,EAAKC,GACxB,IAAIJ,EAAII,GAAU,EACdC,EAAMN,EAEV,MAAO,CACLM,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MACvBK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MAAO,IAC9BK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MAAO,IAC9BK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MAAO,IAC9BK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MAAO,IAC9BK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MACvBK,EAAIF,EAAIH,MAAOK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B,M,gFAAC,EA/CmB,ID2STkK,GAAM,WAoBf,WACI1H,EACA0J,EACAC,EACAC,EACAC,EACAC,GAEF,IADE5B,EAAyC,UAAH,6CAAG,GAAE,2MAE3C5K,KAAK0C,KAAOA,EACZ1C,KAAKoM,IAAMA,EACXpM,KAAKyK,OAAS4B,EACdrM,KAAKsM,YAAcA,EACnBtM,KAAKuM,iBAAmBA,EACxBvM,KAAKwM,gBAAkBA,EACvBxM,KAAK4K,KAAOA,CAChB,CAoBC,OAlBD,iCAQA,SAAgBV,GACZ,OAAO,IAAIE,EACPF,EAAKY,KACLZ,EAAKuC,IACLvC,EAAKc,aACLd,EAAKwC,YACLxC,EAAKyC,iBACLzC,EAAK0C,gBACL1C,EAAKgB,KAEb,KAAC,EAxDc,GA2DNe,GAA0B,gCAUnC,WAAYxL,EAAiBgC,EAAcgJ,GAAoC,MAGjD,OAHiD,WACvD,MAApB,cAAMhL,EAASgC,IAAK,oBACpB,EAAKC,KAAO,6BACZ,EAAK+I,UAAYA,EAAS,CAC9B,CAAC,aAdkC,CAASjJ,IAoBpB,SAAvB8G,GAAAA,EAAuB,0BAAvBA,EAAuB,gCAAvBA,EAAuB,4BAAvBA,EAAuB,gCAAvBA,EAAuB,6BAAvBA,KAAAA,GAAuB,I","sources":["webpack://k6-jslib-aws/./node_modules/uuid/index.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/bytesToUuid.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/rng-browser.js","webpack://k6-jslib-aws/./node_modules/uuid/v1.js","webpack://k6-jslib-aws/./node_modules/uuid/v4.js","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/secrets-manager.ts","webpack://k6-jslib-aws/./src/internal/client.ts"],"sourcesContent":["var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { v4 as uuidv4 } from 'uuid'\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's SecretsManager service\n */\nexport class SecretsManagerClient extends AWSClient {\n /**\n * HTTP Method to use when interacting with the Secrets Manager service.\n */\n method: HTTPMethod\n\n /**\n * HTTP headers to use accross all requests to the Secrets Manager service.\n */\n commonHeaders: HTTPHeaders\n\n signature: SignatureV4\n\n /**\n * Create a SecretsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'secretsmanager')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n\n // All interactions with the Secrets Manager service\n // are made via the GET or POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Returns a list of all secrets owned by the authenticated sender of the request.\n * To use this operation, you must have the secretsmanager:ListSecrets permission.\n *\n * @return {Array.} secrets - An array of objects describing Secret Manager's secrets\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n listSecrets(): Array {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.ListSecrets`,\n },\n body: JSON.stringify({}),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.ListSecrets, res)\n const json: JSONArray = res.json('SecretList') as JSONArray\n\n return json.map((s) => Secret.fromJSON(s as JSONObject))\n }\n\n /**\n * Retrieves a secret from Amazon Sercets Manager\n *\n * @param {string} id - The ARN or name of the secret to retrieve.\n * @returns {Secret} - returns the content of the fetched Secret object.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getSecret(id: string): Secret | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.GetSecretValue`,\n },\n body: JSON.stringify({ SecretId: id }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n\n this._handle_error(SecretsManagerOperation.GetSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Creates a new secret\n *\n * Note that this method only supports string-based values at the moment.\n *\n * @param {string} name - The name of the new secret.\n * The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {string} description - The description of the secret.\n * @param {string} versionID=null - Version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * algorithm.\n * @param {Array.} tags=[] - A list of tags to attach to the secret. Each tag is a key and\n * value pair of strings in a JSON text string. Note that tag key names are case sensitive.\n * @returns {Secret} - returns the created secret\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n createSecret(\n name: string,\n secret: string,\n description: string,\n versionID?: string,\n tags?: Array\n ): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.CreateSecret`,\n },\n body: JSON.stringify({\n Name: name,\n Description: description,\n SecretString: secret,\n ClientRequestToken: versionID,\n Tags: tags,\n }),\n },\n {}\n )\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n // headers['X-Amz-Target'] = `${this.serviceName}.CreateSecret`\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.CreateSecret, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n /**\n * Update a secret's value.\n *\n * Note that this method only support string-based values at the moment.\n *\n * @param {string} id - The ARN or name of the secret to update.\n * @param {string} secret - The text data to encrypt and store in this new version of the secret.\n * @param {} versionID=null - A unique identifier for the new version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n putSecretValue(id: string, secret: string, versionID?: string): Secret {\n versionID = versionID || uuidv4()\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.PutSecretValue`,\n },\n body: JSON.stringify({\n SecretId: id,\n SecretString: secret,\n ClientRequestToken: versionID,\n }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.PutSecretValue, res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Deletes a secret and all of its versions.\n *\n * You can specify a recovery window during which you can restore the secret.\n * The minimum recovery window is 7 days. The default recovery window is 30 days.\n *\n * @param {string} secretID - The ARN or name of the secret to delete.\n * @param {number} recoveryWindow - The number of days from 7 to 30 that Secrets Manager\n * waits before permanently deleting the secret.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteSecret(\n id: string,\n { recoveryWindow = 30, noRecovery = false }: { recoveryWindow: number; noRecovery: boolean }\n ) {\n const payload: { [key: string]: string | boolean | number } = {\n SecretId: id,\n }\n\n // noRecovery and recoveryWindow are exclusive parameters\n if (noRecovery === true) {\n payload['ForceDeleteWithoutRecovery'] = true\n } else {\n payload['RecoveryWindowInDays'] = recoveryWindow\n }\n\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `${this.serviceName}.DeleteSecret`,\n },\n body: JSON.stringify(payload),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SecretsManagerOperation.DeleteSecret, res)\n }\n\n _handle_error(\n operation: SecretsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SecretsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SecretsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n// TODO: create a Tags type\n\n/**\n * Class representing a Secret Manager's secret\n */\nexport class Secret {\n name: string\n arn: string\n secret: string\n createdDate: number\n lastAccessedDate: number\n lastChangedDate: number\n tags: Array<{ [key: string]: string }>\n\n /**\n * Constructs a Secret Manager's Secret\n *\n * @param {string} name - The friendly name of the secret.\n * @param {string} arn - The ARN of the secret.\n * @param {number} createdDate - The date and time that this version of the secret was created.\n * @param {number} lastAccessedDate - The last date that this secret was accessed. This value is\n * truncated to midnight of the date and therefore shows only the date, not the time.\n * @param {number} lastChangedDate - The last date and time that this secret was modified in any way.\n * @param {Array.} tags - The list of user-defined tags associated with the secret.\n */\n constructor(\n name: string,\n arn: string,\n secretString: string,\n createdDate: number,\n lastAccessedDate: number,\n lastChangedDate: number,\n tags: Array<{ [key: string]: string }> = []\n ) {\n this.name = name\n this.arn = arn\n this.secret = secretString\n this.createdDate = createdDate\n this.lastAccessedDate = lastAccessedDate\n this.lastChangedDate = lastChangedDate\n this.tags = tags\n }\n\n /**\n * Parses and constructs a Secret Manager's Secret from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {Secret}\n */\n static fromJSON(json: JSONObject) {\n return new Secret(\n json.Name as string,\n json.ARN as string,\n json.SecretString as string,\n json.CreatedDate as number,\n json.LastAccessedDate as number,\n json.LastChangedDate as number,\n json.Tags as Array<{ [key: string]: string }>\n )\n }\n}\n\nexport class SecretsManagerServiceError extends AWSError {\n operation: SecretsManagerOperation\n\n /**\n * Constructs a SecretsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SecretsManagerOperation) {\n super(message, code)\n this.name = 'SecretsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SecretsManagerOperation defines all currently implemented Secrets Manager Service operations.\n */\nenum SecretsManagerOperation {\n ListSecrets = 'ListSecrets',\n GetSecretValue = 'GetSecretValue',\n CreateSecret = 'CreateSecret',\n PutSecretValue = 'PutSecretValue',\n DeleteSecret = 'DeleteSecret',\n}\n","import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n"],"names":["v1","v4","uuid","module","exports","byteToHex","i","toString","substr","buf","offset","bth","join","getRandomValues","crypto","bind","window","msCrypto","rnds8","Uint8Array","rnds","Array","r","Math","random","_nodeId","_clockseq","rng","bytesToUuid","_lastMSecs","_lastNSecs","options","b","node","clockseq","undefined","seedBytes","msecs","Date","getTime","nsecs","dt","Error","tl","tmh","n","ii","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AWSConfig","region","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","this","sessionToken","scheme","endpoint","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","require","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","SecretsManagerOperation","SecretsManagerClient","awsConfig","serviceName","commonHeaders","signedRequest","sign","host","res","http","_handle_error","ListSecrets","json","s","Secret","fromJSON","id","SecretId","GetSecretValue","secret","description","versionID","tags","uuidv4","Name","Description","SecretString","ClientRequestToken","Tags","CreateSecret","PutSecretValue","recoveryWindow","noRecovery","payload","DeleteSecret","operation","response","errorCode","error_code","error","errorMessage","Message","__type","SecretsManagerServiceError","_host","_scheme","arn","secretString","createdDate","lastAccessedDate","lastChangedDate","ARN","CreatedDate","LastAccessedDate","LastChangedDate"],"sourceRoot":""} \ No newline at end of file diff --git a/build/signature.js.map b/build/signature.js.map index c7a579b..49d493f 100644 --- a/build/signature.js.map +++ b/build/signature.js.map @@ -1 +1 @@ -{"version":3,"file":"signature.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+ZCFvD,IAAMC,EAA4B,kBAC5BC,EAA6B,mBAC7BC,EAAuB,aACvBC,EAA0B,gBAC1BC,EAA4B,kBAC5BC,EAAiC,sBAEjCC,EAAwB,uBAKxBC,EAA4B,uBAC5BC,EAAkBN,EAAqBO,cACvCC,EAAuBN,EAA0BK,cAEjDE,GAVyB,eASkBF,cACxBH,EAAsBG,eAKzCG,EAAuB,gBAMvBC,EAAoB,CAACD,EAAsBJ,EAL7B,QAMdM,EAAc,OAMdC,EAA4B,CACrCC,eAAe,EACf,iBAAiB,EACjBC,YAAY,EACZC,QAAQ,EACRC,MAAM,EACN,cAAc,EACd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AW,GAAGvD,SAAS,IAAIwD,cAC5C,GAGJ,CASA,SAAS9F,EAAW+F,GAChB,IAeaC,EAfP/F,GAeO+F,EAfYD,EA2B7B,SAAgBC,GACZ,MAAoB,iBAATA,EACA,IAAItG,KAAY,IAAPsG,GAGA,iBAATA,EACHC,OAAOD,GACA,IAAItG,KAAoB,IAAfuG,OAAOD,IAGpB,IAAItG,KAAKsG,GAGbA,CACX,CAzBWE,CAAOF,GACTG,cACA5B,QAAQ,YAAa,MAlBKA,QAAQ,SAAU,IACjD,MAAO,CACHtE,SAAAA,EACAC,UAAWD,EAAS2E,MAAM,EAAG,GAErC,C","sources":["webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","UNSIGNED_PAYLOAD","require","AWSError","message","code","name","xmlDocument","doc","parseHTML","find","text","Error","SignatureV4","service","region","credentials","uriEscapePath","applyChecksum","this","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","sessionToken","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","accessKeyId","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","options","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","secretAccessKey","kDate","kRegion","kService","normalizedURISegments","split","URISegment","length","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","undefined","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"signature.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CA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,C","sources":["webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","UNSIGNED_PAYLOAD","require","AWSError","message","code","name","xmlDocument","doc","parseHTML","find","text","Error","SignatureV4","service","region","credentials","uriEscapePath","applyChecksum","this","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","sessionToken","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","accessKeyId","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","options","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","secretAccessKey","kDate","kRegion","kService","normalizedURISegments","split","URISegment","length","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","undefined","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString"],"sourceRoot":""} \ No newline at end of file diff --git a/build/sqs.js.map b/build/sqs.js.map index 2b25747..0880d55 100644 --- a/build/sqs.js.map +++ b/build/sqs.js.map @@ -1 +1 @@ -{"version":3,"file":"sqs.js","mappings":"04BAUO,IAAMA,EAAS,WAWlB,WAAYC,EAAsBC,I,4FAAqB,iHACnDC,KAAKF,UAAYA,EACjBE,KAAKD,YAAcA,CACvB,C,UAiCD,O,EA/BC,G,EAAA,iBAIA,WAII,OAHkBE,MAAdD,KAAKE,QACPF,KAAKE,MAAQ,GAAH,OAAMF,KAAKD,YAAW,YAAIC,KAAKF,UAAUK,OAAM,YAAIH,KAAKF,UAAUM,WAEvEJ,KAAKE,KAChB,EAAC,IAED,SAAgBG,GACZL,KAAKE,MAAQG,CACjB,GAEE,kBAKF,WAKE,OAHoBJ,MAAhBD,KAAKM,UACPN,KAAKM,QAAUN,KAAKF,UAAUS,QAEzBP,KAAKM,OACd,E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AGtC,OAHsC,UAC5C,IAApB,cAAMnN,EAASiC,IAAK,oBACpB,EAAKC,KAAO,kBACZ,EAAKiL,UAAYA,EAAS,CAC9B,CAAC,YAPuB,CAASnL,EAAAA,E","sources":["webpack://k6-jslib-aws/./src/internal/client.ts","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/sqs.ts"],"sourcesContent":["import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","module.exports = require(\"k6/crypto\");","module.exports = require(\"k6/html\");","module.exports = require(\"k6/http\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { SignatureV4, InvalidSignatureError } from './signature'\nimport { HTTPHeaders, SignedHTTPRequest } from './http'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\nimport { toFormUrlEncoded } from './utils'\nimport { AWSError } from './error'\n\nconst API_VERSION = '2012-11-05'\n\nexport class SQSClient extends AWSClient {\n private readonly signature: SignatureV4\n private readonly commonHeaders: HTTPHeaders\n\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'sqs')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken\n },\n uriEscapePath: true,\n applyChecksum: true\n })\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }\n }\n\n /**\n * Delivers a message to the specified queue.\n *\n * @param {string} queueUrl - The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive.\n * @param {string} messageBody - The message to send. The minimum size is one character. The maximum size is 256 KB.\n * @param {Object} options - Options for the request\n * @param {string} [options.messageDeduplicationId] - The message deduplication id.\n * @param {string} [options.messageGroupId] - The message group ID for FIFO queues\n * @returns {Message} - The message that was sent.\n */\n sendMessage(queueUrl: string, messageBody: string, options: { messageDeduplicationId?: string; messageGroupId?: string} = {}): Message {\n const method = 'POST'\n\n let body: any = {\n Action: 'SendMessage',\n Version: API_VERSION,\n QueueUrl: queueUrl,\n MessageBody: messageBody,\n }\n\n if (typeof(options.messageDeduplicationId) !== 'undefined') {\n body = { ...body,\n MessageDeduplicationId: options.messageDeduplicationId\n }\n }\n\n if (typeof(options.messageGroupId) !== 'undefined') {\n body = { ...body,\n MessageGroupId: options.messageGroupId\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('SendMessage', res)\n\n const parsed = res.html('SendMessageResponse > SendMessageResult')\n return new Message(\n parsed.find('MessageId').text(),\n parsed.find('MD5OfMessageBody').text()\n )\n }\n\n /**\n * Returns a list of your queues in the current region.\n *\n * @param {ListQueuesRequestParameters} [parameters={}] request parameters\n * @param {number} [ListQueuesRequestParameters.maxResults] Maximum number of results to include in the response. Value range is 1 to 1000. You must set maxResults to receive a value for nextToken in the response.\n * @param {string} [ListQueuesRequestParameters.nextToken] Pagination token to request the next set of results.\n * @param {string} [ListQueuesRequestParameters.queueNamePrefix] A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * @returns {Object}\n * @returns {string[]} Object.queueUrls - A list of queue URLs, up to 1000 entries.\n * @returns {string} [Object.nextToken] - In the future, you can use NextToken to request the next set of results.\n */\n listQueues(parameters: ListQueuesRequestParameters = {}): ListQueuesResponse {\n const method = 'POST'\n\n let body: any = {\n Action: 'ListQueues',\n Version: API_VERSION,\n }\n\n if (typeof(parameters?.maxResults) !== 'undefined') {\n body = { ...body,\n MaxResults: parameters.maxResults\n }\n }\n\n if (typeof(parameters?.nextToken) !== 'undefined') {\n body = { ...body,\n NextToken: parameters.nextToken\n }\n }\n\n if (typeof(parameters?.queueNamePrefix) !== 'undefined') {\n body = { ...body,\n QueueNamePrefix: parameters.queueNamePrefix\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n 'Host': this.host\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('ListQueues', res)\n\n let parsed = res.html()\n return {\n urls: parsed.find('QueueUrl').toArray().map(e => e.text()),\n nextToken: parsed.find('NextToken').text() || undefined\n }\n }\n\n private _handleError(operation: SQSOperation, response: RefinedResponse) {\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n if (errorMessage == '' && errorCode === 0) {\n return\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new SQSServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/**\n * An Amazon SQS message.\n */\nexport class Message {\n /**\n * A unique identifier for the message.\n * A MessageIdis considered unique across all AWS accounts for an extended period of time.\n */\n id: string\n\n /**\n * An MD5 digest of the non-URL-encoded message body string.\n */\n bodyMD5: string\n\n /**\n * Instantiates a new Message object.\n *\n * @param id\n * @param md5Ofbody\n */\n constructor(id: string, bodyMD5: string) {\n this.id = id\n this.bodyMD5 = bodyMD5\n }\n}\n\n/**\n * SQSServiceError indicates an error occurred while interacting with the SQS API.\n */\nexport class SQSServiceError extends AWSError {\n operation: SQSOperation;\n\n constructor(message: string, code: string, operation: SQSOperation) {\n super(message, code)\n this.name = 'SQSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SQSOperation describes possible SQS operations.\n */\ntype SQSOperation = 'ListQueues' | 'SendMessage'\n\nexport interface SendMessageOptions {\n /*\n * The message deduplication ID for FIFO queues\n */\n messageDeduplicationId?: string\n\n /*\n * The message group ID for FIFO queues\n */\n messageGroupId?: string\n}\n\nexport interface ListQueuesRequestParameters {\n /**\n * Maximum number of results to include in the response. Value range is 1 to 1000.\n */\n maxResults?: number\n /**\n * Pagination token to request the next set of results.\n */\n nextToken?: string\n /**\n * A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * Queue URLs and names are case-sensitive.\n */\n queueNamePrefix?: string\n}\n\nexport interface ListQueuesResponse {\n /**\n * A list of queue URLs, up to 1,000 entries, or the value of MaxResults you sent in the request.\n */\n urls: string[]\n /**\n * Pagination token to include in the next request.\n */\n nextToken?: string\n}"],"names":["AWSClient","awsConfig","serviceName","this","undefined","_host","region","endpoint","host","_scheme","scheme","AWSConfig","options","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","sessionToken","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","EMPTY_SHA256","UNSIGNED_PAYLOAD","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","hasHeader","soughtHeader","headers","Object","keys","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","hostname","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","key","value","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","isArrayBuffer","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","prototype","call","toFormUrlEncoded","form","params","module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","o","defineProperty","enumerable","get","obj","prop","hasOwnProperty","r","Symbol","toStringTag","API_VERSION","SQSClient","commonHeaders","queueUrl","messageBody","Action","Version","QueueUrl","MessageBody","messageDeduplicationId","MessageDeduplicationId","messageGroupId","MessageGroupId","signedRequest","sign","res","http","_handleError","parsed","html","Message","parameters","maxResults","MaxResults","nextToken","NextToken","queueNamePrefix","QueueNamePrefix","urls","toArray","e","operation","response","errorCode","error_code","error","awsError","SQSServiceError","id","bodyMD5"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"sqs.js","mappings":"04BAUO,IAAMA,EAAS,WAWlB,WAAYC,EAAsBC,I,4FAAqB,iHACnDC,KAAKF,UAAYA,EACjBE,KAAKD,YAAcA,CACvB,C,UAiCD,O,EA/BC,G,EAAA,iBAIA,WAII,OAHkBE,MAAdD,KAAKE,QACPF,KAAKE,MAAQ,GAAH,OAAMF,KAAKD,YAAW,YAAIC,KAAKF,UAAUK,OAAM,YAAIH,KAAKF,UAAUM,WAEvEJ,KAAKE,KAChB,EAAC,IAED,SAAgBG,GACZL,KAAKE,MAAQG,CACjB,GAEE,kBAKF,WAKE,OAHoBJ,MAAhBD,KAAKM,UACPN,KAAKM,QAAUN,KAAKF,UAAUS,QAEzBP,KAAKM,OACd,EAEA,IACA,SAAkBC,GAChBP,KAAKM,QAAUC,CACnB,M,8EAAC,EA/CmB,E,oiFCPf,IAAMC,EAAS,WAsFlB,WAAYC,GACR,GADmC,8IApDlB,SAAO,kBAST,kBA4CVA,EAAQN,QAA6B,KAAnBM,EAAQN,OAC3B,MAAM,IAAIO,EAAsB,yFAAD,OAC+DD,EAAQN,OAAM,MAIhH,IAAKM,EAAQE,aAAuC,KAAxBF,EAAQE,YAChC,MAAM,IAAID,EAAsB,wEAAD,OAC8CD,EAAQE,YAAW,MAIpG,GAAIF,EAAQE,YAAYC,OAAS,IAAMH,EAAQE,YAAYC,OAAS,IAChE,MAAM,IAAIF,EAAsB,wFAAD,OAC6DD,EAAQE,YAAYC,SAIpH,IAAKH,EAAQI,iBAA+C,KAA5BJ,E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AAI,CAC1EzB,QAASuJ,EAAcvJ,UAE3B9D,KAAKyN,aAAa,aAAcF,GAEhC,IAAIG,EAASH,EAAII,OACjB,MAAO,CACHS,KAAMV,EAAOhK,KAAK,YAAY2K,UAAUnH,KAAI,SAAAoH,GAAC,OAAIA,EAAE3K,MAAM,IACzDqK,UAAWN,EAAOhK,KAAK,aAAaC,aAAU1D,EAEtD,GAAC,0BAED,SAAqBsO,EAAyBC,GAC1C,IAAMC,EAAoBD,EAASE,WAGnC,GAAoB,IAFSF,EAASG,OAEE,IAAdF,EAA1B,CAIA,IAAMG,EAAWxL,EAAAA,EAAAA,SAAkBoL,EAASjJ,MAC5C,GACS,iCADDqJ,EAASvL,KAET,MAAM,IAAIsD,EAAAA,EAAsBiI,EAASxN,QAASwN,EAASvL,MAE3D,MAAM,IAAIwL,EAAgBD,EAASxN,QAASwN,EAASvL,MAAQ,UAAWkL,EAPhF,CASJ,KAAC,EAjKiB,CAAS1O,EAAAA,GAuKlB+N,EAAO,GAkBhB,WAAYkB,EAAYC,GAAiB,uDACrC/O,KAAK8O,GAAKA,EACV9O,KAAK+O,QAAUA,CACnB,IAMSF,EAAe,8BAGxB,WAAYzN,EAAiBiC,EAAckL,GAAyB,MAGtC,OAHsC,UAC5C,IAApB,cAAMnN,EAASiC,IAAK,oBACpB,EAAKC,KAAO,kBACZ,EAAKiL,UAAYA,EAAS,CAC9B,CAAC,YAPuB,CAASnL,EAAAA,E","sources":["webpack://k6-jslib-aws/./src/internal/client.ts","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/sqs.ts"],"sourcesContent":["import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","module.exports = require(\"k6/crypto\");","module.exports = require(\"k6/html\");","module.exports = require(\"k6/http\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { SignatureV4, InvalidSignatureError } from './signature'\nimport { HTTPHeaders, SignedHTTPRequest } from './http'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\nimport { toFormUrlEncoded } from './utils'\nimport { AWSError } from './error'\n\nconst API_VERSION = '2012-11-05'\n\nexport class SQSClient extends AWSClient {\n private readonly signature: SignatureV4\n private readonly commonHeaders: HTTPHeaders\n\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'sqs')\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: this.awsConfig.region,\n credentials: {\n accessKeyId: this.awsConfig.accessKeyId,\n secretAccessKey: this.awsConfig.secretAccessKey,\n sessionToken: this.awsConfig.sessionToken\n },\n uriEscapePath: true,\n applyChecksum: true\n })\n\n this.commonHeaders = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }\n }\n\n /**\n * Delivers a message to the specified queue.\n *\n * @param {string} queueUrl - The URL of the Amazon SQS queue to which a message is sent. Queue URLs and names are case-sensitive.\n * @param {string} messageBody - The message to send. The minimum size is one character. The maximum size is 256 KB.\n * @param {Object} options - Options for the request\n * @param {string} [options.messageDeduplicationId] - The message deduplication id.\n * @param {string} [options.messageGroupId] - The message group ID for FIFO queues\n * @returns {Message} - The message that was sent.\n */\n sendMessage(queueUrl: string, messageBody: string, options: { messageDeduplicationId?: string; messageGroupId?: string} = {}): Message {\n const method = 'POST'\n\n let body: any = {\n Action: 'SendMessage',\n Version: API_VERSION,\n QueueUrl: queueUrl,\n MessageBody: messageBody,\n }\n\n if (typeof(options.messageDeduplicationId) !== 'undefined') {\n body = { ...body,\n MessageDeduplicationId: options.messageDeduplicationId\n }\n }\n\n if (typeof(options.messageGroupId) !== 'undefined') {\n body = { ...body,\n MessageGroupId: options.messageGroupId\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('SendMessage', res)\n\n const parsed = res.html('SendMessageResponse > SendMessageResult')\n return new Message(\n parsed.find('MessageId').text(),\n parsed.find('MD5OfMessageBody').text()\n )\n }\n\n /**\n * Returns a list of your queues in the current region.\n *\n * @param {ListQueuesRequestParameters} [parameters={}] request parameters\n * @param {number} [ListQueuesRequestParameters.maxResults] Maximum number of results to include in the response. Value range is 1 to 1000. You must set maxResults to receive a value for nextToken in the response.\n * @param {string} [ListQueuesRequestParameters.nextToken] Pagination token to request the next set of results.\n * @param {string} [ListQueuesRequestParameters.queueNamePrefix] A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * @returns {Object}\n * @returns {string[]} Object.queueUrls - A list of queue URLs, up to 1000 entries.\n * @returns {string} [Object.nextToken] - In the future, you can use NextToken to request the next set of results.\n */\n listQueues(parameters: ListQueuesRequestParameters = {}): ListQueuesResponse {\n const method = 'POST'\n\n let body: any = {\n Action: 'ListQueues',\n Version: API_VERSION,\n }\n\n if (typeof(parameters?.maxResults) !== 'undefined') {\n body = { ...body,\n MaxResults: parameters.maxResults\n }\n }\n\n if (typeof(parameters?.nextToken) !== 'undefined') {\n body = { ...body,\n NextToken: parameters.nextToken\n }\n }\n\n if (typeof(parameters?.queueNamePrefix) !== 'undefined') {\n body = { ...body,\n QueueNamePrefix: parameters.queueNamePrefix\n }\n }\n\n const signedRequest: SignedHTTPRequest = this.signature.sign(\n {\n method: 'POST',\n protocol: 'https',\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n 'Host': this.host\n },\n body: toFormUrlEncoded(body)\n },\n {}\n )\n\n const res = http.request(method, signedRequest.url, signedRequest.body || '', {\n headers: signedRequest.headers\n })\n this._handleError('ListQueues', res)\n\n let parsed = res.html()\n return {\n urls: parsed.find('QueueUrl').toArray().map(e => e.text()),\n nextToken: parsed.find('NextToken').text() || undefined\n }\n }\n\n private _handleError(operation: SQSOperation, response: RefinedResponse) {\n const errorCode: number = response.error_code\n const errorMessage: string = response.error\n\n if (errorMessage == '' && errorCode === 0) {\n return\n }\n\n const awsError = AWSError.parseXML(response.body as string)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new SQSServiceError(awsError.message, awsError.code || 'unknown', operation)\n }\n }\n}\n\n/**\n * An Amazon SQS message.\n */\nexport class Message {\n /**\n * A unique identifier for the message.\n * A MessageIdis considered unique across all AWS accounts for an extended period of time.\n */\n id: string\n\n /**\n * An MD5 digest of the non-URL-encoded message body string.\n */\n bodyMD5: string\n\n /**\n * Instantiates a new Message object.\n *\n * @param id\n * @param md5Ofbody\n */\n constructor(id: string, bodyMD5: string) {\n this.id = id\n this.bodyMD5 = bodyMD5\n }\n}\n\n/**\n * SQSServiceError indicates an error occurred while interacting with the SQS API.\n */\nexport class SQSServiceError extends AWSError {\n operation: SQSOperation;\n\n constructor(message: string, code: string, operation: SQSOperation) {\n super(message, code)\n this.name = 'SQSServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SQSOperation describes possible SQS operations.\n */\ntype SQSOperation = 'ListQueues' | 'SendMessage'\n\nexport interface SendMessageOptions {\n /*\n * The message deduplication ID for FIFO queues\n */\n messageDeduplicationId?: string\n\n /*\n * The message group ID for FIFO queues\n */\n messageGroupId?: string\n}\n\nexport interface ListQueuesRequestParameters {\n /**\n * Maximum number of results to include in the response. Value range is 1 to 1000.\n */\n maxResults?: number\n /**\n * Pagination token to request the next set of results.\n */\n nextToken?: string\n /**\n * A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.\n * Queue URLs and names are case-sensitive.\n */\n queueNamePrefix?: string\n}\n\nexport interface ListQueuesResponse {\n /**\n * A list of queue URLs, up to 1,000 entries, or the value of MaxResults you sent in the request.\n */\n urls: string[]\n /**\n * Pagination token to include in the next request.\n */\n nextToken?: string\n}"],"names":["AWSClient","awsConfig","serviceName","this","undefined","_host","region","endpoint","host","_scheme","scheme","AWSConfig","options","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","sessionToken","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","EMPTY_SHA256","UNSIGNED_PAYLOAD","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","hasHeader","soughtHeader","headers","Object","keys","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","hostname","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","key","value","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","isArrayBuffer","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","prototype","call","toFormUrlEncoded","form","params","module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","o","defineProperty","enumerable","get","obj","prop","hasOwnProperty","r","Symbol","toStringTag","API_VERSION","SQSClient","commonHeaders","queueUrl","messageBody","Action","Version","QueueUrl","MessageBody","messageDeduplicationId","MessageDeduplicationId","messageGroupId","MessageGroupId","signedRequest","sign","res","http","_handleError","parsed","html","Message","parameters","maxResults","MaxResults","nextToken","NextToken","queueNamePrefix","QueueNamePrefix","urls","toArray","e","operation","response","errorCode","error_code","error","awsError","SQSServiceError","id","bodyMD5"],"sourceRoot":""} \ No newline at end of file diff --git a/build/ssm.js.map b/build/ssm.js.map index 2dd0cf7..f6e7b73 100644 --- a/build/ssm.js.map +++ b/build/ssm.js.map @@ -1 +1 @@ -{"version":3,"file":"ssm.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA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,EAAUO,KACVP,EAAUQ,MACVR,EAAUS,QAElB,KAAC,EA5G+B,GA+GvBnB,GAA0B,gCAUnC,WAAY7K,EAAiBiC,EAAcoI,GAAoC,MAGjD,OAHiD,WACvD,MAApB,cAAMrK,EAASiC,IAAK,oBACpB,EAAKC,KAAO,6BACZ,EAAKmI,UAAYA,EAAS,CAC9B,CAAC,aAdkC,CAASrI,IAoBpB,SAAvBmH,GAAAA,EAAuB,6BAAvBA,KAAAA,GAAuB,K","sources":["webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/ssm.ts","webpack://k6-jslib-aws/./src/internal/client.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's Systems Manager service\n */\nexport class SystemsManagerClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n signature: SignatureV4\n\n /**\n * Create a SystemsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'ssm')\n\n // All interactions with the Systems Manager service\n // are made via the POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n }\n\n /**\n * Retrieves a parameter from Amazon Systems Manager\n *\n * @param {string} name - The ARN or name of the parameter to retrieve.\n * @param {boolean} withDecryption - whether returned secure string parameters should be decrypted.\n * @returns {SystemsManagerParameter} - returns the fetched Parameter object.\n * @throws {SystemsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getParameter(\n name: string,\n withDecryption: boolean = false\n ): SystemsManagerParameter | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `AmazonSSM.GetParameter`,\n },\n body: JSON.stringify({ Name: name, WithDecryption: withDecryption }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SystemsManagerOperation.GetParameter, res)\n\n return SystemsManagerParameter.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(\n operation: SystemsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SystemsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SystemsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a Systems Manager's Parameter\n */\nexport class SystemsManagerParameter {\n /**\n * The Amazon Resource Name (ARN) of the parameter.\n */\n arn: string\n\n /**\n * The data type of the parameter, such as text or aws:ec2:image.\n * The default is text.\n */\n dataType: string\n\n /**\n * Date the parameter was last changed or updated and the parameter version was created.\n */\n lastModifiedDate: number\n\n /**\n * The friendly name of the parameter.\n */\n name: string\n\n /**\n * Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n */\n selector: string\n\n /**\n * plies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n */\n sourceResult: string\n\n /**\n * The type of parameter. Valid values include the following: String, StringList, and SecureString.\n */\n type: string\n\n /**\n * The parameter value.\n */\n value: string\n\n /**\n * The parameter version.\n */\n version: number\n\n /**\n * Constructs a Systems Manager's Parameter\n *\n * @param {string} arn - The Amazon Resource Name (ARN) of the parameter.\n * @param {string} dataType - The data type of the parameter, such as text or aws:ec2:image. The default is text.\n * @param {number} lastModifiedDate - Date the parameter was last changed or updated and the parameter version was created.\n * @param {string} name - The friendly name of the parameter.\n * @param {string} selector - Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n * @param {string} sourceResult - Applies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n * @param {string} type - The type of parameter. Valid values include the following: String, StringList, and SecureString.\n * @param {string} value - The parameter value.\n * @param {number} version - The parameter version.\n */\n constructor(\n arn: string,\n dataType: string,\n lastModifiedDate: number,\n name: string,\n selector: string,\n sourceResult: string,\n type: string,\n value: string,\n version: number\n ) {\n this.arn = arn\n this.dataType = dataType\n this.lastModifiedDate = lastModifiedDate\n this.name = name\n this.selector = selector\n this.sourceResult = sourceResult\n this.type = type\n this.value = value\n this.version = version\n }\n\n /**\n * Parses and constructs a Systems Manager's Parameter from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {SystemsManagerParameter}\n */\n static fromJSON(json: JSONObject): SystemsManagerParameter {\n const parameter = json.Parameter as JSONObject\n\n return new SystemsManagerParameter(\n parameter.ARN as string,\n parameter.DataType as string,\n parameter.LastModifiedDate as number,\n parameter.Name as string,\n parameter.Selector as string,\n parameter.SourceResult as string,\n parameter.Type as string,\n parameter.Value as string,\n parameter.Version as number\n )\n }\n}\n\nexport class SystemsManagerServiceError extends AWSError {\n operation: SystemsManagerOperation\n\n /**\n * Constructs a SystemsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {SystemsManagerOperation} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SystemsManagerOperation) {\n super(message, code)\n this.name = 'SystemsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SystemsManagerOperation defines all currently implemented Systems Manager operations.\n */\nenum SystemsManagerOperation {\n GetParameter = 'GetParameter',\n}\n","import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AWSConfig","options","region","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","this","undefined","sessionToken","scheme","endpoint","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","require","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","SystemsManagerOperation","SystemsManagerClient","awsConfig","commonHeaders","serviceName","withDecryption","signedRequest","sign","host","Name","WithDecryption","res","http","_handle_error","GetParameter","SystemsManagerParameter","fromJSON","json","operation","response","errorCode","error_code","error","errorMessage","Message","__type","SystemsManagerServiceError","_host","_scheme","arn","dataType","lastModifiedDate","selector","sourceResult","type","version","parameter","Parameter","ARN","DataType","LastModifiedDate","Selector","SourceResult","Type","Value","Version"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"ssm.js","mappings":"mBACA,IAA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SACVH,EAAUI,iBACVJ,EAAU3B,KACV2B,EAAUK,SACVL,EAAUM,aACVN,EAAUO,KACVP,EAAUQ,MACVR,EAAUS,QAElB,KAAC,EA5G+B,GA+GvBnB,GAA0B,gCAUnC,WAAY7K,EAAiBiC,EAAcoI,GAAoC,MAGjD,OAHiD,WACvD,MAApB,cAAMrK,EAASiC,IAAK,oBACpB,EAAKC,KAAO,6BACZ,EAAKmI,UAAYA,EAAS,CAC9B,CAAC,aAdkC,CAASrI,IAoBpB,SAAvBmH,GAAAA,EAAuB,6BAAvBA,KAAAA,GAAuB,K","sources":["webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/./src/internal/constants.ts","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/http.ts","webpack://k6-jslib-aws/./src/internal/utils.ts","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/ssm.ts","webpack://k6-jslib-aws/./src/internal/client.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { HTTPScheme } from './http'\n\n/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme} ['https']\n */\n scheme: HTTPScheme = 'https'\n\n // FIXME: Should really be called \"host\" instead. When used\n // with localstack we pass a complete host (hostname:port) here.\n /**\n * The AWS hostname to connect to.\n *\n * @type {string} ['amazonaws.com']\n */\n endpoint: string = 'amazonaws.com'\n\n /**\n * fromEnvironment creates an AWSConfig from the environment variables.\n *\n * It expects to find the following compulsory environment variables:\n * * AWS_REGION\n * * AWS_ACCESS_KEY_ID\n * * AWS_SECRET_ACCESS_KEY\n *\n * If set, the following optional environment variables are also used:\n * * AWS_SESSION_TOKEN\n *\n * Finally, the options parameter allows to explicitly set the scheme and endpoint\n * to use when connecting to AWS.\n *\n * @param options {AWSConnectionOptions}\n * @returns\n */\n static fromEnvironment(options?: AWSConnectionOptions): AWSConfig {\n const region = __ENV.AWS_REGION;\n const accessKeyId = __ENV.AWS_ACCESS_KEY_ID;\n const secretAccessKey = __ENV.AWS_SECRET_ACCESS_KEY;\n const sessionToken: string | undefined = __ENV.AWS_SESSION_TOKEN;\n const scheme: HTTPScheme | undefined = options?.scheme;\n const endpoint: string | undefined = options?.endpoint;\n\n return new AWSConfig({\n region,\n accessKeyId,\n secretAccessKey,\n sessionToken,\n scheme: scheme,\n endpoint: endpoint,\n })\n }\n\n /**\n * Create an AWSConfig.\n *\n * @param {AWSConfigOptions} options - configuration attributes to use when interacting with AWS' APIs\n * @throws {InvalidArgumentException}\n */\n constructor(options: AWSConfigOptions) {\n if (!options.region || options.region === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS region; reason: expected a valid AWS region name (e.g. \"us-east-1\"), got \\`${options.region}\\``\n )\n }\n\n if (!options.accessKeyId || options.accessKeyId === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: expected a non empty string, got \\`${options.accessKeyId}\\``\n )\n }\n\n if (options.accessKeyId.length < 16 || options.accessKeyId.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS access key ID; reason: size should be between 16 and 128 characters, got ${options.accessKeyId.length}`\n )\n }\n\n if (!options.secretAccessKey || options.secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: expected a non empty string, got \\`${options.secretAccessKey}\\``\n )\n }\n\n if (options.secretAccessKey.length < 16 || options.secretAccessKey.length > 128) {\n throw new InvalidAWSConfigError(\n `invalid AWS secret access key; reason: size should be between 16 and 128 characters, got ${options.secretAccessKey.length}`\n )\n }\n\n this.region = options.region\n this.accessKeyId = options.accessKeyId\n this.secretAccessKey = options.secretAccessKey\n\n if (options.sessionToken !== undefined) {\n this.sessionToken = options.sessionToken\n }\n\n if (options.scheme !== undefined) {\n this.scheme = options.scheme\n }\n\n if (options.endpoint !== undefined) {\n this.endpoint = options.endpoint\n }\n }\n}\n\n/**\n * Interface representing AWSConfig options\n */\nexport interface AWSConfigOptions extends AWSConnectionOptions {\n /**\n * The AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n *\n * @type {string}\n */\n region: string\n\n /**\n * Your user's AWS access key id credential.\n *\n * @type {string}\n */\n accessKeyId: string\n\n /**\n * Your user's AWS secret access key credential.\n *\n * @type {string}\n */\n secretAccessKey: string\n\n /**\n * Your user's AWS session token credential.\n *\n * @type {string}\n */\n sessionToken?: string\n}\n\n/**\n * Interface representing AWS connection options\n */\nexport interface AWSConnectionOptions {\n /**\n * The HTTP scheme to use when connecting to AWS.\n *\n * @type {HTTPScheme}\n */\n scheme?: HTTPScheme\n\n /**\n * The AWS hostname to connect to.\n *\n * @type {string}\n */\n endpoint?: string\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","/**\n * Standard Amazon AWS query parameter names\n */\nexport const AMZ_ALGORITHM_QUERY_PARAM = 'X-Amz-Algorithm'\nexport const AMZ_CREDENTIAL_QUERY_PARAM = 'X-Amz-Credential'\nexport const AMZ_DATE_QUERY_PARAM = 'X-Amz-Date'\nexport const AMZ_EXPIRES_QUERY_PARAM = 'X-Amz-Expires'\nexport const AMZ_SIGNATURE_QUERY_PARAM = 'X-Amz-Signature'\nexport const AMZ_SIGNED_HEADERS_QUERY_PARAM = 'X-Amz-SignedHeaders'\nexport const AMZ_TARGET_QUERY_PARAM = 'X-Amz-Target'\nexport const AMZ_TOKEN_QUERY_PARAM = 'X-Amz-Security-Token'\n\n/**\n * Standard Amazon AWS header names\n */\nexport const AMZ_CONTENT_SHA256_HEADER = 'x-amz-content-sha256'\nexport const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase()\nexport const AMZ_SIGNATURE_HEADER = AMZ_SIGNATURE_QUERY_PARAM.toLowerCase()\nexport const AMZ_TARGET_HEADER = AMZ_TARGET_QUERY_PARAM.toLowerCase()\nexport const AMZ_TOKEN_HEADER = AMZ_TOKEN_QUERY_PARAM.toLowerCase()\n\n/**\n * Common HTTP headers we rely on in the signing process\n */\nexport const AUTHORIZATION_HEADER = 'authorization'\nexport const DATE_HEADER = 'date'\n\n/**\n * Lists the headers that are generated as part of the signature process.\n */\nexport const GENERATED_HEADERS = [AUTHORIZATION_HEADER, AMZ_DATE_HEADER, DATE_HEADER]\nexport const HOST_HEADER = 'host'\n\n/**\n * Lists the headers that should never be included in the\n * request signature signature process.\n */\nexport const ALWAYS_UNSIGNABLE_HEADERS = {\n authorization: true,\n 'cache-control': true,\n connection: true,\n expect: true,\n from: true,\n 'keep-alive': true,\n 'max-forwards': true,\n pragma: true,\n referer: true,\n te: true,\n trailer: true,\n 'transfer-encoding': true,\n upgrade: true,\n 'user-agent': true,\n 'x-amzn-trace-id': true,\n}\n\n/**\n * Signature specific constants included in the signing process\n */\nexport const KEY_TYPE_IDENTIFIER = 'aws4_request'\nexport const SIGNING_ALGORITHM_IDENTIFIER = 'AWS4-HMAC-SHA256'\n\n/**\n * Maximum time to live of a signed request in seconds: 7 days.\n */\nexport const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7\n\n/**\n * SHA256 hash of an empty string (so we don't waste cycles recomputing it)\n */\nexport const EMPTY_SHA256 = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n\n/**\n * SHA256 hash of the unsigned payload constant (so we don't waste cycles recomputing it)\n */\nexport const UNSIGNED_PAYLOAD_SHA256 =\n '5a41b0751e4537c6ff868564ab44a4d4ecceec2ec5b1c5f74d97422968e04237'\n\nexport const UNSIGNED_PAYLOAD = 'UNSIGNED-PAYLOAD'\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Error code issued by the service (if any)\n */\n code?: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string?} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code?: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","import crypto from 'k6/crypto'\n\nimport * as constants from './constants'\nimport { AWSError } from './error'\nimport { hasHeader, HTTPHeaderBag, HTTPRequest, QueryParameterBag, SignedHTTPRequest } from './http'\nimport { isArrayBuffer } from './utils'\n\n/**\n * SignatureV4 can be used to sign HTTP requests and presign URLs using the AWS Signature\n * Version 4 signing process.\n *\n * It offers two signing methods:\n * - sign: signs the request headers and payload\n * - presign: returns a presigned (authorization information contained in the query string) URL\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html\n */\nexport class SignatureV4 {\n /**\n * The name of the service to sign for.\n */\n private readonly service: string\n\n /**\n * The name of the region to sign for.\n */\n private readonly region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n private readonly credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n private readonly uriEscapePath: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n private readonly applyChecksum: boolean\n\n // TODO: uriEscapePath and applyChecksum should not be present in the constructor\n constructor({\n service,\n region,\n credentials,\n uriEscapePath,\n applyChecksum,\n }: SignatureV4Options) {\n this.service = service\n this.region = region\n this.credentials = credentials\n this.uriEscapePath = typeof uriEscapePath === 'boolean' ? uriEscapePath : true\n this.applyChecksum = typeof applyChecksum === 'boolean' ? applyChecksum : true\n }\n\n /**\n * Includes AWS v4 signing information to the provided HTTP request.\n *\n * This method adds an Authorization header to the request, containing\n * the signature and other signing information. It also returns a preformatted\n * URL that can be used to make the k6 http request.\n *\n * This method mutates the request object.\n *\n * @param request {HTTPRequest} The request to sign.\n * @param param1 {SignOptions} Options for signing the request.\n * @returns {SignedHTTPRequest} The signed request.\n */\n sign(\n request: HTTPRequest,\n {\n signingDate = new Date(),\n signingService,\n signingRegion,\n unsignableHeaders = new Set(),\n signableHeaders = new Set(),\n }: RequestSigningOptions\n ): SignedHTTPRequest {\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const service = signingService || this.service\n const region = signingRegion || this.region\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = request.hostname\n\n // Filter out headers that will be generated and managed by the signing process.\n // If the user provide any of those as part of the HTTPRequest's headers, they\n // will be ignored.\n for (const headerName of Object.keys(request.headers)) {\n if (constants.GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) {\n delete request.headers[headerName]\n }\n }\n\n request.headers[constants.AMZ_DATE_HEADER] = longDate\n if (this.credentials.sessionToken) {\n request.headers[constants.AMZ_TOKEN_HEADER] = this.credentials.sessionToken\n }\n\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n if (ArrayBuffer.isView(request.body)) {\n request.body = request.body.buffer\n }\n\n // Ensure we avoid passing undefined to the crypto hash function.\n if (!request.body) {\n request.body = ''\n }\n\n let payloadHash = this.computePayloadHash(request)\n if (!hasHeader(constants.AMZ_CONTENT_SHA256_HEADER, request.headers) && this.applyChecksum) {\n request.headers[constants.AMZ_CONTENT_SHA256_HEADER] = payloadHash\n }\n\n const canonicalHeaders = this.computeCanonicalHeaders(request, unsignableHeaders, signableHeaders);\n const signature = this.calculateSignature(\n longDate,\n scope,\n this.deriveSigningKey(this.credentials, service, region, shortDate),\n this.createCanonicalRequest(request, canonicalHeaders, payloadHash),\n );\n\n /**\n * Step 4 of the signing process: add the signature to the HTTP request's headers.\n *\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n */\n request.headers[constants.AUTHORIZATION_HEADER] =\n `${constants.SIGNING_ALGORITHM_IDENTIFIER} ` +\n `Credential=${this.credentials.accessKeyId}/${scope}, ` +\n `SignedHeaders=${Object.keys(canonicalHeaders).sort().join(';')}, ` +\n `Signature=${signature}`\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n // We exclude the signature from the query string\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return {\n url: url,\n ...request,\n }\n }\n\n /**\n * Produces a presigned URL with AWS v4 signature information for the provided HTTP request.\n *\n * A presigned URL is a URL that contains the authorization information\n * (signature and other signing information) in the query string. This method\n * returns a preformatted URL that can be used to make the k6 http request.\n *\n * @param originalRequest - The original request to presign.\n * @param options - Options controlling the signing of the request.\n * @returns A signed request, including the presigned URL.\n */\n presign(originalRequest: HTTPRequest, options: PresignOptions = {}): SignedHTTPRequest {\n const {\n signingDate = new Date(),\n expiresIn = 3600,\n unsignableHeaders,\n unhoistableHeaders,\n signableHeaders,\n signingRegion,\n signingService,\n } = options\n const { longDate, shortDate }: DateInfo = formatDate(signingDate)\n const region = signingRegion || this.region\n const service = signingService || this.service\n\n if (expiresIn > constants.MAX_PRESIGNED_TTL) {\n throw new InvalidSignatureError(\n \"Signature version 4 presigned URLs can't be valid for more than 7 days\"\n )\n }\n\n const scope = `${shortDate}/${region}/${service}/${constants.KEY_TYPE_IDENTIFIER}`\n const request = this.moveHeadersToQuery(originalRequest, { unhoistableHeaders })\n\n // Required by the specification:\n // \"For HTTP/1.1 requests, you must include the host header at a minimum.\n // Standard headers like content-type are optional.\n // For HTTP/2 requests, you must include the :authority header instead of\n // the host header. Different services might require other headers.\"\n request.headers[constants.HOST_HEADER] = originalRequest.hostname\n\n // If the user provided a session token, include it in the signed url query string.\n if (this.credentials.sessionToken) {\n request.query[constants.AMZ_TOKEN_QUERY_PARAM] = this.credentials.sessionToken\n }\n\n // Add base signing query parameters to the request, as described in the documentation\n // @see https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n request.query[constants.AMZ_ALGORITHM_QUERY_PARAM] = constants.SIGNING_ALGORITHM_IDENTIFIER\n request.query[\n constants.AMZ_CREDENTIAL_QUERY_PARAM\n ] = `${this.credentials.accessKeyId}/${scope}`\n request.query[constants.AMZ_DATE_QUERY_PARAM] = longDate\n request.query[constants.AMZ_EXPIRES_QUERY_PARAM] = expiresIn.toString(10)\n\n const canonicalHeaders = this.computeCanonicalHeaders(\n request,\n unsignableHeaders,\n signableHeaders\n )\n request.query[constants.AMZ_SIGNED_HEADERS_QUERY_PARAM] = Object.keys(canonicalHeaders)\n .sort()\n .join(';')\n\n const signingKey = this.deriveSigningKey(this.credentials, service, region, shortDate)\n\n // Computing the payload from the original request. This is required\n // in the event the user attempts to produce a presigned URL for s3,\n // which requires the payload hash to be 'UNSIGNED-PAYLOAD'.\n //\n // To that effect, users need to set the 'x-amz-content-sha256' header,\n // and mark it as unhoistable and unsignable. When setup this way,\n // the computePayloadHash method will then return the string 'UNSIGNED-PAYLOAD'.\n const payloadHash = this.computePayloadHash(originalRequest)\n const canonicalRequest = this.createCanonicalRequest(request, canonicalHeaders, payloadHash)\n\n request.query[constants.AMZ_SIGNATURE_QUERY_PARAM] = this.calculateSignature(\n longDate,\n scope,\n signingKey,\n canonicalRequest\n )\n\n // If a request path was provided, add it to the URL\n let url = `${request.protocol}://${request.hostname}`\n if (request.path) {\n url += request.path\n }\n\n // If a request query string was provided, add it to the URL\n if (request.query) {\n url += `?${this.serializeQueryParameters(request.query)}`\n }\n\n return { url: url, ...request }\n }\n\n /**\n * Create a string including information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * Step 1 of the signing process: create the canonical request string.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\n *\n * @param request {HTTPRequest} The request to sign.\n * @param canonicalHeaders {HTTPHeaderBag} The request's canonical headers.\n * @param payloadHash {string} The hexadecimally encoded request's payload hash .\n * @returns {string} The canonical request string.\n */\n private createCanonicalRequest(\n request: HTTPRequest,\n canonicalHeaders: HTTPHeaderBag,\n payloadHash: string\n ): string {\n const sortedHeaders = Object.keys(canonicalHeaders).sort()\n const sortedCanonicalHeaders = sortedHeaders\n .map((name) => `${name}:${canonicalHeaders[name]}`)\n .join('\\n')\n const signedHeaders = sortedHeaders.join(';')\n\n return (\n `${request.method}\\n` +\n `${this.computeCanonicalURI(request)}\\n` +\n `${this.computeCanonicalQuerystring(request)}\\n` +\n `${sortedCanonicalHeaders}\\n\\n` +\n `${signedHeaders}\\n` +\n `${payloadHash}`\n )\n }\n\n /**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n * Step 2 of the signing process: create the string to sign.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The \"string to sign\".\n */\n private createStringToSign(\n longDate: string,\n credentialScope: string,\n canonicalRequest: string\n ): string {\n const hashedCanonicalRequest = crypto.sha256(canonicalRequest, 'hex')\n\n return (\n `${constants.SIGNING_ALGORITHM_IDENTIFIER}\\n` +\n `${longDate}\\n` +\n `${credentialScope}\\n` +\n `${hashedCanonicalRequest}`\n )\n }\n\n /**\n * Calculte the signature for AWS signature version 4.\n *\n * Step 3 of the signing process: create the signature.\n * @see https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\n *\n * @param longDate {string} The request's date in iso 8601 format.\n * @param credentialScope {string} The request's credential scope.\n * @param signingKey {string} the signing key as computed by the deriveSigningKey method.\n * @param canonicalRequest {string} The request's canonical request.\n * @returns {string} The signature.\n */\n private calculateSignature(\n longDate: string,\n credentialScope: string,\n signingKey: Uint8Array,\n canonicalRequest: string\n ): string {\n const stringToSign = this.createStringToSign(longDate, credentialScope, canonicalRequest)\n return crypto.hmac('sha256', signingKey, stringToSign, 'hex')\n }\n\n /**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param credentials {AWSCredentials} The credentials to use for signing.\n * @param service {string} The service the request is targeted at.\n * @param region {string} The region the request is targeted at.\n * @param shortDate {string} The request's date in YYYYMMDD format.\n * @returns {Uint8Array} The derived signing key.\n */\n private deriveSigningKey(\n credentials: Credentials,\n service: string,\n region: string,\n shortDate: string\n ): Uint8Array {\n const kSecret: string = credentials.secretAccessKey\n const kDate: any = crypto.hmac('sha256', 'AWS4' + kSecret, shortDate, 'binary')\n const kRegion: any = crypto.hmac('sha256', kDate, region, 'binary')\n const kService: any = crypto.hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = crypto.hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n }\n\n /**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param param0 {HTTPRequest} The request to sign.\n * @returns {string} The canonical URI.\n */\n private computeCanonicalURI({ path }: HTTPRequest): string {\n if (this.uriEscapePath) {\n // Non-S3 services, we normalize the path and then double URI encode it.\n // Ref: \"Remove Dot Segments\" https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4\n const normalizedURISegments = []\n\n for (const URISegment of path.split('/')) {\n if (URISegment?.length === 0) {\n continue\n }\n\n if (URISegment === '.') {\n continue\n }\n\n if (URISegment === '..') {\n normalizedURISegments.pop()\n } else {\n normalizedURISegments.push(URISegment)\n }\n }\n\n // Normalize the URI\n const leading = path?.startsWith('/') ? '/' : ''\n const URI = normalizedURISegments.join('/')\n const trailing = normalizedURISegments.length > 0 && path?.endsWith('/') ? '/' : ''\n const normalizedURI = `${leading}${URI}${trailing}`\n\n const doubleEncoded = encodeURIComponent(normalizedURI)\n\n return doubleEncoded.replace(/%2F/g, '/')\n }\n\n // For S3, we shouldn't normalize the path. For example, object name\n // my-object//example//photo.user should not be normalized to\n // my-object/example/photo.user\n return path\n }\n\n /**\n * Serializes the request's query parameters into their canonical\n * string version. If the request does not include a query parameters,\n * returns an empty string.\n *\n * @param param0 {HTTPRequest} The request containing the query parameters.\n * @returns {string} The canonical query string.\n */\n private computeCanonicalQuerystring({ query = {} }: HTTPRequest): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (key.toLowerCase() === constants.AMZ_SIGNATURE_HEADER) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n\n /**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * @param param0 {HTTPRequest} The request to compute the canonical headers of.\n * @param unsignableHeaders {Set} The headers that should not be signed.\n * @param signableHeaders {Set} The headers that should be signed.\n * @returns {string} The canonical headers.\n */\n private computeCanonicalHeaders(\n { headers }: HTTPRequest,\n unsignableHeaders?: Set,\n signableHeaders?: Set\n ): HTTPHeaderBag {\n const canonicalHeaders: HTTPHeaderBag = {}\n\n for (const headerName of Object.keys(headers).sort()) {\n if (headers[headerName] == undefined) {\n continue\n }\n\n const canonicalHeaderName = headerName.toLowerCase()\n if (\n canonicalHeaderName in constants.ALWAYS_UNSIGNABLE_HEADERS ||\n unsignableHeaders?.has(canonicalHeaderName)\n ) {\n if (\n !signableHeaders ||\n (signableHeaders && !signableHeaders.has(canonicalHeaderName))\n ) {\n continue\n }\n }\n\n canonicalHeaders[canonicalHeaderName] = headers[headerName].trim().replace(/\\s+/g, ' ')\n }\n\n return canonicalHeaders\n }\n\n /**\n * Computes the SHA256 cryptographic hash of the request's body.\n *\n * If the headers contain the 'X-Amz-Content-Sha256' header, then\n * the value of that header is returned instead. This proves useful\n * when, for example, presiging a URL for S3, as the payload hash\n * must always be equal to 'UNSIGNED-PAYLOAD'.\n *\n * @param param0 {HTTPRequest} The request to compute the payload hash of.\n * @returns {string} The hex encoded SHA256 payload hash, or the value of the 'X-Amz-Content-Sha256' header.\n */\n private computePayloadHash({ headers, body }: HTTPRequest): string {\n // for (const headerName of Object.keys(headers)) {\n // // If the header is present, return its value.\n // // So that we let the 'UNSIGNED-PAYLOAD' value pass through.\n // if (headerName.toLowerCase() === constants.AMZ_CONTENT_SHA256_HEADER) {\n // return headers[headerName]\n // }\n // }\n\n if (headers[constants.AMZ_CONTENT_SHA256_HEADER]) {\n return headers[constants.AMZ_CONTENT_SHA256_HEADER]\n }\n\n if (body == undefined) {\n return constants.EMPTY_SHA256\n }\n\n if (typeof body === 'string' || isArrayBuffer(body)) {\n return crypto.sha256(body, 'hex').toLowerCase()\n }\n\n if (ArrayBuffer.isView(body)) {\n // If the request body is a typed array, we need to convert it to a buffer\n // so that we can calculate the checksum.\n return crypto.sha256((body as DataView).buffer, 'hex').toLowerCase()\n }\n\n return constants.UNSIGNED_PAYLOAD\n }\n\n /**\n * Moves a request's headers to its query parameters.\n *\n * The operation will ignore any amazon standard headers, prefixed\n * with 'X-Amz-'. It will also ignore any headers specified as unhoistable\n * by the options.\n *\n * The operation will delete the headers from the request.\n *\n * @param request {HTTPRequest} The request to move the headers from.\n * @param options\n * @returns {HTTPRequest} The request with the headers moved to the query parameters.\n */\n private moveHeadersToQuery(\n request: HTTPRequest,\n options: { unhoistableHeaders?: Set } = {}\n ): HTTPRequest & { query: QueryParameterBag } {\n const requestCopy = JSON.parse(JSON.stringify(request))\n const { headers, query = {} as QueryParameterBag } = requestCopy\n\n for (const name of Object.keys(headers)) {\n const lowerCaseName = name.toLowerCase()\n if (\n lowerCaseName.slice(0, 6) === 'x-amz-' &&\n !options.unhoistableHeaders?.has(lowerCaseName)\n ) {\n query[name] = headers[name]\n delete headers[name]\n }\n }\n\n return {\n ...requestCopy,\n headers,\n query,\n }\n }\n\n /**\n * Serializes a HTTPRequest's query parameter bag into a string.\n *\n * @param query {QueryParameterBag} The query parameters to serialize.\n * @param ignoreKeys {Set} The keys to ignore.\n * @returns {string} The serialized, and ready to use in a URL, query parameters.\n */\n private serializeQueryParameters(query: QueryParameterBag, ignoreKeys?: string[]): string {\n const keys: Array = []\n const serialized: Record = {}\n\n for (const key of Object.keys(query).sort()) {\n if (ignoreKeys?.includes(key.toLowerCase())) {\n continue\n }\n\n keys.push(key)\n const value = query[key]\n\n if (typeof value === 'string') {\n serialized[key] = `${escapeURI(key)}=${escapeURI(value)}`\n } else if (Array.isArray(value)) {\n serialized[key] = value\n .slice(0)\n .sort()\n .reduce(\n (encoded: Array, value: string) =>\n encoded.concat([`${escapeURI(key)}=${escapeURI(value)}`]),\n []\n )\n .join('&')\n }\n }\n\n return keys\n .map((key) => serialized[key])\n .filter((serialized) => serialized)\n .join('&')\n }\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code?: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\nexport interface SignatureV4Options {\n /**\n * The name of the service to sign for.\n */\n service: string\n\n /**\n * The name of the region to sign for.\n */\n region: string\n\n /**\n * The credentials with which the request should be signed.\n */\n credentials: Credentials\n\n /**\n * Whether to uri-escape the request URI path as part of computing the\n * canonical request string. This is required for every AWS service, except\n * Amazon S3, as of late 2017.\n *\n * @default [true]\n */\n uriEscapePath?: boolean\n\n /**\n * Whether to calculate a checksum of the request body and include it as\n * either a request header (when signing) or as a query string parameter\n * (when presigning). This is required for AWS Glacier and Amazon S3 and optional for\n * every other AWS service as of late 2017.\n *\n * @default [true]\n */\n applyChecksum?: boolean\n}\n\nexport interface SignOptions {\n /**\n * The date and time to be used as signature metadata. This value should be\n * a Date object, a unix (epoch) timestamp, or a string that can be\n * understood by the JavaScript `Date` constructor.If not supplied, the\n * value returned by `new Date()` will be used.\n */\n signingDate?: Date\n\n /**\n * The service signing name. It will override the service name of the signer\n * in current invocation\n */\n signingService?: string\n\n /**\n * The region name to sign the request. It will override the signing region of the\n * signer in current invocation\n */\n signingRegion?: string\n}\n\nexport interface RequestSigningOptions extends SignOptions {\n /**\n * A set of strings whose members represents headers that cannot be signed.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unsignableHeaders set.\n */\n unsignableHeaders?: Set\n\n /**\n * A set of strings whose members represents headers that should be signed.\n * Any values passed here will override those provided via unsignableHeaders,\n * allowing them to be signed.\n *\n * All headers in the provided request will have their names converted to\n * lower case before signing.\n */\n signableHeaders?: Set\n}\n\nexport interface PresignOptions extends RequestSigningOptions {\n /**\n * The number of seconds before the presigned URL expires\n */\n expiresIn?: number\n\n /**\n * A set of strings whose representing headers that should not be hoisted\n * to presigned request's query string. If not supplied, the presigner\n * moves all the AWS-specific headers (starting with `x-amz-`) to the request\n * query string. If supplied, these headers remain in the presigned request's\n * header.\n * All headers in the provided request will have their names converted to\n * lower case and then checked for existence in the unhoistableHeaders set.\n */\n unhoistableHeaders?: Set\n}\n\nexport interface Credentials {\n /**\n * AWS access key ID\n */\n readonly accessKeyId: string\n\n /**\n * AWS secret access key\n */\n readonly secretAccessKey: string\n\n /**\n * A security or session token to use with these credentials. Usually\n * present for temporary credentials.\n */\n readonly sessionToken?: string\n}\n\nexport interface DateInfo {\n /**\n * ISO8601 formatted date string\n */\n longDate: string\n\n /**\n * String in the format YYYYMMDD\n */\n shortDate: string\n}\n\n/**\n * Escapes a URI following the AWS signature v4 escaping rules.\n *\n * @param URI {string} The URI to escape.\n * @returns {string} The escaped URI.\n */\nfunction escapeURI(URI: string): string {\n const hexEncode = (c: string): string => {\n return `%${c.charCodeAt(0).toString(16).toUpperCase()}`\n }\n\n return encodeURIComponent(URI).replace(/[!'()*]/g, hexEncode)\n}\n\n/**\n * formatDate formats a Date object into a ISO8601 formatted date string\n * and a string in the format YYYYMMDD.\n *\n * @param date {Date} The date to format.\n * @returns {DateInfo} The formatted date.\n */\nfunction formatDate(date: Date): DateInfo {\n const longDate = iso8601(date).replace(/[\\-:]/g, '')\n return {\n longDate,\n shortDate: longDate.slice(0, 8),\n }\n}\n\n/**\n * Formats a time into an ISO 8601 string.\n *\n * @see https://en.wikipedia.org/wiki/ISO_8601\n *\n * @param time {number | string | Date} The time to format.\n * @returns {string} The ISO 8601 formatted time.\n */\nfunction iso8601(time: number | string | Date): string {\n return toDate(time)\n .toISOString()\n .replace(/\\.\\d{3}Z$/, 'Z')\n}\n\n/**\n * Converts a time value into a Date object.\n *\n * @param time {number | string | Date} The time to convert.\n * @returns {Date} The resulting Date object.\n */\nfunction toDate(time: number | string | Date): Date {\n if (typeof time === 'number') {\n return new Date(time * 1000)\n }\n\n if (typeof time === 'string') {\n if (Number(time)) {\n return new Date(Number(time) * 1000)\n }\n\n return new Date(time)\n }\n\n return time\n}\n","/**\n * Type representing HTTP schemes\n */\nexport type HTTPScheme = 'http' | 'https'\n\n/**\n * Type representing HTTP Methods\n *\n */\nexport type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'\n\n/**\n * Type alias representing HTTP Headers\n */\nexport type HTTPHeaders = { [key: string]: string }\n\n/**\n * HTTPHeaderBag is a type alias representing HTTP Headers\n */\nexport type HTTPHeaderBag = Record\n\nexport function hasHeader(soughtHeader: string, headers: HTTPHeaderBag): boolean {\n soughtHeader = soughtHeader.toLowerCase()\n\n for (const headerName of Object.keys(headers)) {\n if (soughtHeader === headerName.toLowerCase()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * QueryParameterBag is a type alias representing HTTP Query Parameters\n */\nexport type QueryParameterBag = Record>\n\n/**\n * HTTPRequest represents an HTTP request\n */\nexport interface HTTPRequest {\n /**\n * The HTTP method to use\n */\n method: HTTPMethod\n\n /**\n * The protocol to use (http or https)\n */\n protocol: HTTPScheme\n\n /**\n * The hostname (domain name or IP address) the request targets\n */\n hostname: string\n\n /**\n * The port to the request targets\n */\n port?: number\n\n /**\n * The path to the resource\n */\n path: string\n\n /**\n * The query parameters to include in the request\n */\n query?: QueryParameterBag\n\n /**\n * The headers to include in the request\n */\n headers: HTTPHeaderBag\n\n /**\n * The body of the request\n */\n body?: string | ArrayBuffer | null\n}\n\n/**\n * SignedHTTPRequest represents an HTTP request that has been signed\n * with an AWS signature. It is a superset of HTTPRequest adding\n * the following fields:\n * - url: the fully qualified URL of the request that can be used in a k6 http.request.\n */\nexport interface SignedHTTPRequest extends HTTPRequest {\n url: string\n}\n","/**\n *\n * @param value\n * @returns\n */\nexport function isArrayBuffer(value: any): value is ArrayBuffer {\n return (\n typeof ArrayBuffer === 'function' &&\n (value instanceof ArrayBuffer ||\n Object.prototype.toString.call(value) === '[object ArrayBuffer]')\n )\n}\n\nexport function toFormUrlEncoded(form: any): string {\n return Object.keys(form).reduce((params, key) => {\n let value = form[key]\n if (value !== undefined && value !== null) {\n params.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`)\n }\n return params;\n }, [] as string[]).join('&')\n}","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient } from './client'\nimport { AWSConfig } from './config'\nimport { AMZ_TARGET_HEADER } from './constants'\nimport { AWSError } from './error'\nimport { HTTPHeaders, HTTPMethod } from './http'\nimport { InvalidSignatureError, SignatureV4 } from './signature'\n\n/**\n * Class allowing to interact with Amazon AWS's Systems Manager service\n */\nexport class SystemsManagerClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n signature: SignatureV4\n\n /**\n * Create a SystemsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n super(awsConfig, 'ssm')\n\n // All interactions with the Systems Manager service\n // are made via the POST method.\n this.method = 'POST'\n this.commonHeaders = {\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n\n this.signature = new SignatureV4({\n service: this.serviceName,\n region: awsConfig.region,\n credentials: {\n accessKeyId: awsConfig.accessKeyId,\n secretAccessKey: awsConfig.secretAccessKey,\n },\n uriEscapePath: true,\n applyChecksum: false,\n })\n }\n\n /**\n * Retrieves a parameter from Amazon Systems Manager\n *\n * @param {string} name - The ARN or name of the parameter to retrieve.\n * @param {boolean} withDecryption - whether returned secure string parameters should be decrypted.\n * @returns {SystemsManagerParameter} - returns the fetched Parameter object.\n * @throws {SystemsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getParameter(\n name: string,\n withDecryption: boolean = false\n ): SystemsManagerParameter | undefined {\n const signedRequest = this.signature.sign(\n {\n method: this.method,\n protocol: this.awsConfig.scheme,\n hostname: this.host,\n path: '/',\n headers: {\n ...this.commonHeaders,\n [AMZ_TARGET_HEADER]: `AmazonSSM.GetParameter`,\n },\n body: JSON.stringify({ Name: name, WithDecryption: withDecryption }),\n },\n {}\n )\n\n const res = http.request(this.method, signedRequest.url, signedRequest.body, {\n headers: signedRequest.headers,\n })\n this._handle_error(SystemsManagerOperation.GetParameter, res)\n\n return SystemsManagerParameter.fromJSON(res.json() as JSONObject)\n }\n\n _handle_error(\n operation: SystemsManagerOperation,\n response: RefinedResponse\n ) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SystemsManagerServiceError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SystemsManagerServiceError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a Systems Manager's Parameter\n */\nexport class SystemsManagerParameter {\n /**\n * The Amazon Resource Name (ARN) of the parameter.\n */\n arn: string\n\n /**\n * The data type of the parameter, such as text or aws:ec2:image.\n * The default is text.\n */\n dataType: string\n\n /**\n * Date the parameter was last changed or updated and the parameter version was created.\n */\n lastModifiedDate: number\n\n /**\n * The friendly name of the parameter.\n */\n name: string\n\n /**\n * Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n */\n selector: string\n\n /**\n * plies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n */\n sourceResult: string\n\n /**\n * The type of parameter. Valid values include the following: String, StringList, and SecureString.\n */\n type: string\n\n /**\n * The parameter value.\n */\n value: string\n\n /**\n * The parameter version.\n */\n version: number\n\n /**\n * Constructs a Systems Manager's Parameter\n *\n * @param {string} arn - The Amazon Resource Name (ARN) of the parameter.\n * @param {string} dataType - The data type of the parameter, such as text or aws:ec2:image. The default is text.\n * @param {number} lastModifiedDate - Date the parameter was last changed or updated and the parameter version was created.\n * @param {string} name - The friendly name of the parameter.\n * @param {string} selector - Either the version number or the label used to retrieve the parameter value. Specify selectors by using one of the following formats:\n * parameter_name:version\n * parameter_name:label\n * @param {string} sourceResult - Applies to parameters that reference information in other AWS services. SourceResult is the raw result or response from the source.\n * @param {string} type - The type of parameter. Valid values include the following: String, StringList, and SecureString.\n * @param {string} value - The parameter value.\n * @param {number} version - The parameter version.\n */\n constructor(\n arn: string,\n dataType: string,\n lastModifiedDate: number,\n name: string,\n selector: string,\n sourceResult: string,\n type: string,\n value: string,\n version: number\n ) {\n this.arn = arn\n this.dataType = dataType\n this.lastModifiedDate = lastModifiedDate\n this.name = name\n this.selector = selector\n this.sourceResult = sourceResult\n this.type = type\n this.value = value\n this.version = version\n }\n\n /**\n * Parses and constructs a Systems Manager's Parameter from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {SystemsManagerParameter}\n */\n static fromJSON(json: JSONObject): SystemsManagerParameter {\n const parameter = json.Parameter as JSONObject\n\n return new SystemsManagerParameter(\n parameter.ARN as string,\n parameter.DataType as string,\n parameter.LastModifiedDate as number,\n parameter.Name as string,\n parameter.Selector as string,\n parameter.SourceResult as string,\n parameter.Type as string,\n parameter.Value as string,\n parameter.Version as number\n )\n }\n}\n\nexport class SystemsManagerServiceError extends AWSError {\n operation: SystemsManagerOperation\n\n /**\n * Constructs a SystemsManagerServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {SystemsManagerOperation} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: SystemsManagerOperation) {\n super(message, code)\n this.name = 'SystemsManagerServiceError'\n this.operation = operation\n }\n}\n\n/**\n * SystemsManagerOperation defines all currently implemented Systems Manager operations.\n */\nenum SystemsManagerOperation {\n GetParameter = 'GetParameter',\n}\n","import { AWSConfig } from './config'\nimport { HTTPHeaders } from './http'\nimport { HTTPScheme } from './http'\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n\n private _host?: string\n private _scheme?: HTTPScheme\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n }\n\n /**\n * Property computing the URL to send the requests to when interacting with\n * the specific AWS service the child class implements the functionalities of.\n */\n public get host() {\n if (this._host == undefined) {\n this._host = `${this.serviceName}.${this.awsConfig.region}.${this.awsConfig.endpoint}`\n }\n return this._host\n }\n\n public set host(host: string) {\n this._host = host\n }\n\n /**\n * Property computing the scheme to use http or https. Defaults to https as per AWSConfig Defaults\n * the specific AWS service the child class implements the functionalities of.\n */\n \n public get scheme() {\n\n if (this._scheme == undefined) {\n this._scheme = this.awsConfig.scheme;\n }\n return this._scheme\n }\n \n // Validatiuon should be done by the type declaration \n public set scheme(scheme: HTTPScheme) {\n this._scheme = scheme\n }\n\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","AWSConfig","options","region","InvalidAWSConfigError","accessKeyId","length","secretAccessKey","this","undefined","sessionToken","scheme","endpoint","__ENV","AWS_REGION","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","message","Error","require","AMZ_ALGORITHM_QUERY_PARAM","AMZ_CREDENTIAL_QUERY_PARAM","AMZ_DATE_QUERY_PARAM","AMZ_EXPIRES_QUERY_PARAM","AMZ_SIGNATURE_QUERY_PARAM","AMZ_SIGNED_HEADERS_QUERY_PARAM","AMZ_TOKEN_QUERY_PARAM","AMZ_CONTENT_SHA256_HEADER","AMZ_DATE_HEADER","toLowerCase","AMZ_SIGNATURE_HEADER","AMZ_TARGET_HEADER","AMZ_TOKEN_HEADER","AUTHORIZATION_HEADER","GENERATED_HEADERS","HOST_HEADER","ALWAYS_UNSIGNABLE_HEADERS","authorization","connection","expect","from","pragma","referer","te","trailer","upgrade","KEY_TYPE_IDENTIFIER","SIGNING_ALGORITHM_IDENTIFIER","MAX_PRESIGNED_TTL","AWSError","code","name","xmlDocument","doc","parseHTML","find","text","SignatureV4","service","credentials","uriEscapePath","applyChecksum","request","signingDate","Date","signingService","signingRegion","unsignableHeaders","Set","signableHeaders","formatDate","longDate","shortDate","scope","constants","headers","hostname","keys","headerName","ArrayBuffer","isView","body","buffer","payloadHash","computePayloadHash","soughtHeader","hasHeader","canonicalHeaders","computeCanonicalHeaders","signature","calculateSignature","deriveSigningKey","createCanonicalRequest","sort","join","url","protocol","path","query","serializeQueryParameters","originalRequest","expiresIn","unhoistableHeaders","InvalidSignatureError","moveHeadersToQuery","toString","signingKey","canonicalRequest","sortedHeaders","sortedCanonicalHeaders","map","signedHeaders","method","computeCanonicalURI","computeCanonicalQuerystring","credentialScope","hashedCanonicalRequest","crypto","stringToSign","createStringToSign","kSecret","kDate","kRegion","kService","normalizedURISegments","split","URISegment","pop","push","leading","startsWith","URI","trailing","endsWith","normalizedURI","encodeURIComponent","replace","serialized","escapeURI","Array","isArray","slice","reduce","encoded","concat","filter","canonicalHeaderName","has","trim","requestCopy","JSON","parse","stringify","lowerCaseName","ignoreKeys","includes","c","charCodeAt","toUpperCase","date","time","Number","toDate","toISOString","SystemsManagerOperation","SystemsManagerClient","awsConfig","commonHeaders","serviceName","withDecryption","signedRequest","sign","host","Name","WithDecryption","res","http","_handle_error","GetParameter","SystemsManagerParameter","fromJSON","json","operation","response","errorCode","error_code","error","errorMessage","Message","__type","SystemsManagerServiceError","_host","_scheme","arn","dataType","lastModifiedDate","selector","sourceResult","type","version","parameter","Parameter","ARN","DataType","LastModifiedDate","Selector","SourceResult","Type","Value","Version"],"sourceRoot":""} \ No newline at end of file diff --git a/examples/s3-multipart.js b/examples/s3-multipart.js new file mode 100644 index 0000000..3732445 --- /dev/null +++ b/examples/s3-multipart.js @@ -0,0 +1,66 @@ +import crypto from 'k6/crypto' +import exec from 'k6/execution' + +import { AWSConfig, S3Client } from '../build/s3.js' + +const awsConfig = new AWSConfig({ + region: __ENV.AWS_REGION, + accessKeyId: __ENV.AWS_ACCESS_KEY_ID, + secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, + sessionToken: __ENV.AWS_SESSION_TOKEN, +}) + + +const s3 = new S3Client(awsConfig) + +const testBucketName = 'test-jslib-aws' +const testFileKey = 'multipart.txt' + +export default function () { + // List the buckets the AWS authentication configuration + // gives us access to. + const buckets = s3.listBuckets() + + // If our test bucket does not exist, abort the execution. + if (buckets.filter((b) => b.name === testBucketName).length == 0) { + exec.test.abort() + } + + // Produce random bytes to upload of size ~12MB, that + // we will upload in two 6MB parts. This is done as the + // minimum part size supported by S3 is 5MB. + const bigFile = crypto.randomBytes(12 * 1024 * 1024) + + // Initialize a multipart upload + const multipartUpload = s3.createMultipartUpload(testBucketName, testFileKey) + + // Upload the first part + const firstPartData = bigFile.slice(0, 6 * 1024 * 1024) + const firstPart = s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 1, + firstPartData + ) + + // Upload the second part + const secondPartData = bigFile.slice(6 * 1024 * 1024, 12 * 1024 * 1024) + const secondPart = s3.uploadPart( + testBucketName, + testFileKey, + multipartUpload.uploadId, + 2, + secondPartData + ) + + // Complete the multipart upload + s3.completeMultipartUpload(testBucketName, testFileKey, multipartUpload.uploadId, [ + firstPart, + secondPart, + ]) + + // Let's redownload it verify it's correct, and delete it + const obj = s3.getObject(testBucketName, testFileKey) + s3.deleteObject(testBucketName, testFileKey) +} diff --git a/src/internal/s3.ts b/src/internal/s3.ts index cc483e4..10f715f 100644 --- a/src/internal/s3.ts +++ b/src/internal/s3.ts @@ -217,7 +217,7 @@ export class S3Client extends AWSClient { // Prepare request const method = 'PUT' const host = `${this.host}` - + const signedRequest = this.signature.sign( { method: method, @@ -274,7 +274,7 @@ export class S3Client extends AWSClient { * The uploadId returned can be used to upload parts to the object. * * @param {string} bucketName - The bucket name containing the object. - * @param {string} objectKey - Key of the object to delete. + * @param {string} objectKey - Key of the object to upload. * @return {S3MultipartUpload} - returns the uploadId of the newly created multipart upload. * @throws {S3ServiceError} * @throws {InvalidSignatureError} @@ -283,15 +283,15 @@ export class S3Client extends AWSClient { // Prepare request const method = 'POST' const host = `${bucketName}.${this.host}` - const query = 'uploads' const signedRequest = this.signature.sign( { method: method, - protocol: 'https', + protocol: this.scheme, hostname: host, - path: `/${objectKey}?${query}`, + path: `/${objectKey}`, headers: {}, + query: { uploads: '' }, }, {} ) @@ -312,7 +312,7 @@ export class S3Client extends AWSClient { /** * Uploads a part in a multipart upload. * @param {string} bucketName - The bucket name containing the object. - * @param {string} objectKey - Key of the object to delete. + * @param {string} objectKey - Key of the object to upload. * @param {string} uploadId - The uploadId of the multipart upload. * @param {number} partNumber - The part number of the part to upload. * @param {string | ArrayBuffer} data - The content of the part to upload. @@ -329,15 +329,18 @@ export class S3Client extends AWSClient { // Prepare request const method = 'PUT' const host = `${bucketName}.${this.host}` - const query = `partNumber=${partNumber}&uploadId=${uploadId}` const signedRequest = this.signature.sign( { method: method, - protocol: 'https', + protocol: this.scheme, hostname: host, - path: `/${objectKey}?${query}`, + path: `/${objectKey}`, headers: {}, body: data, + query: { + partNumber: `${partNumber}`, + uploadId: `${uploadId}`, + }, }, {} ) @@ -369,7 +372,6 @@ export class S3Client extends AWSClient { // Prepare request const method = 'POST' const host = `${bucketName}.${this.host}` - const query = `uploadId=${uploadId}` const body = `${parts .map( (part) => @@ -379,11 +381,14 @@ export class S3Client extends AWSClient { const signedRequest = this.signature.sign( { method: method, - protocol: 'https', + protocol: this.scheme, hostname: host, - path: `/${objectKey}?${query}`, + path: `/${objectKey}`, headers: {}, body: body, + query: { + uploadId: `${uploadId}`, + }, }, {} ) @@ -408,14 +413,16 @@ export class S3Client extends AWSClient { // Prepare request const method = 'DELETE' const host = `${bucketName}.${this.host}` - const query = `uploadId=${uploadId}` const signedRequest = this.signature.sign( { method: method, - protocol: 'https', + protocol: this.scheme, hostname: host, - path: `/${objectKey}?${query}`, + path: `/${objectKey}`, headers: {}, + query: { + uploadId: `${uploadId}`, + }, }, {} )