@peculiar/acme-client
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -1,1 +0,1 @@ | ||
var acme=function(t){"use strict";var e,r,n,o,i,s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(t){!function(e){var r="object"==typeof s?s:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),n=o(t);function o(t,e){return function(r,n){"function"!=typeof t[r]&&Object.defineProperty(t,r,{configurable:!0,writable:!0,value:n}),e&&e(r,n)}}void 0===r.Reflect?r.Reflect=t:n=o(r.Reflect,n),function(t){var e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,n=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",i="function"==typeof Object.create,s={__proto__:[]}instanceof Array,a=!i&&!s,c={create:i?function(){return nt(Object.create(null))}:s?function(){return nt({__proto__:null})}:function(){return nt({})},has:a?function(t,r){return e.call(t,r)}:function(t,e){return e in t},get:a?function(t,r){return e.call(t,r)?t[r]:void 0}:function(t,e){return t[e]}},u=Object.getPrototypeOf(Function),h="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,f=h||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,l=h||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?et():Set,p=new(h||"function"!=typeof WeakMap?rt():WeakMap);function y(t,e,r,n){if(x(r)){if(!J(t))throw new TypeError;if(!G(e))throw new TypeError;return b(t,e)}if(!J(t))throw new TypeError;if(!I(e))throw new TypeError;if(!I(n)&&!x(n)&&!N(n))throw new TypeError;return N(n)&&(n=void 0),_(t,e,r=D(r),n)}function d(t,e){function r(r,n){if(!I(r))throw new TypeError;if(!x(n)&&!$(n))throw new TypeError;K(t,e,r,n)}return r}function g(t,e,r,n){if(!I(r))throw new TypeError;return x(n)||(n=D(n)),K(t,e,r,n)}function v(t,e,r){if(!I(e))throw new TypeError;return x(r)||(r=D(r)),R(t,e,r)}function S(t,e,r){if(!I(e))throw new TypeError;return x(r)||(r=D(r)),P(t,e,r)}function m(t,e,r){if(!I(e))throw new TypeError;return x(r)||(r=D(r)),T(t,e,r)}function w(t,e,r){if(!I(e))throw new TypeError;return x(r)||(r=D(r)),O(t,e,r)}function A(t,e){if(!I(t))throw new TypeError;return x(e)||(e=D(e)),H(t,e)}function C(t,e){if(!I(t))throw new TypeError;return x(e)||(e=D(e)),B(t,e)}function E(t,e,r){if(!I(e))throw new TypeError;x(r)||(r=D(r));var n=k(e,r,!1);if(x(n))return!1;if(!n.delete(t))return!1;if(n.size>0)return!0;var o=p.get(e);return o.delete(r),o.size>0||p.delete(e),!0}function b(t,e){for(var r=t.length-1;r>=0;--r){var n=(0,t[r])(e);if(!x(n)&&!N(n)){if(!G(n))throw new TypeError;e=n}}return e}function _(t,e,r,n){for(var o=t.length-1;o>=0;--o){var i=(0,t[o])(e,r,n);if(!x(i)&&!N(i)){if(!I(i))throw new TypeError;n=i}}return n}function k(t,e,r){var n=p.get(t);if(x(n)){if(!r)return;n=new f,p.set(t,n)}var o=n.get(e);if(x(o)){if(!r)return;o=new f,n.set(e,o)}return o}function R(t,e,r){if(P(t,e,r))return!0;var n=X(e);return!N(n)&&R(t,n,r)}function P(t,e,r){var n=k(e,r,!1);return!x(n)&&L(n.has(t))}function T(t,e,r){if(P(t,e,r))return O(t,e,r);var n=X(e);return N(n)?void 0:T(t,n,r)}function O(t,e,r){var n=k(e,r,!1);if(!x(n))return n.get(t)}function K(t,e,r,n){k(r,n,!0).set(t,e)}function H(t,e){var r=B(t,e),n=X(t);if(null===n)return r;var o=H(n,e);if(o.length<=0)return r;if(r.length<=0)return o;for(var i=new l,s=[],a=0,c=r;a<c.length;a++){var u=c[a];i.has(u)||(i.add(u),s.push(u))}for(var h=0,f=o;h<f.length;h++){u=f[h];i.has(u)||(i.add(u),s.push(u))}return s}function B(t,e){var r=[],n=k(t,e,!1);if(x(n))return r;for(var o=q(n.keys()),i=0;;){var s=Z(o);if(!s)return r.length=i,r;var a=Y(s);try{r[i]=a}catch(t){try{Q(o)}finally{throw t}}i++}}function j(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function x(t){return void 0===t}function N(t){return null===t}function M(t){return"symbol"==typeof t}function I(t){return"object"==typeof t?null!==t:"function"==typeof t}function U(t,e){switch(j(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var r=3===e?"string":5===e?"number":"default",o=V(t,n);if(void 0!==o){var i=o.call(t,r);if(I(i))throw new TypeError;return i}return W(t,"default"===r?"number":r)}function W(t,e){if("string"===e){var r=t.toString;if(z(r))if(!I(o=r.call(t)))return o;if(z(n=t.valueOf))if(!I(o=n.call(t)))return o}else{var n;if(z(n=t.valueOf))if(!I(o=n.call(t)))return o;var o,i=t.toString;if(z(i))if(!I(o=i.call(t)))return o}throw new TypeError}function L(t){return!!t}function F(t){return""+t}function D(t){var e=U(t,3);return M(e)?e:F(e)}function J(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function z(t){return"function"==typeof t}function G(t){return"function"==typeof t}function $(t){switch(j(t)){case 3:case 4:return!0;default:return!1}}function V(t,e){var r=t[e];if(null!=r){if(!z(r))throw new TypeError;return r}}function q(t){var e=V(t,o);if(!z(e))throw new TypeError;var r=e.call(t);if(!I(r))throw new TypeError;return r}function Y(t){return t.value}function Z(t){var e=t.next();return!e.done&&e}function Q(t){var e=t.return;e&&e.call(t)}function X(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===u)return e;if(e!==u)return e;var r=t.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return e;var o=n.constructor;return"function"!=typeof o||o===t?e:o}function tt(){var t={},e=[],r=function(){function t(t,e,r){this._index=0,this._keys=t,this._values=e,this._selector=r}return t.prototype["@@iterator"]=function(){return this},t.prototype[o]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var r=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var r=this._find(t,!0);return this._values[r]=e,this},e.prototype.delete=function(e){var r=this._find(e,!1);if(r>=0){for(var n=this._keys.length,o=r+1;o<n;o++)this._keys[o-1]=this._keys[o],this._values[o-1]=this._values[o];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new r(this._keys,this._values,n)},e.prototype.values=function(){return new r(this._keys,this._values,i)},e.prototype.entries=function(){return new r(this._keys,this._values,s)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[o]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function n(t,e){return t}function i(t,e){return e}function s(t,e){return[t,e]}}function et(){return function(){function t(){this._map=new f}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[o]=function(){return this.keys()},t}()}function rt(){var t=16,r=c.create(),n=o();return function(){function t(){this._key=o()}return t.prototype.has=function(t){var e=i(t,!1);return void 0!==e&&c.has(e,this._key)},t.prototype.get=function(t){var e=i(t,!1);return void 0!==e?c.get(e,this._key):void 0},t.prototype.set=function(t,e){return i(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=i(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=o()},t}();function o(){var t;do{t="@@WeakMap@@"+u()}while(c.has(r,t));return r[t]=!0,t}function i(t,r){if(!e.call(t,n)){if(!r)return;Object.defineProperty(t,n,{value:c.create()})}return t[n]}function s(t,e){for(var r=0;r<e;++r)t[r]=255*Math.random()|0;return t}function a(t){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):s(new Uint8Array(t),t):s(new Array(t),t)}function u(){var e=a(t);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var r="",n=0;n<t;++n){var o=e[n];4!==n&&6!==n&&8!==n||(r+="-"),o<16&&(r+="0"),r+=o.toString(16).toLowerCase()}return r}}function nt(t){return t.__=void 0,delete t.__,t}t("decorate",y),t("metadata",d),t("defineMetadata",g),t("hasMetadata",v),t("hasOwnMetadata",S),t("getMetadata",m),t("getOwnMetadata",w),t("getMetadataKeys",A),t("getOwnMetadataKeys",C),t("deleteMetadata",E)}(n)}()}(e||(e={}));class a{static toArrayBuffer(t){const e=this.toUint8Array(t);return e.byteOffset||e.length?e.buffer.slice(e.byteOffset,e.byteOffset+e.length):e.buffer}static toUint8Array(t){if("undefined"!=typeof Buffer&&Buffer.isBuffer(t))return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(t instanceof ArrayBuffer)return new Uint8Array(t);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||t instanceof ArrayBuffer}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&t.buffer instanceof ArrayBuffer}}function c(t){return"undefined"!=typeof Buffer&&Buffer.isBuffer(t)?new Uint8Array(t):a.isArrayBufferView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}class u{static isHex(t){return"string"==typeof t&&/^[a-z0-9]+$/i.test(t)}static isBase64(t){return"string"==typeof t&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}static isBase64Url(t){return"string"==typeof t&&/^[a-zA-Z0-9-_]+$/i.test(t)}static ToString(t,e="utf8"){const r=c(t);switch(e.toLowerCase()){case"utf8":return this.ToUtf8String(r);case"binary":return this.ToBinary(r);case"hex":return this.ToHex(r);case"base64":return this.ToBase64(r);case"base64url":return this.ToBase64Url(r);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromString(t,e="utf8"){if(!t)return new ArrayBuffer(0);switch(e.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToBase64(t){const e=c(t);if("undefined"!=typeof btoa){const t=this.ToString(e,"binary");return btoa(t)}return Buffer.from(e).toString("base64")}static FromBase64(t){const e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!u.isBase64(e))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return"undefined"!=typeof atob?this.FromBinary(atob(e)):new Uint8Array(Buffer.from(e,"base64")).buffer}static FromBase64Url(t){const e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!u.isBase64Url(e))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(e.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t){const e=unescape(encodeURIComponent(t)),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r.buffer}static ToUtf8String(t){const e=c(t),r=String.fromCharCode.apply(null,e);return decodeURIComponent(escape(r))}static FromBinary(t){const e=t.length,r=new Uint8Array(e);for(let n=0;n<e;n++)r[n]=t.charCodeAt(n);return r.buffer}static ToBinary(t){const e=c(t);let r="";const n=e.length;for(let t=0;t<n;t++)r+=String.fromCharCode(e[t]);return r}static ToHex(t){const e=c(t),r=[],n=e.length;for(let t=0;t<n;t++){const n=e[t].toString(16);r.push(1===n.length?"0"+n:n)}return r.join("")}static FromHex(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!u.isHex(e))throw new TypeError("Argument 'hexString' is not HEX encoded");e.length%2&&(e="0"+e);const r=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2){const n=e.slice(t,t+2);r[t/2]=parseInt(n,16)}return r.buffer}static Base64Padding(t){const e=4-t.length%4;if(e<4)for(let r=0;r<e;r++)t+="=";return t}static formatString(t){return(null==t?void 0:t.replace(/[\n\r\t ]/g,""))||""}}!function(t){t[t.ok=200]="ok",t[t.noContent=204]="noContent",t[t.unauthorized=401]="unauthorized",t[t.badRequest=400]="badRequest",t[t.forbidden=403]="forbidden",t[t.notFound=404]="notFound",t[t.methodNotAllowed=405]="methodNotAllowed",t[t.internalServerError=500]="internalServerError"}(r||(r={}));class h extends Error{constructor(t,e="",n=r.internalServerError,o){super(e),this.type=t,this.message=e,this.status=n,this.inner=o,this.name="AcmeError"}}!function(t){t.json="application/json",t.joseJson="application/jose+json",t.problemJson="application/problem+json",t.pkix="application/pkix-cert",t.pem="application/pem-certificate-chain",t.pkcs7="application/pkcs7-mime"}(n||(n={}));class f{constructor(t,e){var r;if(this.content=new ArrayBuffer(0),"string"==typeof t)this.content=u.FromUtf8String(t),this.type=n.pem;else if(t instanceof h)this.content=u.FromUtf8String(JSON.stringify({detail:t.message,type:t.type,subproblems:null===(r=t.subproblems)||void 0===r?void 0:r.map(t=>({detail:t.message,type:t.type}))})),this.type=n.problemJson;else if(a.isBufferSource(t)){if(!e)throw new TypeError("Cannot get required argument 'type'");this.content=a.toArrayBuffer(t),this.type=e}else{const r=e?JSON.stringify(t,null," "):JSON.stringify(t);this.content=u.FromUtf8String(r),this.type=n.json}}toJSON(){return JSON.parse(this.toString())}toString(){return u.ToUtf8String(this.content)}}class l extends Map{get location(){return this.get(l.LOCATION)||null}set location(t){t?this.set(l.LOCATION,t):this.delete(l.LOCATION)}get contentType(){var t,e;const r=this.get(l.CONTENT_TYPE);return r?{mediaType:r.split(";")[0],charset:null===(t=/charset=([\w-]+)/i.exec(r))||void 0===t?void 0:t[1],boundary:null===(e=/boundary=([\w-]+)/i.exec(r))||void 0===e?void 0:e[1]}:null}get link(){const t=this.get(l.LINK);return t?t.split(",").map(t=>t.trim()):null}setLink(t){let e=this.get(l.LINK);e?e+=","+t:e=t,this.set(l.LINK,e)}get replayNonce(){return this.get(l.REPLAY_NONCE)||null}set replayNonce(t){t?this.set(l.REPLAY_NONCE,t):this.delete(l.REPLAY_NONCE)}set(t,e){return super.set(t.toLowerCase(),e)}get(t){return super.get(t.toLowerCase())}append(t,e){const r=this.get(t);e?this.set(t,`${r}, ${e}`):this.set(t,e)}}l.REPLAY_NONCE="Replay-Nonce",l.LINK="Link",l.CONTENT_TYPE="Content-Type",l.LOCATION="Location";class p{constructor(){this.status=r.ok,this.headers=new l}json(){if(this.content)return this.content.toJSON();throw new Error("No content in ACME response")}}function y(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}function d(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}!function(t){t.accountDoesNotExist="urn:ietf:params:acme:error:accountDoesNotExist",t.alreadyRevoked="urn:ietf:params:acme:error:alreadyRevoked",t.badCSR="urn:ietf:params:acme:error:badCSR",t.badNonce="urn:ietf:params:acme:error:badNonce",t.badPublicKey="urn:ietf:params:acme:error:badPublicKey",t.badRevocationReason="urn:ietf:params:acme:error:badRevocationReason",t.badSignatureAlgorithm="urn:ietf:params:acme:error:badSignatureAlgorithm",t.caa="urn:ietf:params:acme:error:caa",t.compound="urn:ietf:params:acme:error:compound",t.connection="urn:ietf:params:acme:error:connection",t.dns="urn:ietf:params:acme:error:dns",t.externalAccountRequired="urn:ietf:params:acme:error:externalAccountRequired",t.incorrectResponse="urn:ietf:params:acme:error:incorrectResponse",t.invalidContact="urn:ietf:params:acme:error:invalidContact",t.malformed="urn:ietf:params:acme:error:malformed",t.orderNotReady="urn:ietf:params:acme:error:orderNotReady",t.rateLimited="urn:ietf:params:acme:error:rateLimited",t.rejectedIdentifier="urn:ietf:params:acme:error:rejectedIdentifier",t.serverInternal="urn:ietf:params:acme:error:serverInternal",t.tls="urn:ietf:params:acme:error:tls",t.unauthorized="urn:ietf:params:acme:error:unauthorized",t.unsupportedContact="urn:ietf:params:acme:error:UnsupportedContact",t.unsupportedIdentifier="urn:ietf:params:acme:error:unsupportedIdentifier",t.userActionRequired="urn:ietf:params:acme:error:userActionRequired"}(o||(o={})),function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"}(i||(i={}));var g=i;function v(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function S(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function m(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(S(arguments[e]));return t}function w(t){return!!t.useClass}function A(t){return!!t.useFactory}var C=function(){function t(t){this.wrap=t,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct"]}return t.prototype.createProxy=function(t){var e,r=this,n=!1;return new Proxy({},this.createHandler((function(){return n||(e=t(r.wrap()),n=!0),e})))},t.prototype.createHandler=function(t){var e={};return this.reflectMethods.forEach((function(r){e[r]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e[0]=t();var o=Reflect[r];return o.apply(void 0,m(e))}})),e},t}();function E(t){return"string"==typeof t||"symbol"==typeof t}function b(t){return!!t.useToken}function _(t){return null!=t.useValue}var k=function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(t){return this.ensure(t),this._registryMap.get(t)},t.prototype.get=function(t){this.ensure(t);var e=this._registryMap.get(t);return e[e.length-1]||null},t.prototype.set=function(t,e){this.ensure(t),this._registryMap.get(t).push(e)},t.prototype.setAll=function(t,e){this._registryMap.set(t,e)},t.prototype.has=function(t){return this.ensure(t),this._registryMap.get(t).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(t){this._registryMap.has(t)||this._registryMap.set(t,[])},t}(),R=function(){this.scopedResolutions=new Map};function P(t,e,r){var n,o,i=S(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2)[1],s=function(t,e){return null===t?"at position #"+e:'"'+t.split(",")[e].trim()+'" at position #'+e}(void 0===i?null:i,e);return n="Cannot inject the dependency "+s+' of "'+t.name+'" constructor. Reason:',void 0===o&&(o=" "),m([n],r.message.split("\n").map((function(t){return o+t}))).join("\n")}var T,O=new Map,K=new(function(){function t(t){this.parent=t,this._registry=new k}return t.prototype.register=function(t,e,r){var n;if(void 0===r&&(r={lifecycle:g.Transient}),n=function(t){return w(t)||_(t)||b(t)||A(t)}(e)?e:{useClass:e},(r.lifecycle===g.Singleton||r.lifecycle==g.ContainerScoped||r.lifecycle==g.ResolutionScoped)&&(_(n)||A(n)))throw new Error('Cannot use lifecycle "'+g[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(t,{provider:n,options:r}),this},t.prototype.registerType=function(t,e){return E(e)?this.register(t,{useToken:e}):this.register(t,{useClass:e})},t.prototype.registerInstance=function(t,e){return this.register(t,{useValue:e})},t.prototype.registerSingleton=function(t,e){if(E(t)){if(E(e))return this.register(t,{useToken:e},{lifecycle:g.Singleton});if(e)return this.register(t,{useClass:e},{lifecycle:g.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=t;return e&&!E(e)&&(r=e),this.register(t,{useClass:r},{lifecycle:g.Singleton})},t.prototype.resolve=function(t,e){void 0===e&&(e=new R);var r=this.getRegistration(t);if(!r&&E(t))throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"');if(r)return this.resolveRegistration(r,e);if(function(t){return"function"==typeof t||t instanceof C}(t))return this.construct(t,e);throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.resolveRegistration=function(t,e){if(t.options.lifecycle===g.ResolutionScoped&&e.scopedResolutions.has(t))return e.scopedResolutions.get(t);var r,n=t.options.lifecycle===g.Singleton,o=t.options.lifecycle===g.ContainerScoped,i=n||o;return r=_(t.provider)?t.provider.useValue:b(t.provider)?i?t.instance||(t.instance=this.resolve(t.provider.useToken,e)):this.resolve(t.provider.useToken,e):w(t.provider)?i?t.instance||(t.instance=this.construct(t.provider.useClass,e)):this.construct(t.provider.useClass,e):A(t.provider)?t.provider.useFactory(this):this.construct(t.provider,e),t.options.lifecycle===g.ResolutionScoped&&e.scopedResolutions.set(t,r),r},t.prototype.resolveAll=function(t,e){var r=this;void 0===e&&(e=new R);var n=this.getAllRegistrations(t);if(!n&&E(t))throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"');return n?n.map((function(t){return r.resolveRegistration(t,e)})):[this.construct(t,e)]},t.prototype.isRegistered=function(t,e){return void 0===e&&(e=!1),this._registry.has(t)||e&&(this.parent||!1)&&this.parent.isRegistered(t,!0)},t.prototype.reset=function(){this._registry.clear()},t.prototype.clearInstances=function(){var t,e;try{for(var r=v(this._registry.entries()),n=r.next();!n.done;n=r.next()){var o=S(n.value,2),i=o[0],s=o[1];this._registry.setAll(i,s.filter((function(t){return!_(t.provider)})).map((function(t){return t.instance=void 0,t})))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.createChildContainer=function(){var e,r,n=new t(this);try{for(var o=v(this._registry.entries()),i=o.next();!i.done;i=o.next()){var s=S(i.value,2),a=s[0],c=s[1];c.some((function(t){return t.options.lifecycle===g.ContainerScoped}))&&n._registry.setAll(a,c.map((function(t){return t.options.lifecycle===g.ContainerScoped?{provider:t.provider,options:t.options}:t})))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n},t.prototype.getRegistration=function(t){return this.isRegistered(t)?this._registry.get(t):this.parent?this.parent.getRegistration(t):null},t.prototype.getAllRegistrations=function(t){return this.isRegistered(t)?this._registry.getAll(t):this.parent?this.parent.getAllRegistrations(t):null},t.prototype.construct=function(t,e){var r=this;if(t instanceof C)return t.createProxy((function(t){return r.resolve(t,e)}));if(0===t.length)return new t;var n=O.get(t);if(!n||0===n.length)throw new Error('TypeInfo not known for "'+t.name+'"');var o=n.map(this.resolveParams(e,t));return new(t.bind.apply(t,m([void 0],o)))},t.prototype.resolveParams=function(t,e){var r=this;return function(n,o){try{return"object"==typeof(i=n)&&"token"in i&&"multiple"in i?n.multiple?r.resolveAll(n.token):r.resolve(n.token,t):r.resolve(n,t)}catch(t){throw new Error(P(e,o,t))}var i}},t}());if("undefined"==typeof Reflect||!Reflect.getMetadata)throw new Error("tsyringe requires a reflect polyfill. Please add 'import \"reflect-metadata\"' to the top of your entry point.");!function(t){t[t.error=0]="error",t[t.warn=1]="warn",t[t.info=2]="info",t[t.debug=3]="debug"}(T||(T={}));let H=class t{constructor(){this.level=T.info}error(t,e){this.write(T.debug,t,e)}info(t,e){this.write(T.info,t,e)}warn(t,e){this.write(T.warn,t,e)}debug(t,e){this.write(T.debug,t,e)}write(t,e,r){this.level>=t&&this.onWrite(t,e,r)}onWrite(t,e,r){}checkLevel(t){return this.level>=t}};H=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}([function(t){O.set(t,function(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata("injectionTokens",t)||{};return Object.keys(r).forEach((function(t){e[+t]=r[t]})),e}(t))}],H),K.register("ACME.Logger",H);class B{static toAlgorithm(t){switch(t){case"ES256":return{name:"ECDSA",hash:{name:"SHA-256"}};case"ES384":return{name:"ECDSA",hash:{name:"SHA-384"}};case"ES512":return{name:"ECDSA",hash:{name:"SHA-512"}};case"HS1":return{name:"HMAC",hash:{name:"SHA-1"}};case"HS256":return{name:"HMAC",hash:{name:"SHA-256"}};case"HS384":return{name:"HMAC",hash:{name:"SHA-384"}};case"HS512":return{name:"HMAC",hash:{name:"SHA-512"}};case"PS1":return{name:"RSA-PSS",hash:{name:"SHA-1"}};case"PS256":return{name:"RSA-PSS",hash:{name:"SHA-256"}};case"PS384":return{name:"RSA-PSS",hash:{name:"SHA-384"}};case"PS512":return{name:"RSA-PSS",hash:{name:"SHA-512"}};case"RS1":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"RS384":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"RS512":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}}}return null}static fromAlgorithm(t){const e="string"==typeof t?{name:t}:t,r=e.name.toLowerCase(),n=e.hash?("string"==typeof e.hash?e.hash:e.hash.name).toLowerCase():"sha-256";switch(r){case"hmac":switch(n){case"sha-1":return"HS1";case"sha-256":return"HS256";case"sha-384":return"HS384";case"sha-512":return"HS512"}break;case"rsassa-pkcs1-v1_5":switch(n){case"sha-1":return"RS1";case"sha-256":return"RS256";case"sha-R84":return"RS384";case"sha-512":return"RS512"}break;case"rsa-pss":switch(n){case"sha-1":return"PS1";case"sha-256":return"PS256";case"sha-P84":return"PS384";case"sha-512":return"PS512"}break;case"ecdsa":switch(n){case"sha-256":return"ES256";case"sha-384":return"ES384";case"sha-512":return"ES512"}}return null}}var j,x,N,M;!function(t){t.hs256="HS256",t.hs384="HS384",t.hs512="HS512",t.RS256="RS256",t.RS384="RS384",t.RS512="RS512",t.ES256="ES256",t.ES384="ES384",t.ES512="ES512",t.PS1="PS1",t.PS256="PS256",t.PS384="PS384",t.PS512="PS512",t.RSA1_5="RSA1_5",t.RSA_OAEP="RSA-OAEP",t.RSA_OAEP_256="RSA-OAEP-256",t.A128KW="A128KW",t.A192KW="A192KW",t.A256KW="A256KW",t.Dir="dir",t.ECDH_ES="ECDH-ES",t.ECDH_ES_A128KW="ECDH-ES+A128KW",t.ECDH_ES_A192KW="ECDH-ES+A192KW",t.ECDH_ES_A256KW="ECDH-ES+A256KW",t.A128GCMKW="A128GCMKW",t.A192GCMKW="A192GCMKW",t.A256GCMKW="A256GCMKW",t.PBES2_HS256_A128KW="PBES2-HS256+A128KW",t.PBES2_HS384_A192KW="PBES2-HS384+A192KW",t.PBES2_HS512_A256KW="PBES2-HS512+A256KW",t.A128CBC_HS256="A128CBC-HS256",t.A192CBC_HS384="A192CBC-HS384",t.A256CBC_HS512="A256CBC-HS512",t.A128GCM="A128GCM",t.A192GCM="A192GCM",t.A256GCM="A256GCM",t.EdDSA="EdDSA",t.RS1="RS1",t.RSA_OAEP_384="RSA-OAEP-384",t.RSA_OAEP_512="RSA-OAEP-512",t.A128CBC="A128CBC",t.A192CBC="A192CBC",t.A256CBC="A256CBC",t.A128CTR="A128CTR",t.A192CTR="A192CTR",t.A256CTR="A256CTR",t.HS1="HS1",t.SHA1="SHA1",t.SHA256="SHA256"}(j||(j={})),function(t){t.EC="EC",t.RSA="RSA",t.OctetSequence="oct",t.OctetStringKeyPairs="OKP"}(x||(x={}));class I{constructor(t,e={}){N.set(this,void 0),Object.assign(this,e),function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");e.set(t,r)}(this,N,t)}exportKey(...t){return y(this,arguments,void 0,(function*(){let e,r=["verify"],n=d(this,N);if(arguments.length<2)switch(n=t[0]||n,this.kty){case x.RSA:e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"};break;case x.EC:e={name:"ECDSA",namedCurve:this.crv};break;case x.OctetSequence:e={name:"HMAC",hash:"SHA-256"};break;default:throw new Error("Unsupported type of JWK")}else e=t[0],r=t[1],n=t[2]||n;return yield n.subtle.importKey("jwk",this,e,!0,r)}))}getThumbprint(t=j.SHA256){return y(this,void 0,void 0,(function*(){const e={};this.crv&&(e.crv=this.crv.toString()),this.e&&(e.e=this.e),this.k&&(e.k=this.k),this.kty&&(e.kty=this.kty.toString()),this.n&&(e.n=this.n),this.x&&(e.x=this.x),this.y&&(e.y=this.y);const r=JSON.stringify(e);switch(t){case j.SHA256:return u.ToHex(yield this.digest(r,"SHA-256"));case j.SHA1:return u.ToHex(yield this.digest(r,"SHA-1"));default:throw new Error("Unsupported algorithm: "+t)}}))}digest(t,e){return y(this,void 0,void 0,(function*(){return yield d(this,N).subtle.digest({name:e},a.toUint8Array(u.FromUtf8String(t)))}))}getPublicKey(){return y(this,void 0,void 0,(function*(){if(this.kty===x.EC)return this.getEcdsaPublicKey();if(this.kty===x.RSA)return this.getRsaPublicKey();throw new Error("Unsupported type "+this.kty)}))}getEcdsaPublicKey(){return y(this,void 0,void 0,(function*(){const t={name:"ECDSA",namedCurve:this.crv};return yield d(this,N).subtle.importKey("jwk",this,t,!0,["verify"])}))}getRsaPublicKey(){return y(this,void 0,void 0,(function*(){return yield d(this,N).subtle.importKey("jwk",this,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}))}}N=new WeakMap;class U{constructor(t={},e){this.cryptoProvider=e,this.protected="e30",this.payload="",this.signature="",t.protected&&this.setProtected(t.protected),t.payload&&this.setPayload(t.payload)}fromJSON(t){Object.assign(this,t)}isPayloadEmpty(){return!this.payload}isPayloadEmptyObject(){return"e30"===this.payload}getProtected(t){const e=this.read(this.protected);return e.jwk&&(e.jwk=new I(this.getCryptoProvider(t),e.jwk)),e}setProtected(t){this.protected=this.write(t)}getPayload(){return this.read(this.payload)}tryGetPayload(){try{return this.getPayload()}catch(t){return null}}setPayload(t){this.payload=this.write(t)}getSignature(){return u.FromBase64Url(this.signature)}setSignature(t){this.signature=u.ToBase64Url(t)}read(t){const e=u.FromBase64Url(t),r=u.ToUtf8String(e);return""===r?"":JSON.parse(r)}write(t){const e=JSON.stringify(t),r=u.FromUtf8String(e);return u.ToBase64Url(r)}verify(t,e){return y(this,void 0,void 0,(function*(){const r=this.getProtected();if(!r.alg)throw new Error("JWS.protected doesn't have required parameter 'alg'");const n=B.toAlgorithm(r.alg);if(!n)throw new Error("Cannot convert JWA to WebCrypto algorithm");if(!t){const r=yield this.getKey(e);if(!r)throw new Error("Cannot get JWK key");t=r}const o=u.FromUtf8String(this.toStringSign());return yield this.getCryptoProvider(e).subtle.verify(n,t,this.getSignature(),o)}))}getKey(t){return y(this,void 0,void 0,(function*(){const e=this.getProtected();if(!e.jwk)return null;if(!e.alg)throw new Error("JWS.protected doesn't have required parameter 'alg'");const r=B.toAlgorithm(e.alg);if(!r)throw new Error("Cannot convert JWA to WebCrypto algorithm");const n=Object.assign({},r);"ECDSA"===n.name&&(n.namedCurve=e.jwk.crv);return yield this.getCryptoProvider(t).subtle.importKey("jwk",e.jwk,n,!0,["verify"])}))}sign(t,e,r){return y(this,void 0,void 0,(function*(){const n=this.getProtected(),o=B.fromAlgorithm(Object.assign(Object.assign({},t),e.algorithm));if(!o)throw new Error("Cannot convert WebCrypto algorithm to JWA");n.alg=o,this.setProtected(n);const i=u.FromUtf8String(this.toStringSign()),s=yield this.getCryptoProvider(r).subtle.sign(t,e,i);this.setSignature(s)}))}toStringSign(){return`${this.protected}.${this.payload}`}toJSON(){const t={};return this.protected&&(t.protected=this.protected),this.payload&&(t.payload=this.payload),this.signature&&(t.signature=this.signature),t}parse(t){if("{"===t[0]){const e=JSON.parse(t);this.protected=e.protected||"",this.payload=e.payload||"",this.signature=e.signature||""}else{const e=t.split(".");this.protected=e[0]||"",this.payload=e[1]||"",this.signature=e[2]||""}}toString(t=!1){return t?`${this.protected}.${this.payload}.${this.signature}`:JSON.stringify(this.toJSON())}getCryptoProvider(t){if(t)return t;if(this.cryptoProvider)return this.cryptoProvider;throw new Error("Cannot find Crypto")}}class W{constructor(t={}){if(this.options={crypto:"undefined"!=typeof self?self.crypto:void 0,debug:t.debug,defaultHash:"SHA-256",fetch:"undefined"!=typeof fetch?fetch:void 0,...t},!this.options.crypto)throw new Error("Cannot initialize ACME client. It requires crypto provider to be set.")}static createResponse(t,e){return{status:t.status,headers:t.headers,content:e}}async fetch(t,e){var r,i;if(!this.options.fetch)throw new Error("Cannot get 'fetch' option");this.options.debug&&(console.log(`REQUEST ${e.method} ${t}`),"body"in e&&console.log("REQUEST BODY",e.body));const s=this.options.fetch;let a;if("GET"===e.method||"HEAD"===e.method)a=await s(t,{method:e.method});else{const r=this.getCrypto(),o=e,i={method:"POST"},c={url:t,nonce:o.nonce};if("string"==typeof o.kid)c.kid=o.kid;else{const t=await this.getCrypto().subtle.exportKey("jwk",o.kid);c.jwk=new I(r,t)}const u=new U({protected:c,payload:o.method&&"POST-as-GET"!==o.method?o.body:""},this.getCrypto());await u.sign({hash:o.hash||this.options.defaultHash,...o.key.algorithm},o.key,r),i.body=u.toString(),i.headers={"Content-Type":n.joseJson},a=await s(t,i)}const c=new p;c.status=a.status,a.headers.forEach((t,e)=>c.headers.set(e,t));const u=await a.arrayBuffer();if(c.content=new f(u,(null===(r=c.headers.contentType)||void 0===r?void 0:r.mediaType)||n.json),this.options.debug&&console.log(`RESPONSE ${e.method} ${t}`),c.content&&(c.status<200||c.status>299)){if((null===(i=c.headers.contentType)||void 0===i?void 0:i.mediaType)===n.problemJson){const t=c.content.toJSON();throw this.options.debug&&console.log("RESPONSE",t),new h(t.type,t.detail,c.status)}{const t=c.content.toString();throw this.options.debug&&console.log("RESPONSE",t),new h(o.serverInternal,"Wrong Content-Type of ACME response. Must be application/problem+json. See inner exception for more details.",c.status,new globalThis.Error(t))}}const l=W.createResponse(c,e.convert(c));return this.options.debug&&console.log("RESPONSE",l),l}getCrypto(){if(!this.options.crypto)throw new Error("Cannot get 'crypto' option");return this.options.crypto}}(M=t.CRLReasons||(t.CRLReasons={}))[M.unspecified=0]="unspecified",M[M.keyCompromise=1]="keyCompromise",M[M.cACompromise=2]="cACompromise",M[M.affiliationChanged=3]="affiliationChanged",M[M.superseded=4]="superseded",M[M.cessationOfOperation=5]="cessationOfOperation",M[M.certificateHold=6]="certificateHold",M[M.removeFromCRL=8]="removeFromCRL",M[M.privilegeWithdrawn=9]="privilegeWithdrawn",M[M.aACompromise=10]="aACompromise";class L extends W{constructor(t,e,r){super(r),this.accountKey=t,this.url=e,this.nonce="",this.accountId=""}static async create(t,e,r){const n=new L(t,e,r);return n.directory=await n.getDirectory(),n}async fetch(t,e){"POST"!==e.method&&"POST-as-GET"!==e.method||(this.nonce||await this.getNonce(),e.nonce=this.nonce,this.nonce="");const r=await super.fetch(t,e);return this.readNonce(r),r}async getDirectory(){return(await this.fetch(this.url,{method:"GET",convert:t=>t.json()})).content}async getNonce(t="HEAD"){const e=await this.fetch(this.directory.newNonce,{method:t,convert:()=>null});return this.readNonce(e)}async newAccount(t){const e={contact:t.contact,onlyReturnExisting:t.onlyReturnExisting,termsOfServiceAgreed:t.termsOfServiceAgreed};t.externalAccountBinding&&(e.externalAccountBinding=await this.createExternalAccountBinding(t.externalAccountBinding.challenge,t.externalAccountBinding.kid));const r=await this.fetch(this.directory.newAccount,{method:"POST",kid:this.accountKey.publicKey,nonce:this.nonce,key:this.accountKey.privateKey,body:e,convert:t=>t.json()});if(!r.headers.location)throw new Error("Cannot get Location header");return this.accountId=r.headers.location,r}async updateAccount(t){const e=this.getAccountId();return await this.fetch(e,{method:"POST",kid:e,nonce:this.nonce,key:this.accountKey.privateKey,body:t,convert:t=>t.json()})}getAccountId(){if(!this.accountId)throw new Error("Create or Find account first");return this.accountId}async deactivateAccount(){return this.deactivate(this.getAccountId(),t=>t.json())}async changeKey(t){const e=this.getAccountId(),r=this.getCrypto(),n=new U({protected:{url:this.directory.keyChange,jwk:new I(r,await r.subtle.exportKey("jwk",t.publicKey))},payload:{account:e,oldKey:new I(r,await r.subtle.exportKey("jwk",this.accountKey.publicKey))}},this.getCrypto());await n.sign({hash:this.options.defaultHash,...t.privateKey.algorithm},t.privateKey);const o=await this.fetch(this.directory.keyChange,{method:"POST",kid:e,nonce:this.nonce,key:this.accountKey.privateKey,body:n,convert:()=>null});return this.accountKey=t,o}async newOrder(t){return this.fetch(this.directory.newOrder,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:t,convert:t=>t.json()})}async getOrder(t){return this.fetch(t,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,convert:t=>t.json()})}async retryOrder(t,e={}){let r="string"==typeof t?await this.getOrder(t):t,n=e.retries||L.RETRIES;for(;n--;){if(!r.headers.location)throw new Error("Cannot get location header from Order response");if(r=await this.getOrder(r.headers.location),"processing"!==r.content.status)break;await this.pause(e.interval||L.INTERVAL)}return r}async revoke(e,r=t.CRLReasons.unspecified){return await this.fetch(this.directory.keyChange,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:{certificate:u.ToBase64Url(e),reason:r},convert:()=>null})}async deactivate(t,e){return this.fetch(t,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:{status:"deactivated"},convert:e})}async deactivateAuthorization(t){return this.deactivate(t,t=>t.json())}async getChallenge(t,e="POST-as-GET"){const r=await this.fetch(t,{method:e,kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:"POST"===e?{}:void 0,convert:t=>t.json()});return"POST"===e&&await this.pause(2e3),r}async finalize(t,e){return this.fetch(t,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:e,convert:t=>t.json()})}async getAuthorization(t){return this.fetch(t,{method:"POST-as-GET",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,convert:t=>t.json()})}async retryAuthorization(t,e={}){let r="string"==typeof t?await this.getOrder(t):t,n=e.retries||L.RETRIES;for(;n--;){if(!r.headers.location)throw new Error("Cannot get location header from Authorization response");if(r=await this.getAuthorization(r.headers.location),"pending"!==r.content.status)break;await this.pause(e.interval||L.INTERVAL)}return r}async getCertificate(t){return await this.fetch(t,{method:"POST-as-GET",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,convert:t=>{if(!t.content)throw new Error("Cannot get content from ACME response");switch(t.content.type){case n.pem:return this.decodePem(t.content.toString());case n.pkix:return[t.content.content];case n.pkcs7:throw new Error("Not implemented");default:throw new Error("Not supported content type for certificate")}}})}async getEndpoint(t){return this.fetch(t,{method:"POST-as-GET",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,convert:t=>t.json()})}readNonce(t){const e=t.headers.replayNonce;return this.nonce=e||"",e}async pause(t){return new Promise(e=>setTimeout(e,t))}async createExternalAccountBinding(t,e){const r=await this.getCrypto().subtle.importKey("raw",u.FromBase64Url(t),{name:"HMAC",hash:"SHA-256"},!0,["sign"]),n=await this.getCrypto().subtle.exportKey("jwk",this.accountKey.publicKey),o=new U({protected:{kid:e},payload:n},this.getCrypto());return await o.sign(r.algorithm,r,this.getCrypto()),o}decodePem(t){const e=/-{5}BEGIN [A-Z0-9 ]+-{5}([a-zA-Z0-9=+/\n\r]+)-{5}END [A-Z0-9 ]+-{5}/g,r=[];let n=null;for(;n=e.exec(t);){const t=n[1].replace(/[\r\n]/g,"");r.push(u.FromBase64(t))}return r}}return L.RETRIES=10,L.INTERVAL=1e3,t.ApiClient=L,t.BaseClient=W,t}({}); | ||
var acme=function(t){"use strict";var e,r,n,o,i,s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(t){!function(e){var r="object"==typeof s?s:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),n=o(t);function o(t,e){return function(r,n){"function"!=typeof t[r]&&Object.defineProperty(t,r,{configurable:!0,writable:!0,value:n}),e&&e(r,n)}}void 0===r.Reflect?r.Reflect=t:n=o(r.Reflect,n),function(t){var e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,n=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",i="function"==typeof Object.create,s={__proto__:[]}instanceof Array,a=!i&&!s,c={create:i?function(){return nt(Object.create(null))}:s?function(){return nt({__proto__:null})}:function(){return nt({})},has:a?function(t,r){return e.call(t,r)}:function(t,e){return e in t},get:a?function(t,r){return e.call(t,r)?t[r]:void 0}:function(t,e){return t[e]}},u=Object.getPrototypeOf(Function),h="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,f=h||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,l=h||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?et():Set,p=new(h||"function"!=typeof WeakMap?rt():WeakMap);function y(t,e,r,n){if(x(r)){if(!J(t))throw new TypeError;if(!G(e))throw new TypeError;return b(t,e)}if(!J(t))throw new TypeError;if(!I(e))throw new TypeError;if(!I(n)&&!x(n)&&!N(n))throw new TypeError;return N(n)&&(n=void 0),_(t,e,r=D(r),n)}function d(t,e){function r(r,n){if(!I(r))throw new TypeError;if(!x(n)&&!$(n))throw new TypeError;K(t,e,r,n)}return r}function g(t,e,r,n){if(!I(r))throw new TypeError;return x(n)||(n=D(n)),K(t,e,r,n)}function v(t,e,r){if(!I(e))throw new TypeError;return x(r)||(r=D(r)),R(t,e,r)}function S(t,e,r){if(!I(e))throw new TypeError;return x(r)||(r=D(r)),P(t,e,r)}function m(t,e,r){if(!I(e))throw new TypeError;return x(r)||(r=D(r)),T(t,e,r)}function w(t,e,r){if(!I(e))throw new TypeError;return x(r)||(r=D(r)),O(t,e,r)}function A(t,e){if(!I(t))throw new TypeError;return x(e)||(e=D(e)),H(t,e)}function C(t,e){if(!I(t))throw new TypeError;return x(e)||(e=D(e)),B(t,e)}function E(t,e,r){if(!I(e))throw new TypeError;x(r)||(r=D(r));var n=k(e,r,!1);if(x(n))return!1;if(!n.delete(t))return!1;if(n.size>0)return!0;var o=p.get(e);return o.delete(r),o.size>0||p.delete(e),!0}function b(t,e){for(var r=t.length-1;r>=0;--r){var n=(0,t[r])(e);if(!x(n)&&!N(n)){if(!G(n))throw new TypeError;e=n}}return e}function _(t,e,r,n){for(var o=t.length-1;o>=0;--o){var i=(0,t[o])(e,r,n);if(!x(i)&&!N(i)){if(!I(i))throw new TypeError;n=i}}return n}function k(t,e,r){var n=p.get(t);if(x(n)){if(!r)return;n=new f,p.set(t,n)}var o=n.get(e);if(x(o)){if(!r)return;o=new f,n.set(e,o)}return o}function R(t,e,r){if(P(t,e,r))return!0;var n=X(e);return!N(n)&&R(t,n,r)}function P(t,e,r){var n=k(e,r,!1);return!x(n)&&L(n.has(t))}function T(t,e,r){if(P(t,e,r))return O(t,e,r);var n=X(e);return N(n)?void 0:T(t,n,r)}function O(t,e,r){var n=k(e,r,!1);if(!x(n))return n.get(t)}function K(t,e,r,n){k(r,n,!0).set(t,e)}function H(t,e){var r=B(t,e),n=X(t);if(null===n)return r;var o=H(n,e);if(o.length<=0)return r;if(r.length<=0)return o;for(var i=new l,s=[],a=0,c=r;a<c.length;a++){var u=c[a];i.has(u)||(i.add(u),s.push(u))}for(var h=0,f=o;h<f.length;h++){u=f[h];i.has(u)||(i.add(u),s.push(u))}return s}function B(t,e){var r=[],n=k(t,e,!1);if(x(n))return r;for(var o=q(n.keys()),i=0;;){var s=Z(o);if(!s)return r.length=i,r;var a=Y(s);try{r[i]=a}catch(t){try{Q(o)}finally{throw t}}i++}}function j(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function x(t){return void 0===t}function N(t){return null===t}function M(t){return"symbol"==typeof t}function I(t){return"object"==typeof t?null!==t:"function"==typeof t}function U(t,e){switch(j(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var r=3===e?"string":5===e?"number":"default",o=V(t,n);if(void 0!==o){var i=o.call(t,r);if(I(i))throw new TypeError;return i}return W(t,"default"===r?"number":r)}function W(t,e){if("string"===e){var r=t.toString;if(z(r))if(!I(o=r.call(t)))return o;if(z(n=t.valueOf))if(!I(o=n.call(t)))return o}else{var n;if(z(n=t.valueOf))if(!I(o=n.call(t)))return o;var o,i=t.toString;if(z(i))if(!I(o=i.call(t)))return o}throw new TypeError}function L(t){return!!t}function F(t){return""+t}function D(t){var e=U(t,3);return M(e)?e:F(e)}function J(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function z(t){return"function"==typeof t}function G(t){return"function"==typeof t}function $(t){switch(j(t)){case 3:case 4:return!0;default:return!1}}function V(t,e){var r=t[e];if(null!=r){if(!z(r))throw new TypeError;return r}}function q(t){var e=V(t,o);if(!z(e))throw new TypeError;var r=e.call(t);if(!I(r))throw new TypeError;return r}function Y(t){return t.value}function Z(t){var e=t.next();return!e.done&&e}function Q(t){var e=t.return;e&&e.call(t)}function X(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===u)return e;if(e!==u)return e;var r=t.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return e;var o=n.constructor;return"function"!=typeof o||o===t?e:o}function tt(){var t={},e=[],r=function(){function t(t,e,r){this._index=0,this._keys=t,this._values=e,this._selector=r}return t.prototype["@@iterator"]=function(){return this},t.prototype[o]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var r=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var r=this._find(t,!0);return this._values[r]=e,this},e.prototype.delete=function(e){var r=this._find(e,!1);if(r>=0){for(var n=this._keys.length,o=r+1;o<n;o++)this._keys[o-1]=this._keys[o],this._values[o-1]=this._values[o];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new r(this._keys,this._values,n)},e.prototype.values=function(){return new r(this._keys,this._values,i)},e.prototype.entries=function(){return new r(this._keys,this._values,s)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[o]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function n(t,e){return t}function i(t,e){return e}function s(t,e){return[t,e]}}function et(){return function(){function t(){this._map=new f}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[o]=function(){return this.keys()},t}()}function rt(){var t=16,r=c.create(),n=o();return function(){function t(){this._key=o()}return t.prototype.has=function(t){var e=i(t,!1);return void 0!==e&&c.has(e,this._key)},t.prototype.get=function(t){var e=i(t,!1);return void 0!==e?c.get(e,this._key):void 0},t.prototype.set=function(t,e){return i(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=i(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=o()},t}();function o(){var t;do{t="@@WeakMap@@"+u()}while(c.has(r,t));return r[t]=!0,t}function i(t,r){if(!e.call(t,n)){if(!r)return;Object.defineProperty(t,n,{value:c.create()})}return t[n]}function s(t,e){for(var r=0;r<e;++r)t[r]=255*Math.random()|0;return t}function a(t){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):s(new Uint8Array(t),t):s(new Array(t),t)}function u(){var e=a(t);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var r="",n=0;n<t;++n){var o=e[n];4!==n&&6!==n&&8!==n||(r+="-"),o<16&&(r+="0"),r+=o.toString(16).toLowerCase()}return r}}function nt(t){return t.__=void 0,delete t.__,t}t("decorate",y),t("metadata",d),t("defineMetadata",g),t("hasMetadata",v),t("hasOwnMetadata",S),t("getMetadata",m),t("getOwnMetadata",w),t("getMetadataKeys",A),t("getOwnMetadataKeys",C),t("deleteMetadata",E)}(n)}()}(e||(e={}));class a{static toArrayBuffer(t){const e=this.toUint8Array(t);return e.byteOffset||e.length?e.buffer.slice(e.byteOffset,e.byteOffset+e.length):e.buffer}static toUint8Array(t){if("undefined"!=typeof Buffer&&Buffer.isBuffer(t))return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(t instanceof ArrayBuffer)return new Uint8Array(t);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||t instanceof ArrayBuffer}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&t.buffer instanceof ArrayBuffer}}function c(t){return"undefined"!=typeof Buffer&&Buffer.isBuffer(t)?new Uint8Array(t):a.isArrayBufferView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)}class u{static isHex(t){return"string"==typeof t&&/^[a-z0-9]+$/i.test(t)}static isBase64(t){return"string"==typeof t&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}static isBase64Url(t){return"string"==typeof t&&/^[a-zA-Z0-9-_]+$/i.test(t)}static ToString(t,e="utf8"){const r=c(t);switch(e.toLowerCase()){case"utf8":return this.ToUtf8String(r);case"binary":return this.ToBinary(r);case"hex":return this.ToHex(r);case"base64":return this.ToBase64(r);case"base64url":return this.ToBase64Url(r);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromString(t,e="utf8"){if(!t)return new ArrayBuffer(0);switch(e.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToBase64(t){const e=c(t);if("undefined"!=typeof btoa){const t=this.ToString(e,"binary");return btoa(t)}return Buffer.from(e).toString("base64")}static FromBase64(t){const e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!u.isBase64(e))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return"undefined"!=typeof atob?this.FromBinary(atob(e)):new Uint8Array(Buffer.from(e,"base64")).buffer}static FromBase64Url(t){const e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!u.isBase64Url(e))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(e.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t){const e=unescape(encodeURIComponent(t)),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r.buffer}static ToUtf8String(t){const e=c(t),r=String.fromCharCode.apply(null,e);return decodeURIComponent(escape(r))}static FromBinary(t){const e=t.length,r=new Uint8Array(e);for(let n=0;n<e;n++)r[n]=t.charCodeAt(n);return r.buffer}static ToBinary(t){const e=c(t);let r="";const n=e.length;for(let t=0;t<n;t++)r+=String.fromCharCode(e[t]);return r}static ToHex(t){const e=c(t),r=[],n=e.length;for(let t=0;t<n;t++){const n=e[t].toString(16);r.push(1===n.length?"0"+n:n)}return r.join("")}static FromHex(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!u.isHex(e))throw new TypeError("Argument 'hexString' is not HEX encoded");e.length%2&&(e="0"+e);const r=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2){const n=e.slice(t,t+2);r[t/2]=parseInt(n,16)}return r.buffer}static Base64Padding(t){const e=4-t.length%4;if(e<4)for(let r=0;r<e;r++)t+="=";return t}static formatString(t){return(null==t?void 0:t.replace(/[\n\r\t ]/g,""))||""}}!function(t){t[t.ok=200]="ok",t[t.noContent=204]="noContent",t[t.unauthorized=401]="unauthorized",t[t.badRequest=400]="badRequest",t[t.forbidden=403]="forbidden",t[t.notFound=404]="notFound",t[t.methodNotAllowed=405]="methodNotAllowed",t[t.internalServerError=500]="internalServerError"}(r||(r={}));class h extends Error{constructor(t,e="",n=r.internalServerError,o){super(e),this.type=t,this.message=e,this.status=n,this.inner=o,this.name="AcmeError"}}!function(t){t.json="application/json",t.joseJson="application/jose+json",t.problemJson="application/problem+json",t.pkix="application/pkix-cert",t.pem="application/pem-certificate-chain",t.pkcs7="application/pkcs7-mime"}(n||(n={}));class f{constructor(t,e){var r;if(this.content=new ArrayBuffer(0),"string"==typeof t)this.content=u.FromUtf8String(t),this.type=n.pem;else if(t instanceof h)this.content=u.FromUtf8String(JSON.stringify({detail:t.message,type:t.type,subproblems:null===(r=t.subproblems)||void 0===r?void 0:r.map(t=>({detail:t.message,type:t.type}))})),this.type=n.problemJson;else if(a.isBufferSource(t)){if(!e)throw new TypeError("Cannot get required argument 'type'");this.content=a.toArrayBuffer(t),this.type=e}else{const r=e?JSON.stringify(t,null," "):JSON.stringify(t);this.content=u.FromUtf8String(r),this.type=n.json}}toJSON(){return JSON.parse(this.toString())}toString(){return u.ToUtf8String(this.content)}}class l extends Map{get location(){return this.get(l.LOCATION)||null}set location(t){t?this.set(l.LOCATION,t):this.delete(l.LOCATION)}get contentType(){var t,e;const r=this.get(l.CONTENT_TYPE);return r?{mediaType:r.split(";")[0],charset:null===(t=/charset=([\w-]+)/i.exec(r))||void 0===t?void 0:t[1],boundary:null===(e=/boundary=([\w-]+)/i.exec(r))||void 0===e?void 0:e[1]}:null}get link(){const t=this.get(l.LINK);return t?t.split(",").map(t=>t.trim()):null}setLink(t){let e=this.get(l.LINK);e?e+=","+t:e=t,this.set(l.LINK,e)}get replayNonce(){return this.get(l.REPLAY_NONCE)||null}set replayNonce(t){t?this.set(l.REPLAY_NONCE,t):this.delete(l.REPLAY_NONCE)}set(t,e){return super.set(t.toLowerCase(),e)}get(t){return super.get(t.toLowerCase())}append(t,e){const r=this.get(t);e?this.set(t,`${r}, ${e}`):this.set(t,e)}}l.REPLAY_NONCE="Replay-Nonce",l.LINK="Link",l.CONTENT_TYPE="Content-Type",l.LOCATION="Location";class p{constructor(){this.status=r.ok,this.headers=new l}json(){if(this.content)return this.content.toJSON();throw new Error("No content in ACME response")}}function y(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}function d(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}!function(t){t.accountDoesNotExist="urn:ietf:params:acme:error:accountDoesNotExist",t.alreadyRevoked="urn:ietf:params:acme:error:alreadyRevoked",t.badCSR="urn:ietf:params:acme:error:badCSR",t.badNonce="urn:ietf:params:acme:error:badNonce",t.badPublicKey="urn:ietf:params:acme:error:badPublicKey",t.badRevocationReason="urn:ietf:params:acme:error:badRevocationReason",t.badSignatureAlgorithm="urn:ietf:params:acme:error:badSignatureAlgorithm",t.caa="urn:ietf:params:acme:error:caa",t.compound="urn:ietf:params:acme:error:compound",t.connection="urn:ietf:params:acme:error:connection",t.dns="urn:ietf:params:acme:error:dns",t.externalAccountRequired="urn:ietf:params:acme:error:externalAccountRequired",t.incorrectResponse="urn:ietf:params:acme:error:incorrectResponse",t.invalidContact="urn:ietf:params:acme:error:invalidContact",t.malformed="urn:ietf:params:acme:error:malformed",t.orderNotReady="urn:ietf:params:acme:error:orderNotReady",t.rateLimited="urn:ietf:params:acme:error:rateLimited",t.rejectedIdentifier="urn:ietf:params:acme:error:rejectedIdentifier",t.serverInternal="urn:ietf:params:acme:error:serverInternal",t.tls="urn:ietf:params:acme:error:tls",t.unauthorized="urn:ietf:params:acme:error:unauthorized",t.unsupportedContact="urn:ietf:params:acme:error:UnsupportedContact",t.unsupportedIdentifier="urn:ietf:params:acme:error:unsupportedIdentifier",t.userActionRequired="urn:ietf:params:acme:error:userActionRequired"}(o||(o={})),function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"}(i||(i={}));var g=i;function v(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function S(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function m(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(S(arguments[e]));return t}function w(t){return!!t.useClass}function A(t){return!!t.useFactory}var C=function(){function t(t){this.wrap=t,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct"]}return t.prototype.createProxy=function(t){var e,r=this,n=!1;return new Proxy({},this.createHandler((function(){return n||(e=t(r.wrap()),n=!0),e})))},t.prototype.createHandler=function(t){var e={};return this.reflectMethods.forEach((function(r){e[r]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e[0]=t();var o=Reflect[r];return o.apply(void 0,m(e))}})),e},t}();function E(t){return"string"==typeof t||"symbol"==typeof t}function b(t){return!!t.useToken}function _(t){return null!=t.useValue}var k=function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(t){return this.ensure(t),this._registryMap.get(t)},t.prototype.get=function(t){this.ensure(t);var e=this._registryMap.get(t);return e[e.length-1]||null},t.prototype.set=function(t,e){this.ensure(t),this._registryMap.get(t).push(e)},t.prototype.setAll=function(t,e){this._registryMap.set(t,e)},t.prototype.has=function(t){return this.ensure(t),this._registryMap.get(t).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(t){this._registryMap.has(t)||this._registryMap.set(t,[])},t}(),R=function(){this.scopedResolutions=new Map};function P(t,e,r){var n,o,i=S(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2)[1],s=function(t,e){return null===t?"at position #"+e:'"'+t.split(",")[e].trim()+'" at position #'+e}(void 0===i?null:i,e);return n="Cannot inject the dependency "+s+' of "'+t.name+'" constructor. Reason:',void 0===o&&(o=" "),m([n],r.message.split("\n").map((function(t){return o+t}))).join("\n")}var T,O=new Map,K=new(function(){function t(t){this.parent=t,this._registry=new k}return t.prototype.register=function(t,e,r){var n;if(void 0===r&&(r={lifecycle:g.Transient}),n=function(t){return w(t)||_(t)||b(t)||A(t)}(e)?e:{useClass:e},(r.lifecycle===g.Singleton||r.lifecycle==g.ContainerScoped||r.lifecycle==g.ResolutionScoped)&&(_(n)||A(n)))throw new Error('Cannot use lifecycle "'+g[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(t,{provider:n,options:r}),this},t.prototype.registerType=function(t,e){return E(e)?this.register(t,{useToken:e}):this.register(t,{useClass:e})},t.prototype.registerInstance=function(t,e){return this.register(t,{useValue:e})},t.prototype.registerSingleton=function(t,e){if(E(t)){if(E(e))return this.register(t,{useToken:e},{lifecycle:g.Singleton});if(e)return this.register(t,{useClass:e},{lifecycle:g.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=t;return e&&!E(e)&&(r=e),this.register(t,{useClass:r},{lifecycle:g.Singleton})},t.prototype.resolve=function(t,e){void 0===e&&(e=new R);var r=this.getRegistration(t);if(!r&&E(t))throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"');if(r)return this.resolveRegistration(r,e);if(function(t){return"function"==typeof t||t instanceof C}(t))return this.construct(t,e);throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.resolveRegistration=function(t,e){if(t.options.lifecycle===g.ResolutionScoped&&e.scopedResolutions.has(t))return e.scopedResolutions.get(t);var r,n=t.options.lifecycle===g.Singleton,o=t.options.lifecycle===g.ContainerScoped,i=n||o;return r=_(t.provider)?t.provider.useValue:b(t.provider)?i?t.instance||(t.instance=this.resolve(t.provider.useToken,e)):this.resolve(t.provider.useToken,e):w(t.provider)?i?t.instance||(t.instance=this.construct(t.provider.useClass,e)):this.construct(t.provider.useClass,e):A(t.provider)?t.provider.useFactory(this):this.construct(t.provider,e),t.options.lifecycle===g.ResolutionScoped&&e.scopedResolutions.set(t,r),r},t.prototype.resolveAll=function(t,e){var r=this;void 0===e&&(e=new R);var n=this.getAllRegistrations(t);if(!n&&E(t))throw new Error('Attempted to resolve unregistered dependency token: "'+t.toString()+'"');return n?n.map((function(t){return r.resolveRegistration(t,e)})):[this.construct(t,e)]},t.prototype.isRegistered=function(t,e){return void 0===e&&(e=!1),this._registry.has(t)||e&&(this.parent||!1)&&this.parent.isRegistered(t,!0)},t.prototype.reset=function(){this._registry.clear()},t.prototype.clearInstances=function(){var t,e;try{for(var r=v(this._registry.entries()),n=r.next();!n.done;n=r.next()){var o=S(n.value,2),i=o[0],s=o[1];this._registry.setAll(i,s.filter((function(t){return!_(t.provider)})).map((function(t){return t.instance=void 0,t})))}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.createChildContainer=function(){var e,r,n=new t(this);try{for(var o=v(this._registry.entries()),i=o.next();!i.done;i=o.next()){var s=S(i.value,2),a=s[0],c=s[1];c.some((function(t){return t.options.lifecycle===g.ContainerScoped}))&&n._registry.setAll(a,c.map((function(t){return t.options.lifecycle===g.ContainerScoped?{provider:t.provider,options:t.options}:t})))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n},t.prototype.getRegistration=function(t){return this.isRegistered(t)?this._registry.get(t):this.parent?this.parent.getRegistration(t):null},t.prototype.getAllRegistrations=function(t){return this.isRegistered(t)?this._registry.getAll(t):this.parent?this.parent.getAllRegistrations(t):null},t.prototype.construct=function(t,e){var r=this;if(t instanceof C)return t.createProxy((function(t){return r.resolve(t,e)}));if(0===t.length)return new t;var n=O.get(t);if(!n||0===n.length)throw new Error('TypeInfo not known for "'+t.name+'"');var o=n.map(this.resolveParams(e,t));return new(t.bind.apply(t,m([void 0],o)))},t.prototype.resolveParams=function(t,e){var r=this;return function(n,o){try{return"object"==typeof(i=n)&&"token"in i&&"multiple"in i?n.multiple?r.resolveAll(n.token):r.resolve(n.token,t):r.resolve(n,t)}catch(t){throw new Error(P(e,o,t))}var i}},t}());if("undefined"==typeof Reflect||!Reflect.getMetadata)throw new Error("tsyringe requires a reflect polyfill. Please add 'import \"reflect-metadata\"' to the top of your entry point.");!function(t){t[t.error=0]="error",t[t.warn=1]="warn",t[t.info=2]="info",t[t.debug=3]="debug"}(T||(T={}));let H=class t{constructor(){this.level=T.info}error(t,e){this.write(T.debug,t,e)}info(t,e){this.write(T.info,t,e)}warn(t,e){this.write(T.warn,t,e)}debug(t,e){this.write(T.debug,t,e)}write(t,e,r){this.level>=t&&this.onWrite(t,e,r)}onWrite(t,e,r){}checkLevel(t){return this.level>=t}};H=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}([function(t){O.set(t,function(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata("injectionTokens",t)||{};return Object.keys(r).forEach((function(t){e[+t]=r[t]})),e}(t))}],H),K.register("ACME.Logger",H);class B{static toAlgorithm(t){switch(t){case"ES256":return{name:"ECDSA",hash:{name:"SHA-256"}};case"ES384":return{name:"ECDSA",hash:{name:"SHA-384"}};case"ES512":return{name:"ECDSA",hash:{name:"SHA-512"}};case"HS1":return{name:"HMAC",hash:{name:"SHA-1"}};case"HS256":return{name:"HMAC",hash:{name:"SHA-256"}};case"HS384":return{name:"HMAC",hash:{name:"SHA-384"}};case"HS512":return{name:"HMAC",hash:{name:"SHA-512"}};case"PS1":return{name:"RSA-PSS",hash:{name:"SHA-1"}};case"PS256":return{name:"RSA-PSS",hash:{name:"SHA-256"}};case"PS384":return{name:"RSA-PSS",hash:{name:"SHA-384"}};case"PS512":return{name:"RSA-PSS",hash:{name:"SHA-512"}};case"RS1":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"RS384":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"RS512":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}}}return null}static fromAlgorithm(t){const e="string"==typeof t?{name:t}:t,r=e.name.toLowerCase(),n=e.hash?("string"==typeof e.hash?e.hash:e.hash.name).toLowerCase():"sha-256";switch(r){case"hmac":switch(n){case"sha-1":return"HS1";case"sha-256":return"HS256";case"sha-384":return"HS384";case"sha-512":return"HS512"}break;case"rsassa-pkcs1-v1_5":switch(n){case"sha-1":return"RS1";case"sha-256":return"RS256";case"sha-R84":return"RS384";case"sha-512":return"RS512"}break;case"rsa-pss":switch(n){case"sha-1":return"PS1";case"sha-256":return"PS256";case"sha-P84":return"PS384";case"sha-512":return"PS512"}break;case"ecdsa":switch(n){case"sha-256":return"ES256";case"sha-384":return"ES384";case"sha-512":return"ES512"}}return null}}var j,x,N,M;!function(t){t.hs256="HS256",t.hs384="HS384",t.hs512="HS512",t.RS256="RS256",t.RS384="RS384",t.RS512="RS512",t.ES256="ES256",t.ES384="ES384",t.ES512="ES512",t.PS1="PS1",t.PS256="PS256",t.PS384="PS384",t.PS512="PS512",t.RSA1_5="RSA1_5",t.RSA_OAEP="RSA-OAEP",t.RSA_OAEP_256="RSA-OAEP-256",t.A128KW="A128KW",t.A192KW="A192KW",t.A256KW="A256KW",t.Dir="dir",t.ECDH_ES="ECDH-ES",t.ECDH_ES_A128KW="ECDH-ES+A128KW",t.ECDH_ES_A192KW="ECDH-ES+A192KW",t.ECDH_ES_A256KW="ECDH-ES+A256KW",t.A128GCMKW="A128GCMKW",t.A192GCMKW="A192GCMKW",t.A256GCMKW="A256GCMKW",t.PBES2_HS256_A128KW="PBES2-HS256+A128KW",t.PBES2_HS384_A192KW="PBES2-HS384+A192KW",t.PBES2_HS512_A256KW="PBES2-HS512+A256KW",t.A128CBC_HS256="A128CBC-HS256",t.A192CBC_HS384="A192CBC-HS384",t.A256CBC_HS512="A256CBC-HS512",t.A128GCM="A128GCM",t.A192GCM="A192GCM",t.A256GCM="A256GCM",t.EdDSA="EdDSA",t.RS1="RS1",t.RSA_OAEP_384="RSA-OAEP-384",t.RSA_OAEP_512="RSA-OAEP-512",t.A128CBC="A128CBC",t.A192CBC="A192CBC",t.A256CBC="A256CBC",t.A128CTR="A128CTR",t.A192CTR="A192CTR",t.A256CTR="A256CTR",t.HS1="HS1",t.SHA1="SHA1",t.SHA256="SHA256"}(j||(j={})),function(t){t.EC="EC",t.RSA="RSA",t.OctetSequence="oct",t.OctetStringKeyPairs="OKP"}(x||(x={}));class I{constructor(t,e={}){N.set(this,void 0),Object.assign(this,e),function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");e.set(t,r)}(this,N,t)}exportKey(...t){return y(this,arguments,void 0,(function*(){let e,r=["verify"],n=d(this,N);if(arguments.length<2)switch(n=t[0]||n,this.kty){case x.RSA:e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"};break;case x.EC:e={name:"ECDSA",namedCurve:this.crv};break;case x.OctetSequence:e={name:"HMAC",hash:"SHA-256"};break;default:throw new Error("Unsupported type of JWK")}else e=t[0],r=t[1],n=t[2]||n;return yield n.subtle.importKey("jwk",this,e,!0,r)}))}getThumbprint(t=j.SHA256){return y(this,void 0,void 0,(function*(){const e={};this.crv&&(e.crv=this.crv.toString()),this.e&&(e.e=this.e),this.k&&(e.k=this.k),this.kty&&(e.kty=this.kty.toString()),this.n&&(e.n=this.n),this.x&&(e.x=this.x),this.y&&(e.y=this.y);const r=JSON.stringify(e);switch(t){case j.SHA256:return u.ToHex(yield this.digest(r,"SHA-256"));case j.SHA1:return u.ToHex(yield this.digest(r,"SHA-1"));default:throw new Error("Unsupported algorithm: "+t)}}))}digest(t,e){return y(this,void 0,void 0,(function*(){return yield d(this,N).subtle.digest({name:e},a.toUint8Array(u.FromUtf8String(t)))}))}getPublicKey(){return y(this,void 0,void 0,(function*(){if(this.kty===x.EC)return this.getEcdsaPublicKey();if(this.kty===x.RSA)return this.getRsaPublicKey();throw new Error("Unsupported type "+this.kty)}))}getEcdsaPublicKey(){return y(this,void 0,void 0,(function*(){const t={name:"ECDSA",namedCurve:this.crv};return yield d(this,N).subtle.importKey("jwk",this,t,!0,["verify"])}))}getRsaPublicKey(){return y(this,void 0,void 0,(function*(){return yield d(this,N).subtle.importKey("jwk",this,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}))}}N=new WeakMap;class U{constructor(t={},e){this.cryptoProvider=e,this.protected="e30",this.payload="",this.signature="",t.protected&&this.setProtected(t.protected),t.payload&&this.setPayload(t.payload)}fromJSON(t){Object.assign(this,t)}isPayloadEmpty(){return!this.payload}isPayloadEmptyObject(){return"e30"===this.payload}getProtected(t){const e=this.read(this.protected);return e.jwk&&(e.jwk=new I(this.getCryptoProvider(t),e.jwk)),e}setProtected(t){this.protected=this.write(t)}getPayload(){return this.read(this.payload)}tryGetPayload(){try{return this.getPayload()}catch(t){return null}}setPayload(t){this.payload=this.write(t)}getSignature(){return u.FromBase64Url(this.signature)}setSignature(t){this.signature=u.ToBase64Url(t)}read(t){const e=u.FromBase64Url(t),r=u.ToUtf8String(e);return""===r?"":JSON.parse(r)}write(t){const e=JSON.stringify(t),r=u.FromUtf8String(e);return u.ToBase64Url(r)}verify(t,e){return y(this,void 0,void 0,(function*(){const r=this.getProtected();if(!r.alg)throw new Error("JWS.protected doesn't have required parameter 'alg'");const n=B.toAlgorithm(r.alg);if(!n)throw new Error("Cannot convert JWA to WebCrypto algorithm");if(!t){const r=yield this.getKey(e);if(!r)throw new Error("Cannot get JWK key");t=r}const o=u.FromUtf8String(this.toStringSign());return yield this.getCryptoProvider(e).subtle.verify(n,t,this.getSignature(),o)}))}getKey(t){return y(this,void 0,void 0,(function*(){const e=this.getProtected();if(!e.jwk)return null;if(!e.alg)throw new Error("JWS.protected doesn't have required parameter 'alg'");const r=B.toAlgorithm(e.alg);if(!r)throw new Error("Cannot convert JWA to WebCrypto algorithm");const n=Object.assign({},r);"ECDSA"===n.name&&(n.namedCurve=e.jwk.crv);return yield this.getCryptoProvider(t).subtle.importKey("jwk",e.jwk,n,!0,["verify"])}))}sign(t,e,r){return y(this,void 0,void 0,(function*(){const n=this.getProtected(),o=B.fromAlgorithm(Object.assign(Object.assign({},t),e.algorithm));if(!o)throw new Error("Cannot convert WebCrypto algorithm to JWA");n.alg=o,this.setProtected(n);const i=u.FromUtf8String(this.toStringSign()),s=yield this.getCryptoProvider(r).subtle.sign(t,e,i);this.setSignature(s)}))}toStringSign(){return`${this.protected}.${this.payload}`}toJSON(){const t={};return this.protected&&(t.protected=this.protected),this.payload&&(t.payload=this.payload),this.signature&&(t.signature=this.signature),t}parse(t){if("{"===t[0]){const e=JSON.parse(t);this.protected=e.protected||"",this.payload=e.payload||"",this.signature=e.signature||""}else{const e=t.split(".");this.protected=e[0]||"",this.payload=e[1]||"",this.signature=e[2]||""}}toString(t=!1){return t?`${this.protected}.${this.payload}.${this.signature}`:JSON.stringify(this.toJSON())}getCryptoProvider(t){if(t)return t;if(this.cryptoProvider)return this.cryptoProvider;throw new Error("Cannot find Crypto")}}class W{constructor(t={}){if(this.options={crypto:"undefined"!=typeof self?self.crypto:void 0,debug:t.debug,defaultHash:"SHA-256",fetch:"undefined"!=typeof fetch?fetch:void 0,...t},!this.options.crypto)throw new Error("Cannot initialize ACME client. It requires crypto provider to be set.")}static createResponse(t,e){return{status:t.status,headers:t.headers,content:e}}async fetch(t,e){var r,i;if(!this.options.fetch)throw new Error("Cannot get 'fetch' option");this.options.debug&&(console.log(`REQUEST ${e.method} ${t}`),"body"in e&&console.log("REQUEST BODY",e.body));const s=this.options.fetch;let a;if("GET"===e.method||"HEAD"===e.method)a=await s(t,{method:e.method,headers:e.headers||{}});else{const r=this.getCrypto(),o=e,i={method:"POST"},c={url:t,nonce:o.nonce};if("string"==typeof o.kid)c.kid=o.kid;else{const t=await this.getCrypto().subtle.exportKey("jwk",o.kid);c.jwk=new I(r,t)}const u=new U({protected:c,payload:o.method&&"POST-as-GET"!==o.method?o.body:""},this.getCrypto());await u.sign({hash:o.hash||this.options.defaultHash,...o.key.algorithm},o.key,r),i.body=u.toString(),i.headers={"Content-Type":n.joseJson},a=await s(t,i)}const c=new p;c.status=a.status,a.headers.forEach((t,e)=>c.headers.set(e,t));const u=await a.arrayBuffer();if(c.content=new f(u,(null===(r=c.headers.contentType)||void 0===r?void 0:r.mediaType)||n.json),this.options.debug&&console.log(`RESPONSE ${e.method} ${t}`),c.content&&(c.status<200||c.status>299)){if((null===(i=c.headers.contentType)||void 0===i?void 0:i.mediaType)===n.problemJson){const t=c.content.toJSON();throw this.options.debug&&console.log("RESPONSE",t),new h(t.type,t.detail,c.status)}{const t=c.content.toString();throw this.options.debug&&console.log("RESPONSE",t),new h(o.serverInternal,"Wrong Content-Type of ACME response. Must be application/problem+json. See inner exception for more details.",c.status,new globalThis.Error(t))}}const l=W.createResponse(c,e.convert(c));return this.options.debug&&console.log("RESPONSE",l),l}getCrypto(){if(!this.options.crypto)throw new Error("Cannot get 'crypto' option");return this.options.crypto}}(M=t.CRLReasons||(t.CRLReasons={}))[M.unspecified=0]="unspecified",M[M.keyCompromise=1]="keyCompromise",M[M.cACompromise=2]="cACompromise",M[M.affiliationChanged=3]="affiliationChanged",M[M.superseded=4]="superseded",M[M.cessationOfOperation=5]="cessationOfOperation",M[M.certificateHold=6]="certificateHold",M[M.removeFromCRL=8]="removeFromCRL",M[M.privilegeWithdrawn=9]="privilegeWithdrawn",M[M.aACompromise=10]="aACompromise";class L extends W{constructor(t,e,r){super(r),this.accountKey=t,this.url=e,this.nonce="",this.accountId=""}static async create(t,e,r){const n=new L(t,e,r);return n.directory=await n.getDirectory(),n}async fetch(t,e){"POST"!==e.method&&"POST-as-GET"!==e.method||(this.nonce||await this.getNonce(),e.nonce=this.nonce,this.nonce="");const r=await super.fetch(t,e);return this.readNonce(r),r}async getDirectory(){return(await this.fetch(this.url,{method:"GET",convert:t=>t.json()})).content}async getNonce(t="HEAD"){const e=await this.fetch(this.directory.newNonce,{method:t,convert:()=>null});return this.readNonce(e)}async newAccount(t){const e={contact:t.contact,onlyReturnExisting:t.onlyReturnExisting,termsOfServiceAgreed:t.termsOfServiceAgreed};t.externalAccountBinding&&(e.externalAccountBinding=await this.createExternalAccountBinding(t.externalAccountBinding.challenge,t.externalAccountBinding.kid));const r=await this.fetch(this.directory.newAccount,{method:"POST",kid:this.accountKey.publicKey,nonce:this.nonce,key:this.accountKey.privateKey,body:e,convert:t=>t.json()});if(!r.headers.location)throw new Error("Cannot get Location header");return this.accountId=r.headers.location,r}async updateAccount(t){const e=this.getAccountId();return await this.fetch(e,{method:"POST",kid:e,nonce:this.nonce,key:this.accountKey.privateKey,body:t,convert:t=>t.json()})}getAccountId(){if(!this.accountId)throw new Error("Create or Find account first");return this.accountId}async deactivateAccount(){return this.deactivate(this.getAccountId(),t=>t.json())}async changeKey(t){const e=this.getAccountId(),r=this.getCrypto(),n=new U({protected:{url:this.directory.keyChange,jwk:new I(r,await r.subtle.exportKey("jwk",t.publicKey))},payload:{account:e,oldKey:new I(r,await r.subtle.exportKey("jwk",this.accountKey.publicKey))}},this.getCrypto());await n.sign({hash:this.options.defaultHash,...t.privateKey.algorithm},t.privateKey);const o=await this.fetch(this.directory.keyChange,{method:"POST",kid:e,nonce:this.nonce,key:this.accountKey.privateKey,body:n,convert:()=>null});return this.accountKey=t,o}async newOrder(t){return this.fetch(this.directory.newOrder,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:t,convert:t=>t.json()})}async getOrder(t){return this.fetch(t,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,convert:t=>t.json()})}async retryOrder(t,e={}){let r="string"==typeof t?await this.getOrder(t):t,n=e.retries||L.RETRIES;for(;n--;){if(!r.headers.location)throw new Error("Cannot get location header from Order response");if(r=await this.getOrder(r.headers.location),"processing"!==r.content.status)break;await this.pause(e.interval||L.INTERVAL)}return r}async revoke(e,r=t.CRLReasons.unspecified){return await this.fetch(this.directory.keyChange,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:{certificate:u.ToBase64Url(e),reason:r},convert:()=>null})}async deactivate(t,e){return this.fetch(t,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:{status:"deactivated"},convert:e})}async deactivateAuthorization(t){return this.deactivate(t,t=>t.json())}async getChallenge(t,e="POST-as-GET"){const r=await this.fetch(t,{method:e,kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:"POST"===e?{}:void 0,convert:t=>t.json()});return"POST"===e&&await this.pause(2e3),r}async finalize(t,e){return this.fetch(t,{method:"POST",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,body:e,convert:t=>t.json()})}async getAuthorization(t){return this.fetch(t,{method:"POST-as-GET",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,convert:t=>t.json()})}async retryAuthorization(t,e={}){let r="string"==typeof t?await this.getOrder(t):t,n=e.retries||L.RETRIES;for(;n--;){if(!r.headers.location)throw new Error("Cannot get location header from Authorization response");if(r=await this.getAuthorization(r.headers.location),"pending"!==r.content.status)break;await this.pause(e.interval||L.INTERVAL)}return r}async getCertificate(t){return await this.fetch(t,{method:"POST-as-GET",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,convert:t=>{if(!t.content)throw new Error("Cannot get content from ACME response");switch(t.content.type){case n.pem:return this.decodePem(t.content.toString());case n.pkix:return[t.content.content];case n.pkcs7:throw new Error("Not implemented");default:throw new Error("Not supported content type for certificate")}}})}async getEndpoint(t){return this.fetch(t,{method:"POST-as-GET",kid:this.getAccountId(),nonce:this.nonce,key:this.accountKey.privateKey,convert:t=>t.json()})}readNonce(t){const e=t.headers.replayNonce;return this.nonce=e||"",e}async pause(t){return new Promise(e=>setTimeout(e,t))}async createExternalAccountBinding(t,e){const r=await this.getCrypto().subtle.importKey("raw",u.FromBase64Url(t),{name:"HMAC",hash:"SHA-256"},!0,["sign"]),n=await this.getCrypto().subtle.exportKey("jwk",this.accountKey.publicKey),o=new U({protected:{kid:e},payload:n},this.getCrypto());return await o.sign(r.algorithm,r,this.getCrypto()),o}decodePem(t){const e=/-{5}BEGIN [A-Z0-9 ]+-{5}([a-zA-Z0-9=+/\n\r]+)-{5}END [A-Z0-9 ]+-{5}/g,r=[];let n=null;for(;n=e.exec(t);){const t=n[1].replace(/[\r\n]/g,"");r.push(u.FromBase64(t))}return r}}return L.RETRIES=10,L.INTERVAL=1e3,t.ApiClient=L,t.BaseClient=W,t}({}); |
@@ -36,3 +36,3 @@ "use strict"; | ||
if (params.method === "GET" || params.method === "HEAD") { | ||
response = yield fetch(url, { method: params.method }); | ||
response = yield fetch(url, { method: params.method, headers: params.headers || {} }); | ||
} | ||
@@ -39,0 +39,0 @@ else { |
@@ -33,3 +33,3 @@ import { __awaiter } from "tslib"; | ||
if (params.method === "GET" || params.method === "HEAD") { | ||
response = yield fetch(url, { method: params.method }); | ||
response = yield fetch(url, { method: params.method, headers: params.headers || {} }); | ||
} | ||
@@ -36,0 +36,0 @@ else { |
@@ -11,2 +11,3 @@ import * as core from "@peculiar/acme-core"; | ||
method: "GET" | "HEAD"; | ||
headers?: Record<string, string>; | ||
convert: (res: core.Response) => T; | ||
@@ -13,0 +14,0 @@ } |
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.2.5](https://github.com/PeculiarVentures/acme-ts/compare/v1.2.4...v1.2.5) (2020-10-15) | ||
### Features | ||
* **client:** Added support headers for get method ([d96e685](https://github.com/PeculiarVentures/acme-ts/commit/d96e68553a1a58e5ac97faeea50823f7a5023c72)) | ||
## [1.2.4](https://github.com/PeculiarVentures/acme-ts/compare/v1.2.3...v1.2.4) (2020-10-13) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@peculiar/acme-client", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Automatic Certificate Management Environment (ACME) client", | ||
@@ -63,3 +63,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "786a2fc9deafda0c886e05f44d2d6209a9f5be05" | ||
"gitHead": "52c11102a6f1258ea0720aa40d6037c12615cccc" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130147
1315