diff --git a/Dockerfile b/Dockerfile index f44b3ba..abd14f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,10 @@ WORKDIR /app COPY export-and-sign ./export-and-sign/ RUN cd export-and-sign && npm ci && npm run build +# Copy import module and build +COPY import ./import/ +RUN cd import && npm ci && npm run build + # Second stage: nginx runtime # This is nginx 1.24.0 on bullseye. # https://hub.docker.com/layers/nginxinc/nginx-unprivileged/1.24.0-bullseye/images/sha256-a8ec652916ce1e7ab2ab624fe59bb8dfc16a018fd489c6fb979fe35c5dd3ec50 @@ -22,11 +26,12 @@ COPY nginx.conf /etc/nginx/nginx.conf # maintain recovery for backwards-compatibility COPY auth /usr/share/nginx/auth COPY auth /usr/share/nginx/recovery + COPY export /usr/share/nginx/export -COPY import /usr/share/nginx/import -# Copy built export-and-sign files from builder stage +# Copy built export-and-sign and import files from builder stage COPY --from=builder /app/export-and-sign/dist /usr/share/nginx/export-and-sign +COPY --from=builder /app/import/dist /usr/share/nginx/import # oauth COPY oauth-origin /usr/share/nginx/oauth-origin diff --git a/README.md b/README.md index 53559ae..0cf8afa 100644 --- a/README.md +++ b/README.md @@ -171,4 +171,57 @@ kubectl port-forward svc/frames 8080:8080 To clean things up: ``` k3d cluster delete frames -``` \ No newline at end of file +``` + +# Building with Webpack + +You'll see that some of our iframes are built with webpack. Note that configurations may vary: some may have standalone HTML pages to serve separately (e.g. import), while others do not. Take a peek at some of the webpack config files for reference. + +## Testing and iterating with Webpack + +For iframes that utilize webpack, the development flows change a bit. Each change you make will likely require a subsequent `npm run build` to webpack-ify your changes. You can then test your changes with `npm run start` to view the site locally. + +Furthermore, the trickier part is ensuring that built files (most of the time persisted in `/dist`) are accessible. See `Dockerfile`, `nginx.conf`, and `kustomize/base/resources.yaml` to see some example configurations. + +Finally, when iterating on an iframe and rebuilding, you may want to test locally with Docker + k8s. If you do so, you may need to add `imagePullPolicy: IfNotPresent` to both the `initContainers` and `containers` within `kustomize/base/resources.yaml`, and `newName: frames` + `newTag: latest` to `kustomize/base/kustomization.yaml`. This helps ensure you're using non-stale artifacts. + +Example diff for `kustomize/base/kustomization.yaml`: + +```bash +diff --git a/kustomize/base/kustomization.yaml b/kustomize/base/kustomization.yaml +index a18fe46..7ef92e7 100644 +--- a/kustomize/base/kustomization.yaml ++++ b/kustomize/base/kustomization.yaml +@@ -6,3 +6,5 @@ resources: + - resources.yaml + images: + - name: ghcr.io/tkhq/frames ++ newName: frames ++ newTag: latest +``` + + +Overall, here's what you might do: + +```bash +# (Re)-Build image +docker build --no-cache -t frames:latest . + +# Import to k3d +k3d image import frames:latest --cluster frames + +# Deploy +kubectl kustomize kustomize | kubectl --context k3d-frames apply -f- + +# Test (with whichever ports are applicable for your iframe) +kubectl port-forward svc/frames 8083:8083 --context k3d-frames +``` + +If testing in a live, non-local environment, you can point containers to a new image as follows: + +``` +# Update containers (main + init) to new image +kubectl --context -n tkhq-frames set image deployment/frames \ + frames=ghcr.io/tkhq/frames@sha256: \ + template-quorum-key=ghcr.io/tkhq/frames@sha256: +``` diff --git a/import/dist/291.bundle.b62abe64ba4ebf68e89b.js b/import/dist/291.bundle.b62abe64ba4ebf68e89b.js new file mode 100644 index 0000000..ae99dcf --- /dev/null +++ b/import/dist/291.bundle.b62abe64ba4ebf68e89b.js @@ -0,0 +1 @@ +(self.webpackChunkimport=self.webpackChunkimport||[]).push([[291],{291:()=>{}}]); \ No newline at end of file diff --git a/import/dist/825.bundle.3a4aff0e743a7540fe25.js b/import/dist/825.bundle.3a4aff0e743a7540fe25.js new file mode 100644 index 0000000..ac6dd8c --- /dev/null +++ b/import/dist/825.bundle.3a4aff0e743a7540fe25.js @@ -0,0 +1 @@ +(self.webpackChunkimport=self.webpackChunkimport||[]).push([[825],{825:()=>{}}]); \ No newline at end of file diff --git a/import/dist/common.bundle.a08f852097edf002c64d.js b/import/dist/common.bundle.a08f852097edf002c64d.js new file mode 100644 index 0000000..32c9b6d --- /dev/null +++ b/import/dist/common.bundle.a08f852097edf002c64d.js @@ -0,0 +1,3 @@ +/*! For license information please see common.bundle.a08f852097edf002c64d.js.LICENSE.txt */ +"use strict";(self.webpackChunkimport=self.webpackChunkimport||[]).push([[76],{482:(e,t,r)=>{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(){var e=s(),t=e.m(o),r=(Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__).constructor;function n(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===r||"GeneratorFunction"===(t.displayName||t.name))}var f={throw:1,return:2,break:3,continue:3};function p(e){var t,r;return function(n){t||(t={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return r(n.a,f[e],t)},delegateYield:function(e,o,i){return t.resultName=o,r(n.d,a(e),i)},finish:function(e){return r(n.f,e)}},r=function(e,r,o){n.p=t.prev,n.n=t.next;try{return e(r,o)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(o=function(){return{wrap:function(t,r,n,o){return e.w(p(t),r,n,o&&o.reverse())},isGeneratorFunction:n,mark:e.m,awrap:function(e,t){return new d(e,t)},AsyncIterator:l,async:function(e,t,r,o,a){return(n(t)?u:c)(p(e),t,r,o,a)},keys:i,values:a}})()}function a(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(n(e)+" is not iterable")}function i(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}}function c(e,t,r,n,o){var a=u(e,t,r,n,o);return a.next().then(function(e){return e.done?e.value:a.next()})}function u(e,t,r,n,o){return new l(s().w(e,t,r,n),o||Promise)}function l(e,t){function r(n,o,a,i){try{var c=e[n](o),u=c.value;return u instanceof d?t.resolve(u.v).then(function(e){r("next",e,a,i)},function(e){r("throw",e,a,i)}):t.resolve(u).then(function(e){c.value=e,a(c)},function(e){return r("throw",e,a,i)})}catch(e){i(e)}}var n;this.next||(f(l.prototype),f(l.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),f(this,"_invoke",function(e,o,a){function i(){return new t(function(t,n){r(e,a,t,n)})}return n=n?n.then(i,i):i()},!0)}function s(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var u=n&&n.prototype instanceof c?n:c,l=Object.create(u.prototype);return f(l,"_invoke",function(r,n,o){var a,c,u,l=0,s=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,c=0,u=e,d.n=r,i}};function p(r,n){for(c=r,u=n,t=0;!f&&l&&!o&&t3?(o=y===n)&&(u=a[(c=a[4])?5:(c=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=r<2&&pn||n>y)&&(a[4]=r,a[5]=n,d.n=y,c=0))}if(o||r>1)return i;throw f=!0,n}return function(o,s,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&p(s,y),c=s,u=y;(t=c<2?e:u)||!f;){a||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(l=2,a){if(c||(o="next"),t=a[o]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=a.return)&&t.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);a=e}else if((t=(f=d.n<0)?u:r.call(n,d))!==i)break}catch(t){a=e,c=1,u=t}finally{l=1}}return{value:t,done:f}}}(r,o,a),!0),l}var i={};function c(){}function u(){}function l(){}t=Object.getPrototypeOf;var d=[][n]?t(t([][n]())):(f(t={},n,function(){return this}),t),p=l.prototype=c.prototype=Object.create(d);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,f(e,o,"GeneratorFunction")),e.prototype=Object.create(p),e}return u.prototype=l,f(p,"constructor",l),f(l,"constructor",u),u.displayName="GeneratorFunction",f(l,o,"GeneratorFunction"),f(p),f(p,o,"Generator"),f(p,n,function(){return this}),f(p,"toString",function(){return"[object Generator]"}),(s=function(){return{w:a,m:y}})()}function f(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}f=function(e,t,r,n){function a(t,r){f(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},f(e,t,r,n)}function d(e,t){this.v=e,this.k=t}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],u=!0,l=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return c}}(e,t)||m(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||m(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){if(e){if("string"==typeof e)return b(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);rM,applySettings:()=>L,base58Decode:()=>K,decodeKey:()=>R,fromDerSignature:()=>H,getSettings:()=>j,getTargetEmbeddedKey:()=>T,loadTargetKey:()=>A,normalizePadding:()=>G,resetTargetEmbeddedKey:()=>_,sendMessageUp:()=>Y,setCryptoProvider:()=>k,setParentFrameMessageChannelPort:()=>D,setSettings:()=>$,setTargetEmbeddedKey:()=>N,uint8arrayFromHexString:()=>P,uint8arrayToHexString:()=>U,validateStyles:()=>W,verifyEnclaveSignature:()=>B});var w="TURNKEY_TARGET_EMBEDDED_KEY",g="TURNKEY_SETTINGS",x=null,E=null;function S(){return E&&E.subtle?E.subtle:"undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto.subtle:"undefined"!=typeof window&&window.crypto&&window.crypto.subtle?window.crypto.subtle:void 0!==r.g&&r.g.crypto&&r.g.crypto.subtle?r.g.crypto.subtle:"undefined"!=typeof crypto&&crypto.subtle?crypto.subtle:null}function k(e){E=e||null}function A(e){return C.apply(this,arguments)}function C(){return(C=h(o().mark(function e(t){var r,n;return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=S()){e.next=3;break}throw new Error("WebCrypto subtle API is unavailable");case 3:return e.next=5,r.importKey("raw",t,{name:"ECDH",namedCurve:"P-256"},!0,[]);case 5:return n=e.sent,e.next=8,r.exportKey("jwk",n);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function I(e){return O.apply(this,arguments)}function O(){return(O=h(o().mark(function e(t){var r;return o().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=S()){e.next=3;break}throw new Error("WebCrypto subtle API is unavailable");case 3:return e.next=5,r.importKey("raw",t,{name:"ECDSA",namedCurve:"P-256"},!0,["verify"]);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function T(){var e=window.localStorage.getItem(w);return e?JSON.parse(e):null}function N(e){window.localStorage.setItem(w,JSON.stringify(e))}function _(){window.localStorage.removeItem(w)}function j(){var e=window.localStorage.getItem(g);return e?JSON.parse(e):null}function $(e){window.localStorage.setItem(g,JSON.stringify(e))}function P(e){if(!e||e.length%2!=0||!/^[0-9A-Fa-f]+$/.test(e))throw new Error("cannot create uint8array from invalid hex string");return new Uint8Array(e.match(/../g).map(function(e){return parseInt(e,16)}))}function U(e){return y(e).map(function(e){return e.toString(16).padStart(2,"0")}).join("")}function K(e){for(var t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",r=(BigInt(0),[]),n=[],o=0;o0;){var c=r[i];a=(c=void 0===c?a:58*c+a)>>8,r[i]=c%256,i++}}var u=n.concat(r.reverse());return new Uint8Array(u)}function R(e,t){switch(t){case"SOLANA":var r=K(e);if(64!==r.length)throw new Error("invalid key length. Expected 64 bytes. Got ".concat(r.length(),"."));return r.subarray(0,32);case"HEXADECIMAL":return e.startsWith("0x")?P(e.slice(2)):P(e);default:return console.warn("invalid key format: ".concat(t,". Defaulting to HEXADECIMAL.")),e.startsWith("0x")?P(e.slice(2)):P(e)}}function D(e){x=e}function G(e,t){var r=t-e.length;if(r>0){var n=new Uint8Array(r).fill(0);return new Uint8Array([].concat(y(n),y(e)))}if(r<0){for(var o=-1*r,a=0,i=0;i]*$',color:"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$",labelColor:"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$",backgroundColor:"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$",width:"^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$",height:"^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$",maxWidth:"^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$",maxHeight:"^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$",lineHeight:"^(\\d+(\\.\\d+)?(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|normal)$",boxShadow:"^(none|(\\d+(px|em|rem) ?){2,4} (#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)) ?(inset)?)$",textAlign:"^(left|right|center|justify|initial|inherit)$",overflowWrap:"^(normal|break-word|anywhere)$",wordWrap:"^(normal|break-word)$",resize:"^(none|both|horizontal|vertical|block|inline)$"};return Object.entries(e).forEach(function(e){var t=p(e,2),o=t[0],a=t[1],i=o.trim();if(0===i.length)throw new Error("css style property cannot be empty");var c=n[i];if(!c)throw new Error('invalid or unsupported css style property: "'.concat(i,'"'));var u=new RegExp(c),l=a.trim();if(0==l.length)throw new Error('css style for "'.concat(i,'" is empty'));if(!u.test(l))throw new Error('invalid css style value for property "'.concat(i,'"'));r[i]=l}),r}function L(e){var t={},r=JSON.parse(e),n=document.getElementById("passphrase-label"),o=document.getElementById("mnemonic-label"),a=document.getElementById("passphrase");if(!n||!a)throw new Error("no passphrase HTML elements found to apply settings to.");var i=document.getElementById("plaintext");if(!i)throw new Error("no plaintext textarea HTML element found to apply settings to.");if(!0===r.enablePassphrase?(n.style.display="inline-block",a.style.display="inline-block",a.style.border="solid 1px #ccc",a.style.borderRadius="4px",o.style.display="inline-block",i.style.border="solid 1px #ccc",i.style.borderRadius="4px",t.enablePassphrase=!0):(n.style.display="none",a.style.display="none",o.style.display="none",i.style.border="none",t.enablePassphrase=!1),r.styles){var c=W(r.styles);Object.entries(c).forEach(function(e){var t=p(e,2),r=t[0],n=t[1];i.style[r]=n}),c.backgroundColor&&(document.documentElement.style.backgroundColor=c.backgroundColor,document.body.style.backgroundColor=c.backgroundColor),c.labelColor&&(document.getElementById("mnemonic-label").style.color=c.labelColor),t.styles=c}if(r.passphraseStyles){var u=TKHQ.validateStyles(r.passphraseStyles);Object.entries(u).forEach(function(e){var t=p(e,2),r=t[0],n=t[1];a.style[r]=n}),u.labelColor&&(document.getElementById("passphrase-label").style.color=u.labelColor),t.passphraseStyles=u}return JSON.stringify(t)}function Y(e,t,r){var n={type:e,value:t};r&&(n.requestId=r),x?x.postMessage(n):window.parent!==window&&window.parent.postMessage({type:e,value:t},"*")}}}]); +//# sourceMappingURL=common.bundle.a08f852097edf002c64d.js.map \ No newline at end of file diff --git a/import/dist/common.bundle.a08f852097edf002c64d.js.LICENSE.txt b/import/dist/common.bundle.a08f852097edf002c64d.js.LICENSE.txt new file mode 100644 index 0000000..775d393 --- /dev/null +++ b/import/dist/common.bundle.a08f852097edf002c64d.js.LICENSE.txt @@ -0,0 +1 @@ +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ diff --git a/import/dist/common.bundle.a08f852097edf002c64d.js.map b/import/dist/common.bundle.a08f852097edf002c64d.js.map new file mode 100644 index 0000000..6c1ad8c --- /dev/null +++ b/import/dist/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AASC,eAAe,kBAAkBK,MAAMlC,MAC9CV,EAAYW,YAGhBwB,EAAsB,OAAInC,CAC5B,CAEA,GAAIoC,EAAYgB,iBAAkB,CAEhC,IAAMpD,EAAcqD,KAAKxD,eAAeuC,EAAYgB,kBACpDpP,OAAOuN,QAAQvB,GAAawB,QAAQ,SAAA8B,GAAkB,IAAAC,EAAAtN,EAAAqN,EAAA,GAAhBL,EAAGM,EAAA,GAAEvO,EAAKuO,EAAA,GAC9Cd,EAAmBG,MAAMK,GAAOjO,CAClC,GAEIgL,EAAYW,aACd2B,SAASC,eAAe,oBAAoBK,MAAMlC,MAChDV,EAAYW,YAGhBwB,EAAgC,iBAAInC,CACtC,CAEA,OAAO1F,KAAKI,UAAUyH,EACxB,CAeA,SAASqB,EAAcC,EAAMzO,EAAO0O,GAClC,IAAMC,EAAU,CACdF,KAAMA,EACNzO,MAAOA,GAIL0O,IACFC,EAAQD,UAAYA,GAGlB1L,EACFA,EAA8B4L,YAAYD,GACjCrL,OAAOuL,SAAWvL,QAC3BA,OAAOuL,OAAOD,YACZ,CACEH,KAAMA,EACNzO,MAAOA,GAET,IAGN,C","sources":["webpack://import/./src/turnkey-core.js"],"sourcesContent":["/** constants for LocalStorage */\nconst TURNKEY_TARGET_EMBEDDED_KEY = \"TURNKEY_TARGET_EMBEDDED_KEY\";\nconst TURNKEY_SETTINGS = \"TURNKEY_SETTINGS\";\n\nvar parentFrameMessageChannelPort = null;\nvar cryptoProviderOverride = null;\n\n/*\n * Returns a reference to the WebCrypto subtle interface regardless of the host environment.\n */\nfunction getSubtleCrypto() {\n if (cryptoProviderOverride && cryptoProviderOverride.subtle) {\n return cryptoProviderOverride.subtle;\n }\n if (\n typeof globalThis !== \"undefined\" &&\n globalThis.crypto &&\n globalThis.crypto.subtle\n ) {\n return globalThis.crypto.subtle;\n }\n if (typeof window !== \"undefined\" && window.crypto && window.crypto.subtle) {\n return window.crypto.subtle;\n }\n if (typeof global !== \"undefined\" && global.crypto && global.crypto.subtle) {\n return global.crypto.subtle;\n }\n if (typeof crypto !== \"undefined\" && crypto.subtle) {\n return crypto.subtle;\n }\n\n return null;\n}\n\n/*\n * Allows tests to explicitly set the crypto provider (e.g. crypto.webcrypto) when the runtime\n * environment does not expose one on the global/window objects.\n */\nfunction setCryptoProvider(cryptoProvider) {\n cryptoProviderOverride = cryptoProvider || null;\n}\n\n/*\n * Load a key to encrypt to as a CryptoKey and return it as a JSON Web Key.\n */\nasync function loadTargetKey(targetPublic) {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n const targetKey = await subtle.importKey(\n \"raw\",\n targetPublic,\n {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n\n return await subtle.exportKey(\"jwk\", targetKey);\n}\n\n/*\n * Loads the quorum public key as a CryptoKey.\n */\nasync function loadQuorumKey(quorumPublic) {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n return await subtle.importKey(\n \"raw\",\n quorumPublic,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n [\"verify\"]\n );\n}\n\n/**\n * Gets the current target embedded private key JWK. Returns `null` if not found.\n */\nfunction getTargetEmbeddedKey() {\n const jwtKey = window.localStorage.getItem(TURNKEY_TARGET_EMBEDDED_KEY);\n return jwtKey ? JSON.parse(jwtKey) : null;\n}\n\n/**\n * Sets the target embedded public key JWK.\n * @param {JsonWebKey} targetKey\n */\nfunction setTargetEmbeddedKey(targetKey) {\n window.localStorage.setItem(\n TURNKEY_TARGET_EMBEDDED_KEY,\n JSON.stringify(targetKey)\n );\n}\n\n/**\n * Resets the current target embedded private key JWK.\n */\nfunction resetTargetEmbeddedKey() {\n window.localStorage.removeItem(TURNKEY_TARGET_EMBEDDED_KEY);\n}\n\n/**\n * Gets the current settings.\n */\nfunction getSettings() {\n const settings = window.localStorage.getItem(TURNKEY_SETTINGS);\n return settings ? JSON.parse(settings) : null;\n}\n\n/**\n * Sets the settings object.\n * @param {Object} settings\n */\nfunction setSettings(settings) {\n window.localStorage.setItem(TURNKEY_SETTINGS, JSON.stringify(settings));\n}\n\n/**\n * Takes a hex string (e.g. \"e4567ab\") and returns an array buffer (Uint8Array)\n * @param {string} hexString\n * @returns {Uint8Array}\n */\nfunction uint8arrayFromHexString(hexString) {\n var hexRegex = /^[0-9A-Fa-f]+$/;\n if (!hexString || hexString.length % 2 != 0 || !hexRegex.test(hexString)) {\n throw new Error(\"cannot create uint8array from invalid hex string\");\n }\n return new Uint8Array(hexString.match(/../g).map((h) => parseInt(h, 16)));\n}\n\n/**\n * Takes a Uint8Array and returns a hex string\n * @param {Uint8Array} buffer\n * @return {string}\n */\nfunction uint8arrayToHexString(buffer) {\n return [...buffer].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Decodes a base58-encoded string into a buffer\n * This function throws an error when the string contains invalid characters.\n * @param {string} s The base58-encoded string.\n * @return {Uint8Array} The decoded buffer.\n */\nfunction base58Decode(s) {\n // See https://en.bitcoin.it/wiki/Base58Check_encoding\n var alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\n var decoded = BigInt(0);\n var decodedBytes = [];\n var leadingZeros = [];\n for (var i = 0; i < s.length; i++) {\n if (alphabet.indexOf(s[i]) === -1) {\n throw new Error(`cannot base58-decode: ${s[i]} isn't a valid character`);\n }\n var carry = alphabet.indexOf(s[i]);\n\n // If the current base58 digit is 0, append a 0 byte.\n // \"i == leadingZeros.length\" can only be true if we have not seen non-zero bytes so far.\n // If we had seen a non-zero byte, carry wouldn't be 0, and i would be strictly more than `leadingZeros.length`\n if (carry == 0 && i === leadingZeros.length) {\n leadingZeros.push(0);\n }\n\n var j = 0;\n while (j < decodedBytes.length || carry > 0) {\n var currentByte = decodedBytes[j];\n\n // shift the current byte 58 units and add the carry amount\n // (or just add the carry amount if this is a new byte -- undefined case)\n if (currentByte === undefined) {\n currentByte = carry;\n } else {\n currentByte = currentByte * 58 + carry;\n }\n\n // find the new carry amount (1-byte shift of current byte value)\n carry = currentByte >> 8;\n // reset the current byte to the remainder (the carry amount will pass on the overflow)\n decodedBytes[j] = currentByte % 256;\n j++;\n }\n }\n\n var result = leadingZeros.concat(decodedBytes.reverse());\n return new Uint8Array(result);\n}\n\n/**\n * Returns private key bytes from a private key, represented in\n * the encoding and format specified by `keyFormat`. Defaults to\n * hex-encoding if `keyFormat` isn't passed.\n * @param {string} privateKey\n * @param {string} keyFormat Can be \"HEXADECIMAL\" or \"SOLANA\"\n */\nfunction decodeKey(privateKey, keyFormat) {\n switch (keyFormat) {\n case \"SOLANA\":\n const decodedKeyBytes = base58Decode(privateKey);\n if (decodedKeyBytes.length !== 64) {\n throw new Error(\n `invalid key length. Expected 64 bytes. Got ${decodedKeyBytes.length()}.`\n );\n }\n return decodedKeyBytes.subarray(0, 32);\n case \"HEXADECIMAL\":\n if (privateKey.startsWith(\"0x\")) {\n return uint8arrayFromHexString(privateKey.slice(2));\n }\n return uint8arrayFromHexString(privateKey);\n default:\n console.warn(\n `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.`\n );\n if (privateKey.startsWith(\"0x\")) {\n return uint8arrayFromHexString(privateKey.slice(2));\n }\n return uint8arrayFromHexString(privateKey);\n }\n}\n\nfunction setParentFrameMessageChannelPort(port) {\n parentFrameMessageChannelPort = port;\n}\n\n/**\n * Function to normalize padding of byte array with 0's to a target length\n */\nfunction normalizePadding(byteArray, targetLength) {\n const paddingLength = targetLength - byteArray.length;\n\n // Add leading 0's to array\n if (paddingLength > 0) {\n const padding = new Uint8Array(paddingLength).fill(0);\n return new Uint8Array([...padding, ...byteArray]);\n }\n\n // Remove leading 0's from array\n if (paddingLength < 0) {\n const expectedZeroCount = paddingLength * -1;\n let zeroCount = 0;\n for (let i = 0; i < expectedZeroCount && i < byteArray.length; i++) {\n if (byteArray[i] === 0) {\n zeroCount++;\n }\n }\n // Check if the number of zeros found equals the number of zeroes expected\n if (zeroCount !== expectedZeroCount) {\n throw new Error(\n `invalid number of starting zeroes. Expected number of zeroes: ${expectedZeroCount}. Found: ${zeroCount}.`\n );\n }\n return byteArray.slice(expectedZeroCount, expectedZeroCount + targetLength);\n }\n return byteArray;\n}\n\n/**\n * Additional Associated Data (AAD) in the format dictated by the enclave_encrypt crate.\n */\nfunction additionalAssociatedData(senderPubBuf, receiverPubBuf) {\n const s = Array.from(new Uint8Array(senderPubBuf));\n const r = Array.from(new Uint8Array(receiverPubBuf));\n return new Uint8Array([...s, ...r]);\n}\n\n/**\n * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses.\n */\nfunction fromDerSignature(derSignature) {\n const derSignatureBuf = uint8arrayFromHexString(derSignature);\n\n // Check and skip the sequence tag (0x30)\n let index = 2;\n\n // Parse 'r' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\n \"failed to convert DER-encoded signature: invalid tag for r\"\n );\n }\n index++; // Move past the INTEGER tag\n const rLength = derSignatureBuf[index];\n index++; // Move past the length byte\n const r = derSignatureBuf.slice(index, index + rLength);\n index += rLength; // Move to the start of s\n\n // Parse 's' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\n \"failed to convert DER-encoded signature: invalid tag for s\"\n );\n }\n index++; // Move past the INTEGER tag\n const sLength = derSignatureBuf[index];\n index++; // Move past the length byte\n const s = derSignatureBuf.slice(index, index + sLength);\n\n // Normalize 'r' and 's' to 32 bytes each\n const rPadded = normalizePadding(r, 32);\n const sPadded = normalizePadding(s, 32);\n\n // Concatenate and return the raw signature\n return new Uint8Array([...rPadded, ...sPadded]);\n}\n\n/**\n * Function to verify enclave signature on import bundle received from the server.\n * @param {string} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature\n * @param {string} publicSignature signature bytes encoded as a hexadecimal string\n * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes\n */\nasync function verifyEnclaveSignature(\n enclaveQuorumPublic,\n publicSignature,\n signedData\n) {\n /** Turnkey Signer enclave's public keys */\n const TURNKEY_SIGNERS_ENCLAVES = {\n prod: \"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\",\n preprod:\n \"04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212\",\n };\n\n const environment =\n (typeof window !== \"undefined\" && window.__TURNKEY_SIGNER_ENVIRONMENT__) ||\n \"prod\";\n const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY =\n TURNKEY_SIGNERS_ENCLAVES[environment];\n if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) {\n throw new Error(\n \"Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined\"\n );\n }\n\n // todo(olivia): throw error if enclave quorum public is null once server changes are deployed\n if (enclaveQuorumPublic) {\n if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) {\n throw new Error(\n `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.`\n );\n }\n }\n\n const encryptionQuorumPublicBuf = new Uint8Array(\n uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY)\n );\n const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf);\n if (!quorumKey) {\n throw new Error(\"failed to load quorum key\");\n }\n\n // The ECDSA signature is ASN.1 DER encoded but WebCrypto uses raw format\n const publicSignatureBuf = fromDerSignature(publicSignature);\n const signedDataBuf = uint8arrayFromHexString(signedData);\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n return await subtle.verify(\n { name: \"ECDSA\", hash: \"SHA-256\" },\n quorumKey,\n publicSignatureBuf,\n signedDataBuf\n );\n}\n\n/**\n * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions).\n * Any invalid style throws an error. Returns an object of valid styles.\n * @param {Object} styles\n * @return {Object}\n */\nfunction validateStyles(styles, element) {\n const validStyles = {};\n\n const cssValidationRegex = {\n padding: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n margin: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n borderWidth: \"^(\\\\d+(px|em|rem) ?){1,4}$\",\n borderStyle:\n \"^(none|solid|dashed|dotted|double|groove|ridge|inset|outset)$\",\n borderColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n borderRadius: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n fontSize: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax))$\",\n fontWeight: \"^(normal|bold|bolder|lighter|\\\\d{3})$\",\n fontFamily: '^[^\";<>]*$', // checks for the absence of some characters that could lead to CSS/HTML injection\n color:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n labelColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n backgroundColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n width: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$\",\n height: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$\",\n maxWidth: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$\",\n maxHeight:\n \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$\",\n lineHeight:\n \"^(\\\\d+(\\\\.\\\\d+)?(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|normal)$\",\n boxShadow:\n \"^(none|(\\\\d+(px|em|rem) ?){2,4} (#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)) ?(inset)?)$\",\n textAlign: \"^(left|right|center|justify|initial|inherit)$\",\n overflowWrap: \"^(normal|break-word|anywhere)$\",\n wordWrap: \"^(normal|break-word)$\",\n resize: \"^(none|both|horizontal|vertical|block|inline)$\",\n };\n\n Object.entries(styles).forEach(([property, value]) => {\n const styleProperty = property.trim();\n if (styleProperty.length === 0) {\n throw new Error(\"css style property cannot be empty\");\n }\n const styleRegexStr = cssValidationRegex[styleProperty];\n if (!styleRegexStr) {\n throw new Error(\n `invalid or unsupported css style property: \"${styleProperty}\"`\n );\n }\n const styleRegex = new RegExp(styleRegexStr);\n const styleValue = value.trim();\n if (styleValue.length == 0) {\n throw new Error(`css style for \"${styleProperty}\" is empty`);\n }\n const isValidStyle = styleRegex.test(styleValue);\n if (!isValidStyle) {\n throw new Error(\n `invalid css style value for property \"${styleProperty}\"`\n );\n }\n validStyles[styleProperty] = styleValue;\n });\n\n return validStyles;\n}\n\n/**\n * Function to apply settings on this page. For now, the only settings that can be applied\n * are for \"styles\". Upon successful application, return the valid, sanitized settings JSON string.\n * @param {string} settings\n * @return {string}\n */\nfunction applySettings(settings) {\n const validSettings = {};\n const settingsObj = JSON.parse(settings);\n\n const passphraseLabel = document.getElementById(\n \"passphrase-label\"\n );\n const mnemonicLabel = document.getElementById(\"mnemonic-label\");\n const passphraseTextarea = document.getElementById(\"passphrase\");\n\n if (!passphraseLabel || !passphraseTextarea) {\n throw new Error(\n \"no passphrase HTML elements found to apply settings to.\"\n );\n }\n const plaintextTextarea = document.getElementById(\"plaintext\");\n if (!plaintextTextarea) {\n throw new Error(\n \"no plaintext textarea HTML element found to apply settings to.\"\n );\n }\n\n // Apply enablePassphrase setting\n if (settingsObj.enablePassphrase === true) {\n passphraseLabel.style.display = \"inline-block\";\n passphraseTextarea.style.display = \"inline-block\";\n passphraseTextarea.style.border = \"solid 1px #ccc\";\n passphraseTextarea.style.borderRadius = \"4px\";\n\n mnemonicLabel.style.display = \"inline-block\";\n plaintextTextarea.style.border = \"solid 1px #ccc\";\n plaintextTextarea.style.borderRadius = \"4px\";\n\n validSettings[\"enablePassphrase\"] = true;\n } else {\n passphraseLabel.style.display = \"none\";\n passphraseTextarea.style.display = \"none\";\n mnemonicLabel.style.display = \"none\";\n\n plaintextTextarea.style.border = \"none\";\n validSettings[\"enablePassphrase\"] = false;\n }\n\n if (settingsObj.styles) {\n // Validate, sanitize, and apply the styles to the \"plaintext\" textarea.\n const validStyles = validateStyles(settingsObj.styles);\n Object.entries(validStyles).forEach(([key, value]) => {\n plaintextTextarea.style[key] = value;\n });\n\n if (validStyles.backgroundColor) {\n // Apply background color to document and body as well.\n document.documentElement.style.backgroundColor =\n validStyles.backgroundColor;\n document.body.style.backgroundColor = validStyles.backgroundColor;\n }\n\n if (validStyles.labelColor) {\n document.getElementById(\"mnemonic-label\").style.color =\n validStyles.labelColor;\n }\n\n validSettings[\"styles\"] = validStyles;\n }\n\n if (settingsObj.passphraseStyles) {\n // Validate, sanitize, and apply the styles to the \"passphrase\" textarea.\n const validStyles = TKHQ.validateStyles(settingsObj.passphraseStyles);\n Object.entries(validStyles).forEach(([key, value]) => {\n passphraseTextarea.style[key] = value;\n });\n\n if (validStyles.labelColor) {\n document.getElementById(\"passphrase-label\").style.color =\n validStyles.labelColor;\n }\n\n validSettings[\"passphraseStyles\"] = validStyles;\n }\n \n return JSON.stringify(validSettings);\n}\n\n/**\n * Function to send a message.\n *\n * If this page is embedded as an iframe we'll send a postMessage\n * in one of two ways depending on the version of @turnkey/iframe-stamper:\n * 1. newer versions (>=v2.1.0) pass a MessageChannel MessagePort from the parent frame for postMessages.\n * 2. older versions ( + + + + + + + + + diff --git a/import/dist/index.bundle.fa4b8f8eab66cd51d789.js b/import/dist/index.bundle.fa4b8f8eab66cd51d789.js new file mode 100644 index 0000000..1f67c5a --- /dev/null +++ b/import/dist/index.bundle.fa4b8f8eab66cd51d789.js @@ -0,0 +1,3 @@ +/*! For license information please see index.bundle.fa4b8f8eab66cd51d789.js.LICENSE.txt */ +(()=>{"use strict";var e,t,r,n,a,o={954:(e,t,r)=>{var n=r(255),a=r(482);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){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 u(e){for(var t=1;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(o(e)+" is not iterable")}function p(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}}function l(e,t,r,n,a){var o=d(e,t,r,n,a);return o.next().then(function(e){return e.done?e.value:o.next()})}function d(e,t,r,n,a){return new v(y().w(e,t,r,n),a||Promise)}function v(e,t){function r(n,a,o,i){try{var u=e[n](a),c=u.value;return c instanceof m?t.resolve(c.v).then(function(e){r("next",e,o,i)},function(e){r("throw",e,o,i)}):t.resolve(c).then(function(e){u.value=e,o(u)},function(e){return r("throw",e,o,i)})}catch(e){i(e)}}var n;this.next||(b(v.prototype),b(v.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),b(this,"_invoke",function(e,a,o){function i(){return new t(function(t,n){r(e,o,t,n)})}return n=n?n.then(i,i):i()},!0)}function y(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function o(r,n,a,o){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return b(s,"_invoke",function(r,n,a){var o,u,c,s=0,f=a||[],p=!1,l={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return o=t,u=0,c=e,l.n=r,i}};function d(r,n){for(u=r,c=n,t=0;!p&&s&&!a&&t3?(a=v===n)&&(c=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=d&&((a=r<2&&dn||n>v)&&(o[4]=r,o[5]=n,l.n=v,u=0))}if(a||r>1)return i;throw p=!0,n}return function(a,f,v){if(s>1)throw TypeError("Generator is already running");for(p&&1===f&&d(f,v),u=f,c=v;(t=u<2?e:c)||!p;){o||(u?u<3?(u>1&&(l.n=-1),d(u,c)):l.n=c:l.v=c);try{if(s=2,o){if(u||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),u=1);o=e}else if((t=(p=l.n<0)?c:r.call(n,l))!==i)break}catch(t){o=e,u=1,c=t}finally{s=1}}return{value:t,done:p}}}(r,a,o),!0),s}var i={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var f=[][n]?t(t([][n]())):(b(t={},n,function(){return this}),t),p=s.prototype=u.prototype=Object.create(f);function l(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,b(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=s,b(p,"constructor",s),b(s,"constructor",c),c.displayName="GeneratorFunction",b(s,a,"GeneratorFunction"),b(p),b(p,a,"Generator"),b(p,n,function(){return this}),b(p,"toString",function(){return"[object Generator]"}),(y=function(){return{w:o,m:l}})()}function b(e,t,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}b=function(e,t,r,n){function o(t,r){b(e,t,function(e){return this._invoke(t,r,e)})}t?a?a(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},b(e,t,r,n)}function m(e,t){this.v=e,this.k=t}function h(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function w(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){h(o,n,a,i,u,"next",e)}function u(e){h(o,n,a,i,u,"throw",e)}i(void 0)})}}window.TKHQ=a;var g=null,x=new AbortController,E=new AbortController,k=function(){var e=w(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.data||"INJECT_IMPORT_BUNDLE"!=t.data.type){e.next=9;break}return e.prev=1,e.next=4,S(t.data.value,t.data.organizationId,t.data.userId,t.data.requestId);case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),a.sendMessageUp("ERROR",e.t0.toString(),t.data.requestId);case 9:if(!t.data||"EXTRACT_WALLET_ENCRYPTED_BUNDLE"!=t.data.type){e.next=18;break}return e.prev=10,e.next=13,T(t.data.requestId);case 13:e.next=18;break;case 15:e.prev=15,e.t1=e.catch(10),a.sendMessageUp("ERROR",e.t1.toString(),t.data.requestId);case 18:if(!t.data||"EXTRACT_KEY_ENCRYPTED_BUNDLE"!=t.data.type){e.next=27;break}return e.prev=19,e.next=22,_(t.data.keyFormat,t.data.requestId);case 22:e.next=27;break;case 24:e.prev=24,e.t2=e.catch(19),a.sendMessageUp("ERROR",e.t2.toString(),t.data.requestId);case 27:if(!t.data||"APPLY_SETTINGS"!=t.data.type){e.next=36;break}return e.prev=28,e.next=31,N(t.data.value,t.data.requestId);case 31:e.next=36;break;case 33:e.prev=33,e.t3=e.catch(28),a.sendMessageUp("ERROR",e.t3.toString(),t.data.requestId);case 36:case"end":return e.stop()}},e,null,[[1,6],[10,15],[19,24],[28,33]])}));return function(t){return e.apply(this,arguments)}}();function O(e){if(e.includes("\n--PASS--\n"))throw new Error('mnemonic cannot include the string "\\n--PASS--\\n"');if(e.includes("\n"))throw new Error("mnemonic cannot include newline characters")}function S(e,t,r,n){return P.apply(this,arguments)}function P(){return(P=w(s().mark(function e(t,r,n,o){var i,u,c,f;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:u=JSON.parse(t),e.t0=u.version,e.next="v1.0.0"===e.t0?4:34;break;case 4:if(u.data){e.next=6;break}throw new Error('missing "data" in bundle');case 6:if(u.dataSignature){e.next=8;break}throw new Error('missing "dataSignature" in bundle');case 8:if(u.enclaveQuorumPublic){e.next=10;break}throw new Error('missing "enclaveQuorumPublic" in bundle');case 10:if(a.verifyEnclaveSignature){e.next=12;break}throw new Error("method not loaded");case 12:return e.next=14,a.verifyEnclaveSignature(u.enclaveQuorumPublic,u.dataSignature,u.data);case 14:if(e.sent){e.next=17;break}throw new Error("failed to verify enclave signature: ".concat(t));case 17:if(c=JSON.parse((new TextDecoder).decode(a.uint8arrayFromHexString(u.data))),r){e.next=22;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "organizationId" for security purposes.'),e.next=24;break;case 22:if(c.organizationId&&c.organizationId===r){e.next=24;break}throw new Error("organization id does not match expected value. Expected: ".concat(r,". Found: ").concat(c.organizationId,"."));case 24:if(n){e.next=28;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "userId" for security purposes.'),e.next=30;break;case 28:if(c.userId&&c.userId===n){e.next=30;break}throw new Error("user id does not match expected value. Expected: ".concat(n,". Found: ").concat(c.userId,"."));case 30:if(c.targetPublic){e.next=32;break}throw new Error('missing "targetPublic" in bundle signed data');case 32:return i=a.uint8arrayFromHexString(c.targetPublic),e.abrupt("break",35);case 34:throw new Error("unsupported version: ".concat(u.version));case 35:return e.next=37,a.loadTargetKey(new Uint8Array(i));case 37:f=e.sent,a.setTargetEmbeddedKey(f),a.sendMessageUp("BUNDLE_INJECTED",!0,o);case 40:case"end":return e.stop()}},e)}))).apply(this,arguments)}function T(e){return j.apply(this,arguments)}function j(){return(j=w(s().mark(function e(t){var r,n,o,i,u,c;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(r=a.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(n=document.getElementById("plaintext").value.trim()){e.next=6;break}throw new Error("no wallet mnemonic entered");case 6:return o=document.getElementById("passphrase").value,O(n),i=""===o?n:"".concat(n,"\n--PASS--\n").concat(o),u=(new TextEncoder).encode(i),e.next=12,C({plaintextBuf:u,receiverPubJwk:r});case 12:c=e.sent,a.resetTargetEmbeddedKey(),a.sendMessageUp("ENCRYPTED_BUNDLE_EXTRACTED",c,t);case 15:case"end":return e.stop()}},e)}))).apply(this,arguments)}function _(e,t){return I.apply(this,arguments)}function I(){return(I=w(s().mark(function e(t,r){var n,o,i,u;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(n=a.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(o=document.getElementById("plaintext").value.trim()){e.next=6;break}throw new Error("no private key entered");case 6:return i=a.decodeKey(o,t),e.next=9,C({plaintextBuf:i,receiverPubJwk:n});case 9:u=e.sent,a.resetTargetEmbeddedKey(),a.sendMessageUp("ENCRYPTED_BUNDLE_EXTRACTED",u,r);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function N(e,t){return A.apply(this,arguments)}function A(){return(A=w(s().mark(function e(t,r){var n;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=a.applySettings(t),a.setSettings(n),a.sendMessageUp("SETTINGS_APPLIED",!0,r);case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}function C(e){return R.apply(this,arguments)}function R(){return(R=w(s().mark(function e(t){var r,o,i,c,f,p,l,d,v,y,b,m,h,w,g;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.plaintextBuf,o=t.receiverPubJwk,i=new n.RG,e.next=4,i.importKey("jwk",u({},o),!0);case 4:return c=e.sent,f=new n.GR({kem:i,kdf:new n.v7,aead:new n.ws}),e.next=8,f.createSenderContext({recipientPublicKey:c,info:(new TextEncoder).encode("turnkey_hpke")});case 8:return p=e.sent,e.next=11,crypto.subtle.importKey("jwk",o,{name:"ECDSA",namedCurve:"P-256"},!0,[]);case 11:return l=e.sent,e.next=14,crypto.subtle.exportKey("raw",l);case 14:return d=e.sent,v=new Uint8Array(d),y=new Uint8Array(p.enc),b=a.additionalAssociatedData(y,v),e.prev=18,e.next=21,p.seal(r,b);case 21:m=e.sent,e.next=27;break;case 24:throw e.prev=24,e.t0=e.catch(18),new Error("failed to encrypt import bundle: "+e.t0.toString());case 27:return h=a.uint8arrayToHexString(new Uint8Array(m)),w=a.uint8arrayToHexString(y),g=JSON.stringify({encappedPublic:w,ciphertext:h}),e.abrupt("return",g);case 31:case"end":return e.stop()}},e,null,[[18,24]])}))).apply(this,arguments)}document.addEventListener("DOMContentLoaded",w(s().mark(function e(){var t,r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(window.addEventListener("message",k,{capture:!1,signal:x.signal}),x.signal.aborted){e.next=9;break}if((t=a.getSettings())&&a.applySettings(t),a.sendMessageUp("PUBLIC_KEY_READY",""),r=document.getElementById("plaintext")){e.next=8;break}return e.abrupt("return");case 8:r.addEventListener("paste",w(s().mark(function e(){var t;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.permissions.query({name:"clipboard-write"}).catch(function(){return null});case 3:if("granted"!==(null==(t=e.sent)?void 0:t.state)&&"prompt"!==(null==t?void 0:t.state)){e.next=7;break}return e.next=7,navigator.clipboard.writeText("");case 7:e.next=11;break;case 9:e.prev=9,e.t0=e.catch(0);case 11:case"end":return e.stop()}},e,null,[[0,9]])})));case 9:case"end":return e.stop()}},e)})),!1),window.addEventListener("message",function(){var e=w(s().mark(function e(t){var r;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.data&&"TURNKEY_INIT_MESSAGE_CHANNEL"==t.data.type&&null!==(r=t.ports)&&void 0!==r&&r[0]&&(x.abort(),(g=t.ports[0]).onmessage=k,a.setParentFrameMessageChannelPort(g),a.sendMessageUp("PUBLIC_KEY_READY",""),E.abort());case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),{signal:E.signal})}},i={};function u(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,u),r.exports}u.m=o,e=[],u.O=(t,r,n,a)=>{if(!r){var o=1/0;for(f=0;f=a)&&Object.keys(u.O).every(e=>u.O[e](r[c]))?r.splice(c--,1):(i=!1,a0&&e[f-1][2]>a;f--)e[f]=e[f-1];e[f]=[r,n,a]},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.t=function(e,n){if(1&n&&(e=this(e)),8&n)return e;if("object"==typeof e&&e){if(4&n&&e.__esModule)return e;if(16&n&&"function"==typeof e.then)return e}var a=Object.create(null);u.r(a);var o={};t=t||[null,r({}),r([]),r(r)];for(var i=2&n&&e;("object"==typeof i||"function"==typeof i)&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(t=>o[t]=()=>e[t]);return o.default=()=>e,u.d(a,o),a},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce((t,r)=>(u.f[r](e,t),t),[])),u.u=e=>e+".bundle."+{291:"b62abe64ba4ebf68e89b",825:"3a4aff0e743a7540fe25"}[e]+".js",u.miniCssF=e=>{},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},a="import:",u.l=(e,t,r,o)=>{if(n[e])n[e].push(t);else{var i,c;if(void 0!==r)for(var s=document.getElementsByTagName("script"),f=0;f{i.onerror=i.onload=null,clearTimeout(d);var a=n[e];if(delete n[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(r)),t)return t(r)},d=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),c&&document.head.appendChild(i)}},u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.p="/",(()=>{var e={57:0};u.f.j=(t,r)=>{var n=u.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise((r,a)=>n=e[t]=[r,a]);r.push(n[2]=a);var o=u.p+u.u(t),i=new Error;u.l(o,r=>{if(u.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}},"chunk-"+t,t)}},u.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,[o,i,c]=r,s=0;if(o.some(t=>0!==e[t])){for(n in i)u.o(i,n)&&(u.m[n]=i[n]);if(c)var f=c(u)}for(t&&t(r);su(954));c=u.O(c)})(); +//# sourceMappingURL=index.bundle.fa4b8f8eab66cd51d789.js.map \ No newline at end of file diff --git a/import/dist/index.bundle.fa4b8f8eab66cd51d789.js.LICENSE.txt b/import/dist/index.bundle.fa4b8f8eab66cd51d789.js.LICENSE.txt new file mode 100644 index 0000000..775d393 --- /dev/null +++ b/import/dist/index.bundle.fa4b8f8eab66cd51d789.js.LICENSE.txt @@ -0,0 +1 @@ +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ diff --git a/import/dist/index.bundle.fa4b8f8eab66cd51d789.js.map b/import/dist/index.bundle.fa4b8f8eab66cd51d789.js.map new file mode 100644 index 0000000..764eff0 --- /dev/null +++ b/import/dist/index.bundle.fa4b8f8eab66cd51d789.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.bundle.fa4b8f8eab66cd51d789.js","mappings":";uBAAIA,ECCAC,EADAC,ECAAC,EACAC,E,i1GCAJ,IAAAC,EAAAC,EAAAC,EAAA,mBAAAC,OAAAA,OAAA,GAAAC,EAAAF,EAAAG,UAAA,aAAAC,EAAAJ,EAAAK,aAAA,yBAAAC,EAAAN,EAAAE,EAAAE,EAAAE,GAAA,IAAAC,EAAAL,GAAAA,EAAAM,qBAAAC,EAAAP,EAAAO,EAAAC,EAAAC,OAAAC,OAAAL,EAAAC,WAAA,OAAAK,EAAAH,EAAA,mBAAAV,EAAAE,EAAAE,GAAA,IAAAE,EAAAC,EAAAG,EAAAI,EAAA,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GAASA,EAAM8M,QAAU9M,EAAM8M,OAAOX,IACpDkB,EAAMG,QAAU,iBAAmB3C,EAAU,cAAgByC,EAAY,KAAOC,EAAU,IAC1FF,EAAM1G,KAAO,iBACb0G,EAAMR,KAAOS,EACbD,EAAMI,QAAUF,EAChBL,EAAmB,GAAGG,EACvB,GAGuC,SAAWxC,EAASA,EAE/D,GAYHhC,EAAoBO,EAAEQ,EAAKiB,GAA0C,IAA7BoC,EAAgBpC,GAGxD,IAAI6C,EAAuB,CAACC,EAA4BtN,KACvD,IAGIyI,EAAU+B,GAHTvB,EAAUsE,EAAaC,GAAWxN,EAGhB/D,EAAI,EAC3B,GAAGgN,EAASwE,KAAMC,GAAgC,IAAxBd,EAAgBc,IAAa,CACtD,IAAIjF,KAAY8E,EACZ/E,EAAoBzM,EAAEwR,EAAa9E,KACrCD,EAAoBzK,EAAE0K,GAAY8E,EAAY9E,IAGhD,GAAG+E,EAAS,IAAIxE,EAASwE,EAAQhF,EAClC,CAEA,IADG8E,GAA4BA,EAA2BtN,GACrD/D,EAAIgN,EAAShM,OAAQhB,IACzBuO,EAAUvB,EAAShN,GAChBuM,EAAoBzM,EAAE6Q,EAAiBpC,IAAYoC,EAAgBpC,IACrEoC,EAAgBpC,GAAS,KAE1BoC,EAAgBpC,GAAW,EAE5B,OAAOhC,EAAoBO,EAAEC,IAG1B2E,EAAqBC,KAAyB,mBAAIA,KAAyB,oBAAK,GACpFD,EAAmBtD,QAAQgD,EAAqBrQ,KAAK,KAAM,IAC3D2Q,EAAmBxC,KAAOkC,EAAqBrQ,KAAK,KAAM2Q,EAAmBxC,KAAKnO,KAAK2Q,G,KClFvF,IAAIE,EAAsBrF,EAAoBO,OAAEJ,EAAW,CAAC,GAAG,IAAK,IAAOH,EAAoB,MAC/FqF,EAAsBrF,EAAoBO,EAAE8E,E","sources":["webpack://import/webpack/runtime/chunk loaded","webpack://import/webpack/runtime/create fake namespace object","webpack://import/webpack/runtime/load script","webpack://import/./src/index.js","webpack://import/webpack/bootstrap","webpack://import/webpack/runtime/define property getters","webpack://import/webpack/runtime/ensure chunk","webpack://import/webpack/runtime/get javascript chunk filename","webpack://import/webpack/runtime/get mini-css chunk filename","webpack://import/webpack/runtime/global","webpack://import/webpack/runtime/hasOwnProperty shorthand","webpack://import/webpack/runtime/make namespace object","webpack://import/webpack/runtime/publicPath","webpack://import/webpack/runtime/jsonp chunk loading","webpack://import/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"import:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","import \"./styles.css\";\nimport * as hpke from \"@hpke/core\";\nimport * as TKHQ from \"./turnkey-core.js\";\n\n// Make TKHQ available globally for backwards compatibility\nwindow.TKHQ = TKHQ;\n\n// persist the MessageChannel object so we can use it to communicate with the parent window\nvar iframeMessagePort = null;\n\n// controllers to remove event listeners\nconst messageListenerController = new AbortController();\nconst turnkeyInitController = new AbortController();\n\n/**\n * Message Event Handlers to process messages from the parent frame\n */\nvar messageEventListener = async function (event) {\n if (event.data && event.data[\"type\"] == \"INJECT_IMPORT_BUNDLE\") {\n try {\n await onInjectImportBundle(\n event.data[\"value\"],\n event.data[\"organizationId\"],\n event.data[\"userId\"],\n event.data[\"requestId\"]\n );\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"EXTRACT_WALLET_ENCRYPTED_BUNDLE\") {\n try {\n await onExtractWalletEncryptedBundle(event.data[\"requestId\"]);\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"EXTRACT_KEY_ENCRYPTED_BUNDLE\") {\n try {\n await onExtractKeyEncryptedBundle(\n event.data[\"keyFormat\"],\n event.data[\"requestId\"]\n );\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"APPLY_SETTINGS\") {\n try {\n await onApplySettings(event.data[\"value\"], event.data[\"requestId\"]);\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n};\n\n/**\n * Broadcast that the frame is ready and set up the message event listeners\n */\ndocument.addEventListener(\n \"DOMContentLoaded\",\n async function () {\n window.addEventListener(\"message\", messageEventListener, {\n capture: false,\n signal: messageListenerController.signal,\n });\n\n if (!messageListenerController.signal.aborted) {\n // If styles are saved in local storage, sanitize and apply them.\n const styleSettings = TKHQ.getSettings();\n if (styleSettings) {\n TKHQ.applySettings(styleSettings);\n }\n // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently,\n // init() waits for a public key to be initialized that can be used to send to the server\n // which will encrypt messages to this public key.\n // In the case of import, this public key is not used because the client encrypts messages\n // to the server's public key.\n TKHQ.sendMessageUp(\"PUBLIC_KEY_READY\", \"\");\n\n const plaintextTextarea = document.getElementById(\"plaintext\");\n if (!plaintextTextarea) return;\n // Clear clipboard after paste to avoid sensitive data lingering in clipboard.\n\n plaintextTextarea.addEventListener(\"paste\", async () => {\n // Let the paste happen first\n try {\n // Check clipboard-write permission first. In new versions of iframe-stamper, we add this permission when creating the iframe. In older versions, this permission is not added.\n const permStatus = await navigator.permissions\n .query({ name: \"clipboard-write\" }) // This is required to avoid error on clipboard write\n .catch(() => null);\n\n // Proceed only if granted or promptable\n if (\n permStatus?.state === \"granted\" ||\n permStatus?.state === \"prompt\"\n ) {\n await navigator.clipboard.writeText(\"\");\n }\n } catch {\n // Silently ignore any errors — no warnings or console noise\n }\n });\n }\n },\n false\n);\n\nwindow.addEventListener(\n \"message\",\n async function (event) {\n /**\n * @turnkey/iframe-stamper >= v2.1.0 is using a MessageChannel to communicate with the parent frame.\n * The parent frame sends a TURNKEY_INIT_MESSAGE_CHANNEL event with the MessagePort.\n * If we receive this event, we want to remove the message event listener that was added in the DOMContentLoaded event to avoid processing messages twice.\n * We persist the MessagePort so we can use it to communicate with the parent window in subsequent calls to TKHQ.sendMessageUp\n */\n if (\n event.data &&\n event.data[\"type\"] == \"TURNKEY_INIT_MESSAGE_CHANNEL\" &&\n event.ports?.[0]\n ) {\n // remove the message event listener that was added in the DOMContentLoaded event\n messageListenerController.abort();\n\n iframeMessagePort = event.ports[0];\n iframeMessagePort.onmessage = messageEventListener;\n\n TKHQ.setParentFrameMessageChannelPort(iframeMessagePort);\n\n // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently,\n // init() waits for a public key to be initialized that can be used to send to the server\n // which will encrypt messages to this public key.\n // In the case of import, this public key is not used because the client encrypts messages\n // to the server's public key.\n TKHQ.sendMessageUp(\"PUBLIC_KEY_READY\", \"\");\n\n // remove the listener for TURNKEY_INIT_MESSAGE_CHANNEL after it's been processed\n turnkeyInitController.abort();\n }\n },\n { signal: turnkeyInitController.signal }\n);\n\n// make sure the mnemonic does not include our splitter (\\n--PASS--\\n) string or \\n characters\nfunction validateMnemonic(mnemonic) {\n if (mnemonic.includes(\"\\n--PASS--\\n\")) {\n throw new Error('mnemonic cannot include the string \"\\\\n--PASS--\\\\n\"');\n }\n if (mnemonic.includes(\"\\n\")) {\n throw new Error(\"mnemonic cannot include newline characters\");\n }\n}\n\n/**\n * Function triggered when INJECT_IMPORT_BUNDLE event is received.\n * Parses the `import_bundle` and stores the target public key as a JWK\n * in local storage. Sends true upon success.\n * @param {string} bundle\n * Example bundle: {\"targetPublic\":\"0491ccb68758b822a6549257f87769eeed37c6cb68a6c6255c5f238e2b6e6e61838c8ac857f2e305970a6435715f84e5a2e4b02a4d1e5289ba7ec7910e47d2d50f\",\"targetPublicSignature\":\"3045022100cefc333c330c9fa300d1aa10a439a76539b4d6967301638ab9edc9fd9468bfdb0220339bba7e2b00b45d52e941d068ecd3bfd16fd1926da69dd7769893268990d62f\",\"enclaveQuorumPublic\":\"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\"}\n * @param {string} organizationId\n * @param {string} userId\n * @param {string} requestId\n */\nasync function onInjectImportBundle(bundle, organizationId, userId, requestId) {\n let targetPublicBuf;\n let verified;\n\n // Parse the import bundle\n const bundleObj = JSON.parse(bundle);\n\n switch (bundleObj.version) {\n case \"v1.0.0\":\n // Validate fields exist\n if (!bundleObj.data) {\n throw new Error('missing \"data\" in bundle');\n }\n if (!bundleObj.dataSignature) {\n throw new Error('missing \"dataSignature\" in bundle');\n }\n if (!bundleObj.enclaveQuorumPublic) {\n throw new Error('missing \"enclaveQuorumPublic\" in bundle');\n }\n\n // Verify enclave signature\n if (!TKHQ.verifyEnclaveSignature) {\n throw new Error(\"method not loaded\");\n }\n verified = await TKHQ.verifyEnclaveSignature(\n bundleObj.enclaveQuorumPublic,\n bundleObj.dataSignature,\n bundleObj.data\n );\n if (!verified) {\n throw new Error(`failed to verify enclave signature: ${bundle}`);\n }\n\n // Parse the signed data. The data is produced by JSON encoding followed by hex encoding. We reverse this here.\n const signedData = JSON.parse(\n new TextDecoder().decode(TKHQ.uint8arrayFromHexString(bundleObj.data))\n );\n\n // Validate fields match\n if (!organizationId) {\n // TODO: throw error if organization id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"organizationId\" for security purposes.'\n );\n } else if (\n !signedData.organizationId ||\n signedData.organizationId !== organizationId\n ) {\n throw new Error(\n `organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.`\n );\n }\n if (!userId) {\n // TODO: throw error if user id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"userId\" for security purposes.'\n );\n } else if (!signedData.userId || signedData.userId !== userId) {\n throw new Error(\n `user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.`\n );\n }\n\n if (!signedData.targetPublic) {\n throw new Error('missing \"targetPublic\" in bundle signed data');\n }\n\n // Load target public key generated from enclave and set in local storage\n targetPublicBuf = TKHQ.uint8arrayFromHexString(signedData.targetPublic);\n break;\n default:\n throw new Error(`unsupported version: ${bundleObj.version}`);\n }\n\n const targetPublicKeyJwk = await TKHQ.loadTargetKey(\n new Uint8Array(targetPublicBuf)\n );\n TKHQ.setTargetEmbeddedKey(targetPublicKeyJwk);\n\n // Send up BUNDLE_INJECTED message\n TKHQ.sendMessageUp(\"BUNDLE_INJECTED\", true, requestId);\n}\n\n/**\n * Function triggered when EXTRACT_WALLET_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the text entered in the\n * `plaintext` textarea element. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n * @param {string} requestId\n */\nasync function onExtractWalletEncryptedBundle(requestId) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext wallet mnemonic\n const plaintext = document.getElementById(\"plaintext\").value.trim();\n if (!plaintext) {\n throw new Error(\"no wallet mnemonic entered\");\n }\n \n const passphrase = document.getElementById(\"passphrase\").value;\n\n validateMnemonic(plaintext);\n\n const combined = passphrase === \"\" ? plaintext : `${plaintext}\\n--PASS--\\n${passphrase}`;\n const plaintextBuf = new TextEncoder().encode(combined);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n TKHQ.sendMessageUp(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle, requestId);\n}\n\n/**\n * Function triggered when EXTRACT_KEY_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the text entered in the\n * `plaintext` textarea element. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n * @param {string} keyFormat\n * @param {string} requestId\n */\nasync function onExtractKeyEncryptedBundle(keyFormat, requestId) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext private key\n const plaintext = document.getElementById(\"plaintext\").value.trim();\n if (!plaintext) {\n throw new Error(\"no private key entered\");\n }\n const plaintextBuf = TKHQ.decodeKey(plaintext, keyFormat);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n TKHQ.sendMessageUp(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle, requestId);\n}\n\n/**\n * Function triggered when APPLY_SETTINGS event is received.\n * For now, the only settings that can be applied are for \"styles\".\n * Persist them in local storage so they can be applied on every\n * page load.\n * @param {string} settings: JSON-stringified settings\n * @param {string} requestId\n */\nasync function onApplySettings(settings, requestId) {\n // Apply settings\n const validSettings = TKHQ.applySettings(settings);\n\n // Persist in local storage\n TKHQ.setSettings(validSettings);\n\n // Send up SETTINGS_APPLIED message\n TKHQ.sendMessageUp(\"SETTINGS_APPLIED\", true, requestId);\n}\n\nasync function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) {\n const kemContext = new hpke.DhkemP256HkdfSha256();\n const receiverPub = await kemContext.importKey(\n \"jwk\",\n { ...receiverPubJwk },\n true\n );\n\n const suite = new hpke.CipherSuite({\n kem: kemContext,\n kdf: new hpke.HkdfSha256(),\n aead: new hpke.Aes256Gcm(),\n });\n\n const senderCtx = await suite.createSenderContext({\n recipientPublicKey: receiverPub,\n info: new TextEncoder().encode(\"turnkey_hpke\"),\n });\n\n // Need to import the key again as a JWK to export as a raw key, the format needed to\n // create the aad with the newly generated raw encapped key.\n const receiverPubCryptoKey = await crypto.subtle.importKey(\n \"jwk\",\n receiverPubJwk,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n const receiverPubRaw = await crypto.subtle.exportKey(\n \"raw\",\n receiverPubCryptoKey\n );\n const receiverPubBuf = new Uint8Array(receiverPubRaw);\n\n const encappedKeyBuf = new Uint8Array(senderCtx.enc);\n\n const aad = TKHQ.additionalAssociatedData(encappedKeyBuf, receiverPubBuf);\n\n var ciphertextBuf;\n try {\n ciphertextBuf = await senderCtx.seal(plaintextBuf, aad);\n } catch (e) {\n throw new Error(\"failed to encrypt import bundle: \" + e.toString());\n }\n\n const ciphertextHex = TKHQ.uint8arrayToHexString(\n new Uint8Array(ciphertextBuf)\n );\n const encappedKeyBufHex = TKHQ.uint8arrayToHexString(encappedKeyBuf);\n const encryptedBundle = JSON.stringify({\n encappedPublic: encappedKeyBufHex,\n ciphertext: ciphertextHex,\n });\n return encryptedBundle;\n}\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// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\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__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".bundle.\" + {\"291\":\"b62abe64ba4ebf68e89b\",\"825\":\"3a4aff0e743a7540fe25\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\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};","__webpack_require__.p = \"/\";","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t57: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkimport\"] = self[\"webpackChunkimport\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [96,76], () => (__webpack_require__(954)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","leafPrototypes","getProto","inProgress","dataWebpackPrefix","e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_invoke","enumerable","configurable","writable","_OverloadYield","k","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","window","TKHQ","iframeMessagePort","messageListenerController","AbortController","turnkeyInitController","messageEventListener","_ref","_regeneratorRuntime","mark","_callee","event","wrap","_context","prev","next","data","onInjectImportBundle","t0","toString","onExtractWalletEncryptedBundle","t1","onExtractKeyEncryptedBundle","t2","onApplySettings","t3","stop","_x","validateMnemonic","mnemonic","includes","Error","_x3","_x4","_x5","_x6","_onInjectImportBundle","_callee5","bundle","organizationId","userId","requestId","targetPublicBuf","bundleObj","signedData","targetPublicKeyJwk","_context5","JSON","parse","version","dataSignature","enclaveQuorumPublic","sent","concat","TextDecoder","decode","console","warn","targetPublic","abrupt","Uint8Array","_x7","_onExtractWalletEncryptedBundle","_callee6","plaintext","passphrase","combined","plaintextBuf","encryptedBundle","_context6","document","getElementById","trim","TextEncoder","encode","HpkeEncrypt","receiverPubJwk","_x8","_x9","_onExtractKeyEncryptedBundle","_callee7","keyFormat","_context7","_x10","_x11","_onApplySettings","_callee8","settings","validSettings","_context8","_x12","_HpkeEncrypt","_callee9","_ref5","kemContext","receiverPub","suite","senderCtx","receiverPubCryptoKey","receiverPubRaw","receiverPubBuf","encappedKeyBuf","aad","ciphertextBuf","ciphertextHex","encappedKeyBufHex","_context9","hpke","importKey","_objectSpread","kem","kdf","aead","createSenderContext","recipientPublicKey","info","crypto","subtle","name","namedCurve","exportKey","enc","seal","stringify","encappedPublic","ciphertext","addEventListener","_callee3","styleSettings","plaintextTextarea","_context3","capture","signal","aborted","_callee2","permStatus","_context2","navigator","permissions","query","state","clipboard","writeText","_ref4","_callee4","_event$ports","_context4","ports","abort","onmessage","_x2","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","keys","every","key","splice","obj","mode","this","__esModule","ns","def","current","indexOf","getOwnPropertyNames","forEach","definition","get","chunkId","all","reduce","promises","miniCssF","g","globalThis","Function","prop","hasOwnProperty","url","push","script","needAttach","scripts","getElementsByTagName","s","getAttribute","createElement","charset","nc","setAttribute","src","onScriptComplete","onerror","onload","clearTimeout","timeout","doneFns","parentNode","removeChild","setTimeout","type","target","head","appendChild","installedChunks","installedChunkData","promise","reject","error","errorType","realSrc","message","request","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","id","chunkLoadingGlobal","self","__webpack_exports__"],"sourceRoot":""} \ No newline at end of file diff --git a/import/dist/index.html b/import/dist/index.html new file mode 100644 index 0000000..1ad55cd --- /dev/null +++ b/import/dist/index.html @@ -0,0 +1 @@ +Turnkey Import
\ No newline at end of file diff --git a/import/dist/index.styles.0903e8b6c7ae355513d0.css b/import/dist/index.styles.0903e8b6c7ae355513d0.css new file mode 100644 index 0000000..0ea6b5c --- /dev/null +++ b/import/dist/index.styles.0903e8b6c7ae355513d0.css @@ -0,0 +1,61 @@ +#plaintext { + width: 300px; + font-size: 0.875rem; + line-height: 1.25rem; + height: 110px; + color: #555b64; + border: none; + resize: none; + word-wrap: break-word; + overflow-wrap: break-word; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; +} +#plaintext:focus { + outline: none; + border: none; +} +#passphrase { + width: 300px; + font-size: 0.875rem; + line-height: 1.25rem; + height: 55px; + color: #555b64; + border: none; + resize: none; + word-wrap: break-word; + overflow-wrap: break-word; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; + display: none; +} +#passphrase:focus { + outline: none; + border: none; +} + +#passphrase-label { + display: none; + border: none; + width: 300px; + margin-top: 12px; + margin-bottom: 4px; + font-size: 0.875rem; + line-height: 1.25rem; + color: #18191a; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; +} +#mnemonic-label { + display: none; + border: none; + width: 300px; + margin-bottom: 4px; + font-size: 0.875rem; + line-height: 1.25rem; + color: #18191a; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; +} + +/*# sourceMappingURL=index.styles.0903e8b6c7ae355513d0.css.map*/ \ No newline at end of file diff --git a/import/dist/index.styles.0903e8b6c7ae355513d0.css.map b/import/dist/index.styles.0903e8b6c7ae355513d0.css.map new file mode 100644 index 0000000..7d94e5b --- /dev/null +++ b/import/dist/index.styles.0903e8b6c7ae355513d0.css.map @@ -0,0 +1 @@ +{"version":3,"file":"index.styles.0903e8b6c7ae355513d0.css","mappings":"AAAA;EACE,YAAY;EACZ,mBAAmB;EACnB,oBAAoB;EACpB,aAAa;EACb,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,qBAAqB;EACrB,yBAAyB;EACzB;sDACoD;AACtD;AACA;EACE,aAAa;EACb,YAAY;AACd;AACA;EACE,YAAY;EACZ,mBAAmB;EACnB,oBAAoB;EACpB,YAAY;EACZ,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,qBAAqB;EACrB,yBAAyB;EACzB;sDACoD;EACpD,aAAa;AACf;AACA;EACE,aAAa;EACb,YAAY;AACd;;AAEA;EACE,aAAa;EACb,YAAY;EACZ,YAAY;EACZ,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,cAAc;EACd;sDACoD;AACtD;AACA;EACE,aAAa;EACb,YAAY;EACZ,YAAY;EACZ,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,cAAc;EACd;sDACoD;AACtD,C","sources":["webpack://import/./src/styles.css"],"sourcesContent":["#plaintext {\n width: 300px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n height: 110px;\n color: #555b64;\n border: none;\n resize: none;\n word-wrap: break-word;\n overflow-wrap: break-word;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n}\n#plaintext:focus {\n outline: none;\n border: none;\n}\n#passphrase {\n width: 300px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n height: 55px;\n color: #555b64;\n border: none;\n resize: none;\n word-wrap: break-word;\n overflow-wrap: break-word;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n display: none;\n}\n#passphrase:focus {\n outline: none;\n border: none;\n}\n\n#passphrase-label {\n display: none;\n border: none;\n width: 300px;\n margin-top: 12px;\n margin-bottom: 4px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n color: #18191a;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n}\n#mnemonic-label {\n display: none;\n border: none;\n width: 300px;\n margin-bottom: 4px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n color: #18191a;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n}"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/import/dist/standalone.bundle.c4c01a7dd7c83bd60221.js b/import/dist/standalone.bundle.c4c01a7dd7c83bd60221.js new file mode 100644 index 0000000..ddfc7e2 --- /dev/null +++ b/import/dist/standalone.bundle.c4c01a7dd7c83bd60221.js @@ -0,0 +1,3 @@ +/*! For license information please see standalone.bundle.c4c01a7dd7c83bd60221.js.LICENSE.txt */ +(()=>{"use strict";var e,t,r,n,o,a={635:(e,t,r)=>{var n=r(255),o=r(482);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 i(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 u(e){for(var t=1;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(a(e)+" is not iterable")}function l(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}}function p(e,t,r,n,o){var a=d(e,t,r,n,o);return a.next().then(function(e){return e.done?e.value:a.next()})}function d(e,t,r,n,o){return new v(y().w(e,t,r,n),o||Promise)}function v(e,t){function r(n,o,a,i){try{var u=e[n](o),c=u.value;return c instanceof m?t.resolve(c.v).then(function(e){r("next",e,a,i)},function(e){r("throw",e,a,i)}):t.resolve(c).then(function(e){u.value=e,a(u)},function(e){return r("throw",e,a,i)})}catch(e){i(e)}}var n;this.next||(b(v.prototype),b(v.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),b(this,"_invoke",function(e,o,a){function i(){return new t(function(t,n){r(e,a,t,n)})}return n=n?n.then(i,i):i()},!0)}function y(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var c=n&&n.prototype instanceof u?n:u,s=Object.create(c.prototype);return b(s,"_invoke",function(r,n,o){var a,u,c,s=0,f=o||[],l=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,u=0,c=e,p.n=r,i}};function d(r,n){for(u=r,c=n,t=0;!l&&s&&!o&&t3?(o=v===n)&&(c=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=e):a[0]<=d&&((o=r<2&&dn||n>v)&&(a[4]=r,a[5]=n,p.n=v,u=0))}if(o||r>1)return i;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&d(f,v),u=f,c=v;(t=u<2?e:c)||!l;){a||(u?u<3?(u>1&&(p.n=-1),d(u,c)):p.n=c:p.v=c);try{if(s=2,a){if(u||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=a.return)&&t.call(a),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=e}else if((t=(l=p.n<0)?c:r.call(n,p))!==i)break}catch(t){a=e,u=1,c=t}finally{s=1}}return{value:t,done:l}}}(r,o,a),!0),s}var i={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var f=[][n]?t(t([][n]())):(b(t={},n,function(){return this}),t),l=s.prototype=u.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,b(e,o,"GeneratorFunction")),e.prototype=Object.create(l),e}return c.prototype=s,b(l,"constructor",s),b(s,"constructor",c),c.displayName="GeneratorFunction",b(s,o,"GeneratorFunction"),b(l),b(l,o,"Generator"),b(l,n,function(){return this}),b(l,"toString",function(){return"[object Generator]"}),(y=function(){return{w:a,m:p}})()}function b(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}b=function(e,t,r,n){function a(t,r){b(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},b(e,t,r,n)}function m(e,t){this.v=e,this.k=t}function w(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){w(a,n,o,i,u,"next",e)}function u(e){w(a,n,o,i,u,"throw",e)}i(void 0)})}}function g(e){var t=document.getElementById("message-log"),r=document.createElement("p");r.innerText=e,t.appendChild(r)}function E(e,t){null!==window.top&&window.top.postMessage({type:e,value:t},"*"),g("⬆️ Sent message ".concat(e,": ").concat(t))}function x(e,t,r){return k.apply(this,arguments)}function k(){return(k=h(s().mark(function e(t,r,n){var a,i,u,c;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=JSON.parse(t),e.t0=i.version,e.next="v1.0.0"===e.t0?4:34;break;case 4:if(i.data){e.next=6;break}throw new Error('missing "data" in bundle');case 6:if(i.dataSignature){e.next=8;break}throw new Error('missing "dataSignature" in bundle');case 8:if(i.enclaveQuorumPublic){e.next=10;break}throw new Error('missing "enclaveQuorumPublic" in bundle');case 10:if(o.verifyEnclaveSignature){e.next=12;break}throw new Error("method not loaded");case 12:return e.next=14,o.verifyEnclaveSignature(i.enclaveQuorumPublic,i.dataSignature,i.data);case 14:if(e.sent){e.next=17;break}throw new Error("failed to verify enclave signature: ".concat(t));case 17:if(u=JSON.parse((new TextDecoder).decode(o.uint8arrayFromHexString(i.data))),r){e.next=22;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "organizationId" for security purposes.'),e.next=24;break;case 22:if(u.organizationId&&u.organizationId===r){e.next=24;break}throw new Error("organization id does not match expected value. Expected: ".concat(r,". Found: ").concat(u.organizationId,"."));case 24:if(n){e.next=28;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "userId" for security purposes.'),e.next=30;break;case 28:if(u.userId&&u.userId===n){e.next=30;break}throw new Error("user id does not match expected value. Expected: ".concat(n,". Found: ").concat(u.userId,"."));case 30:if(u.targetPublic){e.next=32;break}throw new Error('missing "targetPublic" in bundle signed data');case 32:return a=o.uint8arrayFromHexString(u.targetPublic),e.abrupt("break",35);case 34:throw new Error("unsupported version: ".concat(i.version));case 35:return e.next=37,o.loadTargetKey(new Uint8Array(a));case 37:c=e.sent,o.setTargetEmbeddedKey(c),E("BUNDLE_INJECTED",!0);case 40:case"end":return e.stop()}},e)}))).apply(this,arguments)}function O(e){return T.apply(this,arguments)}function T(){return(T=h(s().mark(function e(t){var r,n,a,i;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(r=o.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(n=t.trim()){e.next=6;break}throw new Error("no wallet mnemonic entered");case 6:return a=(new TextEncoder).encode(n),e.next=9,_({plaintextBuf:a,receiverPubJwk:r});case 9:i=e.sent,o.resetTargetEmbeddedKey(),E("ENCRYPTED_BUNDLE_EXTRACTED",i);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function P(e,t){return j.apply(this,arguments)}function j(){return(j=h(s().mark(function e(t,r){var n,a,i,u;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(n=o.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(a=t.trim()){e.next=6;break}throw new Error("no private key entered");case 6:return i=o.decodeKey(a,r),e.next=9,_({plaintextBuf:i,receiverPubJwk:n});case 9:u=e.sent,o.resetTargetEmbeddedKey(),E("ENCRYPTED_BUNDLE_EXTRACTED",u);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function _(e){return S.apply(this,arguments)}function S(){return(S=h(s().mark(function e(t){var r,a,i,c,f,l,p,d,v,y,b,m,w,h,g;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.plaintextBuf,a=t.receiverPubJwk,i=new n.RG,e.next=4,i.importKey("jwk",u({},a),!0);case 4:return c=e.sent,f=new n.GR({kem:i,kdf:new n.v7,aead:new n.ws}),e.next=8,f.createSenderContext({recipientPublicKey:c,info:(new TextEncoder).encode("turnkey_hpke")});case 8:return l=e.sent,e.next=11,crypto.subtle.importKey("jwk",a,{name:"ECDSA",namedCurve:"P-256"},!0,[]);case 11:return p=e.sent,e.next=14,crypto.subtle.exportKey("raw",p);case 14:return d=e.sent,v=new Uint8Array(d),y=new Uint8Array(l.enc),b=o.additionalAssociatedData(y,v),e.prev=18,e.next=21,l.seal(r,b);case 21:m=e.sent,e.next=27;break;case 24:throw e.prev=24,e.t0=e.catch(18),new Error("failed to encrypt import bundle: "+e.t0.toString());case 27:return w=o.uint8arrayToHexString(new Uint8Array(m)),h=o.uint8arrayToHexString(y),g=JSON.stringify({encappedPublic:h,ciphertext:w}),e.abrupt("return",g);case 31:case"end":return e.stop()}},e,null,[[18,24]])}))).apply(this,arguments)}window.TKHQ=o,document.addEventListener("DOMContentLoaded",h(s().mark(function e(){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:E("PUBLIC_KEY_READY",""),window.addEventListener("message",function(){var e=h(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.data||"INJECT_IMPORT_BUNDLE"!=t.data.type){e.next=10;break}return g("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value,", ").concat(t.data.organizationId,", ").concat(t.data.userId)),e.prev=2,e.next=5,x(t.data.value,t.data.organizationId,t.data.userId);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),E("ERROR",e.t0.toString());case 10:if(!t.data||"EXTRACT_WALLET_ENCRYPTED_BUNDLE"!=t.data.type){e.next=20;break}return g("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value)),e.prev=12,e.next=15,O(t.data.value);case 15:e.next=20;break;case 17:e.prev=17,e.t1=e.catch(12),E("ERROR",e.t1.toString());case 20:if(!t.data||"EXTRACT_KEY_ENCRYPTED_BUNDLE"!=t.data.type){e.next=30;break}return g("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value,", ").concat(t.data.keyFormat)),e.prev=22,e.next=25,P(t.data.value,t.data.keyFormat);case 25:e.next=30;break;case 27:e.prev=27,e.t2=e.catch(22),E("ERROR",e.t2.toString());case 30:case"end":return e.stop()}},e,null,[[2,7],[12,17],[22,27]])}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("inject-import-bundle").addEventListener("click",function(){var e=h(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.preventDefault(),window.postMessage({type:"INJECT_IMPORT_BUNDLE",value:document.getElementById("import-bundle").value,organizationId:document.getElementById("organization-id").value,userId:document.getElementById("user-id").value});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("encrypt-wallet-bundle").addEventListener("click",function(){var e=h(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.preventDefault(),window.postMessage({type:"EXTRACT_WALLET_ENCRYPTED_BUNDLE",value:document.getElementById("wallet-plaintext").value});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("encrypt-key-bundle").addEventListener("click",function(){var e=h(s().mark(function e(t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.preventDefault(),window.postMessage({type:"EXTRACT_KEY_ENCRYPTED_BUNDLE",value:document.getElementById("key-plaintext").value,keyFormat:document.getElementById("key-import-format").value});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),!1);case 5:case"end":return e.stop()}},e)})),!1)}},i={};function u(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return a[e](r,r.exports,u),r.exports}u.m=a,e=[],u.O=(t,r,n,o)=>{if(!r){var a=1/0;for(f=0;f=o)&&Object.keys(u.O).every(e=>u.O[e](r[c]))?r.splice(c--,1):(i=!1,o0&&e[f-1][2]>o;f--)e[f]=e[f-1];e[f]=[r,n,o]},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.t=function(e,n){if(1&n&&(e=this(e)),8&n)return e;if("object"==typeof e&&e){if(4&n&&e.__esModule)return e;if(16&n&&"function"==typeof e.then)return e}var o=Object.create(null);u.r(o);var a={};t=t||[null,r({}),r([]),r(r)];for(var i=2&n&&e;("object"==typeof i||"function"==typeof i)&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(t=>a[t]=()=>e[t]);return a.default=()=>e,u.d(o,a),o},u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce((t,r)=>(u.f[r](e,t),t),[])),u.u=e=>e+".bundle."+{291:"b62abe64ba4ebf68e89b",825:"3a4aff0e743a7540fe25"}[e]+".js",u.miniCssF=e=>{},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},o="import:",u.l=(e,t,r,a)=>{if(n[e])n[e].push(t);else{var i,c;if(void 0!==r)for(var s=document.getElementsByTagName("script"),f=0;f{i.onerror=i.onload=null,clearTimeout(d);var o=n[e];if(delete n[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),c&&document.head.appendChild(i)}},u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.p="/",(()=>{var e={362:0};u.f.j=(t,r)=>{var n=u.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=o);var a=u.p+u.u(t),i=new Error;u.l(a,r=>{if(u.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}},"chunk-"+t,t)}},u.O.j=t=>0===e[t];var t=(t,r)=>{var n,o,[a,i,c]=r,s=0;if(a.some(t=>0!==e[t])){for(n in i)u.o(i,n)&&(u.m[n]=i[n]);if(c)var f=c(u)}for(t&&t(r);su(635));c=u.O(c)})(); +//# sourceMappingURL=standalone.bundle.c4c01a7dd7c83bd60221.js.map \ No newline at end of file diff --git a/import/dist/standalone.bundle.c4c01a7dd7c83bd60221.js.LICENSE.txt b/import/dist/standalone.bundle.c4c01a7dd7c83bd60221.js.LICENSE.txt new file mode 100644 index 0000000..775d393 --- /dev/null +++ b/import/dist/standalone.bundle.c4c01a7dd7c83bd60221.js.LICENSE.txt @@ -0,0 +1 @@ +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ diff --git a/import/dist/standalone.bundle.c4c01a7dd7c83bd60221.js.map b/import/dist/standalone.bundle.c4c01a7dd7c83bd60221.js.map new file mode 100644 index 0000000..cd19d67 --- /dev/null +++ b/import/dist/standalone.bundle.c4c01a7dd7c83bd60221.js.map @@ -0,0 +1 @@ +{"version":3,"file":"standalone.bundle.c4c01a7dd7c83bd60221.js","mappings":";uBAAIA,ECCAC,EADAC,ECAAC,EACAC,E,i1GCAJ,IAAAC,EAAAC,EAAAC,EAAA,mBAAAC,OAAAA,OAAA,GAAAC,EAAAF,EAAAG,UAAA,aAAAC,EAAAJ,EAAAK,aAAA,yBAAAC,EAAAN,EAAAE,EAAAE,EAAAE,GAAA,IAAAC,EAAAL,GAAAA,EAAAM,qBAAAC,EAAAP,EAAAO,EAAAC,EAAAC,OAAAC,OAAAL,EAAAC,WAAA,OAAAK,EAAAH,EAAA,mBAAAV,EAAAE,EAAAE,GAAA,IAAAE,EAAAC,EAAAG,EAAAI,EAAA,EAAAC,EAAAX,GAAA,GAAAY,GAAA,EAAAC,EAAA,CAAAF,EAAA,EAAAb,EAAA,EAAAgB,EAAApB,EAAAqB,EAAAC,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D,EAAmBlD,QAAQ4C,EAAqB/O,KAAK,KAAM,IAC3DqP,EAAmBpC,KAAO8B,EAAqB/O,KAAK,KAAMqP,EAAmBpC,KAAKjN,KAAKqP,G,KClFvF,IAAIE,EAAsBjF,EAAoBO,OAAEJ,EAAW,CAAC,GAAG,IAAK,IAAOH,EAAoB,MAC/FiF,EAAsBjF,EAAoBO,EAAE0E,E","sources":["webpack://import/webpack/runtime/chunk loaded","webpack://import/webpack/runtime/create fake namespace object","webpack://import/webpack/runtime/load script","webpack://import/./src/standalone.js","webpack://import/webpack/bootstrap","webpack://import/webpack/runtime/define property getters","webpack://import/webpack/runtime/ensure chunk","webpack://import/webpack/runtime/get javascript chunk filename","webpack://import/webpack/runtime/get mini-css chunk filename","webpack://import/webpack/runtime/global","webpack://import/webpack/runtime/hasOwnProperty shorthand","webpack://import/webpack/runtime/make namespace object","webpack://import/webpack/runtime/publicPath","webpack://import/webpack/runtime/jsonp chunk loading","webpack://import/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"import:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","import \"./standalone-styles.css\";\nimport * as hpke from \"@hpke/core\";\nimport * as TKHQ from \"./turnkey-core.js\";\n\n// Make TKHQ available globally\nwindow.TKHQ = TKHQ;\n\n/**\n * Function to log a message and persist it in the page's DOM.\n */\nfunction logMessage(content) {\n const messageLog = document.getElementById(\"message-log\");\n const message = document.createElement(\"p\");\n message.innerText = content;\n messageLog.appendChild(message);\n}\n\n/**\n * Standalone-specific sendMessageUp that logs to DOM instead\n */\nfunction sendMessageUpStandalone(type, value) {\n if (window.top !== null) {\n window.top.postMessage(\n {\n type: type,\n value: value,\n },\n \"*\"\n );\n }\n logMessage(`⬆️ Sent message ${type}: ${value}`);\n}\n\ndocument.addEventListener(\n \"DOMContentLoaded\",\n async () => {\n // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently,\n // init() waits for a public key to be initialized that can be used to send to the server\n // which will encrypt messages to this public key.\n // In the case of import, this public key is not used because the client encrypts messages\n // to the server's public key.\n sendMessageUpStandalone(\"PUBLIC_KEY_READY\", \"\");\n\n // TODO: find a way to filter messages and ensure they're coming from the parent window?\n // We do not want to arbitrarily receive messages from all origins.\n window.addEventListener(\n \"message\",\n async function (event) {\n if (event.data && event.data[\"type\"] == \"INJECT_IMPORT_BUNDLE\") {\n logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}, ${event.data[\"organizationId\"]}, ${event.data[\"userId\"]}`\n );\n try {\n await onInjectImportBundle(\n event.data[\"value\"],\n event.data[\"organizationId\"],\n event.data[\"userId\"]\n );\n } catch (e) {\n sendMessageUpStandalone(\"ERROR\", e.toString());\n }\n }\n // TODO: deprecate EXTRACT_WALLET_ENCRYPTED_BUNDLE in favor of EXTRACT_ENCRYPTED_BUNDLE\n if (\n event.data &&\n event.data[\"type\"] == \"EXTRACT_WALLET_ENCRYPTED_BUNDLE\"\n ) {\n logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}`\n );\n try {\n await onExtractWalletEncryptedBundle(event.data[\"value\"]);\n } catch (e) {\n sendMessageUpStandalone(\"ERROR\", e.toString());\n }\n }\n if (\n event.data &&\n event.data[\"type\"] == \"EXTRACT_KEY_ENCRYPTED_BUNDLE\"\n ) {\n logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}, ${event.data[\"keyFormat\"]}`\n );\n try {\n await onExtractKeyEncryptedBundle(\n event.data[\"value\"],\n event.data[\"keyFormat\"]\n );\n } catch (e) {\n sendMessageUpStandalone(\"ERROR\", e.toString());\n }\n }\n },\n false\n );\n\n /**\n * Event handlers to power the import flow in standalone mode\n * Instead of receiving events from the parent page, forms trigger them.\n * This is useful for debugging as well.\n */\n document.getElementById(\"inject-import-bundle\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"INJECT_IMPORT_BUNDLE\",\n value: document.getElementById(\"import-bundle\").value,\n organizationId: document.getElementById(\"organization-id\").value,\n userId: document.getElementById(\"user-id\").value,\n });\n },\n false\n );\n document.getElementById(\"encrypt-wallet-bundle\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"EXTRACT_WALLET_ENCRYPTED_BUNDLE\",\n value: document.getElementById(\"wallet-plaintext\").value,\n });\n },\n false\n );\n document.getElementById(\"encrypt-key-bundle\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"EXTRACT_KEY_ENCRYPTED_BUNDLE\",\n value: document.getElementById(\"key-plaintext\").value,\n keyFormat: document.getElementById(\"key-import-format\").value,\n });\n },\n false\n );\n },\n false\n);\n\n/**\n * Function triggered when INJECT_IMPORT_BUNDLE event is received.\n * Parses the `import_bundle` and stores the target public key as a JWK\n * in local storage. Sends true upon success.\n * @param {string} bundle\n * Example bundle: {\"targetPublic\":\"0491ccb68758b822a6549257f87769eeed37c6cb68a6c6255c5f238e2b6e6e61838c8ac857f2e305970a6435715f84e5a2e4b02a4d1e5289ba7ec7910e47d2d50f\",\"targetPublicSignature\":\"3045022100cefc333c330c9fa300d1aa10a439a76539b4d6967301638ab9edc9fd9468bfdb0220339bba7e2b00b45d52e941d068ecd3bfd16fd1926da69dd7769893268990d62f\",\"enclaveQuorumPublic\":\"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\"}\n * @param {string} organizationId\n * @param {string} userId\n */\nasync function onInjectImportBundle(bundle, organizationId, userId) {\n let targetPublicBuf;\n let verified;\n\n // Parse the import bundle\n const bundleObj = JSON.parse(bundle);\n\n switch (bundleObj.version) {\n case \"v1.0.0\":\n // Validate fields exist\n if (!bundleObj.data) {\n throw new Error('missing \"data\" in bundle');\n }\n if (!bundleObj.dataSignature) {\n throw new Error('missing \"dataSignature\" in bundle');\n }\n if (!bundleObj.enclaveQuorumPublic) {\n throw new Error('missing \"enclaveQuorumPublic\" in bundle');\n }\n\n // Verify enclave signature\n if (!TKHQ.verifyEnclaveSignature) {\n throw new Error(\"method not loaded\");\n }\n verified = await TKHQ.verifyEnclaveSignature(\n bundleObj.enclaveQuorumPublic,\n bundleObj.dataSignature,\n bundleObj.data\n );\n if (!verified) {\n throw new Error(`failed to verify enclave signature: ${bundle}`);\n }\n\n // Parse the signed data. The data is produced by JSON encoding followed by hex encoding. We reverse this here.\n const signedData = JSON.parse(\n new TextDecoder().decode(TKHQ.uint8arrayFromHexString(bundleObj.data))\n );\n\n // Validate fields match\n if (!organizationId) {\n // TODO: throw error if organization id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"organizationId\" for security purposes.'\n );\n } else if (\n !signedData.organizationId ||\n signedData.organizationId !== organizationId\n ) {\n throw new Error(\n `organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.`\n );\n }\n if (!userId) {\n // TODO: throw error if user id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"userId\" for security purposes.'\n );\n } else if (!signedData.userId || signedData.userId !== userId) {\n throw new Error(\n `user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.`\n );\n }\n\n if (!signedData.targetPublic) {\n throw new Error('missing \"targetPublic\" in bundle signed data');\n }\n\n // Load target public key generated from enclave and set in local storage\n targetPublicBuf = TKHQ.uint8arrayFromHexString(signedData.targetPublic);\n break;\n default:\n throw new Error(`unsupported version: ${bundleObj.version}`);\n }\n\n const targetPublicKeyJwk = await TKHQ.loadTargetKey(\n new Uint8Array(targetPublicBuf)\n );\n TKHQ.setTargetEmbeddedKey(targetPublicKeyJwk);\n\n // Send up BUNDLE_INJECTED message\n sendMessageUpStandalone(\"BUNDLE_INJECTED\", true);\n}\n\n/**\n * Function triggered when EXTRACT_WALLET_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the plaintextValue. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n */\nasync function onExtractWalletEncryptedBundle(plaintextValue) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext wallet mnemonic\n const plaintext = plaintextValue.trim();\n if (!plaintext) {\n throw new Error(\"no wallet mnemonic entered\");\n }\n const plaintextBuf = new TextEncoder().encode(plaintext);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n sendMessageUpStandalone(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle);\n}\n\n/**\n * Function triggered when EXTRACT_KEY_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the plaintextValue. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n */\nasync function onExtractKeyEncryptedBundle(plaintextValue, keyFormat) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext private key\n const plaintext = plaintextValue.trim();\n if (!plaintext) {\n throw new Error(\"no private key entered\");\n }\n const plaintextBuf = TKHQ.decodeKey(plaintext, keyFormat);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n sendMessageUpStandalone(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle);\n}\n\nasync function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) {\n const kemContext = new hpke.DhkemP256HkdfSha256();\n const receiverPub = await kemContext.importKey(\n \"jwk\",\n { ...receiverPubJwk },\n true\n );\n\n const suite = new hpke.CipherSuite({\n kem: kemContext,\n kdf: new hpke.HkdfSha256(),\n aead: new hpke.Aes256Gcm(),\n });\n\n const senderCtx = await suite.createSenderContext({\n recipientPublicKey: receiverPub,\n info: new TextEncoder().encode(\"turnkey_hpke\"),\n });\n\n // Need to import the key again as a JWK to export as a raw key, the format needed to\n // create the aad with the newly generated raw encapped key.\n const receiverPubCryptoKey = await crypto.subtle.importKey(\n \"jwk\",\n receiverPubJwk,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n const receiverPubRaw = await crypto.subtle.exportKey(\n \"raw\",\n receiverPubCryptoKey\n );\n const receiverPubBuf = new Uint8Array(receiverPubRaw);\n\n const encappedKeyBuf = new Uint8Array(senderCtx.enc);\n\n const aad = TKHQ.additionalAssociatedData(encappedKeyBuf, receiverPubBuf);\n\n var ciphertextBuf;\n try {\n ciphertextBuf = await senderCtx.seal(plaintextBuf, aad);\n } catch (e) {\n throw new Error(\"failed to encrypt import bundle: \" + e.toString());\n }\n\n const ciphertextHex = TKHQ.uint8arrayToHexString(\n new Uint8Array(ciphertextBuf)\n );\n const encappedKeyBufHex = TKHQ.uint8arrayToHexString(encappedKeyBuf);\n const encryptedBundle = JSON.stringify({\n encappedPublic: encappedKeyBufHex,\n ciphertext: ciphertextHex,\n });\n return encryptedBundle;\n}\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// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\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__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".bundle.\" + {\"291\":\"b62abe64ba4ebf68e89b\",\"825\":\"3a4aff0e743a7540fe25\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\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};","__webpack_require__.p = \"/\";","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t362: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkimport\"] = self[\"webpackChunkimport\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [96,76], () => (__webpack_require__(635)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","leafPrototypes","getProto","inProgress","dataWebpackPrefix","e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_invoke","enumerable","configurable","writable","_OverloadYield","k","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","logMessage","content","messageLog","document","getElementById","message","createElement","innerText","appendChild","sendMessageUpStandalone","type","window","top","postMessage","concat","onInjectImportBundle","_x5","_x6","_x7","_onInjectImportBundle","_regeneratorRuntime","mark","_callee6","bundle","organizationId","userId","targetPublicBuf","bundleObj","signedData","targetPublicKeyJwk","wrap","_context6","prev","next","JSON","parse","t0","version","data","Error","dataSignature","enclaveQuorumPublic","TKHQ","sent","TextDecoder","decode","console","warn","targetPublic","abrupt","Uint8Array","stop","onExtractWalletEncryptedBundle","_x8","_onExtractWalletEncryptedBundle","_callee7","plaintextValue","plaintext","plaintextBuf","encryptedBundle","_context7","trim","TextEncoder","encode","HpkeEncrypt","receiverPubJwk","onExtractKeyEncryptedBundle","_x9","_x10","_onExtractKeyEncryptedBundle","_callee8","keyFormat","_context8","_x11","_HpkeEncrypt","_callee9","_ref6","kemContext","receiverPub","suite","senderCtx","receiverPubCryptoKey","receiverPubRaw","receiverPubBuf","encappedKeyBuf","aad","ciphertextBuf","ciphertextHex","encappedKeyBufHex","_context9","hpke","importKey","_objectSpread","kem","kdf","aead","createSenderContext","recipientPublicKey","info","crypto","subtle","name","namedCurve","exportKey","enc","seal","toString","stringify","encappedPublic","ciphertext","addEventListener","_callee5","_context5","_ref2","_callee","event","_context","t1","t2","_x","_ref3","_callee2","_context2","preventDefault","_x2","_ref4","_callee3","_context3","_x3","_ref5","_callee4","_context4","_x4","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","keys","every","key","splice","obj","mode","this","__esModule","ns","def","current","indexOf","getOwnPropertyNames","forEach","definition","get","chunkId","all","reduce","promises","miniCssF","g","globalThis","Function","prop","hasOwnProperty","url","push","script","needAttach","scripts","getElementsByTagName","s","getAttribute","charset","nc","setAttribute","src","onScriptComplete","onerror","onload","clearTimeout","timeout","doneFns","parentNode","removeChild","setTimeout","target","head","installedChunks","installedChunkData","promise","reject","error","errorType","realSrc","request","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","id","chunkLoadingGlobal","self","__webpack_exports__"],"sourceRoot":""} \ No newline at end of file diff --git a/import/dist/standalone.html b/import/dist/standalone.html new file mode 100644 index 0000000..0e0ae9b --- /dev/null +++ b/import/dist/standalone.html @@ -0,0 +1 @@ +Turnkey Import (Standalone Mode)

Initialize Import




Import Wallet


Import Private Key



Message log

Below we display a log of the messages sent / received. The forms above send messages, and the code communicates results by sending events via the postMessage API.

\ No newline at end of file diff --git a/import/dist/standalone.styles.a83187f9b253fbae4dcd.css b/import/dist/standalone.styles.a83187f9b253fbae4dcd.css new file mode 100644 index 0000000..ce1a42a --- /dev/null +++ b/import/dist/standalone.styles.a83187f9b253fbae4dcd.css @@ -0,0 +1,70 @@ +body { + text-align: center; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; + max-width: 1024px; + margin: auto; +} + +form { + text-align: left; + margin-bottom: 2rem; +} + +label { + display: inline-block; + width: 8em; +} + +input[type="text"], +select { + width: 40em; + margin: 0.5em; + font-family: "Courier New", Courier, monospace; + font-size: 1em; + height: 1.8em; + color: rgb(18, 87, 18); + border: 1px rgb(217, 240, 221) solid; + border-radius: 4px; +} + +input:disabled { + background-color: rgb(239, 243, 240); +} + +#inject-import-bundle, +#encrypt-wallet-bundle, +#encrypt-key-bundle { + color: white; + width: 10em; + font-size: 1em; + padding: 0.38em; + border-radius: 4px; + background-color: rgb(50, 44, 44); + border: 1px rgb(33, 33, 33) solid; + cursor: pointer; + display: inline; +} + +#message-log { + border: 1px #2a2828 solid; + padding: 0 0.7em; + border-radius: 4px; + margin-top: 2em; + max-width: 800px; + margin: auto; + display: block; +} + +#message-log p { + font-size: 0.9em; + text-align: left; + word-break: break-all; +} + +.hidden { + display: none; +} + + +/*# sourceMappingURL=standalone.styles.a83187f9b253fbae4dcd.css.map*/ \ No newline at end of file diff --git a/import/dist/standalone.styles.a83187f9b253fbae4dcd.css.map b/import/dist/standalone.styles.a83187f9b253fbae4dcd.css.map new file mode 100644 index 0000000..ff369e5 --- /dev/null +++ b/import/dist/standalone.styles.a83187f9b253fbae4dcd.css.map @@ -0,0 +1 @@ +{"version":3,"file":"standalone.styles.a83187f9b253fbae4dcd.css","mappings":"AAAA;EACE,kBAAkB;EAClB;sDACoD;EACpD,iBAAiB;EACjB,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,qBAAqB;EACrB,UAAU;AACZ;;AAEA;;EAEE,WAAW;EACX,aAAa;EACb,8CAA8C;EAC9C,cAAc;EACd,aAAa;EACb,sBAAsB;EACtB,oCAAoC;EACpC,kBAAkB;AACpB;;AAEA;EACE,oCAAoC;AACtC;;AAEA;;;EAGE,YAAY;EACZ,WAAW;EACX,cAAc;EACd,eAAe;EACf,kBAAkB;EAClB,iCAAiC;EACjC,iCAAiC;EACjC,eAAe;EACf,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,gBAAgB;EAChB,kBAAkB;EAClB,eAAe;EACf,gBAAgB;EAChB,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,gBAAgB;EAChB,gBAAgB;EAChB,qBAAqB;AACvB;;AAEA;EACE,aAAa;AACf","sources":["webpack://import/./src/standalone-styles.css"],"sourcesContent":["body {\n text-align: center;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n max-width: 1024px;\n margin: auto;\n}\n\nform {\n text-align: left;\n margin-bottom: 2rem;\n}\n\nlabel {\n display: inline-block;\n width: 8em;\n}\n\ninput[type=\"text\"],\nselect {\n width: 40em;\n margin: 0.5em;\n font-family: \"Courier New\", Courier, monospace;\n font-size: 1em;\n height: 1.8em;\n color: rgb(18, 87, 18);\n border: 1px rgb(217, 240, 221) solid;\n border-radius: 4px;\n}\n\ninput:disabled {\n background-color: rgb(239, 243, 240);\n}\n\n#inject-import-bundle,\n#encrypt-wallet-bundle,\n#encrypt-key-bundle {\n color: white;\n width: 10em;\n font-size: 1em;\n padding: 0.38em;\n border-radius: 4px;\n background-color: rgb(50, 44, 44);\n border: 1px rgb(33, 33, 33) solid;\n cursor: pointer;\n display: inline;\n}\n\n#message-log {\n border: 1px #2a2828 solid;\n padding: 0 0.7em;\n border-radius: 4px;\n margin-top: 2em;\n max-width: 800px;\n margin: auto;\n display: block;\n}\n\n#message-log p {\n font-size: 0.9em;\n text-align: left;\n word-break: break-all;\n}\n\n.hidden {\n display: none;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/import/dist/vendors.bundle.21bb724fa18b849859c6.js b/import/dist/vendors.bundle.21bb724fa18b849859c6.js new file mode 100644 index 0000000..45c5b81 --- /dev/null +++ b/import/dist/vendors.bundle.21bb724fa18b849859c6.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunkimport=self.webpackChunkimport||[]).push([[96],{255:(e,t,i)=>{i.d(t,{ws:()=>W,GR:()=>be,RG:()=>fe,v7:()=>pe});class r extends Error{constructor(e){let t;t=e instanceof Error?e.message:"string"==typeof e?e:"",super(t),this.name=this.constructor.name}}class a extends r{}class n extends r{}class s extends r{}class o extends r{}class c extends r{}class h extends r{}class l extends r{}class u extends r{}class d extends r{}class y extends r{}class w extends r{}const b=(f=globalThis,p={},new Proxy(f,{get:(e,t,i)=>t in p?p[t]:f[t],set:(e,t,i)=>(t in p&&delete p[t],f[t]=i,!0),deleteProperty(e,t){let i=!1;return t in p&&(delete p[t],i=!0),t in f&&(delete f[t],i=!0),i},ownKeys(e){const t=Reflect.ownKeys(f),i=Reflect.ownKeys(p),r=new Set(i);return[...t.filter(e=>!r.has(e)),...i]},defineProperty:(e,t,i)=>(t in p&&delete p[t],Reflect.defineProperty(f,t,i),!0),getOwnPropertyDescriptor:(e,t)=>t in p?Reflect.getOwnPropertyDescriptor(p,t):Reflect.getOwnPropertyDescriptor(f,t),has:(e,t)=>t in p||t in f}));var f,p;class _{constructor(){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}async _setup(){void 0===this._api&&(this._api=await async function(){if(void 0!==b&&void 0!==globalThis.crypto)return globalThis.crypto.subtle;try{const{webcrypto:e}=await i.e(825).then(i.t.bind(i,825,19));return e.subtle}catch(e){throw new w(e)}}())}}const g=8192,m=new Uint8Array(0),v=new Uint8Array([75,69,77,0,0]),k=e=>"object"==typeof e&&null!==e&&"object"==typeof e.privateKey&&"object"==typeof e.publicKey;function P(e,t){if(t<=0)throw new Error("i2Osp: too small size");if(e>=256**t)throw new Error("i2Osp: too large integer");const i=new Uint8Array(t);for(let r=0;r>=8;return i}function K(e,t){const i=new Uint8Array(e.length+t.length);return i.set(e,0),i.set(t,e.length),i}const A=new Uint8Array([101,97,101,95,112,114,107]),x=new Uint8Array([115,104,97,114,101,100,95,115,101,99,114,101,116]);class S{constructor(e,t,i){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_prim",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e,this._prim=t,this._kdf=i;const r=new Uint8Array(v);r.set(P(this.id,2),3),this._kdf.init(r)}async serializePublicKey(e){return await this._prim.serializePublicKey(e)}async deserializePublicKey(e){return await this._prim.deserializePublicKey(e)}async serializePrivateKey(e){return await this._prim.serializePrivateKey(e)}async deserializePrivateKey(e){return await this._prim.deserializePrivateKey(e)}async importKey(e,t,i=!0){return await this._prim.importKey(e,t,i)}async generateKeyPair(){return await this._prim.generateKeyPair()}async deriveKeyPair(e){if(e.byteLength>g)throw new a("Too long ikm");return await this._prim.deriveKeyPair(e)}async encap(e){let t;t=void 0===e.ekm?await this.generateKeyPair():k(e.ekm)?e.ekm:await this.deriveKeyPair(e.ekm);const i=await this._prim.serializePublicKey(t.publicKey),r=await this._prim.serializePublicKey(e.recipientPublicKey);try{let a,n;if(void 0===e.senderKey)a=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey));else{const i=k(e.senderKey)?e.senderKey.privateKey:e.senderKey;a=K(new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey)),new Uint8Array(await this._prim.dh(i,e.recipientPublicKey)))}if(void 0===e.senderKey)n=K(new Uint8Array(i),new Uint8Array(r));else{const t=k(e.senderKey)?e.senderKey.publicKey:await this._prim.derivePublicKey(e.senderKey),a=await this._prim.serializePublicKey(t);n=function(e,t,i){const r=new Uint8Array(e.length+t.length+i.length);return r.set(e,0),r.set(t,e.length),r.set(i,e.length+t.length),r}(new Uint8Array(i),new Uint8Array(r),new Uint8Array(a))}return{enc:i,sharedSecret:await this._generateSharedSecret(a,n)}}catch(e){throw new o(e)}}async decap(e){const t=await this._prim.deserializePublicKey(e.enc),i=k(e.recipientKey)?e.recipientKey.privateKey:e.recipientKey,r=k(e.recipientKey)?e.recipientKey.publicKey:await this._prim.derivePublicKey(e.recipientKey),a=await this._prim.serializePublicKey(r);try{let r,n;if(void 0===e.senderPublicKey)r=new Uint8Array(await this._prim.dh(i,t));else{r=K(new Uint8Array(await this._prim.dh(i,t)),new Uint8Array(await this._prim.dh(i,e.senderPublicKey)))}if(void 0===e.senderPublicKey)n=K(new Uint8Array(e.enc),new Uint8Array(a));else{const t=await this._prim.serializePublicKey(e.senderPublicKey);n=new Uint8Array(e.enc.byteLength+a.byteLength+t.byteLength),n.set(new Uint8Array(e.enc),0),n.set(new Uint8Array(a),e.enc.byteLength),n.set(new Uint8Array(t),e.enc.byteLength+a.byteLength)}return await this._generateSharedSecret(r,n)}catch(e){throw new c(e)}}async _generateSharedSecret(e,t){const i=this._kdf.buildLabeledIkm(A,e),r=this._kdf.buildLabeledInfo(x,t,this.secretSize);return await this._kdf.extractAndExpand(m.buffer,i.buffer,r.buffer,this.secretSize)}}const U=["deriveBits"],j=new Uint8Array([100,107,112,95,112,114,107]);new Uint8Array([115,107]);class E{constructor(e){Object.defineProperty(this,"_num",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._num=new Uint8Array(e)}val(){return this._num}reset(){this._num.fill(0)}set(e){if(e.length!==this._num.length)throw new Error("Bignum.set: invalid argument");this._num.set(e)}isZero(){for(let e=0;ee[t])return!1}return!1}}const O=new Uint8Array([99,97,110,100,105,100,97,116,101]),z=new Uint8Array([255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81]),I=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115]),L=new Uint8Array([1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,1,72,247,9,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,9]),C=new Uint8Array([48,65,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,39,48,37,2,1,1,4,32]),T=new Uint8Array([48,78,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,55,48,53,2,1,1,4,48]),H=new Uint8Array([48,96,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,73,48,71,2,1,1,4,66]);class R extends _{constructor(e,t){switch(super(),Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_alg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nDh",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bitmask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pkcs8AlgId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=t,e){case 16:this._alg={name:"ECDH",namedCurve:"P-256"},this._nPk=65,this._nSk=32,this._nDh=32,this._order=z,this._bitmask=255,this._pkcs8AlgId=C;break;case 17:this._alg={name:"ECDH",namedCurve:"P-384"},this._nPk=97,this._nSk=48,this._nDh=48,this._order=I,this._bitmask=255,this._pkcs8AlgId=T;break;default:this._alg={name:"ECDH",namedCurve:"P-521"},this._nPk=133,this._nSk=66,this._nDh=66,this._order=L,this._bitmask=1,this._pkcs8AlgId=H}}async serializePublicKey(e){await this._setup();try{return await this._api.exportKey("raw",e)}catch(e){throw new n(e)}}async deserializePublicKey(e){await this._setup();try{return await this._importRawKey(e,!0)}catch(e){throw new s(e)}}async serializePrivateKey(e){await this._setup();try{const t=await this._api.exportKey("jwk",e);if(!("d"in t))throw new Error("Not private key");return function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),i=atob(t),r=new Uint8Array(i.length);for(let e=0;e255)throw new Error("Faild to derive a key pair");const r=new Uint8Array(await this._hkdf.labeledExpand(t,O,P(e,1),this._nSk));r[0]=r[0]&this._bitmask,i.set(r)}const r=await this._deserializePkcs8Key(i.val());return i.reset(),{privateKey:r,publicKey:await this.derivePublicKey(r)}}catch(e){throw new y(e)}}async derivePublicKey(e){await this._setup();try{const t=await this._api.exportKey("jwk",e);return delete t.d,delete t.key_ops,await this._api.importKey("jwk",t,this._alg,!0,[])}catch(e){throw new s(e)}}async dh(e,t){try{return await this._setup(),await this._api.deriveBits({name:"ECDH",public:t},e,8*this._nDh)}catch(e){throw new n(e)}}async _importRawKey(e,t){if(t&&e.byteLength!==this._nPk)throw new Error("Invalid public key for the ciphersuite");if(!t&&e.byteLength!==this._nSk)throw new Error("Invalid private key for the ciphersuite");return t?await this._api.importKey("raw",e,this._alg,!0,[]):await this._deserializePkcs8Key(new Uint8Array(e))}async _importJWK(e,t){if(void 0===e.crv||e.crv!==this._alg.namedCurve)throw new Error(`Invalid crv: ${e.crv}`);if(t){if(void 0!==e.d)throw new Error("Invalid key: `d` should not be set");return await this._api.importKey("jwk",e,this._alg,!0,[])}if(void 0===e.d)throw new Error("Invalid key: `d` not found");return await this._api.importKey("jwk",e,this._alg,!0,U)}async _deserializePkcs8Key(e){const t=new Uint8Array(this._pkcs8AlgId.length+e.length);return t.set(this._pkcs8AlgId,0),t.set(e,this._pkcs8AlgId.length),await this._api.importKey("pkcs8",t,this._alg,!0,U)}}const D=new Uint8Array([72,80,75,69,45,118,49]);class N extends _{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:m}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}init(e){this._suiteId=e}buildLabeledIkm(e,t){this._checkInit();const i=new Uint8Array(7+this._suiteId.byteLength+e.byteLength+t.byteLength);return i.set(D,0),i.set(this._suiteId,7),i.set(e,7+this._suiteId.byteLength),i.set(t,7+this._suiteId.byteLength+e.byteLength),i}buildLabeledInfo(e,t,i){this._checkInit();const r=new Uint8Array(9+this._suiteId.byteLength+e.byteLength+t.byteLength);return r.set(new Uint8Array([0,i]),0),r.set(D,2),r.set(this._suiteId,9),r.set(e,9+this._suiteId.byteLength),r.set(t,9+this._suiteId.byteLength+e.byteLength),r}async extract(e,t){if(await this._setup(),0===e.byteLength&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)throw new a("The salt length must be the same as the hashSize");const i=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",i,t)}async expand(e,t,i){await this._setup();const r=await this._api.importKey("raw",e,this.algHash,!1,["sign"]),a=new ArrayBuffer(i),n=new Uint8Array(a);let s=m;const o=new Uint8Array(t),c=new Uint8Array(1);if(i>255*this.hashSize)throw new Error("Entropy limit reached");const h=new Uint8Array(this.hashSize+o.length+1);for(let e=1,t=0;t=s.length?(n.set(s,t),t+=s.length):(n.set(s.slice(0,n.length-t),t),t+=n.length-t);return a}async extractAndExpand(e,t,i,r){await this._setup();const a=await this._api.importKey("raw",t,"HKDF",!1,["deriveBits"]);return await this._api.deriveBits({name:"HKDF",hash:this.algHash.hash,salt:e,info:i},a,8*r)}async labeledExtract(e,t,i){return await this.extract(e,this.buildLabeledIkm(t,i).buffer)}async labeledExpand(e,t,i,r){return await this.expand(e,this.buildLabeledInfo(t,i,r).buffer,r)}_checkInit(){if(this._suiteId===m)throw new Error("Not initialized. Call init()")}}class B extends N{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}}const M=["encrypt","decrypt"];BigInt(0),BigInt(1),BigInt(2);class q extends _{constructor(e){super(),Object.defineProperty(this,"_rawKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._rawKey=e}async seal(e,t,i){await this._setupKey();const r={name:"AES-GCM",iv:e,additionalData:i};return await this._api.encrypt(r,this._key,t)}async open(e,t,i){await this._setupKey();const r={name:"AES-GCM",iv:e,additionalData:i};return await this._api.decrypt(r,this._key,t)}async _setupKey(){if(void 0!==this._key)return;await this._setup();const e=await this._importKey(this._rawKey);new Uint8Array(this._rawKey).fill(0),this._key=e}async _importKey(e){return await this._api.importKey("raw",e,{name:"AES-GCM"},!0,M)}}class G{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new q(e)}}class W extends G{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:2}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}}function F(){return new Promise((e,t)=>{t(new w("Not supported"))})}const J=new Uint8Array([115,101,99]);class Z{constructor(e,t,i){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exporterSecret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._api=e,this._kdf=t,this.exporterSecret=i}async seal(e,t){return await F()}async open(e,t){return await F()}async export(e,t){if(e.byteLength>g)throw new a("Too long exporter context");try{return await this._kdf.labeledExpand(this.exporterSecret,J,new Uint8Array(e),t)}catch(e){throw new h(e)}}}class X extends Z{}class $ extends Z{constructor(e,t,i,r){super(e,t,i),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=r}}class Q extends Z{constructor(e,t,i){if(super(e,t,i.exporterSecret),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nN",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nT",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),void 0===i.key||void 0===i.baseNonce||void 0===i.seq)throw new Error("Required parameters are missing");this._aead=i.aead,this._nK=this._aead.keySize,this._nN=this._aead.nonceSize,this._nT=this._aead.tagSize;const r=this._aead.createEncryptionContext(i.key);this._ctx={key:r,baseNonce:i.baseNonce,seq:i.seq}}computeNonce(e){const t=P(e.seq,e.baseNonce.byteLength);return function(e,t){if(e.byteLength!==t.byteLength)throw new Error("xor: different length inputs");const i=new Uint8Array(e.byteLength);for(let r=0;rNumber.MAX_SAFE_INTEGER)throw new d("Message limit reached");e.seq+=1}}var V;class Y{constructor(){V.set(this,Promise.resolve())}async lock(){let e;const t=new Promise(t=>{e=t}),i=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)}(this,V,"f");return function(e,t,i,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?a.call(e,i):a?a.value=i:t.set(e,i)}(this,V,t,"f"),await i,e}}V=new WeakMap;var ee,te=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};class ie extends Q{constructor(){super(...arguments),ee.set(this,void 0)}async open(e,t=m.buffer){!function(e,t,i,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?a.call(e,i):a?a.value=i:t.set(e,i)}(this,ee,te(this,ee,"f")??new Y,"f");const i=await te(this,ee,"f").lock();let r;try{r=await this._ctx.key.open(this.computeNonce(this._ctx),e,t)}catch(e){throw new u(e)}finally{i()}return this.incrementSeq(this._ctx),r}}ee=new WeakMap;var re,ae=function(e,t,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(e):r?r.value:t.get(e)};class ne extends Q{constructor(e,t,i,r){super(e,t,i),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),re.set(this,void 0),this.enc=r}async seal(e,t=m.buffer){!function(e,t,i,r,a){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?a.call(e,i):a?a.value=i:t.set(e,i)}(this,re,ae(this,re,"f")??new Y,"f");const i=await ae(this,re,"f").lock();let r;try{r=await this._ctx.key.seal(this.computeNonce(this._ctx),e,t)}catch(e){throw new l(e)}finally{i()}return this.incrementSeq(this._ctx),r}}re=new WeakMap;const se=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),oe=new Uint8Array([101,120,112]),ce=new Uint8Array([105,110,102,111,95,104,97,115,104]),he=new Uint8Array([107,101,121]),le=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),ue=new Uint8Array([115,101,99,114,101,116]),de=new Uint8Array([72,80,75,69,0,0,0,0,0,0]);class ye extends _{constructor(e){if(super(),Object.defineProperty(this,"_kem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),"number"==typeof e.kem)throw new a("KemId cannot be used");if(this._kem=e.kem,"number"==typeof e.kdf)throw new a("KdfId cannot be used");if(this._kdf=e.kdf,"number"==typeof e.aead)throw new a("AeadId cannot be used");this._aead=e.aead,this._suiteId=new Uint8Array(de),this._suiteId.set(P(this._kem.id,2),4),this._suiteId.set(P(this._kdf.id,2),6),this._suiteId.set(P(this._aead.id,2),8),this._kdf.init(this._suiteId)}get kem(){return this._kem}get kdf(){return this._kdf}get aead(){return this._aead}async createSenderContext(e){this._validateInputLength(e),await this._setup();const t=await this._kem.encap(e);let i;return i=void 0!==e.psk?void 0!==e.senderKey?3:1:void 0!==e.senderKey?2:0,await this._keyScheduleS(i,t.sharedSecret,t.enc,e)}async createRecipientContext(e){this._validateInputLength(e),await this._setup();const t=await this._kem.decap(e);let i;return i=void 0!==e.psk?void 0!==e.senderPublicKey?3:1:void 0!==e.senderPublicKey?2:0,await this._keyScheduleR(i,t,e)}async seal(e,t,i=m.buffer){const r=await this.createSenderContext(e);return{ct:await r.seal(t,i),enc:r.enc}}async open(e,t,i=m.buffer){const r=await this.createRecipientContext(e);return await r.open(t,i)}async _keySchedule(e,t,i){const r=void 0===i.psk?m:new Uint8Array(i.psk.id),a=await this._kdf.labeledExtract(m.buffer,le,r),n=void 0===i.info?m:new Uint8Array(i.info),s=await this._kdf.labeledExtract(m.buffer,ce,n),o=new Uint8Array(1+a.byteLength+s.byteLength);o.set(new Uint8Array([e]),0),o.set(new Uint8Array(a),1),o.set(new Uint8Array(s),1+a.byteLength);const c=void 0===i.psk?m:new Uint8Array(i.psk.key),h=this._kdf.buildLabeledIkm(ue,c).buffer,l=this._kdf.buildLabeledInfo(oe,o,this._kdf.hashSize).buffer,u=await this._kdf.extractAndExpand(t,h,l,this._kdf.hashSize);if(65535===this._aead.id)return{aead:this._aead,exporterSecret:u};const d=this._kdf.buildLabeledInfo(he,o,this._aead.keySize).buffer,y=await this._kdf.extractAndExpand(t,h,d,this._aead.keySize),w=this._kdf.buildLabeledInfo(se,o,this._aead.nonceSize).buffer,b=await this._kdf.extractAndExpand(t,h,w,this._aead.nonceSize);return{aead:this._aead,exporterSecret:u,key:y,baseNonce:new Uint8Array(b),seq:0}}async _keyScheduleS(e,t,i,r){const a=await this._keySchedule(e,t,r);return void 0===a.key?new $(this._api,this._kdf,a.exporterSecret,i):new ne(this._api,this._kdf,a,i)}async _keyScheduleR(e,t,i){const r=await this._keySchedule(e,t,i);return void 0===r.key?new X(this._api,this._kdf,r.exporterSecret):new ie(this._api,this._kdf,r)}_validateInputLength(e){if(void 0!==e.info&&e.info.byteLength>65536)throw new a("Too long info");if(void 0!==e.psk){if(e.psk.key.byteLength<32)throw new a("PSK must have at least 32 bytes");if(e.psk.key.byteLength>g)throw new a("Too long psk.key");if(e.psk.id.byteLength>g)throw new a("Too long psk.id")}}}class we extends S{constructor(){const e=new B;super(16,new R(16,e),e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}}class be extends ye{}class fe extends we{}class pe extends B{}new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]),new Uint8Array([48,70,2,1,0,48,5,6,3,43,101,111,4,58,4,56])}}]); +//# sourceMappingURL=vendors.bundle.21bb724fa18b849859c6.js.map \ No newline at end of file diff --git a/import/dist/vendors.bundle.21bb724fa18b849859c6.js.map b/import/dist/vendors.bundle.21bb724fa18b849859c6.js.map new file mode 100644 index 0000000..cec715d --- /dev/null +++ b/import/dist/vendors.bundle.21bb724fa18b849859c6.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vendors.bundle.21bb724fa18b849859c6.js","mappings":"6IAIO,MAAMA,UAAkBC,MAC3B,WAAAC,CAAYC,GACR,IAAIC,EAEAA,EADAD,aAAaF,MACHE,EAAEC,QAEM,iBAAND,EACFA,EAGA,GAEdE,MAAMD,GACNE,KAAKC,KAAOD,KAAKJ,YAAYK,IACjC,EAMG,MAAM,UAA0BP,GAYhC,MAAM,UAAuBA,GAM7B,MAAM,UAAyBA,GAM/B,MAAMQ,UAAmBR,GAMzB,MAAMS,UAAmBT,GAMzB,MAAMU,UAAoBV,GAM1B,MAAMW,UAAkBX,GAMxB,MAAMY,UAAkBZ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Ia,KmBFjBgB,OAAOJ,eAAe/B,KAAM,aAAc,CACtCoC,YAAY,EACZC,cAAc,EACdC,UAAU,EACVnB,MAAO,KAEXgB,OAAOJ,eAAe/B,KAAM,UAAW,CACnCoC,YAAY,EACZC,cAAc,EACdC,UAAU,EACVnB,MAAO,KAEXgB,OAAOJ,eAAe/B,KAAM,gBAAiB,CACzCoC,YAAY,EACZC,cAAc,EACdC,UAAU,EACVnB,MAAO,KAEXgB,OAAOJ,eAAe/B,KAAM,iBAAkB,CAC1CoC,YAAY,EACZC,cAAc,EACdC,UAAU,EACVnB,MAAO,IAEf,EC6BG,MAAMoR,WAAoBpB,IA0B1B,MAAMqB,WAA4BF,IAiFlC,MAAMG,WAAmBzG,GCzKJ,IAAIhJ,WAAW,CACvC,GAAM,GAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAC1C,EAAM,GAAM,IAAM,IAAM,EAAM,GAAM,EAAM,KCFpB,IAAIA,WAAW,CACrC,GAAM,GAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAC1C,EAAM,GAAM,IAAM,IAAM,EAAM,GAAM,EAAM,I","sources":["webpack://import/./node_modules/@hpke/common/esm/src/errors.js","webpack://import/./node_modules/@hpke/common/esm/_dnt.shims.js","webpack://import/./node_modules/@hpke/common/esm/src/algorithm.js","webpack://import/./node_modules/@hpke/common/esm/src/identifiers.js","webpack://import/./node_modules/@hpke/common/esm/src/consts.js","webpack://import/./node_modules/@hpke/common/esm/src/interfaces/kemInterface.js","webpack://import/./node_modules/@hpke/common/esm/src/utils/misc.js","webpack://import/./node_modules/@hpke/common/esm/src/kems/dhkem.js","webpack://import/./node_modules/@hpke/common/esm/src/interfaces/dhkemPrimitives.js","webpack://import/./node_modules/@hpke/common/esm/src/utils/bignum.js","webpack://import/./node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/ec.js","webpack://import/./node_modules/@hpke/common/esm/src/kdfs/hkdf.js","webpack://import/./node_modules/@hpke/common/esm/src/interfaces/aeadEncryptionContext.js","webpack://import/./node_modules/@hpke/common/esm/src/curve/montgomery.js","webpack://import/./node_modules/@hpke/core/esm/src/aeads/aesGcm.js","webpack://import/./node_modules/@hpke/core/esm/src/utils/emitNotSupported.js","webpack://import/./node_modules/@hpke/core/esm/src/exporterContext.js","webpack://import/./node_modules/@hpke/core/esm/src/encryptionContext.js","webpack://import/./node_modules/@hpke/core/esm/src/mutex.js","webpack://import/./node_modules/@hpke/core/esm/src/recipientContext.js","webpack://import/./node_modules/@hpke/core/esm/src/senderContext.js","webpack://import/./node_modules/@hpke/core/esm/src/cipherSuiteNative.js","webpack://import/./node_modules/@hpke/core/esm/src/kems/dhkemNative.js","webpack://import/./node_modules/@hpke/core/esm/src/native.js","webpack://import/./node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js","webpack://import/./node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js"],"sourcesContent":["/**\n * The base error class of hpke-js.\n * @group Errors\n */\nexport class HpkeError extends Error {\n constructor(e) {\n let message;\n if (e instanceof Error) {\n message = e.message;\n }\n else if (typeof e === \"string\") {\n message = e;\n }\n else {\n message = \"\";\n }\n super(message);\n this.name = this.constructor.name;\n }\n}\n/**\n * Invalid parameter.\n * @group Errors\n */\nexport class InvalidParamError extends HpkeError {\n}\n/**\n * KEM input or output validation failure.\n * @group Errors\n */\nexport class ValidationError extends HpkeError {\n}\n/**\n * Public or private key serialization failure.\n * @group Errors\n */\nexport class SerializeError extends HpkeError {\n}\n/**\n * Public or private key deserialization failure.\n * @group Errors\n */\nexport class DeserializeError extends HpkeError {\n}\n/**\n * encap() failure.\n * @group Errors\n */\nexport class EncapError extends HpkeError {\n}\n/**\n * decap() failure.\n * @group Errors\n */\nexport class DecapError extends HpkeError {\n}\n/**\n * Secret export failure.\n * @group Errors\n */\nexport class ExportError extends HpkeError {\n}\n/**\n * seal() failure.\n * @group Errors\n */\nexport class SealError extends HpkeError {\n}\n/**\n * open() failure.\n * @group Errors\n */\nexport class OpenError extends HpkeError {\n}\n/**\n * Sequence number overflow on the encryption context.\n * @group Errors\n */\nexport class MessageLimitReachedError extends HpkeError {\n}\n/**\n * Key pair derivation failure.\n * @group Errors\n */\nexport class DeriveKeyPairError extends HpkeError {\n}\n/**\n * Not supported failure.\n * @group Errors\n */\nexport class NotSupportedError extends HpkeError {\n}\n","const dntGlobals = {};\nexport const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);\nfunction createMergeProxy(baseObj, extObj) {\n return new Proxy(baseObj, {\n get(_target, prop, _receiver) {\n if (prop in extObj) {\n return extObj[prop];\n }\n else {\n return baseObj[prop];\n }\n },\n set(_target, prop, value) {\n if (prop in extObj) {\n delete extObj[prop];\n }\n baseObj[prop] = value;\n return true;\n },\n deleteProperty(_target, prop) {\n let success = false;\n if (prop in extObj) {\n delete extObj[prop];\n success = true;\n }\n if (prop in baseObj) {\n delete baseObj[prop];\n success = true;\n }\n return success;\n },\n ownKeys(_target) {\n const baseKeys = Reflect.ownKeys(baseObj);\n const extKeys = Reflect.ownKeys(extObj);\n const extKeysSet = new Set(extKeys);\n return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];\n },\n defineProperty(_target, prop, desc) {\n if (prop in extObj) {\n delete extObj[prop];\n }\n Reflect.defineProperty(baseObj, prop, desc);\n return true;\n },\n getOwnPropertyDescriptor(_target, prop) {\n if (prop in extObj) {\n return Reflect.getOwnPropertyDescriptor(extObj, prop);\n }\n else {\n return Reflect.getOwnPropertyDescriptor(baseObj, prop);\n }\n },\n has(_target, prop) {\n return prop in extObj || prop in baseObj;\n },\n });\n}\n","import * as dntShim from \"../_dnt.shims.js\";\nimport { NotSupportedError } from \"./errors.js\";\nasync function loadSubtleCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto.subtle;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto.subtle;\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n}\nexport class NativeAlgorithm {\n constructor() {\n Object.defineProperty(this, \"_api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n }\n async _setup() {\n if (this._api !== undefined) {\n return;\n }\n this._api = await loadSubtleCrypto();\n }\n}\n","/**\n * The supported HPKE modes.\n */\nexport const Mode = {\n Base: 0x00,\n Psk: 0x01,\n Auth: 0x02,\n AuthPsk: 0x03,\n};\n/**\n * The supported Key Encapsulation Mechanism (KEM) identifiers.\n */\nexport const KemId = {\n NotAssigned: 0x0000,\n DhkemP256HkdfSha256: 0x0010,\n DhkemP384HkdfSha384: 0x0011,\n DhkemP521HkdfSha512: 0x0012,\n DhkemSecp256k1HkdfSha256: 0x0013,\n DhkemX25519HkdfSha256: 0x0020,\n DhkemX448HkdfSha512: 0x0021,\n HybridkemX25519Kyber768: 0x0030,\n MlKem512: 0x0040,\n MlKem768: 0x0041,\n MlKem1024: 0x0042,\n XWing: 0x647a,\n};\n/**\n * The supported Key Derivation Function (KDF) identifiers.\n */\nexport const KdfId = {\n HkdfSha256: 0x0001,\n HkdfSha384: 0x0002,\n HkdfSha512: 0x0003,\n};\n/**\n * The supported Authenticated Encryption with Associated Data (AEAD) identifiers.\n */\nexport const AeadId = {\n Aes128Gcm: 0x0001,\n Aes256Gcm: 0x0002,\n Chacha20Poly1305: 0x0003,\n ExportOnly: 0xFFFF,\n};\n","// The input length limit (psk, psk_id, info, exporter_context, ikm).\nexport const INPUT_LENGTH_LIMIT = 8192;\nexport const INFO_LENGTH_LIMIT = 65536;\n// The minimum length of a PSK.\nexport const MINIMUM_PSK_LENGTH = 32;\n// b\"\"\nexport const EMPTY = new Uint8Array(0);\n","// b\"KEM\"\nexport const SUITE_ID_HEADER_KEM = new Uint8Array([\n 75,\n 69,\n 77,\n 0,\n 0,\n]);\n","import * as dntShim from \"../../_dnt.shims.js\";\nimport { KemId } from \"../identifiers.js\";\nexport const isDenoV1 = () => \n// deno-lint-ignore no-explicit-any\ndntShim.dntGlobalThis.process === undefined;\n/**\n * Checks whether the runtime is Deno or not (Node.js).\n * @returns boolean - true if the runtime is Deno, false Node.js.\n */\nexport function isDeno() {\n // deno-lint-ignore no-explicit-any\n if (dntShim.dntGlobalThis.process === undefined) {\n return true;\n }\n // deno-lint-ignore no-explicit-any\n return dntShim.dntGlobalThis.process?.versions?.deno !== undefined;\n}\n/**\n * Checks whetehr the type of input is CryptoKeyPair or not.\n */\nexport const isCryptoKeyPair = (x) => typeof x === \"object\" &&\n x !== null &&\n typeof x.privateKey === \"object\" &&\n typeof x.publicKey === \"object\";\n/**\n * Converts integer to octet string. I2OSP implementation.\n */\nexport function i2Osp(n, w) {\n if (w <= 0) {\n throw new Error(\"i2Osp: too small size\");\n }\n if (n >= 256 ** w) {\n throw new Error(\"i2Osp: too large integer\");\n }\n const ret = new Uint8Array(w);\n for (let i = 0; i < w && n; i++) {\n ret[w - (i + 1)] = n % 256;\n n = n >> 8;\n }\n return ret;\n}\n/**\n * Concatenates two Uint8Arrays.\n * @param a Uint8Array\n * @param b Uint8Array\n * @returns Concatenated Uint8Array\n */\nexport function concat(a, b) {\n const ret = new Uint8Array(a.length + b.length);\n ret.set(a, 0);\n ret.set(b, a.length);\n return ret;\n}\n/**\n * Decodes Base64Url-encoded data.\n * @param v Base64Url-encoded string\n * @returns Uint8Array\n */\nexport function base64UrlToBytes(v) {\n const base64 = v.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const byteString = atob(base64);\n const ret = new Uint8Array(byteString.length);\n for (let i = 0; i < byteString.length; i++) {\n ret[i] = byteString.charCodeAt(i);\n }\n return ret;\n}\n/**\n * Encodes Uint8Array to Base64Url.\n * @param v Uint8Array\n * @returns Base64Url-encoded string\n */\nexport function bytesToBase64Url(v) {\n return btoa(String.fromCharCode(...v))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=*$/g, \"\");\n}\n/**\n * Decodes hex string to Uint8Array.\n * @param v Hex string\n * @returns Uint8Array\n * @throws Error if the input is not a hex string.\n */\nexport function hexToBytes(v) {\n if (v.length === 0) {\n return new Uint8Array([]);\n }\n const res = v.match(/[\\da-f]{2}/gi);\n if (res == null) {\n throw new Error(\"Not hex string.\");\n }\n return new Uint8Array(res.map(function (h) {\n return parseInt(h, 16);\n }));\n}\n/**\n * Encodes Uint8Array to hex string.\n * @param v Uint8Array\n * @returns Hex string\n */\nexport function bytesToHex(v) {\n return [...v].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n/**\n * Converts KemId to KeyAlgorithm.\n * @param kem KemId\n * @returns KeyAlgorithm\n */\nexport function kemToKeyGenAlgorithm(kem) {\n switch (kem) {\n case KemId.DhkemP256HkdfSha256:\n return {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n };\n case KemId.DhkemP384HkdfSha384:\n return {\n name: \"ECDH\",\n namedCurve: \"P-384\",\n };\n case KemId.DhkemP521HkdfSha512:\n return {\n name: \"ECDH\",\n namedCurve: \"P-521\",\n };\n default:\n // case KemId.DhkemX25519HkdfSha256\n return {\n name: \"X25519\",\n };\n }\n}\nexport async function loadSubtleCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto.subtle;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto.subtle;\n }\n catch (_e) {\n throw new Error(\"Failed to load SubtleCrypto\");\n }\n}\nexport async function loadCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto;\n }\n catch (_e) {\n throw new Error(\"Web Cryptograph API not supported\");\n }\n}\n/**\n * XOR for Uint8Array.\n */\nexport function xor(a, b) {\n if (a.byteLength !== b.byteLength) {\n throw new Error(\"xor: different length inputs\");\n }\n const buf = new Uint8Array(a.byteLength);\n for (let i = 0; i < a.byteLength; i++) {\n buf[i] = a[i] ^ b[i];\n }\n return buf;\n}\n","import { EMPTY, INPUT_LENGTH_LIMIT } from \"../consts.js\";\nimport { DecapError, EncapError, InvalidParamError } from \"../errors.js\";\nimport { SUITE_ID_HEADER_KEM } from \"../interfaces/kemInterface.js\";\nimport { concat, i2Osp, isCryptoKeyPair } from \"../utils/misc.js\";\n// b\"eae_prk\"\nconst LABEL_EAE_PRK = new Uint8Array([101, 97, 101, 95, 112, 114, 107]);\n// b\"shared_secret\"\n// deno-fmt-ignore\nconst LABEL_SHARED_SECRET = new Uint8Array([\n 115, 104, 97, 114, 101, 100, 95, 115, 101, 99,\n 114, 101, 116,\n]);\nfunction concat3(a, b, c) {\n const ret = new Uint8Array(a.length + b.length + c.length);\n ret.set(a, 0);\n ret.set(b, a.length);\n ret.set(c, a.length + b.length);\n return ret;\n}\nexport class Dhkem {\n constructor(id, prim, kdf) {\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"_prim\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.id = id;\n this._prim = prim;\n this._kdf = kdf;\n const suiteId = new Uint8Array(SUITE_ID_HEADER_KEM);\n suiteId.set(i2Osp(this.id, 2), 3);\n this._kdf.init(suiteId);\n }\n async serializePublicKey(key) {\n return await this._prim.serializePublicKey(key);\n }\n async deserializePublicKey(key) {\n return await this._prim.deserializePublicKey(key);\n }\n async serializePrivateKey(key) {\n return await this._prim.serializePrivateKey(key);\n }\n async deserializePrivateKey(key) {\n return await this._prim.deserializePrivateKey(key);\n }\n async importKey(format, key, isPublic = true) {\n return await this._prim.importKey(format, key, isPublic);\n }\n async generateKeyPair() {\n return await this._prim.generateKeyPair();\n }\n async deriveKeyPair(ikm) {\n if (ikm.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long ikm\");\n }\n return await this._prim.deriveKeyPair(ikm);\n }\n async encap(params) {\n let ke;\n if (params.ekm === undefined) {\n ke = await this.generateKeyPair();\n }\n else if (isCryptoKeyPair(params.ekm)) {\n // params.ekm is only used for testing.\n ke = params.ekm;\n }\n else {\n // params.ekm is only used for testing.\n ke = await this.deriveKeyPair(params.ekm);\n }\n const enc = await this._prim.serializePublicKey(ke.publicKey);\n const pkrm = await this._prim.serializePublicKey(params.recipientPublicKey);\n try {\n let dh;\n if (params.senderKey === undefined) {\n dh = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey));\n }\n else {\n const sks = isCryptoKeyPair(params.senderKey)\n ? params.senderKey.privateKey\n : params.senderKey;\n const dh1 = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey));\n const dh2 = new Uint8Array(await this._prim.dh(sks, params.recipientPublicKey));\n dh = concat(dh1, dh2);\n }\n let kemContext;\n if (params.senderKey === undefined) {\n kemContext = concat(new Uint8Array(enc), new Uint8Array(pkrm));\n }\n else {\n const pks = isCryptoKeyPair(params.senderKey)\n ? params.senderKey.publicKey\n : await this._prim.derivePublicKey(params.senderKey);\n const pksm = await this._prim.serializePublicKey(pks);\n kemContext = concat3(new Uint8Array(enc), new Uint8Array(pkrm), new Uint8Array(pksm));\n }\n const sharedSecret = await this._generateSharedSecret(dh, kemContext);\n return {\n enc: enc,\n sharedSecret: sharedSecret,\n };\n }\n catch (e) {\n throw new EncapError(e);\n }\n }\n async decap(params) {\n const pke = await this._prim.deserializePublicKey(params.enc);\n const skr = isCryptoKeyPair(params.recipientKey)\n ? params.recipientKey.privateKey\n : params.recipientKey;\n const pkr = isCryptoKeyPair(params.recipientKey)\n ? params.recipientKey.publicKey\n : await this._prim.derivePublicKey(params.recipientKey);\n const pkrm = await this._prim.serializePublicKey(pkr);\n try {\n let dh;\n if (params.senderPublicKey === undefined) {\n dh = new Uint8Array(await this._prim.dh(skr, pke));\n }\n else {\n const dh1 = new Uint8Array(await this._prim.dh(skr, pke));\n const dh2 = new Uint8Array(await this._prim.dh(skr, params.senderPublicKey));\n dh = concat(dh1, dh2);\n }\n let kemContext;\n if (params.senderPublicKey === undefined) {\n kemContext = concat(new Uint8Array(params.enc), new Uint8Array(pkrm));\n }\n else {\n const pksm = await this._prim.serializePublicKey(params.senderPublicKey);\n kemContext = new Uint8Array(params.enc.byteLength + pkrm.byteLength + pksm.byteLength);\n kemContext.set(new Uint8Array(params.enc), 0);\n kemContext.set(new Uint8Array(pkrm), params.enc.byteLength);\n kemContext.set(new Uint8Array(pksm), params.enc.byteLength + pkrm.byteLength);\n }\n return await this._generateSharedSecret(dh, kemContext);\n }\n catch (e) {\n throw new DecapError(e);\n }\n }\n async _generateSharedSecret(dh, kemContext) {\n const labeledIkm = this._kdf.buildLabeledIkm(LABEL_EAE_PRK, dh);\n const labeledInfo = this._kdf.buildLabeledInfo(LABEL_SHARED_SECRET, kemContext, this.secretSize);\n return await this._kdf.extractAndExpand(EMPTY.buffer, labeledIkm.buffer, labeledInfo.buffer, this.secretSize);\n }\n}\n","// The key usages for KEM.\nexport const KEM_USAGES = [\"deriveBits\"];\n// b\"dkp_prk\"\nexport const LABEL_DKP_PRK = new Uint8Array([\n 100,\n 107,\n 112,\n 95,\n 112,\n 114,\n 107,\n]);\n// b\"sk\"\nexport const LABEL_SK = new Uint8Array([115, 107]);\n","/**\n * The minimum inplementation of bignum to derive an EC key pair.\n */\nexport class Bignum {\n constructor(size) {\n Object.defineProperty(this, \"_num\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._num = new Uint8Array(size);\n }\n val() {\n return this._num;\n }\n reset() {\n this._num.fill(0);\n }\n set(src) {\n if (src.length !== this._num.length) {\n throw new Error(\"Bignum.set: invalid argument\");\n }\n this._num.set(src);\n }\n isZero() {\n for (let i = 0; i < this._num.length; i++) {\n if (this._num[i] !== 0) {\n return false;\n }\n }\n return true;\n }\n lessThan(v) {\n if (v.length !== this._num.length) {\n throw new Error(\"Bignum.lessThan: invalid argument\");\n }\n for (let i = 0; i < this._num.length; i++) {\n if (this._num[i] < v[i]) {\n return true;\n }\n if (this._num[i] > v[i]) {\n return false;\n }\n }\n return false;\n }\n}\n","import { NativeAlgorithm } from \"../../algorithm.js\";\nimport { EMPTY } from \"../../consts.js\";\nimport { DeriveKeyPairError, DeserializeError, NotSupportedError, SerializeError, } from \"../../errors.js\";\nimport { KemId } from \"../../identifiers.js\";\nimport { KEM_USAGES, LABEL_DKP_PRK } from \"../../interfaces/dhkemPrimitives.js\";\nimport { Bignum } from \"../../utils/bignum.js\";\nimport { base64UrlToBytes, i2Osp } from \"../../utils/misc.js\";\n// b\"candidate\"\n// deno-fmt-ignore\nconst LABEL_CANDIDATE = new Uint8Array([\n 99, 97, 110, 100, 105, 100, 97, 116, 101,\n]);\n// the order of the curve being used.\n// deno-fmt-ignore\nconst ORDER_P_256 = new Uint8Array([\n 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xbc, 0xe6, 0xfa, 0xad, 0xa7, 0x17, 0x9e, 0x84,\n 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, 0x25, 0x51,\n]);\n// deno-fmt-ignore\nconst ORDER_P_384 = new Uint8Array([\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xc7, 0x63, 0x4d, 0x81, 0xf4, 0x37, 0x2d, 0xdf,\n 0x58, 0x1a, 0x0d, 0xb2, 0x48, 0xb0, 0xa7, 0x7a,\n 0xec, 0xec, 0x19, 0x6a, 0xcc, 0xc5, 0x29, 0x73,\n]);\n// deno-fmt-ignore\nconst ORDER_P_521 = new Uint8Array([\n 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xfa, 0x51, 0x86, 0x87, 0x83, 0xbf, 0x2f,\n 0x96, 0x6b, 0x7f, 0xcc, 0x01, 0x48, 0xf7, 0x09,\n 0xa5, 0xd0, 0x3b, 0xb5, 0xc9, 0xb8, 0x89, 0x9c,\n 0x47, 0xae, 0xbb, 0x6f, 0xb7, 0x1e, 0x91, 0x38,\n 0x64, 0x09,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_256 = new Uint8Array([\n 48, 65, 2, 1, 0, 48, 19, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 8, 42, 134,\n 72, 206, 61, 3, 1, 7, 4, 39, 48, 37,\n 2, 1, 1, 4, 32,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_384 = new Uint8Array([\n 48, 78, 2, 1, 0, 48, 16, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 5, 43, 129,\n 4, 0, 34, 4, 55, 48, 53, 2, 1, 1,\n 4, 48,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_521 = new Uint8Array([\n 48, 96, 2, 1, 0, 48, 16, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 5, 43, 129,\n 4, 0, 35, 4, 73, 48, 71, 2, 1, 1,\n 4, 66,\n]);\nexport class Ec extends NativeAlgorithm {\n constructor(kem, hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // EC specific arguments for deriving key pair.\n Object.defineProperty(this, \"_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_bitmask\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._hkdf = hkdf;\n switch (kem) {\n case KemId.DhkemP256HkdfSha256:\n this._alg = { name: \"ECDH\", namedCurve: \"P-256\" };\n this._nPk = 65;\n this._nSk = 32;\n this._nDh = 32;\n this._order = ORDER_P_256;\n this._bitmask = 0xFF;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_256;\n break;\n case KemId.DhkemP384HkdfSha384:\n this._alg = { name: \"ECDH\", namedCurve: \"P-384\" };\n this._nPk = 97;\n this._nSk = 48;\n this._nDh = 48;\n this._order = ORDER_P_384;\n this._bitmask = 0xFF;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_384;\n break;\n default:\n // case KemId.DhkemP521HkdfSha512:\n this._alg = { name: \"ECDH\", namedCurve: \"P-521\" };\n this._nPk = 133;\n this._nSk = 66;\n this._nDh = 66;\n this._order = ORDER_P_521;\n this._bitmask = 0x01;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_521;\n break;\n }\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(this._alg, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const bn = new Bignum(this._nSk);\n for (let counter = 0; bn.isZero() || !bn.lessThan(this._order); counter++) {\n if (counter > 255) {\n throw new Error(\"Faild to derive a key pair\");\n }\n const bytes = new Uint8Array(await this._hkdf.labeledExpand(dkpPrk, LABEL_CANDIDATE, i2Osp(counter, 1), this._nSk));\n bytes[0] = bytes[0] & this._bitmask;\n bn.set(bytes);\n }\n const sk = await this._deserializePkcs8Key(bn.val());\n bn.reset();\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n try {\n await this._setup();\n const bits = await this._api.deriveBits({\n name: \"ECDH\",\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.crv === \"undefined\" || key.crv !== this._alg.namedCurve) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","import { EMPTY } from \"../consts.js\";\nimport { InvalidParamError } from \"../errors.js\";\nimport { KdfId } from \"../identifiers.js\";\nimport { NativeAlgorithm } from \"../algorithm.js\";\n// b\"HPKE-v1\"\nconst HPKE_VERSION = new Uint8Array([72, 80, 75, 69, 45, 118, 49]);\nexport class HkdfNative extends NativeAlgorithm {\n constructor() {\n super();\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha256\n });\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"_suiteId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: EMPTY\n });\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-256\",\n length: 256,\n }\n });\n }\n init(suiteId) {\n this._suiteId = suiteId;\n }\n buildLabeledIkm(label, ikm) {\n this._checkInit();\n const ret = new Uint8Array(7 + this._suiteId.byteLength + label.byteLength + ikm.byteLength);\n ret.set(HPKE_VERSION, 0);\n ret.set(this._suiteId, 7);\n ret.set(label, 7 + this._suiteId.byteLength);\n ret.set(ikm, 7 + this._suiteId.byteLength + label.byteLength);\n return ret;\n }\n buildLabeledInfo(label, info, len) {\n this._checkInit();\n const ret = new Uint8Array(9 + this._suiteId.byteLength + label.byteLength + info.byteLength);\n ret.set(new Uint8Array([0, len]), 0);\n ret.set(HPKE_VERSION, 2);\n ret.set(this._suiteId, 9);\n ret.set(label, 9 + this._suiteId.byteLength);\n ret.set(info, 9 + this._suiteId.byteLength + label.byteLength);\n return ret;\n }\n async extract(salt, ikm) {\n await this._setup();\n if (salt.byteLength === 0) {\n salt = new ArrayBuffer(this.hashSize);\n }\n if (salt.byteLength !== this.hashSize) {\n throw new InvalidParamError(\"The salt length must be the same as the hashSize\");\n }\n const key = await this._api.importKey(\"raw\", salt, this.algHash, false, [\n \"sign\",\n ]);\n return await this._api.sign(\"HMAC\", key, ikm);\n }\n async expand(prk, info, len) {\n await this._setup();\n const key = await this._api.importKey(\"raw\", prk, this.algHash, false, [\n \"sign\",\n ]);\n const okm = new ArrayBuffer(len);\n const p = new Uint8Array(okm);\n let prev = EMPTY;\n const mid = new Uint8Array(info);\n const tail = new Uint8Array(1);\n if (len > 255 * this.hashSize) {\n throw new Error(\"Entropy limit reached\");\n }\n const tmp = new Uint8Array(this.hashSize + mid.length + 1);\n for (let i = 1, cur = 0; cur < p.length; i++) {\n tail[0] = i;\n tmp.set(prev, 0);\n tmp.set(mid, prev.length);\n tmp.set(tail, prev.length + mid.length);\n prev = new Uint8Array(await this._api.sign(\"HMAC\", key, tmp.slice(0, prev.length + mid.length + 1)));\n if (p.length - cur >= prev.length) {\n p.set(prev, cur);\n cur += prev.length;\n }\n else {\n p.set(prev.slice(0, p.length - cur), cur);\n cur += p.length - cur;\n }\n }\n return okm;\n }\n async extractAndExpand(salt, ikm, info, len) {\n await this._setup();\n const baseKey = await this._api.importKey(\"raw\", ikm, \"HKDF\", false, [\"deriveBits\"]);\n return await this._api.deriveBits({\n name: \"HKDF\",\n hash: this.algHash.hash,\n salt: salt,\n info: info,\n }, baseKey, len * 8);\n }\n async labeledExtract(salt, label, ikm) {\n return await this.extract(salt, this.buildLabeledIkm(label, ikm).buffer);\n }\n async labeledExpand(prk, label, info, len) {\n return await this.expand(prk, this.buildLabeledInfo(label, info, len).buffer, len);\n }\n _checkInit() {\n if (this._suiteId === EMPTY) {\n throw new Error(\"Not initialized. Call init()\");\n }\n }\n}\nexport class HkdfSha256Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha256 (0x0001) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha256\n });\n /** 32 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-256\",\n length: 256,\n }\n });\n }\n}\nexport class HkdfSha384Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha384 (0x0002) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha384\n });\n /** 48 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-384\",\n length: 384,\n }\n });\n }\n}\nexport class HkdfSha512Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha512 (0x0003) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha512\n });\n /** 64 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-512\",\n length: 512,\n }\n });\n }\n}\n","// The key usages for AEAD.\nexport const AEAD_USAGES = [\"encrypt\", \"decrypt\"];\n","/**\n * This file is based on noble-curves (https://github.com/paulmillr/noble-curves).\n *\n * noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com)\n *\n * The original file is located at:\n * https://github.com/paulmillr/noble-curves/blob/b9d49d2b41d550571a0c5be443ecb62109fa3373/src/abstract/montgomery.ts\n */\n/**\n * Montgomery curve methods. It's not really whole montgomery curve,\n * just bunch of very specific methods for X25519 / X448 from\n * [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748)\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { abytes, aInRange, bytesToNumberLE, copyBytes, numberToBytesLE, randomBytesAsync, validateObject, } from \"../utils/noble.js\";\nimport { createKeygen } from \"./curve.js\";\nimport { mod } from \"./modular.js\";\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nfunction validateOpts(curve) {\n validateObject(curve, {\n adjustScalarBytes: \"function\",\n powPminus2: \"function\",\n });\n return Object.freeze({ ...curve });\n}\nexport function montgomery(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { P, type, adjustScalarBytes, powPminus2, randomBytes: rand } = CURVE;\n const is25519 = type === \"x25519\";\n if (!is25519 && type !== \"x448\")\n throw new Error(\"invalid type\");\n const randomBytes_ = rand || randomBytesAsync;\n const montgomeryBits = is25519 ? 255 : 448;\n const fieldLen = is25519 ? 32 : 56;\n const Gu = is25519 ? BigInt(9) : BigInt(5);\n // RFC 7748 #5:\n // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519 and\n // (156326 - 2) / 4 = 39081 for curve448/X448\n // const a = is25519 ? 156326n : 486662n;\n const a24 = is25519 ? BigInt(121665) : BigInt(39081);\n // RFC: x25519 \"the resulting integer is of the form 2^254 plus\n // eight times a value between 0 and 2^251 - 1 (inclusive)\"\n // x448: \"2^447 plus four times a value between 0 and 2^445 - 1 (inclusive)\"\n const minScalar = is25519 ? _2n ** BigInt(254) : _2n ** BigInt(447);\n const maxAdded = is25519\n ? BigInt(8) * _2n ** BigInt(251) - _1n\n : BigInt(4) * _2n ** BigInt(445) - _1n;\n const maxScalar = minScalar + maxAdded + _1n; // (inclusive)\n const modP = (n) => mod(n, P);\n const GuBytes = encodeU(Gu);\n function encodeU(u) {\n return numberToBytesLE(modP(u), fieldLen);\n }\n function decodeU(u) {\n const _u = copyBytes(abytes(u, fieldLen, \"uCoordinate\"));\n // RFC: When receiving such an array, implementations of X25519\n // (but not X448) MUST mask the most significant bit in the final byte.\n if (is25519)\n _u[31] &= 127; // 0b0111_1111\n // RFC: Implementations MUST accept non-canonical values and process them as\n // if they had been reduced modulo the field prime. The non-canonical\n // values are 2^255 - 19 through 2^255 - 1 for X25519 and 2^448 - 2^224\n // - 1 through 2^448 - 1 for X448.\n return modP(bytesToNumberLE(_u));\n }\n function decodeScalar(scalar) {\n return bytesToNumberLE(adjustScalarBytes(copyBytes(abytes(scalar, fieldLen, \"scalar\"))));\n }\n function scalarMult(scalar, u) {\n const pu = montgomeryLadder(decodeU(u), decodeScalar(scalar));\n // Some public keys are useless, of low-order. Curve author doesn't think\n // it needs to be validated, but we do it nonetheless.\n // https://cr.yp.to/ecdh.html#validate\n if (pu === _0n)\n throw new Error(\"invalid private or public key received\");\n return encodeU(pu);\n }\n // Computes public key from private. By doing scalar multiplication of base point.\n function scalarMultBase(scalar) {\n return scalarMult(scalar, GuBytes);\n }\n const getPublicKey = scalarMultBase;\n const getSharedSecret = scalarMult;\n // cswap from RFC7748 \"example code\"\n function cswap(swap, x_2, x_3) {\n // dummy = mask(swap) AND (x_2 XOR x_3)\n // Where mask(swap) is the all-1 or all-0 word of the same length as x_2\n // and x_3, computed, e.g., as mask(swap) = 0 - swap.\n const dummy = modP(swap * (x_2 - x_3));\n x_2 = modP(x_2 - dummy); // x_2 = x_2 XOR dummy\n x_3 = modP(x_3 + dummy); // x_3 = x_3 XOR dummy\n return { x_2, x_3 };\n }\n /**\n * Montgomery x-only multiplication ladder.\n * @param pointU u coordinate (x) on Montgomery Curve 25519\n * @param scalar by which the point would be multiplied\n * @returns new Point on Montgomery curve\n */\n function montgomeryLadder(u, scalar) {\n aInRange(\"u\", u, _0n, P);\n aInRange(\"scalar\", scalar, minScalar, maxScalar);\n const k = scalar;\n const x_1 = u;\n let x_2 = _1n;\n let z_2 = _0n;\n let x_3 = u;\n let z_3 = _1n;\n let swap = _0n;\n for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) {\n const k_t = (k >> t) & _1n;\n swap ^= k_t;\n ({ x_2, x_3 } = cswap(swap, x_2, x_3));\n ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3));\n swap = k_t;\n const A = x_2 + z_2;\n const AA = modP(A * A);\n const B = x_2 - z_2;\n const BB = modP(B * B);\n const E = AA - BB;\n const C = x_3 + z_3;\n const D = x_3 - z_3;\n const DA = modP(D * A);\n const CB = modP(C * B);\n const dacb = DA + CB;\n const da_cb = DA - CB;\n x_3 = modP(dacb * dacb);\n z_3 = modP(x_1 * modP(da_cb * da_cb));\n x_2 = modP(AA * BB);\n z_2 = modP(E * (AA + modP(a24 * E)));\n }\n ({ x_2, x_3 } = cswap(swap, x_2, x_3));\n ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3));\n const z2 = powPminus2(z_2); // `Fp.pow(x, P - _2n)` is much slower equivalent\n return modP(x_2 * z2); // Return x_2 * (z_2^(p - 2))\n }\n const lengths = {\n secretKey: fieldLen,\n publicKey: fieldLen,\n seed: fieldLen,\n };\n const randomSecretKey = async (seed) => {\n if (seed === undefined) {\n seed = await randomBytes_(fieldLen);\n }\n abytes(seed, lengths.seed, \"seed\");\n return seed;\n };\n const utils = { randomSecretKey };\n return Object.freeze({\n keygen: createKeygen(randomSecretKey, getPublicKey),\n getSharedSecret,\n getPublicKey,\n scalarMult,\n scalarMultBase,\n utils,\n GuBytes: GuBytes.slice(),\n lengths,\n });\n}\n","import { AEAD_USAGES, AeadId, NativeAlgorithm } from \"@hpke/common\";\nexport class AesGcmContext extends NativeAlgorithm {\n constructor(key) {\n super();\n Object.defineProperty(this, \"_rawKey\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_key\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n this._rawKey = key;\n }\n async seal(iv, data, aad) {\n await this._setupKey();\n const alg = {\n name: \"AES-GCM\",\n iv: iv,\n additionalData: aad,\n };\n const ct = await this._api.encrypt(alg, this._key, data);\n return ct;\n }\n async open(iv, data, aad) {\n await this._setupKey();\n const alg = {\n name: \"AES-GCM\",\n iv: iv,\n additionalData: aad,\n };\n const pt = await this._api.decrypt(alg, this._key, data);\n return pt;\n }\n async _setupKey() {\n if (this._key !== undefined) {\n return;\n }\n await this._setup();\n const key = await this._importKey(this._rawKey);\n (new Uint8Array(this._rawKey)).fill(0);\n this._key = key;\n return;\n }\n async _importKey(key) {\n return await this._api.importKey(\"raw\", key, { name: \"AES-GCM\" }, true, AEAD_USAGES);\n }\n}\n/**\n * The AES-128-GCM for HPKE AEAD implementing {@link AeadInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes128Gcm`.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class Aes128Gcm {\n constructor() {\n /** AeadId.Aes128Gcm (0x0001) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: AeadId.Aes128Gcm\n });\n /** 16 */\n Object.defineProperty(this, \"keySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n /** 12 */\n Object.defineProperty(this, \"nonceSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 12\n });\n /** 16 */\n Object.defineProperty(this, \"tagSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n }\n createEncryptionContext(key) {\n return new AesGcmContext(key);\n }\n}\n/**\n * The AES-256-GCM for HPKE AEAD implementing {@link AeadInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes256Gcm`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class Aes256Gcm extends Aes128Gcm {\n constructor() {\n super(...arguments);\n /** AeadId.Aes256Gcm (0x0002) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: AeadId.Aes256Gcm\n });\n /** 32 */\n Object.defineProperty(this, \"keySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n /** 12 */\n Object.defineProperty(this, \"nonceSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 12\n });\n /** 16 */\n Object.defineProperty(this, \"tagSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n }\n}\n","import { NotSupportedError } from \"@hpke/common\";\nexport function emitNotSupported() {\n return new Promise((_resolve, reject) => {\n reject(new NotSupportedError(\"Not supported\"));\n });\n}\n","import { ExportError, INPUT_LENGTH_LIMIT, InvalidParamError, } from \"@hpke/common\";\nimport { emitNotSupported } from \"./utils/emitNotSupported.js\";\n// b\"sec\"\nconst LABEL_SEC = new Uint8Array([115, 101, 99]);\nexport class ExporterContextImpl {\n constructor(api, kdf, exporterSecret) {\n Object.defineProperty(this, \"_api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"exporterSecret\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._api = api;\n this._kdf = kdf;\n this.exporterSecret = exporterSecret;\n }\n async seal(_data, _aad) {\n return await emitNotSupported();\n }\n async open(_data, _aad) {\n return await emitNotSupported();\n }\n async export(exporterContext, len) {\n if (exporterContext.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long exporter context\");\n }\n try {\n return await this._kdf.labeledExpand(this.exporterSecret, LABEL_SEC, new Uint8Array(exporterContext), len);\n }\n catch (e) {\n throw new ExportError(e);\n }\n }\n}\nexport class RecipientExporterContextImpl extends ExporterContextImpl {\n}\nexport class SenderExporterContextImpl extends ExporterContextImpl {\n constructor(api, kdf, exporterSecret, enc) {\n super(api, kdf, exporterSecret);\n Object.defineProperty(this, \"enc\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.enc = enc;\n return;\n }\n}\n","import { i2Osp, MessageLimitReachedError, xor } from \"@hpke/common\";\nimport { ExporterContextImpl } from \"./exporterContext.js\";\nexport class EncryptionContextImpl extends ExporterContextImpl {\n constructor(api, kdf, params) {\n super(api, kdf, params.exporterSecret);\n // AEAD id.\n Object.defineProperty(this, \"_aead\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of a key for the algorithm.\n Object.defineProperty(this, \"_nK\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of a nonce for the algorithm.\n Object.defineProperty(this, \"_nN\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of an authentication tag for the algorithm.\n Object.defineProperty(this, \"_nT\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The end-to-end encryption key information.\n Object.defineProperty(this, \"_ctx\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n if (params.key === undefined || params.baseNonce === undefined ||\n params.seq === undefined) {\n throw new Error(\"Required parameters are missing\");\n }\n this._aead = params.aead;\n this._nK = this._aead.keySize;\n this._nN = this._aead.nonceSize;\n this._nT = this._aead.tagSize;\n const key = this._aead.createEncryptionContext(params.key);\n this._ctx = {\n key: key,\n baseNonce: params.baseNonce,\n seq: params.seq,\n };\n }\n computeNonce(k) {\n const seqBytes = i2Osp(k.seq, k.baseNonce.byteLength);\n return xor(k.baseNonce, seqBytes).buffer;\n }\n incrementSeq(k) {\n // if (this.seq >= (1 << (8 * this.baseNonce.byteLength)) - 1) {\n if (k.seq > Number.MAX_SAFE_INTEGER) {\n throw new MessageLimitReachedError(\"Message limit reached\");\n }\n k.seq += 1;\n return;\n }\n}\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _Mutex_locked;\nexport class Mutex {\n constructor() {\n _Mutex_locked.set(this, Promise.resolve());\n }\n async lock() {\n let releaseLock;\n const nextLock = new Promise((resolve) => {\n releaseLock = resolve;\n });\n const previousLock = __classPrivateFieldGet(this, _Mutex_locked, \"f\");\n __classPrivateFieldSet(this, _Mutex_locked, nextLock, \"f\");\n await previousLock;\n return releaseLock;\n }\n}\n_Mutex_locked = new WeakMap();\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _RecipientContextImpl_mutex;\nimport { EMPTY, OpenError } from \"@hpke/common\";\nimport { EncryptionContextImpl } from \"./encryptionContext.js\";\nimport { Mutex } from \"./mutex.js\";\nexport class RecipientContextImpl extends EncryptionContextImpl {\n constructor() {\n super(...arguments);\n _RecipientContextImpl_mutex.set(this, void 0);\n }\n async open(data, aad = EMPTY.buffer) {\n __classPrivateFieldSet(this, _RecipientContextImpl_mutex, __classPrivateFieldGet(this, _RecipientContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n const release = await __classPrivateFieldGet(this, _RecipientContextImpl_mutex, \"f\").lock();\n let pt;\n try {\n pt = await this._ctx.key.open(this.computeNonce(this._ctx), data, aad);\n }\n catch (e) {\n throw new OpenError(e);\n }\n finally {\n release();\n }\n this.incrementSeq(this._ctx);\n return pt;\n }\n}\n_RecipientContextImpl_mutex = new WeakMap();\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _SenderContextImpl_mutex;\nimport { EMPTY, SealError } from \"@hpke/common\";\nimport { EncryptionContextImpl } from \"./encryptionContext.js\";\nimport { Mutex } from \"./mutex.js\";\nexport class SenderContextImpl extends EncryptionContextImpl {\n constructor(api, kdf, params, enc) {\n super(api, kdf, params);\n Object.defineProperty(this, \"enc\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n _SenderContextImpl_mutex.set(this, void 0);\n this.enc = enc;\n }\n async seal(data, aad = EMPTY.buffer) {\n __classPrivateFieldSet(this, _SenderContextImpl_mutex, __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n const release = await __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\").lock();\n let ct;\n try {\n ct = await this._ctx.key.seal(this.computeNonce(this._ctx), data, aad);\n }\n catch (e) {\n throw new SealError(e);\n }\n finally {\n release();\n }\n this.incrementSeq(this._ctx);\n return ct;\n }\n}\n_SenderContextImpl_mutex = new WeakMap();\n","import { AeadId, EMPTY, i2Osp, INFO_LENGTH_LIMIT, INPUT_LENGTH_LIMIT, InvalidParamError, MINIMUM_PSK_LENGTH, Mode, NativeAlgorithm, } from \"@hpke/common\";\nimport { RecipientExporterContextImpl, SenderExporterContextImpl, } from \"./exporterContext.js\";\nimport { RecipientContextImpl } from \"./recipientContext.js\";\nimport { SenderContextImpl } from \"./senderContext.js\";\n// b\"base_nonce\"\n// deno-fmt-ignore\nconst LABEL_BASE_NONCE = new Uint8Array([\n 98, 97, 115, 101, 95, 110, 111, 110, 99, 101,\n]);\n// b\"exp\"\nconst LABEL_EXP = new Uint8Array([101, 120, 112]);\n// b\"info_hash\"\n// deno-fmt-ignore\nconst LABEL_INFO_HASH = new Uint8Array([\n 105, 110, 102, 111, 95, 104, 97, 115, 104,\n]);\n// b\"key\"\nconst LABEL_KEY = new Uint8Array([107, 101, 121]);\n// b\"psk_id_hash\"\n// deno-fmt-ignore\nconst LABEL_PSK_ID_HASH = new Uint8Array([\n 112, 115, 107, 95, 105, 100, 95, 104, 97, 115, 104,\n]);\n// b\"secret\"\nconst LABEL_SECRET = new Uint8Array([115, 101, 99, 114, 101, 116]);\n// b\"HPKE\"\n// deno-fmt-ignore\nconst SUITE_ID_HEADER_HPKE = new Uint8Array([\n 72, 80, 75, 69, 0, 0, 0, 0, 0, 0,\n]);\n/**\n * The Hybrid Public Key Encryption (HPKE) ciphersuite,\n * which is implemented using only\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n *\n * This is the super class of {@link CipherSuite} and the same as\n * {@link https://jsr.io/@hpke/core/doc/~/CipherSuite | @hpke/core#CipherSuite} as follows:\n * which supports only the ciphersuites that can be implemented on the native\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n * Therefore, the following cryptographic algorithms are not supported for now:\n * - DHKEM(X25519, HKDF-SHA256)\n * - DHKEM(X448, HKDF-SHA512)\n * - ChaCha20Poly1305\n *\n * In addtion, the HKDF functions contained in this class can only derive\n * keys of the same length as the `hashSize`.\n *\n * If you want to use the unsupported cryptographic algorithms\n * above or derive keys longer than the `hashSize`,\n * please use {@link CipherSuite}.\n *\n * This class provides following functions:\n *\n * - Creates encryption contexts both for senders and recipients.\n * - {@link createSenderContext}\n * - {@link createRecipientContext}\n * - Provides single-shot encryption API.\n * - {@link seal}\n * - {@link open}\n *\n * The calling of the constructor of this class is the starting\n * point for HPKE operations for both senders and recipients.\n *\n * @example Use only ciphersuites supported by Web Cryptography API.\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * CipherSuite,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n *\n * @example Use a ciphersuite which is currently not supported by Web Cryptography API.\n *\n * ```ts\n * import { Aes128Gcm, HkdfSha256, CipherSuite } from \"@hpke/core\";\n * // Use an extension module.\n * import { DhkemX25519HkdfSha256 } from \"@hpke/dhkem-x25519\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemX25519HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class CipherSuiteNative extends NativeAlgorithm {\n /**\n * @param params A set of parameters for building a cipher suite.\n *\n * If the error occurred, throws {@link InvalidParamError}.\n *\n * @throws {@link InvalidParamError}\n */\n constructor(params) {\n super();\n Object.defineProperty(this, \"_kem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_aead\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_suiteId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // KEM\n if (typeof params.kem === \"number\") {\n throw new InvalidParamError(\"KemId cannot be used\");\n }\n this._kem = params.kem;\n // KDF\n if (typeof params.kdf === \"number\") {\n throw new InvalidParamError(\"KdfId cannot be used\");\n }\n this._kdf = params.kdf;\n // AEAD\n if (typeof params.aead === \"number\") {\n throw new InvalidParamError(\"AeadId cannot be used\");\n }\n this._aead = params.aead;\n this._suiteId = new Uint8Array(SUITE_ID_HEADER_HPKE);\n this._suiteId.set(i2Osp(this._kem.id, 2), 4);\n this._suiteId.set(i2Osp(this._kdf.id, 2), 6);\n this._suiteId.set(i2Osp(this._aead.id, 2), 8);\n this._kdf.init(this._suiteId);\n }\n /**\n * Gets the KEM context of the ciphersuite.\n */\n get kem() {\n return this._kem;\n }\n /**\n * Gets the KDF context of the ciphersuite.\n */\n get kdf() {\n return this._kdf;\n }\n /**\n * Gets the AEAD context of the ciphersuite.\n */\n get aead() {\n return this._aead;\n }\n /**\n * Creates an encryption context for a sender.\n *\n * If the error occurred, throws {@link DecapError} | {@link ValidationError}.\n *\n * @param params A set of parameters for the sender encryption context.\n * @returns A sender encryption context.\n * @throws {@link EncapError}, {@link ValidationError}\n */\n async createSenderContext(params) {\n this._validateInputLength(params);\n await this._setup();\n const dh = await this._kem.encap(params);\n let mode;\n if (params.psk !== undefined) {\n mode = params.senderKey !== undefined ? Mode.AuthPsk : Mode.Psk;\n }\n else {\n mode = params.senderKey !== undefined ? Mode.Auth : Mode.Base;\n }\n return await this._keyScheduleS(mode, dh.sharedSecret, dh.enc, params);\n }\n /**\n * Creates an encryption context for a recipient.\n *\n * If the error occurred, throws {@link DecapError}\n * | {@link DeserializeError} | {@link ValidationError}.\n *\n * @param params A set of parameters for the recipient encryption context.\n * @returns A recipient encryption context.\n * @throws {@link DecapError}, {@link DeserializeError}, {@link ValidationError}\n */\n async createRecipientContext(params) {\n this._validateInputLength(params);\n await this._setup();\n const sharedSecret = await this._kem.decap(params);\n let mode;\n if (params.psk !== undefined) {\n mode = params.senderPublicKey !== undefined ? Mode.AuthPsk : Mode.Psk;\n }\n else {\n mode = params.senderPublicKey !== undefined ? Mode.Auth : Mode.Base;\n }\n return await this._keyScheduleR(mode, sharedSecret, params);\n }\n /**\n * Encrypts a message to a recipient.\n *\n * If the error occurred, throws `EncapError` | `MessageLimitReachedError` | `SealError` | `ValidationError`.\n *\n * @param params A set of parameters for building a sender encryption context.\n * @param pt A plain text as bytes to be encrypted.\n * @param aad Additional authenticated data as bytes fed by an application.\n * @returns A cipher text and an encapsulated key as bytes.\n * @throws {@link EncapError}, {@link MessageLimitReachedError}, {@link SealError}, {@link ValidationError}\n */\n async seal(params, pt, aad = EMPTY.buffer) {\n const ctx = await this.createSenderContext(params);\n return {\n ct: await ctx.seal(pt, aad),\n enc: ctx.enc,\n };\n }\n /**\n * Decrypts a message from a sender.\n *\n * If the error occurred, throws `DecapError` | `DeserializeError` | `OpenError` | `ValidationError`.\n *\n * @param params A set of parameters for building a recipient encryption context.\n * @param ct An encrypted text as bytes to be decrypted.\n * @param aad Additional authenticated data as bytes fed by an application.\n * @returns A decrypted plain text as bytes.\n * @throws {@link DecapError}, {@link DeserializeError}, {@link OpenError}, {@link ValidationError}\n */\n async open(params, ct, aad = EMPTY.buffer) {\n const ctx = await this.createRecipientContext(params);\n return await ctx.open(ct, aad);\n }\n // private verifyPskInputs(mode: Mode, params: KeyScheduleParams) {\n // const gotPsk = (params.psk !== undefined);\n // const gotPskId = (params.psk !== undefined && params.psk.id.byteLength > 0);\n // if (gotPsk !== gotPskId) {\n // throw new Error('Inconsistent PSK inputs');\n // }\n // if (gotPsk && (mode === Mode.Base || mode === Mode.Auth)) {\n // throw new Error('PSK input provided when not needed');\n // }\n // if (!gotPsk && (mode === Mode.Psk || mode === Mode.AuthPsk)) {\n // throw new Error('Missing required PSK input');\n // }\n // return;\n // }\n async _keySchedule(mode, sharedSecret, params) {\n // Currently, there is no point in executing this function\n // because this hpke library does not allow users to explicitly specify the mode.\n //\n // this.verifyPskInputs(mode, params);\n const pskId = params.psk === undefined\n ? EMPTY\n : new Uint8Array(params.psk.id);\n const pskIdHash = await this._kdf.labeledExtract(EMPTY.buffer, LABEL_PSK_ID_HASH, pskId);\n const info = params.info === undefined\n ? EMPTY\n : new Uint8Array(params.info);\n const infoHash = await this._kdf.labeledExtract(EMPTY.buffer, LABEL_INFO_HASH, info);\n const keyScheduleContext = new Uint8Array(1 + pskIdHash.byteLength + infoHash.byteLength);\n keyScheduleContext.set(new Uint8Array([mode]), 0);\n keyScheduleContext.set(new Uint8Array(pskIdHash), 1);\n keyScheduleContext.set(new Uint8Array(infoHash), 1 + pskIdHash.byteLength);\n const psk = params.psk === undefined\n ? EMPTY\n : new Uint8Array(params.psk.key);\n const ikm = this._kdf.buildLabeledIkm(LABEL_SECRET, psk)\n .buffer;\n const exporterSecretInfo = this._kdf.buildLabeledInfo(LABEL_EXP, keyScheduleContext, this._kdf.hashSize).buffer;\n const exporterSecret = await this._kdf.extractAndExpand(sharedSecret, ikm, exporterSecretInfo, this._kdf.hashSize);\n if (this._aead.id === AeadId.ExportOnly) {\n return { aead: this._aead, exporterSecret: exporterSecret };\n }\n const keyInfo = this._kdf.buildLabeledInfo(LABEL_KEY, keyScheduleContext, this._aead.keySize).buffer;\n const key = await this._kdf.extractAndExpand(sharedSecret, ikm, keyInfo, this._aead.keySize);\n const baseNonceInfo = this._kdf.buildLabeledInfo(LABEL_BASE_NONCE, keyScheduleContext, this._aead.nonceSize).buffer;\n const baseNonce = await this._kdf.extractAndExpand(sharedSecret, ikm, baseNonceInfo, this._aead.nonceSize);\n return {\n aead: this._aead,\n exporterSecret: exporterSecret,\n key: key,\n baseNonce: new Uint8Array(baseNonce),\n seq: 0,\n };\n }\n async _keyScheduleS(mode, sharedSecret, enc, params) {\n const res = await this._keySchedule(mode, sharedSecret, params);\n if (res.key === undefined) {\n return new SenderExporterContextImpl(this._api, this._kdf, res.exporterSecret, enc);\n }\n return new SenderContextImpl(this._api, this._kdf, res, enc);\n }\n async _keyScheduleR(mode, sharedSecret, params) {\n const res = await this._keySchedule(mode, sharedSecret, params);\n if (res.key === undefined) {\n return new RecipientExporterContextImpl(this._api, this._kdf, res.exporterSecret);\n }\n return new RecipientContextImpl(this._api, this._kdf, res);\n }\n _validateInputLength(params) {\n if (params.info !== undefined &&\n params.info.byteLength > INFO_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long info\");\n }\n if (params.psk !== undefined) {\n if (params.psk.key.byteLength < MINIMUM_PSK_LENGTH) {\n throw new InvalidParamError(`PSK must have at least ${MINIMUM_PSK_LENGTH} bytes`);\n }\n if (params.psk.key.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long psk.key\");\n }\n if (params.psk.id.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long psk.id\");\n }\n }\n return;\n }\n}\n","import { Dhkem, Ec, HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, KemId, } from \"@hpke/common\";\nexport class DhkemP256HkdfSha256Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha256Native();\n const prim = new Ec(KemId.DhkemP256HkdfSha256, kdf);\n super(KemId.DhkemP256HkdfSha256, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP256HkdfSha256\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 65\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 65\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n }\n}\nexport class DhkemP384HkdfSha384Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha384Native();\n const prim = new Ec(KemId.DhkemP384HkdfSha384, kdf);\n super(KemId.DhkemP384HkdfSha384, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP384HkdfSha384\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 97\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 97\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n }\n}\nexport class DhkemP521HkdfSha512Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha512Native();\n const prim = new Ec(KemId.DhkemP521HkdfSha512, kdf);\n super(KemId.DhkemP521HkdfSha512, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP521HkdfSha512\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 133\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 133\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n }\n}\n","import { HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, } from \"@hpke/common\";\nimport { CipherSuiteNative } from \"./cipherSuiteNative.js\";\nimport { DhkemP256HkdfSha256Native, DhkemP384HkdfSha384Native, DhkemP521HkdfSha512Native, } from \"./kems/dhkemNative.js\";\n/**\n * The Hybrid Public Key Encryption (HPKE) ciphersuite,\n * which is implemented using only\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n *\n * This class is the same as\n * {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteNative | @hpke/core#CipherSuiteNative} as follows:\n * which supports only the ciphersuites that can be implemented on the native\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n * Therefore, the following cryptographic algorithms are not supported for now:\n * - `DHKEM(X25519, HKDF-SHA256)`\n * - `DHKEM(X448, HKDF-SHA512)`\n * - `ChaCha20Poly1305`\n *\n * In addtion, the HKDF functions contained in this `CipherSuiteNative`\n * class can only derive keys of the same length as the `hashSize`.\n *\n * If you want to use the unsupported cryptographic algorithms\n * above or derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * This class provides following functions:\n *\n * - Creates encryption contexts both for senders and recipients.\n * - {@link createSenderContext}\n * - {@link createRecipientContext}\n * - Provides single-shot encryption API.\n * - {@link seal}\n * - {@link open}\n *\n * The calling of the constructor of this class is the starting\n * point for HPKE operations for both senders and recipients.\n *\n * @example Use only ciphersuites supported by Web Cryptography API.\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * CipherSuite,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n *\n * @example Use a ciphersuite which is currently not supported by Web Cryptography API.\n *\n * ```ts\n * import { Aes128Gcm, HkdfSha256, CipherSuite } from \"@hpke/core\";\n * import { DhkemX25519HkdfSha256 } from \"@hpke/dhkem-x25519\";\n * const suite = new CipherSuite({\n * kem: new DhkemX25519HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class CipherSuite extends CipherSuiteNative {\n}\n/**\n * The DHKEM(P-256, HKDF-SHA256) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP256HkdfSha256`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class DhkemP256HkdfSha256 extends DhkemP256HkdfSha256Native {\n}\n/**\n * The DHKEM(P-384, HKDF-SHA384) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP384HkdfSha384`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP384HkdfSha384,\n * HkdfSha384,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP384HkdfSha384(),\n * kdf: new HkdfSha384(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class DhkemP384HkdfSha384 extends DhkemP384HkdfSha384Native {\n}\n/**\n * The DHKEM(P-521, HKDF-SHA512) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP521HkdfSha512`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP521HkdfSha512,\n * HkdfSha512,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP521HkdfSha512(),\n * kdf: new HkdfSha512(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class DhkemP521HkdfSha512 extends DhkemP521HkdfSha512Native {\n}\n/**\n * The HKDF-SHA256 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha256`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class HkdfSha256 extends HkdfSha256Native {\n}\n/**\n * The HKDF-SHA384 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha384`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP384HkdfSha384,\n * HkdfSha384,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP384HkdfSha384(),\n * kdf: new HkdfSha384(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class HkdfSha384 extends HkdfSha384Native {\n}\n/**\n * The HKDF-SHA512 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha512`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP521HkdfSha512,\n * HkdfSha512,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP521HkdfSha512(),\n * kdf: new HkdfSha512(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class HkdfSha512 extends HkdfSha512Native {\n}\n","import { base64UrlToBytes, DeriveKeyPairError, DeserializeError, EMPTY, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, NativeAlgorithm, NotSupportedError, SerializeError, } from \"@hpke/common\";\nconst ALG_NAME = \"X25519\";\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_X25519 = new Uint8Array([\n 0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06,\n 0x03, 0x2b, 0x65, 0x6e, 0x04, 0x22, 0x04, 0x20,\n]);\nexport class X25519 extends NativeAlgorithm {\n constructor(hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._alg = { name: ALG_NAME };\n this._hkdf = hkdf;\n this._nPk = 32;\n this._nSk = 32;\n this._nDh = 32;\n this._pkcs8AlgId = PKCS8_ALG_ID_X25519;\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(ALG_NAME, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);\n const rawSkBytes = new Uint8Array(rawSk);\n const sk = await this._deserializePkcs8Key(rawSkBytes);\n rawSkBytes.fill(0);\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n await this._setup();\n try {\n const bits = await this._api.deriveBits({\n name: ALG_NAME,\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.kty === \"undefined\" || key.kty !== \"OKP\") {\n throw new Error(`Invalid kty: ${key.crv}`);\n }\n if (typeof key.crv === \"undefined\" || key.crv !== ALG_NAME) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","import { base64UrlToBytes, DeriveKeyPairError, DeserializeError, EMPTY, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, NativeAlgorithm, NotSupportedError, SerializeError, } from \"@hpke/common\";\nconst ALG_NAME = \"X448\";\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_X448 = new Uint8Array([\n 0x30, 0x46, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06,\n 0x03, 0x2b, 0x65, 0x6f, 0x04, 0x3a, 0x04, 0x38,\n]);\nexport class X448 extends NativeAlgorithm {\n constructor(hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._alg = { name: ALG_NAME };\n this._hkdf = hkdf;\n this._nPk = 56;\n this._nSk = 56;\n this._nDh = 56;\n this._pkcs8AlgId = PKCS8_ALG_ID_X448;\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(ALG_NAME, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);\n const rawSkBytes = new Uint8Array(rawSk);\n const sk = await this._deserializePkcs8Key(rawSkBytes);\n rawSkBytes.fill(0);\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n await this._setup();\n try {\n const bits = await this._api.deriveBits({\n name: ALG_NAME,\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.kty === \"undefined\" || key.kty !== \"OKP\") {\n throw new Error(`Invalid kty: ${key.crv}`);\n }\n if (typeof key.crv === \"undefined\" || key.crv !== ALG_NAME) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n"],"names":["HpkeError","Error","constructor","e","message","super","this","name","EncapError","DecapError","ExportError","SealError","OpenError","MessageLimitReachedError","DeriveKeyPairError","dntGlobalThis","baseObj","globalThis","extObj","Proxy","get","_target","prop","_receiver","set","value","deleteProperty","success","ownKeys","baseKeys","Reflect","extKeys","extKeysSet","Set","filter","k","has","defineProperty","desc","getOwnPropertyDescriptor","NativeAlgorithm","Object","enumerable","configurable","writable","undefined","_setup","_api","async","crypto","subtle","webcrypto","loadSubtleCrypto","INPUT_LENGTH_LIMIT","Uint8Array","x","privateKey","publicKey","n","w","ret","i","a","b","length","LABEL_EAE_PRK","LABEL_SHARED_SECRET","Dhkem","id","prim","kdf","_prim","_kdf","suiteId","init","serializePublicKey","key","deserializePublicKey","serializePrivateKey","deserializePrivateKey","importKey","format","isPublic","generateKeyPair","deriveKeyPair","ikm","byteLength","encap","params","ke","ekm","enc","pkrm","recipientPublicKey","dh","kemContext","senderKey","sks","pks","derivePublicKey","pksm","c","concat3","sharedSecret","_generateSharedSecret","decap","pke","skr","recipientKey","pkr","senderPublicKey","labeledIkm","buildLabeledIkm","labeledInfo","buildLabeledInfo","secretSize","extractAndExpand","buffer","KEM_USAGES","Bignum","size","_num","val","reset","fill","src","isZero","lessThan","v","LABEL_CANDIDATE","ORDER_P_256","ORDER_P_384","ORDER_P_521","PKCS8_ALG_ID_P_256","PKCS8_ALG_ID_P_384","PKCS8_ALG_ID_P_521","Ec","kem","hkdf","_hkdf","_alg","namedCurve","_nPk","_nSk","_nDh","_order","_bitmask","_pkcs8AlgId","exportKey","_importRawKey","jwk","base64","replace","byteString","atob","charCodeAt","base64UrlToBytes","ArrayBuffer","_importJWK","generateKey","dkpPrk","labeledExtract","bn","counter","bytes","labeledExpand","sk","_deserializePkcs8Key","pk","deriveBits","public","crv","d","pkcs8Key","HPKE_VERSION","HkdfNative","hash","_suiteId","label","_checkInit","info","len","extract","salt","hashSize","algHash","sign","expand","prk","okm","p","prev","mid","tail","tmp","cur","slice","baseKey","HkdfSha256Native","arguments","AEAD_USAGES","BigInt","AesGcmContext","_rawKey","seal","iv","data","aad","_setupKey","alg","additionalData","encrypt","_key","open","decrypt","_importKey","Aes128Gcm","createEncryptionContext","Aes256Gcm","emitNotSupported","Promise","_resolve","reject","LABEL_SEC","ExporterContextImpl","api","exporterSecret","_data","_aad","exporterContext","RecipientExporterContextImpl","SenderExporterContextImpl","EncryptionContextImpl","baseNonce","seq","_aead","aead","_nK","keySize","_nN","nonceSize","_nT","tagSize","_ctx","computeNonce","seqBytes","buf","xor","incrementSeq","Number","MAX_SAFE_INTEGER","_Mutex_locked","Mutex","resolve","lock","releaseLock","nextLock","previousLock","receiver","state","kind","f","TypeError","call","__classPrivateFieldGet","__classPrivateFieldSet","WeakMap","_RecipientContextImpl_mutex","RecipientContextImpl","release","pt","_SenderContextImpl_mutex","SenderContextImpl","ct","LABEL_BASE_NONCE","LABEL_EXP","LABEL_INFO_HASH","LABEL_KEY","LABEL_PSK_ID_HASH","LABEL_SECRET","SUITE_ID_HEADER_HPKE","CipherSuiteNative","_kem","createSenderContext","_validateInputLength","mode","psk","_keyScheduleS","createRecipientContext","_keyScheduleR","ctx","_keySchedule","pskId","pskIdHash","infoHash","keyScheduleContext","exporterSecretInfo","keyInfo","baseNonceInfo","res","DhkemP256HkdfSha256Native","CipherSuite","DhkemP256HkdfSha256","HkdfSha256"],"sourceRoot":""} \ No newline at end of file diff --git a/import/hpke-core.js b/import/hpke-core.js deleted file mode 100644 index 531eadc..0000000 --- a/import/hpke-core.js +++ /dev/null @@ -1,4 +0,0 @@ -// The following is vendored via https://esm.sh/@hpke/core@1.2.7. Note that we have excluded the source maps. - -/* esm.sh - esbuild bundle(@hpke/core@1.2.7) es2022 production */ -var ve={},fe=Se(globalThis,ve);function Se(i,e){return new Proxy(i,{get(t,r,n){return r in e?e[r]:i[r]},set(t,r,n){return r in e&&delete e[r],i[r]=n,!0},deleteProperty(t,r){let n=!1;return r in e&&(delete e[r],n=!0),r in i&&(delete i[r],n=!0),n},ownKeys(t){let r=Reflect.ownKeys(i),n=Reflect.ownKeys(e),a=new Set(n);return[...r.filter(s=>!a.has(s)),...n]},defineProperty(t,r,n){return r in e&&delete e[r],Reflect.defineProperty(i,r,n),!0},getOwnPropertyDescriptor(t,r){return r in e?Reflect.getOwnPropertyDescriptor(e,r):Reflect.getOwnPropertyDescriptor(i,r)},has(t,r){return r in e||r in i}})}var ee=class extends Error{constructor(e){let t;e instanceof Error?t=e.message:typeof e=="string"?t=e:t="",super(t),this.name=this.constructor.name}},h=class extends ee{},l=class extends h{},de=class extends h{},P=class extends h{},g=class extends h{},D=class extends h{},N=class extends h{},T=class extends h{},C=class extends h{},M=class extends h{},R=class extends h{},B=class extends h{},p=class extends h{};async function Ae(){if(fe!==void 0&&globalThis.crypto!==void 0)return globalThis.crypto.subtle;try{let{webcrypto:i}=await import("/v135/crypto-browserify@3.12.0/es2022/crypto-browserify.mjs");return i.subtle}catch(i){throw new p(i)}}var w=class{constructor(){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}async _setup(){this._api===void 0&&(this._api=await Ae())}};var x={Base:0,Psk:1,Auth:2,AuthPsk:3},Ee={NotAssigned:0,DhkemP256HkdfSha256:16,DhkemP384HkdfSha384:17,DhkemP521HkdfSha512:18,DhkemSecp256k1HkdfSha256:19,DhkemX25519HkdfSha256:32,DhkemX448HkdfSha512:33,HybridkemX25519Kyber768:48},f=Ee,Ie={HkdfSha256:1,HkdfSha384:2,HkdfSha512:3},v=Ie,Le={Aes128Gcm:1,Aes256Gcm:2,Chacha20Poly1305:3,ExportOnly:65535},m=Le;var ye=["encrypt","decrypt"];var te=class extends w{constructor(e){super(),Object.defineProperty(this,"_rawKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._rawKey=e}async seal(e,t,r){await this._setupKey();let n={name:"AES-GCM",iv:e,additionalData:r};return await this._api.encrypt(n,this._key,t)}async open(e,t,r){await this._setupKey();let n={name:"AES-GCM",iv:e,additionalData:r};return await this._api.decrypt(n,this._key,t)}async _setupKey(){if(this._key!==void 0)return;await this._setup();let e=await this._importKey(this._rawKey);new Uint8Array(this._rawKey).fill(0),this._key=e}async _importKey(e){return await this._api.importKey("raw",e,{name:"AES-GCM"},!0,ye)}},G=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:m.Aes128Gcm}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new te(e)}},re=class extends G{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:m.Aes256Gcm}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}};var ie=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:m.ExportOnly}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:0})}createEncryptionContext(e){throw new p("Export only")}};var c=new Uint8Array(0);function ne(){return new Promise((i,e)=>{e(new p("Not supported"))})}var Ue=new Uint8Array([115,101,99]),S=class{constructor(e,t,r){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exporterSecret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._api=e,this._kdf=t,this.exporterSecret=r}async seal(e,t){return await ne()}async open(e,t){return await ne()}async export(e,t){if(e.byteLength>8192)throw new l("Too long exporter context");try{return await this._kdf.labeledExpand(this.exporterSecret,Ue,new Uint8Array(e),t)}catch(r){throw new T(r)}}},F=class extends S{},q=class extends S{constructor(e,t,r,n){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=n}};var K=i=>typeof i=="object"&&i!==null&&typeof i.privateKey=="object"&&typeof i.publicKey=="object";function _(i,e){if(e<=0)throw new Error("i2Osp: too small size");if(i>=256**e)throw new Error("i2Osp: too large integer");let t=new Uint8Array(e);for(let r=0;r>8;return t}function z(i,e){let t=new Uint8Array(i.length+e.length);return t.set(i,0),t.set(e,i.length),t}function be(i){let e=i.replace(/-/g,"+").replace(/_/g,"/"),t=atob(e),r=new Uint8Array(t.length);for(let n=0;nNumber.MAX_SAFE_INTEGER)throw new R("Message limit reached");e.seq+=1}};var Y=class extends A{async open(e,t=c){let r;try{r=await this._ctx.key.open(this.computeNonce(this._ctx),e,t)}catch(n){throw new M(n)}return this.incrementSeq(this._ctx),r}};var X=class extends A{constructor(e,t,r,n){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=n}async seal(e,t=c){let r;try{r=await this._ctx.key.seal(this.computeNonce(this._ctx),e,t)}catch(n){throw new C(n)}return this.incrementSeq(this._ctx),r}};var ze=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),He=new Uint8Array([101,120,112]),je=new Uint8Array([105,110,102,111,95,104,97,115,104]),De=new Uint8Array([107,101,121]),Ne=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),Te=new Uint8Array([115,101,99,114,101,116]),Ce=new Uint8Array([72,80,75,69,0,0,0,0,0,0]),J=class extends w{constructor(e){if(super(),Object.defineProperty(this,"_kem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof e.kem=="number")throw new l("KemId cannot be used");if(this._kem=e.kem,typeof e.kdf=="number")throw new l("KdfId cannot be used");if(this._kdf=e.kdf,typeof e.aead=="number")throw new l("AeadId cannot be used");this._aead=e.aead,this._suiteId=new Uint8Array(Ce),this._suiteId.set(_(this._kem.id,2),4),this._suiteId.set(_(this._kdf.id,2),6),this._suiteId.set(_(this._aead.id,2),8),this._kdf.init(this._suiteId)}get kem(){return this._kem}get kdf(){return this._kdf}get aead(){return this._aead}async createSenderContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.encap(e),r;return e.psk!==void 0?r=e.senderKey!==void 0?x.AuthPsk:x.Psk:r=e.senderKey!==void 0?x.Auth:x.Base,await this._keyScheduleS(r,t.sharedSecret,t.enc,e)}async createRecipientContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.decap(e),r;return e.psk!==void 0?r=e.senderPublicKey!==void 0?x.AuthPsk:x.Psk:r=e.senderPublicKey!==void 0?x.Auth:x.Base,await this._keyScheduleR(r,t,e)}async seal(e,t,r=c){let n=await this.createSenderContext(e);return{ct:await n.seal(t,r),enc:n.enc}}async open(e,t,r=c){return await(await this.createRecipientContext(e)).open(t,r)}async _keySchedule(e,t,r){let n=r.psk===void 0?c:new Uint8Array(r.psk.id),a=await this._kdf.labeledExtract(c,Ne,n),s=r.info===void 0?c:new Uint8Array(r.info),o=await this._kdf.labeledExtract(c,je,s),u=new Uint8Array(1+a.byteLength+o.byteLength);u.set(new Uint8Array([e]),0),u.set(new Uint8Array(a),1),u.set(new Uint8Array(o),1+a.byteLength);let y=r.psk===void 0?c:new Uint8Array(r.psk.key),b=this._kdf.buildLabeledIkm(Te,y),j=this._kdf.buildLabeledInfo(He,u,this._kdf.hashSize),d=await this._kdf.extractAndExpand(t,b,j,this._kdf.hashSize);if(this._aead.id===m.ExportOnly)return{aead:this._aead,exporterSecret:d};let me=this._kdf.buildLabeledInfo(De,u,this._aead.keySize),ge=await this._kdf.extractAndExpand(t,b,me,this._aead.keySize),ke=this._kdf.buildLabeledInfo(ze,u,this._aead.nonceSize),Pe=await this._kdf.extractAndExpand(t,b,ke,this._aead.nonceSize);return{aead:this._aead,exporterSecret:d,key:ge,baseNonce:new Uint8Array(Pe),seq:0}}async _keyScheduleS(e,t,r,n){let a=await this._keySchedule(e,t,n);return a.key===void 0?new q(this._api,this._kdf,a.exporterSecret,r):new X(this._api,this._kdf,a,r)}async _keyScheduleR(e,t,r){let n=await this._keySchedule(e,t,r);return n.key===void 0?new F(this._api,this._kdf,n.exporterSecret):new Y(this._api,this._kdf,n)}_validateInputLength(e){if(e.info!==void 0&&e.info.byteLength>8192)throw new l("Too long info");if(e.psk!==void 0){if(e.psk.key.byteLength<32)throw new l(`PSK must have at least ${32} bytes`);if(e.psk.key.byteLength>8192)throw new l("Too long psk.key");if(e.psk.id.byteLength>8192)throw new l("Too long psk.id")}}};var we=new Uint8Array([72,80,75,69,45,118,49]),H=class extends w{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:v.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}init(e){this._suiteId=e}buildLabeledIkm(e,t){this._checkInit();let r=new Uint8Array(7+this._suiteId.byteLength+e.byteLength+t.byteLength);return r.set(we,0),r.set(this._suiteId,7),r.set(e,7+this._suiteId.byteLength),r.set(t,7+this._suiteId.byteLength+e.byteLength),r}buildLabeledInfo(e,t,r){this._checkInit();let n=new Uint8Array(9+this._suiteId.byteLength+e.byteLength+t.byteLength);return n.set(new Uint8Array([0,r]),0),n.set(we,2),n.set(this._suiteId,9),n.set(e,9+this._suiteId.byteLength),n.set(t,9+this._suiteId.byteLength+e.byteLength),n}async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)throw new l("The salt length must be the same as the hashSize");let r=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",r,t)}async expand(e,t,r){await this._setup();let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]),a=new ArrayBuffer(r),s=new Uint8Array(a),o=c,u=new Uint8Array(t),y=new Uint8Array(1);if(r>255*this.hashSize)throw new Error("Entropy limit reached");let b=new Uint8Array(this.hashSize+u.length+1);for(let j=1,d=0;d=o.length?(s.set(o,d),d+=o.length):(s.set(o.slice(0,s.length-d),d),d+=s.length-d);return a}async extractAndExpand(e,t,r,n){await this._setup();let a=await this._api.importKey("raw",t,"HKDF",!1,["deriveBits"]);return await this._api.deriveBits({name:"HKDF",hash:this.algHash.hash,salt:e,info:r},a,n*8)}async labeledExtract(e,t,r){return await this.extract(e,this.buildLabeledIkm(t,r))}async labeledExpand(e,t,r,n){return await this.expand(e,this.buildLabeledInfo(t,r,n),n)}_checkInit(){if(this._suiteId===c)throw new Error("Not initialized. Call init()")}},E=class extends H{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:v.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}},I=class extends H{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:v.HkdfSha384}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-384",length:384}})}},L=class extends H{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:v.HkdfSha512}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-512",length:512}})}};var _e=new Uint8Array([75,69,77,0,0]);var Me=new Uint8Array([101,97,101,95,112,114,107]),Re=new Uint8Array([115,104,97,114,101,100,95,115,101,99,114,101,116]);function Be(i,e,t){let r=new Uint8Array(i.length+e.length+t.length);return r.set(i,0),r.set(e,i.length),r.set(t,i.length+e.length),r}var U=class{constructor(e,t,r){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_prim",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e,this._prim=t,this._kdf=r;let n=new Uint8Array(_e);n.set(_(this.id,2),3),this._kdf.init(n)}async serializePublicKey(e){return await this._prim.serializePublicKey(e)}async deserializePublicKey(e){return await this._prim.deserializePublicKey(e)}async serializePrivateKey(e){return await this._prim.serializePrivateKey(e)}async deserializePrivateKey(e){return await this._prim.deserializePrivateKey(e)}async importKey(e,t,r=!0){return await this._prim.importKey(e,t,r)}async generateKeyPair(){return await this._prim.generateKeyPair()}async deriveKeyPair(e){if(e.byteLength>8192)throw new l("Too long ikm");return await this._prim.deriveKeyPair(e)}async encap(e){let t;e.ekm===void 0?t=await this.generateKeyPair():K(e.ekm)?t=e.ekm:t=await this.deriveKeyPair(e.ekm);let r=await this._prim.serializePublicKey(t.publicKey),n=await this._prim.serializePublicKey(e.recipientPublicKey);try{let a;if(e.senderKey===void 0)a=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey));else{let u=K(e.senderKey)?e.senderKey.privateKey:e.senderKey,y=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey)),b=new Uint8Array(await this._prim.dh(u,e.recipientPublicKey));a=z(y,b)}let s;if(e.senderKey===void 0)s=z(new Uint8Array(r),new Uint8Array(n));else{let u=K(e.senderKey)?e.senderKey.publicKey:await this._prim.derivePublicKey(e.senderKey),y=await this._prim.serializePublicKey(u);s=Be(new Uint8Array(r),new Uint8Array(n),new Uint8Array(y))}let o=await this._generateSharedSecret(a,s);return{enc:r,sharedSecret:o}}catch(a){throw new D(a)}}async decap(e){let t=await this._prim.deserializePublicKey(e.enc),r=K(e.recipientKey)?e.recipientKey.privateKey:e.recipientKey,n=K(e.recipientKey)?e.recipientKey.publicKey:await this._prim.derivePublicKey(e.recipientKey),a=await this._prim.serializePublicKey(n);try{let s;if(e.senderPublicKey===void 0)s=new Uint8Array(await this._prim.dh(r,t));else{let u=new Uint8Array(await this._prim.dh(r,t)),y=new Uint8Array(await this._prim.dh(r,e.senderPublicKey));s=z(u,y)}let o;if(e.senderPublicKey===void 0)o=z(new Uint8Array(e.enc),new Uint8Array(a));else{let u=await this._prim.serializePublicKey(e.senderPublicKey);o=new Uint8Array(e.enc.byteLength+a.byteLength+u.byteLength),o.set(new Uint8Array(e.enc),0),o.set(new Uint8Array(a),e.enc.byteLength),o.set(new Uint8Array(u),e.enc.byteLength+a.byteLength)}return await this._generateSharedSecret(s,o)}catch(s){throw new N(s)}}async _generateSharedSecret(e,t){let r=this._kdf.buildLabeledIkm(Me,e),n=this._kdf.buildLabeledInfo(Re,t,this.secretSize);return await this._kdf.extractAndExpand(c,r,n,this.secretSize)}};var W=["deriveBits"],xe=new Uint8Array([100,107,112,95,112,114,107]),Jt=new Uint8Array([115,107]);var Z=class{constructor(e){Object.defineProperty(this,"_num",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._num=new Uint8Array(e)}val(){return this._num}reset(){this._num.fill(0)}set(e){if(e.length!==this._num.length)throw new Error("Bignum.set: invalid argument");this._num.set(e)}isZero(){for(let e=0;ee[t])return!1}return!1}};var Ge=new Uint8Array([99,97,110,100,105,100,97,116,101]),Fe=new Uint8Array([255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81]),qe=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115]),Ye=new Uint8Array([1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,1,72,247,9,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,9]),Xe=new Uint8Array([48,65,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,39,48,37,2,1,1,4,32]),Je=new Uint8Array([48,78,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,55,48,53,2,1,1,4,48]),We=new Uint8Array([48,96,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,73,48,71,2,1,1,4,66]),O=class extends w{constructor(e,t){switch(super(),Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_alg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nDh",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bitmask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pkcs8AlgId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=t,e){case f.DhkemP256HkdfSha256:this._alg={name:"ECDH",namedCurve:"P-256"},this._nPk=65,this._nSk=32,this._nDh=32,this._order=Fe,this._bitmask=255,this._pkcs8AlgId=Xe;break;case f.DhkemP384HkdfSha384:this._alg={name:"ECDH",namedCurve:"P-384"},this._nPk=97,this._nSk=48,this._nDh=48,this._order=qe,this._bitmask=255,this._pkcs8AlgId=Je;break;default:this._alg={name:"ECDH",namedCurve:"P-521"},this._nPk=133,this._nSk=66,this._nDh=66,this._order=Ye,this._bitmask=1,this._pkcs8AlgId=We;break}}async serializePublicKey(e){await this._setup();try{return await this._api.exportKey("raw",e)}catch(t){throw new P(t)}}async deserializePublicKey(e){await this._setup();try{return await this._importRawKey(e,!0)}catch(t){throw new g(t)}}async serializePrivateKey(e){await this._setup();try{let t=await this._api.exportKey("jwk",e);if(!("d"in t))throw new Error("Not private key");return be(t.d)}catch(t){throw new P(t)}}async deserializePrivateKey(e){await this._setup();try{return await this._importRawKey(e,!1)}catch(t){throw new g(t)}}async importKey(e,t,r){await this._setup();try{if(e==="raw")return await this._importRawKey(t,r);if(t instanceof ArrayBuffer)throw new Error("Invalid jwk key format");return await this._importJWK(t,r)}catch(n){throw new g(n)}}async generateKeyPair(){await this._setup();try{return await this._api.generateKey(this._alg,!0,W)}catch(e){throw new p(e)}}async deriveKeyPair(e){await this._setup();try{let t=await this._hkdf.labeledExtract(c,xe,new Uint8Array(e)),r=new Z(this._nSk);for(let a=0;r.isZero()||!r.lessThan(this._order);a++){if(a>255)throw new Error("Faild to derive a key pair");let s=new Uint8Array(await this._hkdf.labeledExpand(t,Ge,_(a,1),this._nSk));s[0]=s[0]&this._bitmask,r.set(s)}let n=await this._deserializePkcs8Key(r.val());return r.reset(),{privateKey:n,publicKey:await this.derivePublicKey(n)}}catch(t){throw new B(t)}}async derivePublicKey(e){await this._setup();try{let t=await this._api.exportKey("jwk",e);return delete t.d,delete t.key_ops,await this._api.importKey("jwk",t,this._alg,!0,[])}catch(t){throw new g(t)}}async dh(e,t){try{return await this._setup(),await this._api.deriveBits({name:"ECDH",public:t},e,this._nDh*8)}catch(r){throw new P(r)}}async _importRawKey(e,t){if(t&&e.byteLength!==this._nPk)throw new Error("Invalid public key for the ciphersuite");if(!t&&e.byteLength!==this._nSk)throw new Error("Invalid private key for the ciphersuite");return t?await this._api.importKey("raw",e,this._alg,!0,[]):await this._deserializePkcs8Key(new Uint8Array(e))}async _importJWK(e,t){if(typeof e.crv>"u"||e.crv!==this._alg.namedCurve)throw new Error(`Invalid crv: ${e.crv}`);if(t){if(typeof e.d<"u")throw new Error("Invalid key: `d` should not be set");return await this._api.importKey("jwk",e,this._alg,!0,[])}if(typeof e.d>"u")throw new Error("Invalid key: `d` not found");return await this._api.importKey("jwk",e,this._alg,!0,W)}async _deserializePkcs8Key(e){let t=new Uint8Array(this._pkcs8AlgId.length+e.length);return t.set(this._pkcs8AlgId,0),t.set(e,this._pkcs8AlgId.length),await this._api.importKey("pkcs8",t,this._alg,!0,W)}};var $=class extends U{constructor(){let e=new E,t=new O(f.DhkemP256HkdfSha256,e);super(f.DhkemP256HkdfSha256,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:f.DhkemP256HkdfSha256}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}},Q=class extends U{constructor(){let e=new I,t=new O(f.DhkemP384HkdfSha384,e);super(f.DhkemP384HkdfSha384,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:f.DhkemP384HkdfSha384}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:97}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:97}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:48})}},V=class extends U{constructor(){let e=new L,t=new O(f.DhkemP521HkdfSha512,e);super(f.DhkemP521HkdfSha512,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:f.DhkemP521HkdfSha512}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:133}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:133}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:64})}};var ae=class extends J{},se=class extends ${},oe=class extends Q{},ue=class extends V{},ce=class extends E{},le=class extends I{},he=class extends L{};export{m as AeadId,G as Aes128Gcm,re as Aes256Gcm,ee as BaseError,ae as CipherSuite,N as DecapError,B as DeriveKeyPairError,g as DeserializeError,se as DhkemP256HkdfSha256,oe as DhkemP384HkdfSha384,ue as DhkemP521HkdfSha512,D as EncapError,T as ExportError,ie as ExportOnly,ce as HkdfSha256,le as HkdfSha384,he as HkdfSha512,h as HpkeError,l as InvalidParamError,v as KdfId,f as KemId,R as MessageLimitReachedError,p as NotSupportedError,M as OpenError,C as SealError,P as SerializeError,de as ValidationError}; diff --git a/import/index.template.html b/import/index.template.html deleted file mode 100644 index 5d8fa91..0000000 --- a/import/index.template.html +++ /dev/null @@ -1,1091 +0,0 @@ - - - - - - - Turnkey Import - - - - - - -
- - - - -
- - - - - - - diff --git a/import/index.test.js b/import/index.test.js index 5df94d7..cfa1d63 100644 --- a/import/index.test.js +++ b/import/index.test.js @@ -1,38 +1,79 @@ import "@testing-library/jest-dom"; -import { JSDOM } from "jsdom"; -import fs from "fs"; -import path from "path"; import * as crypto from "crypto"; +import * as TKHQ from "./src/turnkey-core.js"; + +// Mock the TURNKEY_SIGNER_ENVIRONMENT replacement that webpack would do +const verifyEnclaveSignature = async function ( + enclaveQuorumPublic, + publicSignature, + signedData +) { + // Replace the template string with actual environment + const TURNKEY_SIGNERS_ENCLAVES = { + prod: "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", + preprod: + "04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212", + }; + + const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY = + TURNKEY_SIGNERS_ENCLAVES["prod"]; + + if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) { + throw new Error( + "Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined" + ); + } -const html = fs - .readFileSync(path.resolve(__dirname, "./index.template.html"), "utf8") - .replace("${TURNKEY_SIGNER_ENVIRONMENT}", "prod"); - -let dom; -let TKHQ; + if (enclaveQuorumPublic) { + if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) { + throw new Error( + `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.` + ); + } + } + + const encryptionQuorumPublicBuf = new Uint8Array( + TKHQ.uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) + ); + const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf); + if (!quorumKey) { + throw new Error("failed to load quorum key"); + } + + const publicSignatureBuf = TKHQ.fromDerSignature(publicSignature); + const signedDataBuf = TKHQ.uint8arrayFromHexString(signedData); + return await crypto.webcrypto.subtle.verify( + { name: "ECDSA", hash: "SHA-256" }, + quorumKey, + publicSignatureBuf, + signedDataBuf + ); +}; + +async function loadQuorumKey(quorumPublic) { + return await crypto.webcrypto.subtle.importKey( + "raw", + quorumPublic, + { + name: "ECDSA", + namedCurve: "P-256", + }, + true, + ["verify"] + ); +} describe("TKHQ", () => { beforeEach(() => { - dom = new JSDOM(html, { - // Necessary to run script tags - runScripts: "dangerously", - // Necessary to have access to localStorage - url: "http://localhost", - // Necessary for TextDecoder to be available. - // See https://github.com/jsdom/jsdom/issues/2524 - beforeParse(window) { - window.TextDecoder = TextDecoder; - window.TextEncoder = TextEncoder; - }, - }); - - // Necessary for crypto to be available. - // See https://github.com/jsdom/jsdom/issues/1612 - Object.defineProperty(dom.window, "crypto", { - value: crypto.webcrypto, - }); - - TKHQ = dom.window.TKHQ; + window.TextDecoder = global.TextDecoder; + window.TextEncoder = global.TextEncoder; + window.__TURNKEY_SIGNER_ENVIRONMENT__ = "prod"; + + global.crypto = crypto.webcrypto; + window.crypto = crypto.webcrypto; + TKHQ.setCryptoProvider(crypto.webcrypto); + + window.localStorage.clear(); }); it("gets and sets embedded target key in localStorage", async () => { @@ -184,7 +225,7 @@ describe("TKHQ", () => { it("verifies enclave signature", async () => { // No "enclaveQuorumPublic" field in the export bundle. Valid signature - let verified = await TKHQ.verifyEnclaveSignature( + let verified = await verifyEnclaveSignature( null, "30440220773382ac39085f58a584fd5ad8c8b91b50993ad480af2c5eaefe0b09447b6dca02205201c8e20a92bce524caac08a956b0c2e7447de9c68f91ab1e09fd58988041b5", "04e479640d6d3487bbf132f6258ee24073411b8325ea68bb28883e45b650d059f82c48db965b8f777b30ab9e7810826bfbe8ad1789f9f10bf76dcd36b2ee399bc5" @@ -192,7 +233,7 @@ describe("TKHQ", () => { expect(verified).toBe(true); // "enclaveQuorumPublic" field present in the export bundle. Valid signature - verified = await TKHQ.verifyEnclaveSignature( + verified = await verifyEnclaveSignature( "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", "30440220773382ac39085f58a584fd5ad8c8b91b50993ad480af2c5eaefe0b09447b6dca02205201c8e20a92bce524caac08a956b0c2e7447de9c68f91ab1e09fd58988041b5", "04e479640d6d3487bbf132f6258ee24073411b8325ea68bb28883e45b650d059f82c48db965b8f777b30ab9e7810826bfbe8ad1789f9f10bf76dcd36b2ee399bc5" @@ -201,7 +242,7 @@ describe("TKHQ", () => { // "enclaveQuorumPublic" field present in the export bundle but doesn't match what's pinned on export.turnkey.com await expect( - TKHQ.verifyEnclaveSignature( + verifyEnclaveSignature( "04ca7c0d624c75de6f34af342e87a21e0d8c83efd1bd5b5da0c0177c147f744fba6f01f9f37356f9c617659aafa55f6e0af8d169a8f054d153ab3201901fb63ecb", "30440220773382ac39085f58a584fd5ad8c8b91b50993ad480af2c5eaefe0b09447b6dca02205201c8e20a92bce524caac08a956b0c2e7447de9c68f91ab1e09fd58988041b5", "04e479640d6d3487bbf132f6258ee24073411b8325ea68bb28883e45b650d059f82c48db965b8f777b30ab9e7810826bfbe8ad1789f9f10bf76dcd36b2ee399bc5" @@ -211,7 +252,7 @@ describe("TKHQ", () => { ); // Invalid signature - verified = await TKHQ.verifyEnclaveSignature( + verified = await verifyEnclaveSignature( "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", "30440220773382ac39085f58a584fd5ad8c8b91b50993ad480af2c5eaefe0b09447b6dca02205201c8e20a92bce524caac08a956b0c2e7447de9c68f91ab1e09fd58988041b5", "04d32d8e0fe5a401a717971fabfabe02ddb6bea39b72a18a415fc0273579b394650aae97f75b0462ffa8880a1899c7a930569974519685a995d2e74e372e105bf4" @@ -220,7 +261,7 @@ describe("TKHQ", () => { // Invalid DER-encoding for signature await expect( - TKHQ.verifyEnclaveSignature( + verifyEnclaveSignature( null, "300220773382ac39085f58a584fd5ad8c8b91b50993ad480af2c5eaefe0b09447b6dca02205201c8e20a92bce524caac08a956b0c2e7447de9c68f91ab1e09fd58988041b5", "04d32d8e0fe5a401a717971fabfabe02ddb6bea39b72a18a415fc0273579b394650aae97f75b0462ffa8880a1899c7a930569974519685a995d2e74e372e105bf4" @@ -231,7 +272,7 @@ describe("TKHQ", () => { // Invalid hex-encoding for signature await expect( - TKHQ.verifyEnclaveSignature( + verifyEnclaveSignature( null, "", "04d32d8e0fe5a401a717971fabfabe02ddb6bea39b72a18a415fc0273579b394650aae97f75b0462ffa8880a1899c7a930569974519685a995d2e74e372e105bf4" @@ -240,7 +281,7 @@ describe("TKHQ", () => { // Invalid hex-encoding for public key await expect( - TKHQ.verifyEnclaveSignature( + verifyEnclaveSignature( null, "30440220773382ac39085f58a584fd5ad8c8b91b50993ad480af2c5eaefe0b09447b6dca02205201c8e20a92bce524caac08a956b0c2e7447de9c68f91ab1e09fd58988041b5", "" diff --git a/import/jest.config.js b/import/jest.config.js index ffcfa55..1c46140 100644 --- a/import/jest.config.js +++ b/import/jest.config.js @@ -1,5 +1,7 @@ module.exports = { clearMocks: true, + testEnvironment: "jsdom", + setupFiles: ["/jest.setup.js"], setupFilesAfterEnv: ["regenerator-runtime/runtime"], testPathIgnorePatterns: ["/node_modules/"], }; diff --git a/import/jest.setup.js b/import/jest.setup.js new file mode 100644 index 0000000..0d33ea4 --- /dev/null +++ b/import/jest.setup.js @@ -0,0 +1,9 @@ +const { TextEncoder, TextDecoder } = require("util"); + +if (typeof global.TextEncoder === "undefined") { + global.TextEncoder = TextEncoder; +} + +if (typeof global.TextDecoder === "undefined") { + global.TextDecoder = TextDecoder; +} diff --git a/import/package-lock.json b/import/package-lock.json index 4e6f798..b52e462 100644 --- a/import/package-lock.json +++ b/import/package-lock.json @@ -1,25 +1,37 @@ { - "name": "import-tests", + "name": "import", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "import-tests", + "name": "import", "version": "1.0.0", "license": "MIT", + "dependencies": { + "@hpke/core": "1.7.5" + }, "devDependencies": { - "@babel/core": "^7.23.0", - "@babel/preset-env": "^7.22.20", - "@testing-library/dom": "^9.3.3", - "@testing-library/jest-dom": "^6.1.3", - "babel-jest": "^29.7.0", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "jsdom": "^22.1.0", - "prettier": "^2.8.4", - "regenerator-runtime": "^0.14.1", - "serve": "^14.2.1" + "@babel/core": "7.23.0", + "@babel/preset-env": "7.22.20", + "@testing-library/dom": "9.3.3", + "@testing-library/jest-dom": "6.1.3", + "babel-jest": "29.7.0", + "babel-loader": "9.1.3", + "copy-webpack-plugin": "11.0.0", + "css-loader": "6.8.1", + "html-webpack-plugin": "5.5.3", + "jest": "29.7.0", + "jest-environment-jsdom": "29.7.0", + "jsdom": "22.1.0", + "mini-css-extract-plugin": "2.9.4", + "prettier": "2.8.4", + "regenerator-runtime": "0.14.1", + "serve": "14.2.5", + "style-loader": "3.3.3", + "webpack": "5.102.1", + "webpack-cli": "5.1.4", + "webpack-dev-server": "5.2.2" } }, "node_modules/@adobe/css-tools": { @@ -65,7 +77,9 @@ } }, "node_modules/@babel/core": { - "version": "7.23.2", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.0.tgz", + "integrity": "sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ==", "dev": true, "license": "MIT", "dependencies": { @@ -74,10 +88,10 @@ "@babel/generator": "^7.23.0", "@babel/helper-compilation-targets": "^7.22.15", "@babel/helper-module-transforms": "^7.23.0", - "@babel/helpers": "^7.23.2", + "@babel/helpers": "^7.23.0", "@babel/parser": "^7.23.0", "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.2", + "@babel/traverse": "^7.23.0", "@babel/types": "^7.23.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", @@ -1445,11 +1459,13 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.23.2", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.22.20.tgz", + "integrity": "sha512-11MY04gGC4kSzlPHRfvVkNAZhUxOvm7DCJ37hPDnUENwe06npjIRAfInEMTGSb4LZK5ZgDFkv5hw0lGebHeTyg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.23.2", + "@babel/compat-data": "^7.22.20", "@babel/helper-compilation-targets": "^7.22.15", "@babel/helper-plugin-utils": "^7.22.5", "@babel/helper-validator-option": "^7.22.15", @@ -1475,15 +1491,15 @@ "@babel/plugin-syntax-top-level-await": "^7.14.5", "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", "@babel/plugin-transform-arrow-functions": "^7.22.5", - "@babel/plugin-transform-async-generator-functions": "^7.23.2", + "@babel/plugin-transform-async-generator-functions": "^7.22.15", "@babel/plugin-transform-async-to-generator": "^7.22.5", "@babel/plugin-transform-block-scoped-functions": "^7.22.5", - "@babel/plugin-transform-block-scoping": "^7.23.0", + "@babel/plugin-transform-block-scoping": "^7.22.15", "@babel/plugin-transform-class-properties": "^7.22.5", "@babel/plugin-transform-class-static-block": "^7.22.11", "@babel/plugin-transform-classes": "^7.22.15", "@babel/plugin-transform-computed-properties": "^7.22.5", - "@babel/plugin-transform-destructuring": "^7.23.0", + "@babel/plugin-transform-destructuring": "^7.22.15", "@babel/plugin-transform-dotall-regex": "^7.22.5", "@babel/plugin-transform-duplicate-keys": "^7.22.5", "@babel/plugin-transform-dynamic-import": "^7.22.11", @@ -1495,9 +1511,9 @@ "@babel/plugin-transform-literals": "^7.22.5", "@babel/plugin-transform-logical-assignment-operators": "^7.22.11", "@babel/plugin-transform-member-expression-literals": "^7.22.5", - "@babel/plugin-transform-modules-amd": "^7.23.0", - "@babel/plugin-transform-modules-commonjs": "^7.23.0", - "@babel/plugin-transform-modules-systemjs": "^7.23.0", + "@babel/plugin-transform-modules-amd": "^7.22.5", + "@babel/plugin-transform-modules-commonjs": "^7.22.15", + "@babel/plugin-transform-modules-systemjs": "^7.22.11", "@babel/plugin-transform-modules-umd": "^7.22.5", "@babel/plugin-transform-named-capturing-groups-regex": "^7.22.5", "@babel/plugin-transform-new-target": "^7.22.5", @@ -1506,7 +1522,7 @@ "@babel/plugin-transform-object-rest-spread": "^7.22.15", "@babel/plugin-transform-object-super": "^7.22.5", "@babel/plugin-transform-optional-catch-binding": "^7.22.11", - "@babel/plugin-transform-optional-chaining": "^7.23.0", + "@babel/plugin-transform-optional-chaining": "^7.22.15", "@babel/plugin-transform-parameters": "^7.22.15", "@babel/plugin-transform-private-methods": "^7.22.5", "@babel/plugin-transform-private-property-in-object": "^7.22.11", @@ -1523,10 +1539,10 @@ "@babel/plugin-transform-unicode-regex": "^7.22.5", "@babel/plugin-transform-unicode-sets-regex": "^7.22.5", "@babel/preset-modules": "0.1.6-no-external-plugins", - "@babel/types": "^7.23.0", - "babel-plugin-polyfill-corejs2": "^0.4.6", - "babel-plugin-polyfill-corejs3": "^0.8.5", - "babel-plugin-polyfill-regenerator": "^0.5.3", + "@babel/types": "^7.22.19", + "babel-plugin-polyfill-corejs2": "^0.4.5", + "babel-plugin-polyfill-corejs3": "^0.8.3", + "babel-plugin-polyfill-regenerator": "^0.5.2", "core-js-compat": "^3.31.0", "semver": "^6.3.1" }, @@ -1619,6 +1635,37 @@ "dev": true, "license": "MIT" }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@hpke/common": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@hpke/common/-/common-1.8.1.tgz", + "integrity": "sha512-PSI4QSxH8XDli0TqAsWycVfrLLCM/bBe+hVlJwtuJJiKIvCaFS3CXX/WtRfJceLJye9NHc2J7GvHVCY9B1BEbA==", + "license": "MIT", + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@hpke/core": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/@hpke/core/-/core-1.7.5.tgz", + "integrity": "sha512-4xfckZuPaIodeu0HpuTRIdtmajhRHXM/6rjS2N62Ns9aOCkGbbeYRwktqR3bUScuhCwyEBsEQqtIh9f0iLP3WQ==", + "license": "MIT", + "dependencies": { + "@hpke/common": "^1.8.1" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "dev": true, @@ -1703,14 +1750,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@jest/console/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/console/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -1813,14 +1852,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@jest/core/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/core/node_modules/pretty-format": { "version": "29.7.0", "dev": true, @@ -2015,14 +2046,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@jest/reporters/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/reporters/node_modules/istanbul-lib-instrument": { "version": "6.0.1", "dev": true, @@ -2201,14 +2224,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@jest/transform/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/transform/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -2281,14 +2296,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@jest/types/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/@jest/types/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -2301,16 +2308,14 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" } }, "node_modules/@jridgewell/resolve-uri": { @@ -2321,21 +2326,28 @@ "node": ">=6.0.0" } }, - "node_modules/@jridgewell/set-array": { - "version": "1.1.2", + "node_modules/@jridgewell/source-map": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz", + "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==", "dev": true, "license": "MIT", - "engines": { - "node": ">=6.0.0" + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.20", + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", "dev": true, "license": "MIT", "dependencies": { @@ -2343,6 +2355,171 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@jsonjoy.com/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@jsonjoy.com/buffers": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/buffers/-/buffers-1.2.1.tgz", + "integrity": "sha512-12cdlDwX4RUM3QxmUbVJWqZ/mrK6dFQH4Zxq6+r1YXKXYBNgZXndx2qbCJwh3+WWkCSn67IjnlG3XYTvmvYtgA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@jsonjoy.com/codegen": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/codegen/-/codegen-1.0.0.tgz", + "integrity": "sha512-E8Oy+08cmCf0EK/NMxpaJZmOxPqM+6iSe2S4nlSBrPZOORoDJILxtbSUEDKQyTamm/BVAhIGllOBNU79/dwf0g==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@jsonjoy.com/json-pack": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/json-pack/-/json-pack-1.21.0.tgz", + "integrity": "sha512-+AKG+R2cfZMShzrF2uQw34v3zbeDYUqnQ+jg7ORic3BGtfw9p/+N6RJbq/kkV8JmYZaINknaEQ2m0/f693ZPpg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jsonjoy.com/base64": "^1.1.2", + "@jsonjoy.com/buffers": "^1.2.0", + "@jsonjoy.com/codegen": "^1.0.0", + "@jsonjoy.com/json-pointer": "^1.0.2", + "@jsonjoy.com/util": "^1.9.0", + "hyperdyperid": "^1.2.0", + "thingies": "^2.5.0", + "tree-dump": "^1.1.0" + }, + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@jsonjoy.com/json-pointer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/json-pointer/-/json-pointer-1.0.2.tgz", + "integrity": "sha512-Fsn6wM2zlDzY1U+v4Nc8bo3bVqgfNTGcn6dMgs6FjrEnt4ZCe60o6ByKRjOGlI2gow0aE/Q41QOigdTqkyK5fg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jsonjoy.com/codegen": "^1.0.0", + "@jsonjoy.com/util": "^1.9.0" + }, + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@jsonjoy.com/util": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@jsonjoy.com/util/-/util-1.9.0.tgz", + "integrity": "sha512-pLuQo+VPRnN8hfPqUTLTHk126wuYdXVxE6aDmjSeV4NCAgyxWbiOIeNJVtID3h1Vzpoi9m4jXezf73I6LgabgQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jsonjoy.com/buffers": "^1.0.0", + "@jsonjoy.com/codegen": "^1.0.0" + }, + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/@leichtgewicht/ip-codec": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz", + "integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "dev": true, @@ -2427,14 +2604,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@testing-library/dom/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/@testing-library/dom/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -2447,11 +2616,13 @@ } }, "node_modules/@testing-library/jest-dom": { - "version": "6.1.4", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.1.3.tgz", + "integrity": "sha512-YzpjRHoCBWPzpPNtg6gnhasqtE/5O4qz8WCwDEaxtfnPO6gkaLrnuXusrGSPyhIGPezr1HM7ZH0CFaUTY9PJEQ==", "dev": true, "license": "MIT", "dependencies": { - "@adobe/css-tools": "^4.3.1", + "@adobe/css-tools": "^4.3.0", "@babel/runtime": "^7.9.2", "aria-query": "^5.0.0", "chalk": "^3.0.0", @@ -2528,14 +2699,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@testing-library/jest-dom/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/@testing-library/jest-dom/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -2597,101 +2760,578 @@ "@babel/types": "^7.20.7" } }, - "node_modules/@types/graceful-fs": { - "version": "4.1.8", + "node_modules/@types/body-parser": { + "version": "1.19.6", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz", + "integrity": "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==", "dev": true, "license": "MIT", "dependencies": { + "@types/connect": "*", "@types/node": "*" } }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.5", + "node_modules/@types/bonjour": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@types/bonjour/-/bonjour-3.5.13.tgz", + "integrity": "sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "@types/node": "*" + } }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.2", + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", "dev": true, "license": "MIT", "dependencies": { - "@types/istanbul-lib-coverage": "*" + "@types/node": "*" } }, - "node_modules/@types/istanbul-reports": { - "version": "3.0.3", + "node_modules/@types/connect-history-api-fallback": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz", + "integrity": "sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw==", "dev": true, "license": "MIT", "dependencies": { - "@types/istanbul-lib-report": "*" + "@types/express-serve-static-core": "*", + "@types/node": "*" } }, - "node_modules/@types/jsdom": { - "version": "20.0.1", + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", "dev": true, "license": "MIT", "dependencies": { - "@types/node": "*", - "@types/tough-cookie": "*", - "parse5": "^7.0.0" + "@types/estree": "*", + "@types/json-schema": "*" } }, - "node_modules/@types/node": { - "version": "20.8.7", + "node_modules/@types/eslint-scope": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~5.25.1" + "@types/eslint": "*", + "@types/estree": "*" } }, - "node_modules/@types/stack-utils": { - "version": "2.0.2", + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "dev": true, "license": "MIT" }, - "node_modules/@types/tough-cookie": { - "version": "4.0.4", + "node_modules/@types/express": { + "version": "4.17.25", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.25.tgz", + "integrity": "sha512-dVd04UKsfpINUnK0yBoYHDF3xu7xVH4BuDotC/xGuycx4CgbP48X/KF/586bcObxT0HENHXEU8Nqtu6NR+eKhw==", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "^1" + } }, - "node_modules/@types/yargs": { - "version": "17.0.29", + "node_modules/@types/express-serve-static-core": { + "version": "4.19.7", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.7.tgz", + "integrity": "sha512-FvPtiIf1LfhzsaIXhv/PHan/2FeQBbtBDtfX2QfvPxdUelMDEckK08SM6nqo1MIZY3RUlfA+HV8+hFUSio78qg==", "dev": true, "license": "MIT", "dependencies": { - "@types/yargs-parser": "*" + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" } }, - "node_modules/@types/yargs-parser": { - "version": "21.0.2", + "node_modules/@types/graceful-fs": { + "version": "4.1.8", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "@types/node": "*" + } }, - "node_modules/@zeit/schemas": { - "version": "2.36.0", - "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz", - "integrity": "sha512-7kjMwcChYEzMKjeex9ZFXkt1AyNov9R5HZtjBKVsmVpw7pa7ZtlCGvCBC2vnnXctaYN+aRI61HjIqeetZW5ROg==", + "node_modules/@types/html-minifier-terser": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", + "integrity": "sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==", "dev": true, "license": "MIT" }, - "node_modules/abab": { - "version": "2.0.6", + "node_modules/@types/http-errors": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.5.tgz", + "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", "dev": true, - "license": "BSD-3-Clause" + "license": "MIT" }, - "node_modules/acorn": { - "version": "8.10.0", + "node_modules/@types/http-proxy": { + "version": "1.17.17", + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.17.tgz", + "integrity": "sha512-ED6LB+Z1AVylNTu7hdzuBqOgMnvG/ld6wGCG8wFnAzKX5uyW2K3WD52v0gnLCTK/VLpXtKckgWuyScYK6cSPaw==", "dev": true, "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" + "dependencies": { + "@types/node": "*" } }, - "node_modules/acorn-globals": { - "version": "7.0.1", + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jsdom": { + "version": "20.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "20.8.7", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.25.1" + } + }, + "node_modules/@types/node-forge": { + "version": "1.3.14", + "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.14.tgz", + "integrity": "sha512-mhVF2BnD4BO+jtOp7z1CdzaK4mbuK0LLQYAvdOLqHTavxFNq4zA1EmYkpnFjP8HOUzedfQkRnp0E2ulSAYSzAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/retry": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", + "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz", + "integrity": "sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/serve-index": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/@types/serve-index/-/serve-index-1.9.4.tgz", + "integrity": "sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/express": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.10", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.10.tgz", + "integrity": "sha512-tRs1dB+g8Itk72rlSI2ZrW6vZg0YrLI81iQSTkMmOqnqCaNr/8Ek4VwWcN5vZgCYWbg/JJSGBlUaYGAOP73qBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "<1" + } + }, + "node_modules/@types/serve-static/node_modules/@types/send": { + "version": "0.17.6", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.6.tgz", + "integrity": "sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/sockjs": { + "version": "0.3.36", + "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", + "integrity": "sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/stack-utils": { + "version": "2.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/tough-cookie": { + "version": "4.0.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yargs": { + "version": "17.0.29", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz", + "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", + "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", + "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", + "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", + "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", + "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", + "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", + "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", + "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", + "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", + "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/helper-wasm-section": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-opt": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1", + "@webassemblyjs/wast-printer": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", + "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", + "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", + "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-api-error": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", + "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.14.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.1.1.tgz", + "integrity": "sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.2.tgz", + "integrity": "sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.5.tgz", + "integrity": "sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/@zeit/schemas": { + "version": "2.36.0", + "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz", + "integrity": "sha512-7kjMwcChYEzMKjeex9ZFXkt1AyNov9R5HZtjBKVsmVpw7pa7ZtlCGvCBC2vnnXctaYN+aRI61HjIqeetZW5ROg==", + "dev": true, + "license": "MIT" + }, + "node_modules/abab": { + "version": "2.0.6", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/accepts/node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-globals": { + "version": "7.0.1", "dev": true, "license": "MIT", "dependencies": { @@ -2699,6 +3339,19 @@ "acorn-walk": "^8.0.2" } }, + "node_modules/acorn-import-phases": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz", + "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.13.0" + }, + "peerDependencies": { + "acorn": "^8.14.0" + } + }, "node_modules/acorn-walk": { "version": "8.2.0", "dev": true, @@ -2735,6 +3388,37 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, "node_modules/ansi-align": { "version": "3.0.1", "dev": true, @@ -2775,6 +3459,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ansi-html-community": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz", + "integrity": "sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==", + "dev": true, + "engines": [ + "node >= 0.8.0" + ], + "license": "Apache-2.0", + "bin": { + "ansi-html": "bin/ansi-html" + } + }, "node_modules/ansi-regex": { "version": "5.0.1", "dev": true, @@ -2847,6 +3544,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "dev": true, + "license": "MIT" + }, "node_modules/asynckit": { "version": "0.4.0", "dev": true, @@ -2928,23 +3632,33 @@ "dev": true, "license": "MIT" }, - "node_modules/babel-jest/node_modules/has-flag": { - "version": "4.0.0", + "node_modules/babel-jest/node_modules/supports-color": { + "version": "7.2.0", "dev": true, "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, "engines": { "node": ">=8" } }, - "node_modules/babel-jest/node_modules/supports-color": { - "version": "7.2.0", + "node_modules/babel-loader": { + "version": "9.1.3", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", + "integrity": "sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==", "dev": true, "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" + "find-cache-dir": "^4.0.0", + "schema-utils": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">= 14.15.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0", + "webpack": ">=5" } }, "node_modules/babel-plugin-istanbul": { @@ -3054,6 +3768,109 @@ "dev": true, "license": "MIT" }, + "node_modules/baseline-browser-mapping": { + "version": "2.8.30", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.30.tgz", + "integrity": "sha512-aTUKW4ptQhS64+v2d6IkPzymEzzhw+G0bA1g3uBRV3+ntkH+svttKseW5IOR4Ed6NUVKqnY7qT3dKvzQ7io4AA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.js" + } + }, + "node_modules/batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", + "dev": true, + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/bonjour-service": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.3.0.tgz", + "integrity": "sha512-3YuAUiSkWykd+2Azjgyxei8OWf8thdn8AITIog2M4UICzoqfjlqr64WIjEXZllf/W6vK1goqleSR6brGomxQqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "multicast-dns": "^7.2.5" + } + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true, + "license": "ISC" + }, "node_modules/boxen": { "version": "7.0.0", "dev": true, @@ -3133,7 +3950,9 @@ } }, "node_modules/browserslist": { - "version": "4.22.1", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.0.tgz", + "integrity": "sha512-tbydkR/CxfMwelN0vwdP/pLkDwyAASZ+VfWm4EOwlB6SWhx1sYnWLqo8N5j0rAzPfzfRaxt0mM/4wPU/Su84RQ==", "dev": true, "funding": [ { @@ -3151,10 +3970,11 @@ ], "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001541", - "electron-to-chromium": "^1.4.535", - "node-releases": "^2.0.13", - "update-browserslist-db": "^1.0.13" + "baseline-browser-mapping": "^2.8.25", + "caniuse-lite": "^1.0.30001754", + "electron-to-chromium": "^1.5.249", + "node-releases": "^2.0.27", + "update-browserslist-db": "^1.1.4" }, "bin": { "browserslist": "cli.js" @@ -3176,6 +3996,22 @@ "dev": true, "license": "MIT" }, + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -3213,6 +4049,23 @@ "node": ">= 0.4" } }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/callsites": { "version": "3.1.0", "dev": true, @@ -3221,6 +4074,17 @@ "node": ">=6" } }, + "node_modules/camel-case": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", + "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, "node_modules/camelcase": { "version": "5.3.1", "dev": true, @@ -3230,7 +4094,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001553", + "version": "1.0.30001756", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001756.tgz", + "integrity": "sha512-4HnCNKbMLkLdhJz3TToeVWHSnfJvPaq6vu/eRP0Ahub/07n484XHhBF5AJoSGHdVrS8tKFauUQz8Bp9P7LVx7A==", "dev": true, "funding": [ { @@ -3307,14 +4173,6 @@ "dev": true, "license": "MIT" }, - "node_modules/chalk-template/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/chalk-template/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -3334,6 +4192,54 @@ "node": ">=10" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/chrome-trace-event": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", + "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0" + } + }, "node_modules/ci-info": { "version": "3.9.0", "dev": true, @@ -3353,6 +4259,19 @@ "dev": true, "license": "MIT" }, + "node_modules/clean-css": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", + "integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "source-map": "~0.6.0" + }, + "engines": { + "node": ">= 10.0" + } + }, "node_modules/cli-boxes": { "version": "3.0.0", "dev": true, @@ -3457,6 +4376,21 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/co": { "version": "4.6.0", "dev": true, @@ -3471,6 +4405,13 @@ "dev": true, "license": "MIT" }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true, + "license": "MIT" + }, "node_modules/combined-stream": { "version": "1.0.8", "dev": true, @@ -3482,6 +4423,23 @@ "node": ">= 0.8" } }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/common-path-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", + "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", + "dev": true, + "license": "ISC" + }, "node_modules/compressible": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", @@ -3536,6 +4494,16 @@ "dev": true, "license": "MIT" }, + "node_modules/connect-history-api-fallback": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz", + "integrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, "node_modules/content-disposition": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", @@ -3546,11 +4514,63 @@ "node": ">= 0.6" } }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/convert-source-map": { "version": "2.0.0", "dev": true, "license": "MIT" }, + "node_modules/cookie": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/copy-webpack-plugin": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz", + "integrity": "sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-glob": "^3.2.11", + "glob-parent": "^6.0.1", + "globby": "^13.1.1", + "normalize-path": "^3.0.0", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "engines": { + "node": ">= 14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, "node_modules/core-js-compat": { "version": "3.33.1", "dev": true, @@ -3563,6 +4583,13 @@ "url": "https://opencollective.com/core-js" } }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, + "license": "MIT" + }, "node_modules/create-jest": { "version": "29.7.0", "dev": true, @@ -3628,14 +4655,6 @@ "dev": true, "license": "MIT" }, - "node_modules/create-jest/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/create-jest/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -3662,11 +4681,94 @@ "node": ">= 8" } }, + "node_modules/css-loader": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.8.1.tgz", + "integrity": "sha512-xDAXtEVGlD0gJ07iclwWVkLoZOpEvAWaSyf6W18S2pOC//K8+qUDIx8IIT3D+HjnmkJPQeesOPv5aiUaJsCM2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "icss-utils": "^5.1.0", + "postcss": "^8.4.21", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.3", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "semver": "^7.3.8" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/css-loader/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/css-select": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", + "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.0.1", + "domhandler": "^4.3.1", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", + "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/css.escape": { "version": "1.5.1", "dev": true, "license": "MIT" }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/cssom": { "version": "0.5.0", "dev": true, @@ -3774,6 +4876,36 @@ "node": ">=0.10.0" } }, + "node_modules/default-browser": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.4.0.tgz", + "integrity": "sha512-XDuvSq38Hr1MdN47EDvYtx3U0MTqpCEn+F6ft8z2vYDzMrvQhVp0ui9oQdqW3MvK3vqUETglt1tVGgjLuJ5izg==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.1.tgz", + "integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/define-data-property": { "version": "1.1.1", "dev": true, @@ -3787,6 +4919,19 @@ "node": ">= 0.4" } }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/define-properties": { "version": "1.2.1", "dev": true, @@ -3811,6 +4956,27 @@ "node": ">=0.4.0" } }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "dev": true, @@ -3819,6 +4985,13 @@ "node": ">=8" } }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true, + "license": "MIT" + }, "node_modules/diff-sequences": { "version": "29.6.3", "dev": true, @@ -3827,11 +5000,85 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dns-packet": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz", + "integrity": "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@leichtgewicht/ip-codec": "^2.0.1" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/dom-accessibility-api": { "version": "0.5.16", "dev": true, "license": "MIT" }, + "node_modules/dom-converter": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", + "integrity": "sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==", + "dev": true, + "license": "MIT", + "dependencies": { + "utila": "~0.4" + } + }, + "node_modules/dom-serializer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", + "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", + "dev": true, + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/dom-serializer/node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "dev": true, + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, "node_modules/domexception": { "version": "4.0.0", "dev": true, @@ -3843,6 +5090,48 @@ "node": ">=12" } }, + "node_modules/domhandler": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", + "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -3863,8 +5152,17 @@ "dev": true, "license": "MIT" }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "dev": true, + "license": "MIT" + }, "node_modules/electron-to-chromium": { - "version": "1.4.564", + "version": "1.5.258", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.258.tgz", + "integrity": "sha512-rHUggNV5jKQ0sSdWwlaRDkFc3/rRJIVnOSe9yR4zrR07m3ZxhP4N27Hlg8VeJGGYgFTxK5NqDmWI4DSH72vIJg==", "dev": true, "license": "ISC" }, @@ -3872,18 +5170,42 @@ "version": "0.13.1", "dev": true, "license": "MIT", - "engines": { - "node": ">=12" + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "dev": true, + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.18.3", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz", + "integrity": "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" }, - "funding": { - "url": "https://github.com/sindresorhus/emittery?sponsor=1" + "engines": { + "node": ">=10.13.0" } }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "dev": true, - "license": "MIT" - }, "node_modules/entities": { "version": "4.5.0", "dev": true, @@ -3895,6 +5217,19 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/envinfo": { + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.20.0.tgz", + "integrity": "sha512-+zUomDcLXsVkQ37vUqWBvQwLaLlj8eZPSi61llaEFAVBY5mhcXdaSw1pSJVl4yTYD5g/gEfpNl28YYk4IPvrrg==", + "dev": true, + "license": "MIT", + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/error-ex": { "version": "1.3.2", "dev": true, @@ -3942,6 +5277,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", @@ -3972,13 +5314,22 @@ } }, "node_modules/escalade": { - "version": "3.1.1", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, "license": "MIT", "engines": { "node": ">=6" } }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true, + "license": "MIT" + }, "node_modules/escodegen": { "version": "2.1.0", "dev": true, @@ -3999,6 +5350,30 @@ "source-map": "~0.6.1" } }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-scope/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, "node_modules/esprima": { "version": "4.0.1", "dev": true, @@ -4011,6 +5386,19 @@ "node": ">=4" } }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, "node_modules/estraverse": { "version": "5.3.0", "dev": true, @@ -4027,6 +5415,33 @@ "node": ">=0.10.0" } }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true, + "license": "MIT" + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, "node_modules/execa": { "version": "5.1.1", "dev": true, @@ -4056,52 +5471,366 @@ "node": ">= 0.8.0" } }, - "node_modules/expect": { - "version": "29.7.0", + "node_modules/expect": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/express": { + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express/node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/express/node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/express/node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/faye-websocket": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", + "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "websocket-driver": ">=0.5.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/find-cache-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-4.0.0.tgz", + "integrity": "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "common-path-prefix": "^3.0.0", + "pkg-dir": "^7.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/expect-utils": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0" + "yocto-queue": "^1.0.0" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "node_modules/find-cache-dir/node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", + "node_modules/find-cache-dir/node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } }, - "node_modules/fb-watchman": { - "version": "2.0.2", + "node_modules/find-cache-dir/node_modules/pkg-dir": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", + "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", "dev": true, - "license": "Apache-2.0", + "license": "MIT", "dependencies": { - "bser": "2.1.1" + "find-up": "^6.3.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "node_modules/find-cache-dir/node_modules/yocto-queue": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.2.tgz", + "integrity": "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==", "dev": true, "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, "engines": { - "node": ">=8" + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/find-up": { @@ -4116,6 +5845,37 @@ "node": ">=8" } }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.3", "dev": true, @@ -4141,6 +5901,26 @@ "node": ">= 6" } }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "dev": true, @@ -4267,6 +6047,43 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob-to-regex.js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/glob-to-regex.js/-/glob-to-regex.js-1.2.0.tgz", + "integrity": "sha512-QMwlOQKU/IzqMUOAZWubUOT8Qft+Y0KQWnX9nK3ch0CJg0tTp4TvGZsTfudYKv2NzoQSyPcnA6TYeIQ3jGichQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true, + "license": "BSD-2-Clause" + }, "node_modules/globals": { "version": "11.12.0", "dev": true, @@ -4275,6 +6092,39 @@ "node": ">=4" } }, + "node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -4293,6 +6143,13 @@ "dev": true, "license": "ISC" }, + "node_modules/handle-thing": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", + "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", + "dev": true, + "license": "MIT" + }, "node_modules/has-bigints": { "version": "1.0.2", "dev": true, @@ -4301,6 +6158,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/has-property-descriptors": { "version": "1.0.1", "dev": true, @@ -4354,6 +6221,69 @@ "node": ">= 0.4" } }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "node_modules/hpack.js/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/hpack.js/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/hpack.js/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/hpack.js/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, "node_modules/html-encoding-sniffer": { "version": "3.0.0", "dev": true, @@ -4370,6 +6300,128 @@ "dev": true, "license": "MIT" }, + "node_modules/html-minifier-terser": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", + "integrity": "sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "camel-case": "^4.1.2", + "clean-css": "^5.2.2", + "commander": "^8.3.0", + "he": "^1.2.0", + "param-case": "^3.0.4", + "relateurl": "^0.2.7", + "terser": "^5.10.0" + }, + "bin": { + "html-minifier-terser": "cli.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/html-webpack-plugin": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.5.3.tgz", + "integrity": "sha512-6YrDKTuqaP/TquFH7h4srYWsZx+x6k6+FbsTm0ziCwGHDP78Unr1r9F/H4+sGmMbX08GQcJ+K64x55b+7VM/jg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/html-minifier-terser": "^6.0.0", + "html-minifier-terser": "^6.0.2", + "lodash": "^4.17.21", + "pretty-error": "^4.0.0", + "tapable": "^2.0.0" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/html-webpack-plugin" + }, + "peerDependencies": { + "webpack": "^5.20.0" + } + }, + "node_modules/htmlparser2": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "dev": true, + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "node_modules/htmlparser2/node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "dev": true, + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==", + "dev": true, + "license": "MIT" + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-parser-js": { + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.10.tgz", + "integrity": "sha512-Pysuw9XpUq5dVc/2SMHpuTY01RFl8fttgcyunjL7eEMhGM3cI4eOmiCycJDVCo/7O7ClfQD3SaI6ftDzqOXYMA==", + "dev": true, + "license": "MIT" + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/http-proxy-agent": { "version": "5.0.0", "dev": true, @@ -4379,8 +6431,33 @@ "agent-base": "6", "debug": "4" }, - "engines": { - "node": ">= 6" + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-proxy-middleware": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.9.tgz", + "integrity": "sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-proxy": "^1.17.8", + "http-proxy": "^1.18.1", + "is-glob": "^4.0.1", + "is-plain-obj": "^3.0.0", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "@types/express": "^4.17.13" + }, + "peerDependenciesMeta": { + "@types/express": { + "optional": true + } } }, "node_modules/https-proxy-agent": { @@ -4403,6 +6480,16 @@ "node": ">=10.17.0" } }, + "node_modules/hyperdyperid": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hyperdyperid/-/hyperdyperid-1.2.0.tgz", + "integrity": "sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.18" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "dev": true, @@ -4414,6 +6501,29 @@ "node": ">=0.10.0" } }, + "node_modules/icss-utils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/import-local": { "version": "3.1.0", "dev": true, @@ -4480,6 +6590,26 @@ "node": ">= 0.4" } }, + "node_modules/interpret": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/ipaddr.js": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", + "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, "node_modules/is-arguments": { "version": "1.1.1", "dev": true, @@ -4524,6 +6654,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-boolean-object": { "version": "1.1.2", "dev": true, @@ -4589,6 +6732,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "dev": true, @@ -4605,6 +6758,54 @@ "node": ">=6" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-inside-container/node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-map": { "version": "2.0.2", "dev": true, @@ -4613,6 +6814,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-network-error": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.3.0.tgz", + "integrity": "sha512-6oIwpsgRfnDiyEDLMay/GqCl3HoAtH5+RUKW29gYkL0QA+ipzpDLA16yQs7/RHCSu+BwgbJaOUqa4A99qNVQVw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -4637,6 +6851,32 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-plain-obj": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", + "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "license": "MIT", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-port-reachable": { "version": "4.0.0", "dev": true, @@ -4781,6 +7021,16 @@ "dev": true, "license": "ISC" }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "dev": true, @@ -4817,14 +7067,6 @@ "node": ">=10" } }, - "node_modules/istanbul-lib-report/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/istanbul-lib-report/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -4974,14 +7216,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-circus/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-circus/node_modules/pretty-format": { "version": "29.7.0", "dev": true, @@ -5099,14 +7333,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-cli/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-cli/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -5207,14 +7433,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-config/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-config/node_modules/pretty-format": { "version": "29.7.0", "dev": true, @@ -5314,14 +7532,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-diff/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-diff/node_modules/pretty-format": { "version": "29.7.0", "dev": true, @@ -5433,14 +7643,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-each/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-each/node_modules/pretty-format": { "version": "29.7.0", "dev": true, @@ -5751,14 +7953,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-matcher-utils/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-matcher-utils/node_modules/pretty-format": { "version": "29.7.0", "dev": true, @@ -5863,14 +8057,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-message-util/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-message-util/node_modules/pretty-format": { "version": "29.7.0", "dev": true, @@ -6024,14 +8210,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-resolve/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-resolve/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -6119,14 +8297,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-runner/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-runner/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -6215,14 +8385,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-runtime/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-runtime/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -6309,14 +8471,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-snapshot/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-snapshot/node_modules/lru-cache": { "version": "6.0.0", "dev": true, @@ -6448,14 +8602,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-util/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-util/node_modules/supports-color": { "version": "7.2.0", "dev": true, @@ -6539,14 +8685,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-validate/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-validate/node_modules/pretty-format": { "version": "29.7.0", "dev": true, @@ -6650,59 +8788,29 @@ "dev": true, "license": "MIT" }, - "node_modules/jest-watcher/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/jest-watcher/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker": { - "version": "29.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "jest-util": "^29.7.0", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "4.0.0", + "version": "7.2.0", "dev": true, "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, "engines": { "node": ">=8" } }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", + "node_modules/jest-worker": { + "version": "29.7.0", "dev": true, "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/js-tokens": { @@ -6799,6 +8907,16 @@ "node": ">=6" } }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/kleur": { "version": "3.0.3", "dev": true, @@ -6807,6 +8925,17 @@ "node": ">=6" } }, + "node_modules/launch-editor": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.12.0.tgz", + "integrity": "sha512-giOHXoOtifjdHqUamwKq6c49GzBdLjvxrd2D+Q4V6uOHopJv7p9VJxikDsQ/CBXZbEITgUqSVHXLTG3VhPP1Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "picocolors": "^1.1.1", + "shell-quote": "^1.8.3" + } + }, "node_modules/leven": { "version": "3.1.0", "dev": true, @@ -6820,6 +8949,20 @@ "dev": true, "license": "MIT" }, + "node_modules/loader-runner": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz", + "integrity": "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.11.5" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/locate-path": { "version": "5.0.0", "dev": true, @@ -6841,6 +8984,16 @@ "dev": true, "license": "MIT" }, + "node_modules/lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.3" + } + }, "node_modules/lru-cache": { "version": "5.1.1", "dev": true, @@ -6919,11 +9072,70 @@ "node": ">= 0.4" } }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/memfs": { + "version": "4.51.0", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-4.51.0.tgz", + "integrity": "sha512-4zngfkVM/GpIhC8YazOsM6E8hoB33NP0BCESPOA6z7qaL6umPJNqkO8CNYaLV2FB2MV6H1O3x2luHHOSqppv+A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jsonjoy.com/json-pack": "^1.11.0", + "@jsonjoy.com/util": "^1.9.0", + "glob-to-regex.js": "^1.0.1", + "thingies": "^2.5.0", + "tree-dump": "^1.0.3", + "tslib": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "dev": true, "license": "MIT" }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -6938,6 +9150,19 @@ "node": ">=8.6" } }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/mime-db": { "version": "1.52.0", "dev": true, @@ -6973,6 +9198,34 @@ "node": ">=4" } }, + "node_modules/mini-css-extract-plugin": { + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.9.4.tgz", + "integrity": "sha512-ZWYT7ln73Hptxqxk2DxPU9MmapXRhxkJD6tkSR04dnQxm8BGu2hzgKLugK5yySD97u/8yy7Ma7E76k9ZdvtjkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "schema-utils": "^4.0.0", + "tapable": "^2.2.1" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true, + "license": "ISC" + }, "node_modules/minimatch": { "version": "3.1.2", "dev": true, @@ -6997,6 +9250,39 @@ "dev": true, "license": "MIT" }, + "node_modules/multicast-dns": { + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz", + "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", + "dev": true, + "license": "MIT", + "dependencies": { + "dns-packet": "^5.2.2", + "thunky": "^1.0.2" + }, + "bin": { + "multicast-dns": "cli.js" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "dev": true, @@ -7012,13 +9298,43 @@ "node": ">= 0.6" } }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true, + "license": "MIT" + }, + "node_modules/no-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, + "node_modules/node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "dev": true, + "license": "(BSD-3-Clause OR GPL-2.0)", + "engines": { + "node": ">= 6.13.0" + } + }, "node_modules/node-int64": { "version": "0.4.0", "dev": true, "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.13", + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", "dev": true, "license": "MIT" }, @@ -7041,15 +9357,33 @@ "node": ">=8" } }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, "node_modules/nwsapi": { "version": "2.2.7", "dev": true, "license": "MIT" }, "node_modules/object-inspect": { - "version": "1.13.1", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", "dev": true, "license": "MIT", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -7094,6 +9428,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true, + "license": "MIT" + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/on-headers": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz", @@ -7126,6 +9480,25 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/open": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.2.0.tgz", + "integrity": "sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "wsl-utils": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-limit": { "version": "3.1.0", "dev": true, @@ -7165,6 +9538,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-retry": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-6.2.1.tgz", + "integrity": "sha512-hEt02O4hUct5wtwg4H4KcWgDdm+l1bOaEy/hWzd8xtXB9BqxTWBBhb+2ImAtH4Cv4rPjV76xN3Zumqk3k3AhhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/retry": "0.12.2", + "is-network-error": "^1.0.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-try": { "version": "2.2.0", "dev": true, @@ -7173,6 +9564,17 @@ "node": ">=6" } }, + "node_modules/param-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", + "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", + "dev": true, + "license": "MIT", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/parse-json": { "version": "5.2.0", "dev": true, @@ -7201,6 +9603,27 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/pascal-case": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", + "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, "node_modules/path-exists": { "version": "4.0.0", "dev": true, @@ -7244,6 +9667,16 @@ "dev": true, "license": "MIT" }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -7256,36 +9689,150 @@ "dev": true, "license": "MIT", "engines": { - "node": ">=8.6" + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-modules-extract-imports": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", + "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-local-by-default": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.2.0.tgz", + "integrity": "sha512-5kcJm/zk+GJDSfw+V/42fJ5fhjL5YbFDl8nVdXkJPLLW+Vf9mTD5Xe0wqIaDnLuL2U6cDNpTr+UQ+v2HWIBhzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^7.0.0", + "postcss-value-parser": "^4.1.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "peerDependencies": { + "postcss": "^8.1.0" } }, - "node_modules/pirates": { - "version": "4.0.6", + "node_modules/postcss-modules-scope": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.1.tgz", + "integrity": "sha512-m9jZstCVaqGjTAuny8MdgE88scJnCiQSlSrOWcTQgM2t32UBe+MUmFSO5t7VMSfAf/FJKImAxBav8ooCHJXCJA==", "dev": true, - "license": "MIT", + "license": "ISC", + "dependencies": { + "postcss-selector-parser": "^7.0.0" + }, "engines": { - "node": ">= 6" + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" } }, - "node_modules/pkg-dir": { - "version": "4.2.0", + "node_modules/postcss-modules-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", + "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "icss-utils": "^5.0.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-selector-parser": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.0.tgz", + "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "dev": true, "license": "MIT", "dependencies": { - "find-up": "^4.0.0" + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" }, "engines": { - "node": ">=8" + "node": ">=4" } }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true, + "license": "MIT" + }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", "dev": true, + "license": "MIT", "bin": { "prettier": "bin-prettier.js" }, @@ -7296,6 +9843,17 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/pretty-error": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz", + "integrity": "sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.20", + "renderkid": "^3.0.0" + } + }, "node_modules/pretty-format": { "version": "27.5.1", "dev": true, @@ -7320,6 +9878,13 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, + "license": "MIT" + }, "node_modules/prompts": { "version": "2.4.2", "dev": true, @@ -7332,6 +9897,30 @@ "node": ">= 6" } }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-addr/node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/psl": { "version": "1.9.0", "dev": true, @@ -7362,11 +9951,58 @@ ], "license": "MIT" }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/querystringify": { "version": "2.2.0", "dev": true, "license": "MIT" }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/range-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", @@ -7377,6 +10013,35 @@ "node": ">= 0.6" } }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/rc": { "version": "1.2.8", "dev": true, @@ -7404,6 +10069,47 @@ "dev": true, "license": "MIT" }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve": "^1.20.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, "node_modules/redent": { "version": "3.0.0", "dev": true, @@ -7517,6 +10223,30 @@ "jsesc": "bin/jsesc" } }, + "node_modules/relateurl": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", + "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/renderkid": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-3.0.0.tgz", + "integrity": "sha512-q/7VIQA8lmM1hF+jn+sFSPWGlMkSAeNYcPLmDQx2zzuiDfaLrOmumR8iaUKlenFgh0XRPIUeSPlH3A+AW3Z5pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-select": "^4.1.3", + "dom-converter": "^0.2.0", + "htmlparser2": "^6.1.0", + "lodash": "^4.17.21", + "strip-ansi": "^6.0.1" + } + }, "node_modules/require-directory": { "version": "2.1.1", "dev": true, @@ -7583,11 +10313,69 @@ "node": ">=10" } }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rrweb-cssom": { "version": "0.6.0", "dev": true, "license": "MIT" }, + "node_modules/run-applescript": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz", + "integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -7625,12 +10413,132 @@ "node": ">=v12.22.7" } }, + "node_modules/schema-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz", + "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", + "dev": true, + "license": "MIT" + }, + "node_modules/selfsigned": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", + "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node-forge": "^1.3.0", + "node-forge": "^1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/semver": { "version": "6.3.1", "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/send/node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" } }, "node_modules/serve": { @@ -7708,6 +10616,108 @@ "node": ">= 0.6" } }, + "node_modules/serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-index/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/serve-index/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", + "dev": true, + "license": "ISC" + }, + "node_modules/serve-index/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/serve-index/node_modules/setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/serve-index/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/serve/node_modules/chalk": { "version": "5.0.1", "dev": true, @@ -7746,6 +10756,26 @@ "node": ">= 0.4" } }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true, + "license": "ISC" + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "dev": true, @@ -7765,14 +10795,90 @@ "node": ">=8" } }, + "node_modules/shell-quote": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz", + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/side-channel": { - "version": "1.0.4", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -7796,6 +10902,18 @@ "node": ">=8" } }, + "node_modules/sockjs": { + "version": "0.3.24", + "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", + "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "faye-websocket": "^0.11.3", + "uuid": "^8.3.2", + "websocket-driver": "^0.7.4" + } + }, "node_modules/source-map": { "version": "0.6.1", "dev": true, @@ -7804,6 +10922,16 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-support": { "version": "0.5.13", "dev": true, @@ -7813,6 +10941,38 @@ "source-map": "^0.6.0" } }, + "node_modules/spdy": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", + "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/spdy-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", + "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "dev": true, @@ -7837,6 +10997,16 @@ "node": ">=8" } }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/stop-iteration-iterator": { "version": "1.0.0", "dev": true, @@ -7848,6 +11018,16 @@ "node": ">= 0.4" } }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-length": { "version": "4.0.2", "dev": true, @@ -7950,22 +11130,156 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/style-loader": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.3.tgz", + "integrity": "sha512-53BiGLXAcll9maCYtZi2RCQZKa8NQQai5C4horqKyRmHj9H7QmcUyucrH+4KW/gBQbXM2AsB0axoEcFZPlfPcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "dev": true, "license": "MIT", - "engines": { - "node": ">= 0.4" + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "dev": true, + "license": "MIT" + }, + "node_modules/tapable": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", + "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/terser": { + "version": "5.44.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.44.1.tgz", + "integrity": "sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.15.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.14", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz", + "integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.25", + "jest-worker": "^27.4.5", + "schema-utils": "^4.3.0", + "serialize-javascript": "^6.0.2", + "terser": "^5.31.1" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/terser-webpack-plugin/node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">= 10.13.0" } }, - "node_modules/symbol-tree": { - "version": "3.2.4", + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true, "license": "MIT" }, + "node_modules/terser/node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "dev": true, @@ -7979,6 +11293,30 @@ "node": ">=8" } }, + "node_modules/thingies": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/thingies/-/thingies-2.5.0.tgz", + "integrity": "sha512-s+2Bwztg6PhWUD7XMfeYm5qliDdSiZm7M7n8KjTkIsm3l/2lgVRc2/Gx/v+ZX8lT4FMA+i8aQvhcWylldc+ZNw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "^2" + } + }, + "node_modules/thunky": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", + "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", + "dev": true, + "license": "MIT" + }, "node_modules/tmpl": { "version": "1.0.5", "dev": true, @@ -7997,6 +11335,16 @@ "node": ">=8.0" } }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, "node_modules/tough-cookie": { "version": "4.1.3", "dev": true, @@ -8022,6 +11370,30 @@ "node": ">=14" } }, + "node_modules/tree-dump": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tree-dump/-/tree-dump-1.1.0.tgz", + "integrity": "sha512-rMuvhU4MCDbcbnleZTFezWsaZXRFemSqAM+7jPnzUl1fo9w3YEKOxAeui0fz3OI4EU4hf23iyA7uQRVko+UaBA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, "node_modules/type-detect": { "version": "4.0.8", "dev": true, @@ -8041,6 +11413,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/undici-types": { "version": "5.25.3", "dev": true, @@ -8090,8 +11476,20 @@ "node": ">= 4.0.0" } }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/update-browserslist-db": { - "version": "1.0.13", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.4.tgz", + "integrity": "sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A==", "dev": true, "funding": [ { @@ -8109,8 +11507,8 @@ ], "license": "MIT", "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.2.0", + "picocolors": "^1.1.1" }, "bin": { "update-browserslist-db": "cli.js" @@ -8147,6 +11545,40 @@ "requires-port": "^1.0.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/utila": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", + "integrity": "sha512-Z0DbgELS9/L/75wZbro8xAnT50pBVFQZ+hUEueGDU5FN51YSCYM+jdxsfCiHjwNP/4LCDD0i/graKpeBnOXKRA==", + "dev": true, + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/v8-to-istanbul": { "version": "9.1.3", "dev": true, @@ -8189,6 +11621,30 @@ "makeerror": "1.0.12" } }, + "node_modules/watchpack": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.4.tgz", + "integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimalistic-assert": "^1.0.0" + } + }, "node_modules/webidl-conversions": { "version": "7.0.0", "dev": true, @@ -8197,6 +11653,286 @@ "node": ">=12" } }, + "node_modules/webpack": { + "version": "5.102.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.102.1.tgz", + "integrity": "sha512-7h/weGm9d/ywQ6qzJ+Xy+r9n/3qgp/thalBbpOi5i223dPXKi04IBtqPN9nTd+jBc7QKfvDbaBnFipYp4sJAUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.8", + "@types/json-schema": "^7.0.15", + "@webassemblyjs/ast": "^1.14.1", + "@webassemblyjs/wasm-edit": "^1.14.1", + "@webassemblyjs/wasm-parser": "^1.14.1", + "acorn": "^8.15.0", + "acorn-import-phases": "^1.0.3", + "browserslist": "^4.26.3", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.17.3", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^4.3.3", + "tapable": "^2.3.0", + "terser-webpack-plugin": "^5.3.11", + "watchpack": "^2.4.4", + "webpack-sources": "^3.3.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz", + "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^2.1.1", + "@webpack-cli/info": "^2.0.2", + "@webpack-cli/serve": "^2.0.5", + "colorette": "^2.0.14", + "commander": "^10.0.1", + "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/webpack-dev-middleware": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-7.4.5.tgz", + "integrity": "sha512-uxQ6YqGdE4hgDKNf7hUiPXOdtkXvBJXrfEGYSx7P7LC8hnUYGK70X6xQXUvXeNyBDDcsiQXpG2m3G9vxowaEuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "colorette": "^2.0.10", + "memfs": "^4.43.1", + "mime-types": "^3.0.1", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "schema-utils": "^4.0.0" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + } + } + }, + "node_modules/webpack-dev-middleware/node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/webpack-dev-middleware/node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/webpack-dev-middleware/node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/webpack-dev-server": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.2.2.tgz", + "integrity": "sha512-QcQ72gh8a+7JO63TAx/6XZf/CWhgMzu5m0QirvPfGvptOusAxG12w2+aua1Jkjr7hzaWDnJ2n6JFeexMHI+Zjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/bonjour": "^3.5.13", + "@types/connect-history-api-fallback": "^1.5.4", + "@types/express": "^4.17.21", + "@types/express-serve-static-core": "^4.17.21", + "@types/serve-index": "^1.9.4", + "@types/serve-static": "^1.15.5", + "@types/sockjs": "^0.3.36", + "@types/ws": "^8.5.10", + "ansi-html-community": "^0.0.8", + "bonjour-service": "^1.2.1", + "chokidar": "^3.6.0", + "colorette": "^2.0.10", + "compression": "^1.7.4", + "connect-history-api-fallback": "^2.0.0", + "express": "^4.21.2", + "graceful-fs": "^4.2.6", + "http-proxy-middleware": "^2.0.9", + "ipaddr.js": "^2.1.0", + "launch-editor": "^2.6.1", + "open": "^10.0.3", + "p-retry": "^6.2.0", + "schema-utils": "^4.2.0", + "selfsigned": "^2.4.1", + "serve-index": "^1.9.1", + "sockjs": "^0.3.24", + "spdy": "^4.0.2", + "webpack-dev-middleware": "^7.4.2", + "ws": "^8.18.0" + }, + "bin": { + "webpack-dev-server": "bin/webpack-dev-server.js" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + }, + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz", + "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/websocket-driver": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", + "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "http-parser-js": ">=0.5.1", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/websocket-extensions": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", + "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/whatwg-encoding": { "version": "2.0.0", "dev": true, @@ -8303,6 +12039,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "dev": true, + "license": "MIT" + }, "node_modules/wrap-ansi": { "version": "8.1.0", "dev": true, @@ -8394,6 +12137,38 @@ } } }, + "node_modules/wsl-utils": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.1.0.tgz", + "integrity": "sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-wsl": "^3.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wsl-utils/node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/xml-name-validator": { "version": "4.0.0", "dev": true, diff --git a/import/package.json b/import/package.json index 35da29b..cc2f4d6 100644 --- a/import/package.json +++ b/import/package.json @@ -1,28 +1,43 @@ { - "name": "import-tests", + "name": "import", "version": "1.0.0", "main": "index.test.js", "scripts": { - "start": "serve", + "build": "webpack --mode=production", + "build:dev": "webpack --mode=development", + "start": "serve dist", + "dev": "webpack serve --mode=development --open", "test": "jest", "prettier:check": "prettier --check \"**/*.{css,html,js,json,md,ts,tsx,yaml,yml}\" --ignore-path ../.prettierignore", "prettier:write": "prettier --write \"**/*.{css,html,js,json,md,ts,tsx,yaml,yml}\" --ignore-path ../.prettierignore" }, "repository": "git@github.com:tkhq/frames.git", "author": "Turnkey ", - "description": "This package is only here to help us test the main html file", + "description": "Import iframe with webpack-managed dependencies", "license": "MIT", + "dependencies": { + "@hpke/core": "1.7.5" + }, "devDependencies": { - "@babel/core": "^7.23.0", - "@babel/preset-env": "^7.22.20", - "@testing-library/dom": "^9.3.3", - "@testing-library/jest-dom": "^6.1.3", - "babel-jest": "^29.7.0", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", - "jsdom": "^22.1.0", - "prettier": "^2.8.4", - "regenerator-runtime": "^0.14.1", - "serve": "^14.2.1" + "@babel/core": "7.23.0", + "@babel/preset-env": "7.22.20", + "@testing-library/dom": "9.3.3", + "@testing-library/jest-dom": "6.1.3", + "babel-jest": "29.7.0", + "babel-loader": "9.1.3", + "copy-webpack-plugin": "11.0.0", + "css-loader": "6.8.1", + "html-webpack-plugin": "5.5.3", + "jest": "29.7.0", + "jest-environment-jsdom": "29.7.0", + "jsdom": "22.1.0", + "mini-css-extract-plugin": "2.9.4", + "prettier": "2.8.4", + "regenerator-runtime": "0.14.1", + "serve": "14.2.5", + "style-loader": "3.3.3", + "webpack": "5.102.1", + "webpack-cli": "5.1.4", + "webpack-dev-server": "5.2.2" } } diff --git a/import/src/index.js b/import/src/index.js new file mode 100644 index 0000000..d963801 --- /dev/null +++ b/import/src/index.js @@ -0,0 +1,405 @@ +import "./styles.css"; +import * as hpke from "@hpke/core"; +import * as TKHQ from "./turnkey-core.js"; + +// Make TKHQ available globally for backwards compatibility +window.TKHQ = TKHQ; + +// persist the MessageChannel object so we can use it to communicate with the parent window +var iframeMessagePort = null; + +// controllers to remove event listeners +const messageListenerController = new AbortController(); +const turnkeyInitController = new AbortController(); + +/** + * Message Event Handlers to process messages from the parent frame + */ +var messageEventListener = async function (event) { + if (event.data && event.data["type"] == "INJECT_IMPORT_BUNDLE") { + try { + await onInjectImportBundle( + event.data["value"], + event.data["organizationId"], + event.data["userId"], + event.data["requestId"] + ); + } catch (e) { + TKHQ.sendMessageUp("ERROR", e.toString(), event.data["requestId"]); + } + } + if (event.data && event.data["type"] == "EXTRACT_WALLET_ENCRYPTED_BUNDLE") { + try { + await onExtractWalletEncryptedBundle(event.data["requestId"]); + } catch (e) { + TKHQ.sendMessageUp("ERROR", e.toString(), event.data["requestId"]); + } + } + if (event.data && event.data["type"] == "EXTRACT_KEY_ENCRYPTED_BUNDLE") { + try { + await onExtractKeyEncryptedBundle( + event.data["keyFormat"], + event.data["requestId"] + ); + } catch (e) { + TKHQ.sendMessageUp("ERROR", e.toString(), event.data["requestId"]); + } + } + if (event.data && event.data["type"] == "APPLY_SETTINGS") { + try { + await onApplySettings(event.data["value"], event.data["requestId"]); + } catch (e) { + TKHQ.sendMessageUp("ERROR", e.toString(), event.data["requestId"]); + } + } +}; + +/** + * Broadcast that the frame is ready and set up the message event listeners + */ +document.addEventListener( + "DOMContentLoaded", + async function () { + window.addEventListener("message", messageEventListener, { + capture: false, + signal: messageListenerController.signal, + }); + + if (!messageListenerController.signal.aborted) { + // If styles are saved in local storage, sanitize and apply them. + const styleSettings = TKHQ.getSettings(); + if (styleSettings) { + TKHQ.applySettings(styleSettings); + } + // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently, + // init() waits for a public key to be initialized that can be used to send to the server + // which will encrypt messages to this public key. + // In the case of import, this public key is not used because the client encrypts messages + // to the server's public key. + TKHQ.sendMessageUp("PUBLIC_KEY_READY", ""); + + const plaintextTextarea = document.getElementById("plaintext"); + if (!plaintextTextarea) return; + // Clear clipboard after paste to avoid sensitive data lingering in clipboard. + + plaintextTextarea.addEventListener("paste", async () => { + // Let the paste happen first + try { + // Check clipboard-write permission first. In new versions of iframe-stamper, we add this permission when creating the iframe. In older versions, this permission is not added. + const permStatus = await navigator.permissions + .query({ name: "clipboard-write" }) // This is required to avoid error on clipboard write + .catch(() => null); + + // Proceed only if granted or promptable + if ( + permStatus?.state === "granted" || + permStatus?.state === "prompt" + ) { + await navigator.clipboard.writeText(""); + } + } catch { + // Silently ignore any errors — no warnings or console noise + } + }); + } + }, + false +); + +window.addEventListener( + "message", + async function (event) { + /** + * @turnkey/iframe-stamper >= v2.1.0 is using a MessageChannel to communicate with the parent frame. + * The parent frame sends a TURNKEY_INIT_MESSAGE_CHANNEL event with the MessagePort. + * If we receive this event, we want to remove the message event listener that was added in the DOMContentLoaded event to avoid processing messages twice. + * We persist the MessagePort so we can use it to communicate with the parent window in subsequent calls to TKHQ.sendMessageUp + */ + if ( + event.data && + event.data["type"] == "TURNKEY_INIT_MESSAGE_CHANNEL" && + event.ports?.[0] + ) { + // remove the message event listener that was added in the DOMContentLoaded event + messageListenerController.abort(); + + iframeMessagePort = event.ports[0]; + iframeMessagePort.onmessage = messageEventListener; + + TKHQ.setParentFrameMessageChannelPort(iframeMessagePort); + + // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently, + // init() waits for a public key to be initialized that can be used to send to the server + // which will encrypt messages to this public key. + // In the case of import, this public key is not used because the client encrypts messages + // to the server's public key. + TKHQ.sendMessageUp("PUBLIC_KEY_READY", ""); + + // remove the listener for TURNKEY_INIT_MESSAGE_CHANNEL after it's been processed + turnkeyInitController.abort(); + } + }, + { signal: turnkeyInitController.signal } +); + +// make sure the mnemonic does not include our splitter (\n--PASS--\n) string or \n characters +function validateMnemonic(mnemonic) { + if (mnemonic.includes("\n--PASS--\n")) { + throw new Error('mnemonic cannot include the string "\\n--PASS--\\n"'); + } + if (mnemonic.includes("\n")) { + throw new Error("mnemonic cannot include newline characters"); + } +} + +/** + * Function triggered when INJECT_IMPORT_BUNDLE event is received. + * Parses the `import_bundle` and stores the target public key as a JWK + * in local storage. Sends true upon success. + * @param {string} bundle + * Example bundle: {"targetPublic":"0491ccb68758b822a6549257f87769eeed37c6cb68a6c6255c5f238e2b6e6e61838c8ac857f2e305970a6435715f84e5a2e4b02a4d1e5289ba7ec7910e47d2d50f","targetPublicSignature":"3045022100cefc333c330c9fa300d1aa10a439a76539b4d6967301638ab9edc9fd9468bfdb0220339bba7e2b00b45d52e941d068ecd3bfd16fd1926da69dd7769893268990d62f","enclaveQuorumPublic":"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569"} + * @param {string} organizationId + * @param {string} userId + * @param {string} requestId + */ +async function onInjectImportBundle(bundle, organizationId, userId, requestId) { + let targetPublicBuf; + let verified; + + // Parse the import bundle + const bundleObj = JSON.parse(bundle); + + switch (bundleObj.version) { + case "v1.0.0": + // Validate fields exist + if (!bundleObj.data) { + throw new Error('missing "data" in bundle'); + } + if (!bundleObj.dataSignature) { + throw new Error('missing "dataSignature" in bundle'); + } + if (!bundleObj.enclaveQuorumPublic) { + throw new Error('missing "enclaveQuorumPublic" in bundle'); + } + + // Verify enclave signature + if (!TKHQ.verifyEnclaveSignature) { + throw new Error("method not loaded"); + } + verified = await TKHQ.verifyEnclaveSignature( + bundleObj.enclaveQuorumPublic, + bundleObj.dataSignature, + bundleObj.data + ); + if (!verified) { + throw new Error(`failed to verify enclave signature: ${bundle}`); + } + + // Parse the signed data. The data is produced by JSON encoding followed by hex encoding. We reverse this here. + const signedData = JSON.parse( + new TextDecoder().decode(TKHQ.uint8arrayFromHexString(bundleObj.data)) + ); + + // Validate fields match + if (!organizationId) { + // TODO: throw error if organization id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper + console.warn( + 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "organizationId" for security purposes.' + ); + } else if ( + !signedData.organizationId || + signedData.organizationId !== organizationId + ) { + throw new Error( + `organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.` + ); + } + if (!userId) { + // TODO: throw error if user id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper + console.warn( + 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "userId" for security purposes.' + ); + } else if (!signedData.userId || signedData.userId !== userId) { + throw new Error( + `user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.` + ); + } + + if (!signedData.targetPublic) { + throw new Error('missing "targetPublic" in bundle signed data'); + } + + // Load target public key generated from enclave and set in local storage + targetPublicBuf = TKHQ.uint8arrayFromHexString(signedData.targetPublic); + break; + default: + throw new Error(`unsupported version: ${bundleObj.version}`); + } + + const targetPublicKeyJwk = await TKHQ.loadTargetKey( + new Uint8Array(targetPublicBuf) + ); + TKHQ.setTargetEmbeddedKey(targetPublicKeyJwk); + + // Send up BUNDLE_INJECTED message + TKHQ.sendMessageUp("BUNDLE_INJECTED", true, requestId); +} + +/** + * Function triggered when EXTRACT_WALLET_ENCRYPTED_BUNDLE event is received. + * Prerequisite: This function uses the target public key in local storage that is imported + * from the INJECT_IMPORT_BUNDLE event. + * Uses the target public key in local storage to encrypt the text entered in the + * `plaintext` textarea element. Upon successful encryption, sends + * an `encrypted_bundle` containing the ciphertext and encapped public key. + * Example bundle: {"encappedPublic":"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f","ciphertext":"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d"} + * @param {string} requestId + */ +async function onExtractWalletEncryptedBundle(requestId) { + // Get target embedded key from previous step (onInjectImportBundle) + const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey(); + if (targetPublicKeyJwk == null) { + throw new Error("no target key found"); + } + + // Get plaintext wallet mnemonic + const plaintext = document.getElementById("plaintext").value.trim(); + if (!plaintext) { + throw new Error("no wallet mnemonic entered"); + } + + const passphrase = document.getElementById("passphrase").value; + + validateMnemonic(plaintext); + + const combined = passphrase === "" ? plaintext : `${plaintext}\n--PASS--\n${passphrase}`; + const plaintextBuf = new TextEncoder().encode(combined); + + // Encrypt the bundle using the enclave target public key + const encryptedBundle = await HpkeEncrypt({ + plaintextBuf, + receiverPubJwk: targetPublicKeyJwk, + }); + + // Reset target embedded key after using for encryption + TKHQ.resetTargetEmbeddedKey(); + + // Send up ENCRYPTED_BUNDLE_EXTRACTED message + TKHQ.sendMessageUp("ENCRYPTED_BUNDLE_EXTRACTED", encryptedBundle, requestId); +} + +/** + * Function triggered when EXTRACT_KEY_ENCRYPTED_BUNDLE event is received. + * Prerequisite: This function uses the target public key in local storage that is imported + * from the INJECT_IMPORT_BUNDLE event. + * Uses the target public key in local storage to encrypt the text entered in the + * `plaintext` textarea element. Upon successful encryption, sends + * an `encrypted_bundle` containing the ciphertext and encapped public key. + * Example bundle: {"encappedPublic":"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f","ciphertext":"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d"} + * @param {string} keyFormat + * @param {string} requestId + */ +async function onExtractKeyEncryptedBundle(keyFormat, requestId) { + // Get target embedded key from previous step (onInjectImportBundle) + const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey(); + if (targetPublicKeyJwk == null) { + throw new Error("no target key found"); + } + + // Get plaintext private key + const plaintext = document.getElementById("plaintext").value.trim(); + if (!plaintext) { + throw new Error("no private key entered"); + } + const plaintextBuf = TKHQ.decodeKey(plaintext, keyFormat); + + // Encrypt the bundle using the enclave target public key + const encryptedBundle = await HpkeEncrypt({ + plaintextBuf, + receiverPubJwk: targetPublicKeyJwk, + }); + + // Reset target embedded key after using for encryption + TKHQ.resetTargetEmbeddedKey(); + + // Send up ENCRYPTED_BUNDLE_EXTRACTED message + TKHQ.sendMessageUp("ENCRYPTED_BUNDLE_EXTRACTED", encryptedBundle, requestId); +} + +/** + * Function triggered when APPLY_SETTINGS event is received. + * For now, the only settings that can be applied are for "styles". + * Persist them in local storage so they can be applied on every + * page load. + * @param {string} settings: JSON-stringified settings + * @param {string} requestId + */ +async function onApplySettings(settings, requestId) { + // Apply settings + const validSettings = TKHQ.applySettings(settings); + + // Persist in local storage + TKHQ.setSettings(validSettings); + + // Send up SETTINGS_APPLIED message + TKHQ.sendMessageUp("SETTINGS_APPLIED", true, requestId); +} + +async function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) { + const kemContext = new hpke.DhkemP256HkdfSha256(); + const receiverPub = await kemContext.importKey( + "jwk", + { ...receiverPubJwk }, + true + ); + + const suite = new hpke.CipherSuite({ + kem: kemContext, + kdf: new hpke.HkdfSha256(), + aead: new hpke.Aes256Gcm(), + }); + + const senderCtx = await suite.createSenderContext({ + recipientPublicKey: receiverPub, + info: new TextEncoder().encode("turnkey_hpke"), + }); + + // Need to import the key again as a JWK to export as a raw key, the format needed to + // create the aad with the newly generated raw encapped key. + const receiverPubCryptoKey = await crypto.subtle.importKey( + "jwk", + receiverPubJwk, + { + name: "ECDSA", + namedCurve: "P-256", + }, + true, + [] + ); + const receiverPubRaw = await crypto.subtle.exportKey( + "raw", + receiverPubCryptoKey + ); + const receiverPubBuf = new Uint8Array(receiverPubRaw); + + const encappedKeyBuf = new Uint8Array(senderCtx.enc); + + const aad = TKHQ.additionalAssociatedData(encappedKeyBuf, receiverPubBuf); + + var ciphertextBuf; + try { + ciphertextBuf = await senderCtx.seal(plaintextBuf, aad); + } catch (e) { + throw new Error("failed to encrypt import bundle: " + e.toString()); + } + + const ciphertextHex = TKHQ.uint8arrayToHexString( + new Uint8Array(ciphertextBuf) + ); + const encappedKeyBufHex = TKHQ.uint8arrayToHexString(encappedKeyBuf); + const encryptedBundle = JSON.stringify({ + encappedPublic: encappedKeyBufHex, + ciphertext: ciphertextHex, + }); + return encryptedBundle; +} diff --git a/import/src/index.template.html b/import/src/index.template.html new file mode 100644 index 0000000..a99b0b9 --- /dev/null +++ b/import/src/index.template.html @@ -0,0 +1,23 @@ + + + + + + + Turnkey Import + + + + + +
+ + + + +
+ + diff --git a/import/src/standalone-styles.css b/import/src/standalone-styles.css new file mode 100644 index 0000000..d06f5f1 --- /dev/null +++ b/import/src/standalone-styles.css @@ -0,0 +1,67 @@ +body { + text-align: center; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; + max-width: 1024px; + margin: auto; +} + +form { + text-align: left; + margin-bottom: 2rem; +} + +label { + display: inline-block; + width: 8em; +} + +input[type="text"], +select { + width: 40em; + margin: 0.5em; + font-family: "Courier New", Courier, monospace; + font-size: 1em; + height: 1.8em; + color: rgb(18, 87, 18); + border: 1px rgb(217, 240, 221) solid; + border-radius: 4px; +} + +input:disabled { + background-color: rgb(239, 243, 240); +} + +#inject-import-bundle, +#encrypt-wallet-bundle, +#encrypt-key-bundle { + color: white; + width: 10em; + font-size: 1em; + padding: 0.38em; + border-radius: 4px; + background-color: rgb(50, 44, 44); + border: 1px rgb(33, 33, 33) solid; + cursor: pointer; + display: inline; +} + +#message-log { + border: 1px #2a2828 solid; + padding: 0 0.7em; + border-radius: 4px; + margin-top: 2em; + max-width: 800px; + margin: auto; + display: block; +} + +#message-log p { + font-size: 0.9em; + text-align: left; + word-break: break-all; +} + +.hidden { + display: none; +} diff --git a/import/src/standalone.js b/import/src/standalone.js new file mode 100644 index 0000000..eb12160 --- /dev/null +++ b/import/src/standalone.js @@ -0,0 +1,361 @@ +import "./standalone-styles.css"; +import * as hpke from "@hpke/core"; +import * as TKHQ from "./turnkey-core.js"; + +// Make TKHQ available globally +window.TKHQ = TKHQ; + +/** + * Function to log a message and persist it in the page's DOM. + */ +function logMessage(content) { + const messageLog = document.getElementById("message-log"); + const message = document.createElement("p"); + message.innerText = content; + messageLog.appendChild(message); +} + +/** + * Standalone-specific sendMessageUp that logs to DOM instead + */ +function sendMessageUpStandalone(type, value) { + if (window.top !== null) { + window.top.postMessage( + { + type: type, + value: value, + }, + "*" + ); + } + logMessage(`⬆️ Sent message ${type}: ${value}`); +} + +document.addEventListener( + "DOMContentLoaded", + async () => { + // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently, + // init() waits for a public key to be initialized that can be used to send to the server + // which will encrypt messages to this public key. + // In the case of import, this public key is not used because the client encrypts messages + // to the server's public key. + sendMessageUpStandalone("PUBLIC_KEY_READY", ""); + + // TODO: find a way to filter messages and ensure they're coming from the parent window? + // We do not want to arbitrarily receive messages from all origins. + window.addEventListener( + "message", + async function (event) { + if (event.data && event.data["type"] == "INJECT_IMPORT_BUNDLE") { + logMessage( + `⬇️ Received message ${event.data["type"]}: ${event.data["value"]}, ${event.data["organizationId"]}, ${event.data["userId"]}` + ); + try { + await onInjectImportBundle( + event.data["value"], + event.data["organizationId"], + event.data["userId"] + ); + } catch (e) { + sendMessageUpStandalone("ERROR", e.toString()); + } + } + // TODO: deprecate EXTRACT_WALLET_ENCRYPTED_BUNDLE in favor of EXTRACT_ENCRYPTED_BUNDLE + if ( + event.data && + event.data["type"] == "EXTRACT_WALLET_ENCRYPTED_BUNDLE" + ) { + logMessage( + `⬇️ Received message ${event.data["type"]}: ${event.data["value"]}` + ); + try { + await onExtractWalletEncryptedBundle(event.data["value"]); + } catch (e) { + sendMessageUpStandalone("ERROR", e.toString()); + } + } + if ( + event.data && + event.data["type"] == "EXTRACT_KEY_ENCRYPTED_BUNDLE" + ) { + logMessage( + `⬇️ Received message ${event.data["type"]}: ${event.data["value"]}, ${event.data["keyFormat"]}` + ); + try { + await onExtractKeyEncryptedBundle( + event.data["value"], + event.data["keyFormat"] + ); + } catch (e) { + sendMessageUpStandalone("ERROR", e.toString()); + } + } + }, + false + ); + + /** + * Event handlers to power the import flow in standalone mode + * Instead of receiving events from the parent page, forms trigger them. + * This is useful for debugging as well. + */ + document.getElementById("inject-import-bundle").addEventListener( + "click", + async (e) => { + e.preventDefault(); + window.postMessage({ + type: "INJECT_IMPORT_BUNDLE", + value: document.getElementById("import-bundle").value, + organizationId: document.getElementById("organization-id").value, + userId: document.getElementById("user-id").value, + }); + }, + false + ); + document.getElementById("encrypt-wallet-bundle").addEventListener( + "click", + async (e) => { + e.preventDefault(); + window.postMessage({ + type: "EXTRACT_WALLET_ENCRYPTED_BUNDLE", + value: document.getElementById("wallet-plaintext").value, + }); + }, + false + ); + document.getElementById("encrypt-key-bundle").addEventListener( + "click", + async (e) => { + e.preventDefault(); + window.postMessage({ + type: "EXTRACT_KEY_ENCRYPTED_BUNDLE", + value: document.getElementById("key-plaintext").value, + keyFormat: document.getElementById("key-import-format").value, + }); + }, + false + ); + }, + false +); + +/** + * Function triggered when INJECT_IMPORT_BUNDLE event is received. + * Parses the `import_bundle` and stores the target public key as a JWK + * in local storage. Sends true upon success. + * @param {string} bundle + * Example bundle: {"targetPublic":"0491ccb68758b822a6549257f87769eeed37c6cb68a6c6255c5f238e2b6e6e61838c8ac857f2e305970a6435715f84e5a2e4b02a4d1e5289ba7ec7910e47d2d50f","targetPublicSignature":"3045022100cefc333c330c9fa300d1aa10a439a76539b4d6967301638ab9edc9fd9468bfdb0220339bba7e2b00b45d52e941d068ecd3bfd16fd1926da69dd7769893268990d62f","enclaveQuorumPublic":"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569"} + * @param {string} organizationId + * @param {string} userId + */ +async function onInjectImportBundle(bundle, organizationId, userId) { + let targetPublicBuf; + let verified; + + // Parse the import bundle + const bundleObj = JSON.parse(bundle); + + switch (bundleObj.version) { + case "v1.0.0": + // Validate fields exist + if (!bundleObj.data) { + throw new Error('missing "data" in bundle'); + } + if (!bundleObj.dataSignature) { + throw new Error('missing "dataSignature" in bundle'); + } + if (!bundleObj.enclaveQuorumPublic) { + throw new Error('missing "enclaveQuorumPublic" in bundle'); + } + + // Verify enclave signature + if (!TKHQ.verifyEnclaveSignature) { + throw new Error("method not loaded"); + } + verified = await TKHQ.verifyEnclaveSignature( + bundleObj.enclaveQuorumPublic, + bundleObj.dataSignature, + bundleObj.data + ); + if (!verified) { + throw new Error(`failed to verify enclave signature: ${bundle}`); + } + + // Parse the signed data. The data is produced by JSON encoding followed by hex encoding. We reverse this here. + const signedData = JSON.parse( + new TextDecoder().decode(TKHQ.uint8arrayFromHexString(bundleObj.data)) + ); + + // Validate fields match + if (!organizationId) { + // TODO: throw error if organization id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper + console.warn( + 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "organizationId" for security purposes.' + ); + } else if ( + !signedData.organizationId || + signedData.organizationId !== organizationId + ) { + throw new Error( + `organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.` + ); + } + if (!userId) { + // TODO: throw error if user id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper + console.warn( + 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "userId" for security purposes.' + ); + } else if (!signedData.userId || signedData.userId !== userId) { + throw new Error( + `user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.` + ); + } + + if (!signedData.targetPublic) { + throw new Error('missing "targetPublic" in bundle signed data'); + } + + // Load target public key generated from enclave and set in local storage + targetPublicBuf = TKHQ.uint8arrayFromHexString(signedData.targetPublic); + break; + default: + throw new Error(`unsupported version: ${bundleObj.version}`); + } + + const targetPublicKeyJwk = await TKHQ.loadTargetKey( + new Uint8Array(targetPublicBuf) + ); + TKHQ.setTargetEmbeddedKey(targetPublicKeyJwk); + + // Send up BUNDLE_INJECTED message + sendMessageUpStandalone("BUNDLE_INJECTED", true); +} + +/** + * Function triggered when EXTRACT_WALLET_ENCRYPTED_BUNDLE event is received. + * Prerequisite: This function uses the target public key in local storage that is imported + * from the INJECT_IMPORT_BUNDLE event. + * Uses the target public key in local storage to encrypt the plaintextValue. Upon successful encryption, sends + * an `encrypted_bundle` containing the ciphertext and encapped public key. + * Example bundle: {"encappedPublic":"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f","ciphertext":"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d"} + */ +async function onExtractWalletEncryptedBundle(plaintextValue) { + // Get target embedded key from previous step (onInjectImportBundle) + const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey(); + if (targetPublicKeyJwk == null) { + throw new Error("no target key found"); + } + + // Get plaintext wallet mnemonic + const plaintext = plaintextValue.trim(); + if (!plaintext) { + throw new Error("no wallet mnemonic entered"); + } + const plaintextBuf = new TextEncoder().encode(plaintext); + + // Encrypt the bundle using the enclave target public key + const encryptedBundle = await HpkeEncrypt({ + plaintextBuf, + receiverPubJwk: targetPublicKeyJwk, + }); + + // Reset target embedded key after using for encryption + TKHQ.resetTargetEmbeddedKey(); + + // Send up ENCRYPTED_BUNDLE_EXTRACTED message + sendMessageUpStandalone("ENCRYPTED_BUNDLE_EXTRACTED", encryptedBundle); +} + +/** + * Function triggered when EXTRACT_KEY_ENCRYPTED_BUNDLE event is received. + * Prerequisite: This function uses the target public key in local storage that is imported + * from the INJECT_IMPORT_BUNDLE event. + * Uses the target public key in local storage to encrypt the plaintextValue. Upon successful encryption, sends + * an `encrypted_bundle` containing the ciphertext and encapped public key. + * Example bundle: {"encappedPublic":"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f","ciphertext":"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d"} + */ +async function onExtractKeyEncryptedBundle(plaintextValue, keyFormat) { + // Get target embedded key from previous step (onInjectImportBundle) + const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey(); + if (targetPublicKeyJwk == null) { + throw new Error("no target key found"); + } + + // Get plaintext private key + const plaintext = plaintextValue.trim(); + if (!plaintext) { + throw new Error("no private key entered"); + } + const plaintextBuf = TKHQ.decodeKey(plaintext, keyFormat); + + // Encrypt the bundle using the enclave target public key + const encryptedBundle = await HpkeEncrypt({ + plaintextBuf, + receiverPubJwk: targetPublicKeyJwk, + }); + + // Reset target embedded key after using for encryption + TKHQ.resetTargetEmbeddedKey(); + + // Send up ENCRYPTED_BUNDLE_EXTRACTED message + sendMessageUpStandalone("ENCRYPTED_BUNDLE_EXTRACTED", encryptedBundle); +} + +async function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) { + const kemContext = new hpke.DhkemP256HkdfSha256(); + const receiverPub = await kemContext.importKey( + "jwk", + { ...receiverPubJwk }, + true + ); + + const suite = new hpke.CipherSuite({ + kem: kemContext, + kdf: new hpke.HkdfSha256(), + aead: new hpke.Aes256Gcm(), + }); + + const senderCtx = await suite.createSenderContext({ + recipientPublicKey: receiverPub, + info: new TextEncoder().encode("turnkey_hpke"), + }); + + // Need to import the key again as a JWK to export as a raw key, the format needed to + // create the aad with the newly generated raw encapped key. + const receiverPubCryptoKey = await crypto.subtle.importKey( + "jwk", + receiverPubJwk, + { + name: "ECDSA", + namedCurve: "P-256", + }, + true, + [] + ); + const receiverPubRaw = await crypto.subtle.exportKey( + "raw", + receiverPubCryptoKey + ); + const receiverPubBuf = new Uint8Array(receiverPubRaw); + + const encappedKeyBuf = new Uint8Array(senderCtx.enc); + + const aad = TKHQ.additionalAssociatedData(encappedKeyBuf, receiverPubBuf); + + var ciphertextBuf; + try { + ciphertextBuf = await senderCtx.seal(plaintextBuf, aad); + } catch (e) { + throw new Error("failed to encrypt import bundle: " + e.toString()); + } + + const ciphertextHex = TKHQ.uint8arrayToHexString( + new Uint8Array(ciphertextBuf) + ); + const encappedKeyBufHex = TKHQ.uint8arrayToHexString(encappedKeyBuf); + const encryptedBundle = JSON.stringify({ + encappedPublic: encappedKeyBufHex, + ciphertext: ciphertextHex, + }); + return encryptedBundle; +} diff --git a/import/src/standalone.template.html b/import/src/standalone.template.html new file mode 100644 index 0000000..aa709b9 --- /dev/null +++ b/import/src/standalone.template.html @@ -0,0 +1,58 @@ + + + + + + + Turnkey Import (Standalone Mode) + + + + +

Initialize Import

+
+ + + +
+ + +
+ + +
+
+

Import Wallet

+
+ + + +
+
+

Import Private Key

+
+ + + + + +
+
+
+

Message log

+

+ Below we display a log of the messages sent / received. The forms above + send messages, and the code communicates results by sending events via + the postMessage API. +

+
+ + diff --git a/import/src/styles.css b/import/src/styles.css new file mode 100644 index 0000000..144acaa --- /dev/null +++ b/import/src/styles.css @@ -0,0 +1,59 @@ +#plaintext { + width: 300px; + font-size: 0.875rem; + line-height: 1.25rem; + height: 110px; + color: #555b64; + border: none; + resize: none; + word-wrap: break-word; + overflow-wrap: break-word; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; +} +#plaintext:focus { + outline: none; + border: none; +} +#passphrase { + width: 300px; + font-size: 0.875rem; + line-height: 1.25rem; + height: 55px; + color: #555b64; + border: none; + resize: none; + word-wrap: break-word; + overflow-wrap: break-word; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; + display: none; +} +#passphrase:focus { + outline: none; + border: none; +} + +#passphrase-label { + display: none; + border: none; + width: 300px; + margin-top: 12px; + margin-bottom: 4px; + font-size: 0.875rem; + line-height: 1.25rem; + color: #18191a; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; +} +#mnemonic-label { + display: none; + border: none; + width: 300px; + margin-bottom: 4px; + font-size: 0.875rem; + line-height: 1.25rem; + color: #18191a; + font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", + "Lucida Sans Unicode", Geneva, Verdana, sans-serif; +} \ No newline at end of file diff --git a/import/src/turnkey-core.js b/import/src/turnkey-core.js new file mode 100644 index 0000000..5abec0c --- /dev/null +++ b/import/src/turnkey-core.js @@ -0,0 +1,593 @@ +/** constants for LocalStorage */ +const TURNKEY_TARGET_EMBEDDED_KEY = "TURNKEY_TARGET_EMBEDDED_KEY"; +const TURNKEY_SETTINGS = "TURNKEY_SETTINGS"; + +var parentFrameMessageChannelPort = null; +var cryptoProviderOverride = null; + +/* + * Returns a reference to the WebCrypto subtle interface regardless of the host environment. + */ +function getSubtleCrypto() { + if (cryptoProviderOverride && cryptoProviderOverride.subtle) { + return cryptoProviderOverride.subtle; + } + if ( + typeof globalThis !== "undefined" && + globalThis.crypto && + globalThis.crypto.subtle + ) { + return globalThis.crypto.subtle; + } + if (typeof window !== "undefined" && window.crypto && window.crypto.subtle) { + return window.crypto.subtle; + } + if (typeof global !== "undefined" && global.crypto && global.crypto.subtle) { + return global.crypto.subtle; + } + if (typeof crypto !== "undefined" && crypto.subtle) { + return crypto.subtle; + } + + return null; +} + +/* + * Allows tests to explicitly set the crypto provider (e.g. crypto.webcrypto) when the runtime + * environment does not expose one on the global/window objects. + */ +function setCryptoProvider(cryptoProvider) { + cryptoProviderOverride = cryptoProvider || null; +} + +/* + * Load a key to encrypt to as a CryptoKey and return it as a JSON Web Key. + */ +async function loadTargetKey(targetPublic) { + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + const targetKey = await subtle.importKey( + "raw", + targetPublic, + { + name: "ECDH", + namedCurve: "P-256", + }, + true, + [] + ); + + return await subtle.exportKey("jwk", targetKey); +} + +/* + * Loads the quorum public key as a CryptoKey. + */ +async function loadQuorumKey(quorumPublic) { + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + return await subtle.importKey( + "raw", + quorumPublic, + { + name: "ECDSA", + namedCurve: "P-256", + }, + true, + ["verify"] + ); +} + +/** + * Gets the current target embedded private key JWK. Returns `null` if not found. + */ +function getTargetEmbeddedKey() { + const jwtKey = window.localStorage.getItem(TURNKEY_TARGET_EMBEDDED_KEY); + return jwtKey ? JSON.parse(jwtKey) : null; +} + +/** + * Sets the target embedded public key JWK. + * @param {JsonWebKey} targetKey + */ +function setTargetEmbeddedKey(targetKey) { + window.localStorage.setItem( + TURNKEY_TARGET_EMBEDDED_KEY, + JSON.stringify(targetKey) + ); +} + +/** + * Resets the current target embedded private key JWK. + */ +function resetTargetEmbeddedKey() { + window.localStorage.removeItem(TURNKEY_TARGET_EMBEDDED_KEY); +} + +/** + * Gets the current settings. + */ +function getSettings() { + const settings = window.localStorage.getItem(TURNKEY_SETTINGS); + return settings ? JSON.parse(settings) : null; +} + +/** + * Sets the settings object. + * @param {Object} settings + */ +function setSettings(settings) { + window.localStorage.setItem(TURNKEY_SETTINGS, JSON.stringify(settings)); +} + +/** + * Takes a hex string (e.g. "e4567ab") and returns an array buffer (Uint8Array) + * @param {string} hexString + * @returns {Uint8Array} + */ +function uint8arrayFromHexString(hexString) { + var hexRegex = /^[0-9A-Fa-f]+$/; + if (!hexString || hexString.length % 2 != 0 || !hexRegex.test(hexString)) { + throw new Error("cannot create uint8array from invalid hex string"); + } + return new Uint8Array(hexString.match(/../g).map((h) => parseInt(h, 16))); +} + +/** + * Takes a Uint8Array and returns a hex string + * @param {Uint8Array} buffer + * @return {string} + */ +function uint8arrayToHexString(buffer) { + return [...buffer].map((x) => x.toString(16).padStart(2, "0")).join(""); +} + +/** + * Decodes a base58-encoded string into a buffer + * This function throws an error when the string contains invalid characters. + * @param {string} s The base58-encoded string. + * @return {Uint8Array} The decoded buffer. + */ +function base58Decode(s) { + // See https://en.bitcoin.it/wiki/Base58Check_encoding + var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + var decoded = BigInt(0); + var decodedBytes = []; + var leadingZeros = []; + for (var i = 0; i < s.length; i++) { + if (alphabet.indexOf(s[i]) === -1) { + throw new Error(`cannot base58-decode: ${s[i]} isn't a valid character`); + } + var carry = alphabet.indexOf(s[i]); + + // If the current base58 digit is 0, append a 0 byte. + // "i == leadingZeros.length" can only be true if we have not seen non-zero bytes so far. + // If we had seen a non-zero byte, carry wouldn't be 0, and i would be strictly more than `leadingZeros.length` + if (carry == 0 && i === leadingZeros.length) { + leadingZeros.push(0); + } + + var j = 0; + while (j < decodedBytes.length || carry > 0) { + var currentByte = decodedBytes[j]; + + // shift the current byte 58 units and add the carry amount + // (or just add the carry amount if this is a new byte -- undefined case) + if (currentByte === undefined) { + currentByte = carry; + } else { + currentByte = currentByte * 58 + carry; + } + + // find the new carry amount (1-byte shift of current byte value) + carry = currentByte >> 8; + // reset the current byte to the remainder (the carry amount will pass on the overflow) + decodedBytes[j] = currentByte % 256; + j++; + } + } + + var result = leadingZeros.concat(decodedBytes.reverse()); + return new Uint8Array(result); +} + +/** + * Returns private key bytes from a private key, represented in + * the encoding and format specified by `keyFormat`. Defaults to + * hex-encoding if `keyFormat` isn't passed. + * @param {string} privateKey + * @param {string} keyFormat Can be "HEXADECIMAL" or "SOLANA" + */ +function decodeKey(privateKey, keyFormat) { + switch (keyFormat) { + case "SOLANA": + const decodedKeyBytes = base58Decode(privateKey); + if (decodedKeyBytes.length !== 64) { + throw new Error( + `invalid key length. Expected 64 bytes. Got ${decodedKeyBytes.length()}.` + ); + } + return decodedKeyBytes.subarray(0, 32); + case "HEXADECIMAL": + if (privateKey.startsWith("0x")) { + return uint8arrayFromHexString(privateKey.slice(2)); + } + return uint8arrayFromHexString(privateKey); + default: + console.warn( + `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.` + ); + if (privateKey.startsWith("0x")) { + return uint8arrayFromHexString(privateKey.slice(2)); + } + return uint8arrayFromHexString(privateKey); + } +} + +function setParentFrameMessageChannelPort(port) { + parentFrameMessageChannelPort = port; +} + +/** + * Function to normalize padding of byte array with 0's to a target length + */ +function normalizePadding(byteArray, targetLength) { + const paddingLength = targetLength - byteArray.length; + + // Add leading 0's to array + if (paddingLength > 0) { + const padding = new Uint8Array(paddingLength).fill(0); + return new Uint8Array([...padding, ...byteArray]); + } + + // Remove leading 0's from array + if (paddingLength < 0) { + const expectedZeroCount = paddingLength * -1; + let zeroCount = 0; + for (let i = 0; i < expectedZeroCount && i < byteArray.length; i++) { + if (byteArray[i] === 0) { + zeroCount++; + } + } + // Check if the number of zeros found equals the number of zeroes expected + if (zeroCount !== expectedZeroCount) { + throw new Error( + `invalid number of starting zeroes. Expected number of zeroes: ${expectedZeroCount}. Found: ${zeroCount}.` + ); + } + return byteArray.slice(expectedZeroCount, expectedZeroCount + targetLength); + } + return byteArray; +} + +/** + * Additional Associated Data (AAD) in the format dictated by the enclave_encrypt crate. + */ +function additionalAssociatedData(senderPubBuf, receiverPubBuf) { + const s = Array.from(new Uint8Array(senderPubBuf)); + const r = Array.from(new Uint8Array(receiverPubBuf)); + return new Uint8Array([...s, ...r]); +} + +/** + * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses. + */ +function fromDerSignature(derSignature) { + const derSignatureBuf = uint8arrayFromHexString(derSignature); + + // Check and skip the sequence tag (0x30) + let index = 2; + + // Parse 'r' and check for integer tag (0x02) + if (derSignatureBuf[index] !== 0x02) { + throw new Error( + "failed to convert DER-encoded signature: invalid tag for r" + ); + } + index++; // Move past the INTEGER tag + const rLength = derSignatureBuf[index]; + index++; // Move past the length byte + const r = derSignatureBuf.slice(index, index + rLength); + index += rLength; // Move to the start of s + + // Parse 's' and check for integer tag (0x02) + if (derSignatureBuf[index] !== 0x02) { + throw new Error( + "failed to convert DER-encoded signature: invalid tag for s" + ); + } + index++; // Move past the INTEGER tag + const sLength = derSignatureBuf[index]; + index++; // Move past the length byte + const s = derSignatureBuf.slice(index, index + sLength); + + // Normalize 'r' and 's' to 32 bytes each + const rPadded = normalizePadding(r, 32); + const sPadded = normalizePadding(s, 32); + + // Concatenate and return the raw signature + return new Uint8Array([...rPadded, ...sPadded]); +} + +/** + * Function to verify enclave signature on import bundle received from the server. + * @param {string} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature + * @param {string} publicSignature signature bytes encoded as a hexadecimal string + * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes + */ +async function verifyEnclaveSignature( + enclaveQuorumPublic, + publicSignature, + signedData +) { + /** Turnkey Signer enclave's public keys */ + const TURNKEY_SIGNERS_ENCLAVES = { + prod: "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", + preprod: + "04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212", + }; + + const environment = + (typeof window !== "undefined" && window.__TURNKEY_SIGNER_ENVIRONMENT__) || + "__TURNKEY_SIGNER_ENVIRONMENT__"; + const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY = + TURNKEY_SIGNERS_ENCLAVES[environment]; + if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) { + throw new Error( + "Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined" + ); + } + + // todo(olivia): throw error if enclave quorum public is null once server changes are deployed + if (enclaveQuorumPublic) { + if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) { + throw new Error( + `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.` + ); + } + } + + const encryptionQuorumPublicBuf = new Uint8Array( + uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) + ); + const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf); + if (!quorumKey) { + throw new Error("failed to load quorum key"); + } + + // The ECDSA signature is ASN.1 DER encoded but WebCrypto uses raw format + const publicSignatureBuf = fromDerSignature(publicSignature); + const signedDataBuf = uint8arrayFromHexString(signedData); + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + return await subtle.verify( + { name: "ECDSA", hash: "SHA-256" }, + quorumKey, + publicSignatureBuf, + signedDataBuf + ); +} + +/** + * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions). + * Any invalid style throws an error. Returns an object of valid styles. + * @param {Object} styles + * @return {Object} + */ +function validateStyles(styles, element) { + const validStyles = {}; + + const cssValidationRegex = { + padding: "^(\\d+(px|em|%|rem) ?){1,4}$", + margin: "^(\\d+(px|em|%|rem) ?){1,4}$", + borderWidth: "^(\\d+(px|em|rem) ?){1,4}$", + borderStyle: + "^(none|solid|dashed|dotted|double|groove|ridge|inset|outset)$", + borderColor: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + borderRadius: "^(\\d+(px|em|%|rem) ?){1,4}$", + fontSize: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax))$", + fontWeight: "^(normal|bold|bolder|lighter|\\d{3})$", + fontFamily: '^[^";<>]*$', // checks for the absence of some characters that could lead to CSS/HTML injection + color: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + labelColor: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + backgroundColor: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + width: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$", + height: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$", + maxWidth: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$", + maxHeight: + "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$", + lineHeight: + "^(\\d+(\\.\\d+)?(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|normal)$", + boxShadow: + "^(none|(\\d+(px|em|rem) ?){2,4} (#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)) ?(inset)?)$", + textAlign: "^(left|right|center|justify|initial|inherit)$", + overflowWrap: "^(normal|break-word|anywhere)$", + wordWrap: "^(normal|break-word)$", + resize: "^(none|both|horizontal|vertical|block|inline)$", + }; + + Object.entries(styles).forEach(([property, value]) => { + const styleProperty = property.trim(); + if (styleProperty.length === 0) { + throw new Error("css style property cannot be empty"); + } + const styleRegexStr = cssValidationRegex[styleProperty]; + if (!styleRegexStr) { + throw new Error( + `invalid or unsupported css style property: "${styleProperty}"` + ); + } + const styleRegex = new RegExp(styleRegexStr); + const styleValue = value.trim(); + if (styleValue.length == 0) { + throw new Error(`css style for "${styleProperty}" is empty`); + } + const isValidStyle = styleRegex.test(styleValue); + if (!isValidStyle) { + throw new Error( + `invalid css style value for property "${styleProperty}"` + ); + } + validStyles[styleProperty] = styleValue; + }); + + return validStyles; +} + +/** + * Function to apply settings on this page. For now, the only settings that can be applied + * are for "styles". Upon successful application, return the valid, sanitized settings JSON string. + * @param {string} settings + * @return {string} + */ +function applySettings(settings) { + const validSettings = {}; + const settingsObj = JSON.parse(settings); + + const passphraseLabel = document.getElementById( + "passphrase-label" + ); + const mnemonicLabel = document.getElementById("mnemonic-label"); + const passphraseTextarea = document.getElementById("passphrase"); + + if (!passphraseLabel || !passphraseTextarea) { + throw new Error( + "no passphrase HTML elements found to apply settings to." + ); + } + const plaintextTextarea = document.getElementById("plaintext"); + if (!plaintextTextarea) { + throw new Error( + "no plaintext textarea HTML element found to apply settings to." + ); + } + + // Apply enablePassphrase setting + if (settingsObj.enablePassphrase === true) { + passphraseLabel.style.display = "inline-block"; + passphraseTextarea.style.display = "inline-block"; + passphraseTextarea.style.border = "solid 1px #ccc"; + passphraseTextarea.style.borderRadius = "4px"; + + mnemonicLabel.style.display = "inline-block"; + plaintextTextarea.style.border = "solid 1px #ccc"; + plaintextTextarea.style.borderRadius = "4px"; + + validSettings["enablePassphrase"] = true; + } else { + passphraseLabel.style.display = "none"; + passphraseTextarea.style.display = "none"; + mnemonicLabel.style.display = "none"; + + plaintextTextarea.style.border = "none"; + validSettings["enablePassphrase"] = false; + } + + if (settingsObj.styles) { + // Validate, sanitize, and apply the styles to the "plaintext" textarea. + const validStyles = validateStyles(settingsObj.styles); + Object.entries(validStyles).forEach(([key, value]) => { + plaintextTextarea.style[key] = value; + }); + + if (validStyles.backgroundColor) { + // Apply background color to document and body as well. + document.documentElement.style.backgroundColor = + validStyles.backgroundColor; + document.body.style.backgroundColor = validStyles.backgroundColor; + } + + if (validStyles.labelColor) { + document.getElementById("mnemonic-label").style.color = + validStyles.labelColor; + } + + validSettings["styles"] = validStyles; + } + + if (settingsObj.passphraseStyles) { + // Validate, sanitize, and apply the styles to the "passphrase" textarea. + const validStyles = TKHQ.validateStyles(settingsObj.passphraseStyles); + Object.entries(validStyles).forEach(([key, value]) => { + passphraseTextarea.style[key] = value; + }); + + if (validStyles.labelColor) { + document.getElementById("passphrase-label").style.color = + validStyles.labelColor; + } + + validSettings["passphraseStyles"] = validStyles; + } + + return JSON.stringify(validSettings); +} + +/** + * Function to send a message. + * + * If this page is embedded as an iframe we'll send a postMessage + * in one of two ways depending on the version of @turnkey/iframe-stamper: + * 1. newer versions (>=v2.1.0) pass a MessageChannel MessagePort from the parent frame for postMessages. + * 2. older versions ( - - - - - - Turnkey Import (Standalone Mode) - - - - - -

Initialize Import

-
- - - -
- - -
- - -
-
-

Import Wallet

-
- - - -
-
-

Import Private Key

-
- - - - - -
-
-
-

Message log

-

- Below we display a log of the messages sent / received. The forms above - send messages, and the code communicates results by sending events via - the postMessage API. -

-
- - - - - - - diff --git a/import/webpack.config.js b/import/webpack.config.js new file mode 100644 index 0000000..2bb5df1 --- /dev/null +++ b/import/webpack.config.js @@ -0,0 +1,137 @@ +const path = require("path"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const CopyWebpackPlugin = require("copy-webpack-plugin"); + +module.exports = (env, argv) => { + const isProduction = argv.mode === "production"; + + return { + mode: isProduction ? "production" : "development", + entry: { + index: "./src/index.js", + standalone: "./src/standalone.js", + }, + output: { + path: path.resolve(__dirname, "dist"), + filename: "[name].bundle.[contenthash].js", + publicPath: "/", + clean: true, + }, + module: { + rules: [ + { + test: /\.js$/, + exclude: /node_modules/, + use: { + loader: "babel-loader", + options: { + presets: ["@babel/preset-env"], + }, + }, + }, + { + test: /\.css$/, + use: [ + isProduction ? MiniCssExtractPlugin.loader : "style-loader", + "css-loader", + ], + }, + ], + }, + plugins: [ + // Iframe page (embedded version) + new HtmlWebpackPlugin({ + template: "./src/index.template.html", + filename: "index.html", + chunks: ["index"], + inject: "body", + meta: { + "Content-Security-Policy": { + "http-equiv": "Content-Security-Policy", + content: + "default-src 'self'; script-src 'self'; style-src 'self'; base-uri 'self'; object-src 'none'; form-action 'none'", + }, + }, + minify: isProduction + ? { + removeComments: true, + collapseWhitespace: true, + removeRedundantAttributes: true, + useShortDoctype: true, + removeEmptyAttributes: true, + removeStyleLinkTypeAttributes: true, + keepClosingSlash: true, + minifyJS: true, + minifyCSS: true, + minifyURLs: true, + } + : false, + }), + // Standalone page (testing version) + new HtmlWebpackPlugin({ + template: "./src/standalone.template.html", + filename: "standalone.html", + chunks: ["standalone"], + inject: "body", + minify: isProduction + ? { + removeComments: true, + collapseWhitespace: true, + removeRedundantAttributes: false, + useShortDoctype: true, + removeEmptyAttributes: true, + removeStyleLinkTypeAttributes: true, + keepClosingSlash: true, + minifyJS: true, + minifyCSS: true, + minifyURLs: true, + } + : false, + }), + // Copy favicon + new CopyWebpackPlugin({ + patterns: [ + { + from: "favicon.svg", + to: "favicon.svg", + }, + ], + }), + ...(isProduction + ? [ + new MiniCssExtractPlugin({ + filename: "[name].styles.[contenthash].css", + }), + ] + : []), + ], + resolve: { + extensions: [".js"], + fallback: { + crypto: false, + }, + }, + optimization: { + splitChunks: { + chunks: "all", + cacheGroups: { + // Shared vendor code (e.g., @hpke/core used by both pages) + vendor: { + test: /[\\/]node_modules[\\/]/, + name: "vendors", + chunks: "all", + }, + // Shared turnkey-core utilities + common: { + test: /[\\/]src[\\/]turnkey-core\.js/, + name: "common", + chunks: "all", + minChunks: 2, + }, + }, + }, + }, + devtool: "source-map", + }; +}; diff --git a/kustomize/base/resources.yaml b/kustomize/base/resources.yaml index 5615dd4..8814a85 100644 --- a/kustomize/base/resources.yaml +++ b/kustomize/base/resources.yaml @@ -21,8 +21,7 @@ spec: - -c - | mkdir -p templated/export templated/import templated/export-and-sign; - envsubst '${TURNKEY_SIGNER_ENVIRONMENT}' < import/index.template.html > templated/import/index.html; - envsubst '${TURNKEY_SIGNER_ENVIRONMENT}' < import/standalone.template.html > templated/import/standalone.html; + envsubst '${TURNKEY_SIGNER_ENVIRONMENT}' < export/index.template.html > templated/export/index.html; # For export-and-sign, copy the webpack-built files and template the environment variable in JS files @@ -39,6 +38,21 @@ spec: fi fi done + + # Do the same for import: copy the webpack-built files and template the environment variable in JS files + if [ -d "/usr/share/nginx/import" ]; then + cp -r /usr/share/nginx/import/. templated/import/; + ls -la templated/import/ + fi + + # Template the environment variable in the built JavaScript files + for file in templated/import/*.js; do + if [ -f "$file" ]; then + if sed "s/__TURNKEY_SIGNER_ENVIRONMENT__/${TURNKEY_SIGNER_ENVIRONMENT}/g" "$file" > "$file.tmp"; then + mv "$file.tmp" "$file" + fi + fi + done securityContext: allowPrivilegeEscalation: false capabilities: @@ -138,4 +152,3 @@ spec: - name: http-oauth-rd port: 8085 targetPort: oauth-redirect - diff --git a/nginx.conf b/nginx.conf index a7f9c95..7ea68e7 100644 --- a/nginx.conf +++ b/nginx.conf @@ -65,18 +65,14 @@ http { } server { listen 8083; - root /usr/share/nginx; + root /usr/share/nginx/templated/import; location / { - try_files /import/$uri /templated/import/$uri /templated/import/$uri/index.html =404; + try_files $uri $uri/ /index.html /standalone.html =404; } } server { listen 8086; - # root /usr/share/nginx; - # add_header Content-Security-Policy "frame-ancestors 'self';"; - # location / { - # try_files /export-and-sign/$uri /templated/export-and-sign/$uri /templated/export-and-sign/$uri/index.html =404; - # } + # optional: add CSP-related configs here later root /usr/share/nginx/templated/export-and-sign; location / { try_files $uri $uri/ /index.html =404;