mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-utils.git
synced 2026-11-05 08:41:07 +00:00
Sign the root over WalletConnect (#83)
* Sign the root over WalletConnect Wallet 1.3.0's DApp browser never delivers injected-provider requests, so the page could not get a signature from any installed wallet. WalletConnect is the route installed wallets answer: on the phone the page opens the wallet by its pezkuwiwallet://wc link, elsewhere it shows a code for the wallet to scan, then asks for polkadot_signMessage on <Bytes>payload</Bytes>. Measured over a real session on the 1.3.0 signing code: the signature verifies under the "substrate" context, which is what the thresholds count. The injected provider stays as a second button for wallets where it works. The WalletConnect bundle is built from scripts/root/wc (pinned versions, node build.mjs). * Open the wallet by a fixed link, not the peer's redirect The redirect in a WalletConnect session's peer metadata is supplied by whichever wallet connects, so following it let a connecting peer navigate the signing page anywhere, javascript: included.
This commit is contained in:
1 parent
306c65532e
commit
c3bc55d37c
6 files changed
+2078
-58
No files matched your search
+100
-58
@@ -5,7 +5,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Guhertina mifteya kokê</title>
|
||||
<!--
|
||||
Root signing page for the wallet's signed config. Open it in the Pezkuwi Wallet DApp browser.
|
||||
Root signing page for the wallet's signed config. The holder's wallet signs over WalletConnect (or the
|
||||
DApp browser's injected provider where it works).
|
||||
It shows the drafted root (proposals/root.N.json), has the holder's wallet sign <Bytes>payload</Bytes>,
|
||||
checks each signature the way the wallet will, and assembles signed/root.N.json once a threshold of the
|
||||
previous root's keys and of the new root's keys have signed. Wallet 1.3.0 accepts sr25519 under the
|
||||
@@ -15,6 +16,7 @@
|
||||
<script src="vendor/bundle-pezkuwi-util-crypto.js"></script>
|
||||
<script src="vendor/bundle-polkadot-util.js"></script>
|
||||
<script src="vendor/bundle-polkadot-util-crypto.js"></script>
|
||||
<script src="vendor/walletconnect.js"></script>
|
||||
<style>
|
||||
:root { --bg: #08090E; --panel: rgba(153,158,199,0.10); --line: rgba(153,158,199,0.16); --text: rgba(255,255,255,0.88);
|
||||
--muted: rgba(255,255,255,0.60); --accent: #009639; --ok: #2FC864; --warn: #EBC50A; --bad: #E53450; }
|
||||
@@ -37,6 +39,7 @@
|
||||
.note { padding: 12px; border-radius: 12px; font-size: 14px; }
|
||||
.note.warn { background: rgba(237,206,54,0.14); } .note.bad { background: rgba(229,52,80,0.14); } .note.ok { background: rgba(47,200,100,0.12); }
|
||||
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
|
||||
a.note { display: block; color: var(--ok); }
|
||||
[hidden] { display: none !important; }
|
||||
</style>
|
||||
</head>
|
||||
@@ -60,7 +63,10 @@
|
||||
<div class="panel row" id="fpBlock" hidden><span>Şopa pêşniyarê</span><span class="mono fp" id="fingerprint"></span></div>
|
||||
<p id="fpHint" hidden>Berî îmzekirinê vê şopê bi telefonê bi xwediyên din re bide ber hev.</p>
|
||||
|
||||
<button id="signButton" hidden>Bi cîzdanê îmze bike</button>
|
||||
<button id="wcButton" hidden>Bi Pezkuwi Cîzdan îmze bike (WalletConnect)</button>
|
||||
<a id="wcOpen" class="note" hidden>Cîzdan venebû? Li vir bitikîne.</a>
|
||||
<div id="wcQrBlock" class="panel" hidden><img id="wcQr" alt="Koda WalletConnect" style="display:block;margin:12px auto;max-width:100%;border-radius:8px"></div>
|
||||
<button id="signButton" class="secondary" hidden>Bi geroka DApp îmze bike</button>
|
||||
<div id="signResult" class="note" hidden></div>
|
||||
<button id="shareButton" class="secondary" hidden>Koda îmzeya min kopî bike</button>
|
||||
|
||||
@@ -207,71 +213,107 @@
|
||||
}
|
||||
};
|
||||
|
||||
// The wallet's injected provider; the signing page asks for accounts only to find the holder's key.
|
||||
const injected = window.injectedWeb3 && (injectedWeb3['pezkuwi-wallet'] || injectedWeb3['pezkuwi-js'] || injectedWeb3['polkadot-js']);
|
||||
if (!injected) {
|
||||
$('signResult').textContent = 'Ji bo îmzekirinê vê rûpelê di geroka DApp ya Pezkuwi Cîzdan de veke.';
|
||||
$('signResult').className = 'note warn';
|
||||
show('signResult');
|
||||
return;
|
||||
}
|
||||
show('signButton');
|
||||
// The wallet answers DApp requests one at a time and waits without limit for each, so a request it never
|
||||
// shows blocks every later one. Each step is named on the page, so a stalled wallet says where it stopped.
|
||||
const step = (text) => {
|
||||
// The wallet answers each request only once its own screen is confirmed, and an unanswered one blocks the
|
||||
// next, so each step is named on the page and a stall says where it stopped.
|
||||
const step = (text, kind = '') => {
|
||||
$('signResult').textContent = text;
|
||||
$('signResult').className = 'note';
|
||||
$('signResult').className = 'note ' + kind;
|
||||
show('signResult');
|
||||
};
|
||||
const waitFor = (promise, text) => {
|
||||
const waitFor = (promise, text, stallHint) => {
|
||||
step(text);
|
||||
const stalled = setTimeout(() => {
|
||||
$('signResult').textContent = text + ' Cîzdan bersiv nade: geroka DApp bi tevahî bigire, rûpelê dîsa veke û carekê bitikîne.';
|
||||
$('signResult').className = 'note warn';
|
||||
}, 45000);
|
||||
const stalled = setTimeout(() => step(text + ' ' + stallHint, 'warn'), 45000);
|
||||
return promise.finally(() => clearTimeout(stalled));
|
||||
};
|
||||
$('signButton').onclick = async () => {
|
||||
$('signButton').disabled = true;
|
||||
try {
|
||||
const extension = await waitFor(injected.enable('Pezkuwi root signing'), 'Bi cîzdanê ve tê girêdan…');
|
||||
const accounts = await waitFor(extension.accounts.get(), 'Hesab têne xwendin…');
|
||||
const mine = accounts.map((a) => ({ address: a.address, keyId: null, public: pz.decodeAddress(a.address) }));
|
||||
for (const account of mine) account.keyId = hex(await sha256(account.public));
|
||||
const holder = mine.find((a) => holders.has(a.keyId));
|
||||
if (!holder) throw new Error('Di vê cîzdanê de hesabekî xwediyê kokê tune.');
|
||||
async function findHolder(addresses) {
|
||||
for (const address of addresses) {
|
||||
const keyId = hex(await sha256(pz.decodeAddress(address)));
|
||||
if (holders.has(keyId)) return { address, keyId };
|
||||
}
|
||||
throw new Error('Cîzdana hilbijartî ne xwediyê kokê ye. Di Pezkuwi Cîzdan de cîzdana xwediyê kokê hilbijêre û dîsa biceribîne.');
|
||||
}
|
||||
function accept(holder, signature) {
|
||||
let sig = pzu.hexToU8a(signature);
|
||||
if (sig.length === 65 && sig[0] === 1) sig = sig.slice(1); // MultiSignature: 0x01 = sr25519
|
||||
const context = classify(holder.keyId, sig);
|
||||
signatures.set(holder.keyId, { sig, context });
|
||||
render();
|
||||
if (context === 'substrate') {
|
||||
step('Îmze derbasdar e. Kodê kopî bike û ji xwediyê ku pelê berhev dike re bişîne.', 'ok');
|
||||
const code = btoa(JSON.stringify({ keyid: holder.keyId, sig: b64(sig) }));
|
||||
$('shareButton').onclick = () => navigator.clipboard.writeText(code).then(() => alert('Hate kopîkirin'), () => prompt('Kod', code));
|
||||
show('shareButton');
|
||||
} else {
|
||||
step(context === 'bizinikiwi'
|
||||
? 'Cîzdan bi çarçoveya "bizinikiwi" îmze kir; cîzdanên 1.3.0 vê qebûl nakin. Ji pêşdebiran re bêje.'
|
||||
: 'Îmze nehat piştrastkirin.', 'bad');
|
||||
}
|
||||
}
|
||||
const guarded = (button, run) => async () => {
|
||||
$(button).disabled = true;
|
||||
try { await run(); } catch (e) { step(e.message || String(e), 'bad'); } finally { $(button).disabled = false; }
|
||||
};
|
||||
|
||||
// WalletConnect: the route every installed wallet answers. On the phone the wallet is opened by its own link;
|
||||
// elsewhere the wallet scans a code. Wallet 1.3.0 signs polkadot_signMessage under the "substrate" context
|
||||
// (measured 11-05 over a real session), and a message already wrapped in <Bytes> is signed as given.
|
||||
const WC_PROJECT_ID = '8292a793b7640e8364c378e331e76d04';
|
||||
const RELAY_CHAIN = 'polkadot:1aa94987791a5544e9667ec249d2cef1';
|
||||
const onPhone = /Android/i.test(navigator.userAgent);
|
||||
let wc = null;
|
||||
show('wcButton');
|
||||
$('wcButton').onclick = guarded('wcButton', async () => {
|
||||
step('WalletConnect tê amadekirin…');
|
||||
wc = wc || await RootSigningWC.SignClient.init({
|
||||
projectId: WC_PROJECT_ID,
|
||||
metadata: { name: 'Pezkuwi root signing', description: 'Guhertina mifteya kokê', url: location.origin, icons: [] },
|
||||
});
|
||||
const { uri, approval } = await wc.connect({
|
||||
optionalNamespaces: { polkadot: { chains: [RELAY_CHAIN], methods: ['polkadot_signMessage'], events: [] } },
|
||||
});
|
||||
const walletLink = 'pezkuwiwallet://wc?uri=' + encodeURIComponent(uri);
|
||||
if (onPhone) {
|
||||
$('wcOpen').href = walletLink;
|
||||
show('wcOpen');
|
||||
location.href = walletLink;
|
||||
} else {
|
||||
$('wcQr').src = await RootSigningWC.qrDataUrl(uri, { width: 280, margin: 2 });
|
||||
show('wcQrBlock');
|
||||
}
|
||||
const session = await waitFor(approval(),
|
||||
onPhone ? 'Di Pezkuwi Cîzdan de girêdanê bipejirîne…' : 'Kodê bi Pezkuwi Cîzdan bixwîne (Mîheng → WalletConnect) û girêdanê bipejirîne…',
|
||||
'Cîzdan bersiv nade: rûpelê nû bike û dîsa biceribîne.');
|
||||
show('wcOpen', false);
|
||||
show('wcQrBlock', false);
|
||||
const holder = await findHolder(session.namespaces.polkadot.accounts.map((a) => a.split(':').pop()));
|
||||
const request = wc.request({
|
||||
topic: session.topic, chainId: RELAY_CHAIN,
|
||||
request: { method: 'polkadot_signMessage', params: { address: holder.address, message: pzu.u8aToHex(message) } },
|
||||
});
|
||||
// A fixed link: the redirect in the peer's metadata is whatever the connecting wallet claims.
|
||||
if (onPhone) location.href = 'pezkuwiwallet://';
|
||||
const { signature } = await waitFor(request, 'Li benda îmzeyê ye: di cîzdanê de peyamê piştrast bike…',
|
||||
'Cîzdan bersiv nade: Pezkuwi Cîzdan veke, daxwazê bibîne an rûpelê nû bike û dîsa biceribîne.');
|
||||
accept(holder, signature);
|
||||
wc.disconnect({ topic: session.topic, reason: { code: 6000, message: 'Signed' } }).catch(() => {});
|
||||
});
|
||||
|
||||
// The provider the wallet's DApp browser injects. Wallet 1.3.0 never delivers its requests (the bridge calls
|
||||
// an interface name the app does not register), so it is offered only beside WalletConnect.
|
||||
const injected = window.injectedWeb3 && (injectedWeb3['pezkuwi-wallet'] || injectedWeb3['pezkuwi-js'] || injectedWeb3['polkadot-js']);
|
||||
if (injected) {
|
||||
show('signButton');
|
||||
const stall = 'Cîzdan bersiv nade: bişkoka WalletConnect bi kar bîne.';
|
||||
$('signButton').onclick = guarded('signButton', async () => {
|
||||
const extension = await waitFor(injected.enable('Pezkuwi root signing'), 'Bi cîzdanê ve tê girêdan…', stall);
|
||||
const accounts = await waitFor(extension.accounts.get(), 'Hesab têne xwendin…', stall);
|
||||
const holder = await findHolder(accounts.map((a) => a.address));
|
||||
const { signature } = await waitFor(
|
||||
extension.signer.signRaw({ address: holder.address, data: pzu.u8aToHex(message), type: 'bytes' }),
|
||||
'Li benda îmzeyê ye: di cîzdanê de peyamê piştrast bike…');
|
||||
let sig = pzu.hexToU8a(signature);
|
||||
if (sig.length === 65 && sig[0] === 1) sig = sig.slice(1); // MultiSignature: 0x01 = sr25519
|
||||
const context = classify(holder.keyId, sig);
|
||||
signatures.set(holder.keyId, { sig, context });
|
||||
render();
|
||||
|
||||
const box = $('signResult');
|
||||
if (context === 'substrate') {
|
||||
box.textContent = 'Îmze derbasdar e. Kodê kopî bike û ji xwediyê ku pelê berhev dike re bişîne.';
|
||||
box.className = 'note ok';
|
||||
const code = btoa(JSON.stringify({ keyid: holder.keyId, sig: b64(sig) }));
|
||||
$('shareButton').onclick = () => navigator.clipboard.writeText(code).then(() => alert('Hate kopîkirin'), () => prompt('Kod', code));
|
||||
show('shareButton');
|
||||
} else {
|
||||
box.textContent = context === 'bizinikiwi'
|
||||
? 'Cîzdan bi çarçoveya "bizinikiwi" îmze kir; cîzdanên 1.3.0 vê qebûl nakin. Ji pêşdebiran re bêje.'
|
||||
: 'Îmze nehat piştrastkirin.';
|
||||
box.className = 'note bad';
|
||||
}
|
||||
show('signResult');
|
||||
} catch (e) {
|
||||
$('signResult').textContent = e.message || String(e);
|
||||
$('signResult').className = 'note bad';
|
||||
show('signResult');
|
||||
} finally {
|
||||
$('signButton').disabled = false;
|
||||
}
|
||||
};
|
||||
'Li benda îmzeyê ye: di cîzdanê de peyamê piştrast bike…', stall);
|
||||
accept(holder, signature);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
fail(e.message || String(e));
|
||||
}
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
var RootSigningWC=(()=>{var tv=Object.create;var Ui=Object.defineProperty;var rv=Object.getOwnPropertyDescriptor;var nv=Object.getOwnPropertyNames;var sv=Object.getPrototypeOf,iv=Object.prototype.hasOwnProperty;var ov=(t,e,r)=>e in t?Ui(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var av=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var X=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Ce=(t,e)=>{for(var r in e)Ui(t,r,{get:e[r],enumerable:!0})},ea=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of nv(e))!iv.call(t,s)&&s!==r&&Ui(t,s,{get:()=>e[s],enumerable:!(n=rv(e,s))||n.enumerable});return t},wt=(t,e,r)=>(ea(t,e,"default"),r&&ea(r,e,"default")),Ie=(t,e,r)=>(r=t!=null?tv(sv(t)):{},ea(e||!t||!t.__esModule?Ui(r,"default",{value:t,enumerable:!0}):r,t)),Cs=t=>ea(Ui({},"__esModule",{value:!0}),t);var Z=(t,e,r)=>ov(t,typeof e!="symbol"?e+"":e,r);var i0=X(ta=>{"use strict";ta.byteLength=uv;ta.toByteArray=fv;ta.fromByteArray=pv;var Qt=[],Dt=[],cv=typeof Uint8Array<"u"?Uint8Array:Array,Yu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Hn=0,n0=Yu.length;Hn<n0;++Hn)Qt[Hn]=Yu[Hn],Dt[Yu.charCodeAt(Hn)]=Hn;var Hn,n0;Dt[45]=62;Dt[95]=63;function s0(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function uv(t){var e=s0(t),r=e[0],n=e[1];return(r+n)*3/4-n}function lv(t,e,r){return(e+r)*3/4-r}function fv(t){var e,r=s0(t),n=r[0],s=r[1],i=new cv(lv(t,n,s)),o=0,a=s>0?n-4:n,c;for(c=0;c<a;c+=4)e=Dt[t.charCodeAt(c)]<<18|Dt[t.charCodeAt(c+1)]<<12|Dt[t.charCodeAt(c+2)]<<6|Dt[t.charCodeAt(c+3)],i[o++]=e>>16&255,i[o++]=e>>8&255,i[o++]=e&255;return s===2&&(e=Dt[t.charCodeAt(c)]<<2|Dt[t.charCodeAt(c+1)]>>4,i[o++]=e&255),s===1&&(e=Dt[t.charCodeAt(c)]<<10|Dt[t.charCodeAt(c+1)]<<4|Dt[t.charCodeAt(c+2)]>>2,i[o++]=e>>8&255,i[o++]=e&255),i}function hv(t){return Qt[t>>18&63]+Qt[t>>12&63]+Qt[t>>6&63]+Qt[t&63]}function dv(t,e,r){for(var n,s=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),s.push(hv(n));return s.join("")}function pv(t){for(var e,r=t.length,n=r%3,s=[],i=16383,o=0,a=r-n;o<a;o+=i)s.push(dv(t,o,o+i>a?a:o+i));return n===1?(e=t[r-1],s.push(Qt[e>>2]+Qt[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],s.push(Qt[e>>10]+Qt[e>>4&63]+Qt[e<<2&63]+"=")),s.join("")}});var o0=X(Ju=>{Ju.read=function(t,e,r,n,s){var i,o,a=s*8-n-1,c=(1<<a)-1,u=c>>1,f=-7,l=r?s-1:0,h=r?-1:1,d=t[e+l];for(l+=h,i=d&(1<<-f)-1,d>>=-f,f+=a;f>0;i=i*256+t[e+l],l+=h,f-=8);for(o=i&(1<<-f)-1,i>>=-f,f+=n;f>0;o=o*256+t[e+l],l+=h,f-=8);if(i===0)i=1-u;else{if(i===c)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,n),i=i-u}return(d?-1:1)*o*Math.pow(2,i-n)};Ju.write=function(t,e,r,n,s,i){var o,a,c,u=i*8-s-1,f=(1<<u)-1,l=f>>1,h=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+l>=1?e+=h/c:e+=h*Math.pow(2,1-l),e*c>=2&&(o++,c/=2),o+l>=f?(a=0,o=f):o+l>=1?(a=(e*c-1)*Math.pow(2,s),o=o+l):(a=e*Math.pow(2,l-1)*Math.pow(2,s),o=0));s>=8;t[r+d]=a&255,d+=p,a/=256,s-=8);for(o=o<<s|a,u+=s;u>0;t[r+d]=o&255,d+=p,o/=256,u-=8);t[r+d-p]|=g*128}});var _0=X(Ls=>{"use strict";var Xu=i0(),Ps=o0(),a0=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ls.Buffer=M;Ls.SlowBuffer=bv;Ls.INSPECT_MAX_BYTES=50;var ra=2147483647;Ls.kMaxLength=ra;M.TYPED_ARRAY_SUPPORT=gv();!M.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function gv(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(M.prototype,"parent",{enumerable:!0,get:function(){if(M.isBuffer(this))return this.buffer}});Object.defineProperty(M.prototype,"offset",{enumerable:!0,get:function(){if(M.isBuffer(this))return this.byteOffset}});function Er(t){if(t>ra)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,M.prototype),e}function M(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return tl(t)}return f0(t,e,r)}M.poolSize=8192;function f0(t,e,r){if(typeof t=="string")return yv(t,e);if(ArrayBuffer.isView(t))return wv(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(er(t,ArrayBuffer)||t&&er(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(er(t,SharedArrayBuffer)||t&&er(t.buffer,SharedArrayBuLine truncated
|
||||
`+t+" = ";for(let s=0;s<e.length;s+=2){if(r===32)n+=su(e[s]).toUpperCase(),n+=" ",n+=su(e[s+1]).toUpperCase();else if(r===64)n+=su(e[s+1]).toUpperCase(),n+=su(e[s]).toUpperCase();else throw new Error("Invalid size "+r);s%6===4?n+=`
|
||||
`+new Array(t.length+4).join(" "):s<e.length-2&&(n+=" ")}console.log(n)}function WA(t,e,r){let n=new Date().getTime(),s=new Uint8Array(e);for(let o=0;o<e;o++)s[o]=o%256;let i=new Date().getTime();console.log("Generated random input in "+(i-n)+"ms"),n=i;for(let o=0;o<r;o++){let a=t(s),c=new Date().getTime(),u=c-n;n=c,console.log("Hashed in "+u+"ms: "+a.substring(0,20)+"..."),console.log(Math.round(e/(1<<20)/(u/1e3)*100)/100+" MB PER SECOND")}}ax.exports={normalizeInput:$A,toHex:jA,debugPrint:KA,testSpeed:WA}});var mx=X((a9,gx)=>{var ou=pd();function iu(t,e,r){let n=t[e]+t[r],s=t[e+1]+t[r+1];n>=4294967296&&s++,t[e]=n,t[e+1]=s}function cx(t,e,r,n){let s=t[e]+r;r<0&&(s+=4294967296);let i=t[e+1]+n;s>=4294967296&&i++,t[e]=s,t[e+1]=i}function ux(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Sn(t,e,r,n,s,i){let o=So[s],a=So[s+1],c=So[i],u=So[i+1];iu(Q,t,e),cx(Q,t,o,a);let f=Q[n]^Q[t],l=Q[n+1]^Q[t+1];Q[n]=l,Q[n+1]=f,iu(Q,r,n),f=Q[e]^Q[r],l=Q[e+1]^Q[r+1],Q[e]=f>>>24^l<<8,Q[e+1]=l>>>24^f<<8,iu(Q,t,e),cx(Q,t,c,u),f=Q[n]^Q[t],l=Q[n+1]^Q[t+1],Q[n]=f>>>16^l<<16,Q[n+1]=l>>>16^f<<16,iu(Q,r,n),f=Q[e]^Q[r],l=Q[e+1]^Q[r+1],Q[e]=l>>>31^f<<1,Q[e+1]=f>>>31^l<<1}var lx=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),GA=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],Qe=new Uint8Array(GA.map(function(t){return t*2})),Q=new Uint32Array(32),So=new Uint32Array(32);function fx(t,e){let r=0;for(r=0;r<16;r++)Q[r]=t.h[r],Q[r+16]=lx[r];for(Q[24]=Q[24]^t.t,Q[25]=Q[25]^t.t/4294967296,e&&(Q[28]=~Q[28],Q[29]=~Q[29]),r=0;r<32;r++)So[r]=ux(t.b,4*r);for(r=0;r<12;r++)Sn(0,8,16,24,Qe[r*16+0],Qe[r*16+1]),Sn(2,10,18,26,Qe[r*16+2],Qe[r*16+3]),Sn(4,12,20,28,Qe[r*16+4],Qe[r*16+5]),Sn(6,14,22,30,Qe[r*16+6],Qe[r*16+7]),Sn(0,10,20,30,Qe[r*16+8],Qe[r*16+9]),Sn(2,12,22,24,Qe[r*16+10],Qe[r*16+11]),Sn(4,14,16,26,Qe[r*16+12],Qe[r*16+13]),Sn(6,8,18,28,Qe[r*16+14],Qe[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Q[r]^Q[r+16]}var In=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function hx(t,e,r,n){if(t===0||t>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(e&&e.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(r&&r.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(n&&n.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");let s={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:t};In.fill(0),In[0]=t,e&&(In[1]=e.length),In[2]=1,In[3]=1,r&&In.set(r,32),n&&In.set(n,48);for(let i=0;i<16;i++)s.h[i]=lx[i]^ux(In,i*4);return e&&(gd(s,e),s.c=128),s}function gd(t,e){for(let r=0;r<e.length;r++)t.c===128&&(t.t+=t.c,fx(t,!1),t.c=0),t.b[t.c++]=e[r]}function dx(t){for(t.t+=t.c;t.c<128;)t.b[t.c++]=0;fx(t,!0);let e=new Uint8Array(t.outlen);for(let r=0;r<t.outlen;r++)e[r]=t.h[r>>2]>>8*(r&3);return e}function px(t,e,r,n,s){r=r||64,t=ou.normalizeInput(t),n&&(n=ou.normalizeInput(n)),s&&(s=ou.normalizeInput(s));let i=hx(r,e,n,s);return gd(i,t),dx(i)}function YA(t,e,r,n,s){let i=px(t,e,r,n,s);return ou.toHex(i)}gx.exports={blake2b:px,blake2bHex:YA,blake2bInit:hx,blake2bUpdate:gd,blake2bFinal:dx}});var Sx=X((c9,_x)=>{var yx=pd();function JA(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Bn(t,e,r,n,s,i){se[t]=se[t]+se[e]+s,se[n]=au(se[n]^se[t],16),se[r]=se[r]+se[n],se[e]=au(se[e]^se[r],12),se[t]=se[t]+se[e]+i,se[n]=au(se[n]^se[t],8),se[r]=se[r]+se[n],se[e]=au(se[e]^se[r],7)}function au(t,e){return t>>>e^t<<32-e}var wx=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),et=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),se=new Uint32Array(16),Ve=new Uint32Array(16);function xx(t,e){let r=0;for(r=0;r<8;r++)se[r]=t.h[r],se[r+8]=wx[r];for(se[12]^=t.t,se[13]^=t.t/4294967296,e&&(se[14]=~se[14]),r=0;r<16;r++)Ve[r]=JA(t.b,4*r);for(r=0;r<10;r++)Bn(0,4,8,12,Ve[et[r*16+0]],Ve[et[r*16+1]]),Bn(1,5,9,13,Ve[et[r*16+2]],Ve[et[r*16+3]]),Bn(2,6,10,14,Ve[et[r*16+4]],Ve[et[r*16+5]]),Bn(3,7,11,15,Ve[et[r*16+6]],Ve
Line truncated
|
||||
]))+`;tn.KANJI=new RegExp(Go,"g");tn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");tn.BYTE=new RegExp(wR,"g");tn.NUMERIC=new RegExp(lE,"g");tn.ALPHANUMERIC=new RegExp(yR,"g");var xR=new RegExp("^"+Go+"$"),bR=new RegExp("^"+lE+"$"),ER=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");tn.testKanji=function(e){return xR.test(e)};tn.testNumeric=function(e){return bR.test(e)};tn.testAlphanumeric=function(e){return ER.test(e)}});var qn=X(Be=>{var vR=Cp(),Pp=Np();Be.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Be.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Be.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Be.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Be.MIXED={bit:-1};Be.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!vR.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Be.getBestModeForData=function(e){return Pp.testNumeric(e)?Be.NUMERIC:Pp.testAlphanumeric(e)?Be.ALPHANUMERIC:Pp.testKanji(e)?Be.KANJI:Be.BYTE};Be.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Be.isValid=function(e){return e&&e.bit&&e.ccBits};function _R(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Be.NUMERIC;case"alphanumeric":return Be.ALPHANUMERIC;case"kanji":return Be.KANJI;case"byte":return Be.BYTE;default:throw new Error("Unknown mode: "+t)}}Be.from=function(e,r){if(Be.isValid(e))return e;try{return _R(e)}catch{return r}}});var gE=X(Ds=>{var Vu=kn(),SR=Rp(),fE=ku(),Fn=qn(),Up=Cp(),dE=7973,hE=Vu.getBCHDigit(dE);function IR(t,e,r){for(let n=1;n<=40;n++)if(e<=Ds.getCapacity(n,r,t))return n}function pE(t,e){return Fn.getCharCountIndicator(t,e)+4}function BR(t,e){let r=0;return t.forEach(function(n){let s=pE(n.mode,e);r+=s+n.getBitsLength()}),r}function AR(t,e){for(let r=1;r<=40;r++)if(BR(t,r)<=Ds.getCapacity(r,e,Fn.MIXED))return r}Ds.from=function(e,r){return Up.isValid(e)?parseInt(e,10):r};Ds.getCapacity=function(e,r,n){if(!Up.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=Fn.BYTE);let s=Vu.getSymbolTotalCodewords(e),i=SR.getTotalCodewordsCount(e,r),o=(s-i)*8;if(n===Fn.MIXED)return o;let a=o-pE(n,e);switch(n){case Fn.NUMERIC:return Math.floor(a/10*3);case Fn.ALPHANUMERIC:return Math.floor(a/11*2);case Fn.KANJI:return Math.floor(a/13);case Fn.BYTE:default:return Math.floor(a/8)}};Ds.getBestVersionForData=function(e,r){let n,s=fE.from(r,fE.M);if(Array.isArray(e)){if(e.length>1)return AR(e,s);if(e.length===0)return 1;n=e[0]}else n=e;return IR(n.mode,n.getLength(),s)};Ds.getEncodedBits=function(e){if(!Up.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Vu.getBCHDigit(r)-hE>=0;)r^=dE<<Vu.getBCHDigit(r)-hE;return e<<12|r}});var xE=X(wE=>{var Lp=kn(),yE=1335,TR=21522,mE=Lp.getBCHDigit(yE);wE.getEncodedBits=function(e,r){let n=e.bit<<3|r,s=n<<10;for(;Lp.getBCHDigit(s)-mE>=0;)s^=yE<<Lp.getBCHDigit(s)-mE;return(n<<10|s)^TR}});var EE=X((iM,bE)=>{var RR=qn();function Di(t){this.mode=RR.NUMERIC,this.data=t.toString()}Di.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Di.prototype.getLength=function(){return this.data.length};Di.prototype.getBitsLength=function(){return Di.getBitsLength(this.data.length)};Di.prototype.write=function(e){let r,n,s;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),s=parseInt(n,10),e.put(s,10);let i=this.data.length-r;i>0&&(n=this.data.substr(r),s=parseInt(n,10),e.put(s,i*3+1))};bE.exports=Di});var _E=X((oM,vE)=>{var DR=qn(),kp=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Oi(t){this.mode=DR.ALPHANUMERIC,this.data=t}Oi.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Oi.prototype.getLength=function(){return this.data.length};Oi.prototype.getBitsLength=function(){return Oi.getBitsLength(this.data.length)};Oi.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=kp.indexOf(this.data[r])*45;n+=kp.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(kp.indexOf(this.data[r]),6)};vE.exports=Oi});var IE=X((aM,SE)=>{var OR=qn();function Ci(t){this.mode=OR.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}Ci.getBitsLength=function(e){return e*8};Ci.prototype.getLength=function(){return this.data.length};Ci.prototype.getBitsLength=function(){return Ci.getBitsLength(this.data.length)};Ci.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};SE.exports=Ci});var AE=X((cM,BE)=>{var CR=qn(),NR=kn();function Ni(t){this.mode=CR.KANJI,this.data=t}Ni.getBitsLength=function(e){return e*13};Ni.prototype.getLength=function(){return this.data.length};Ni.prototype.getBitsLength=function(){return Ni.getBitsLength(this.data.length)};Ni.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=NR.toSJIS(this.dat
Line truncated
|
||||
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};BE.exports=Ni});var TE=X((uM,Mp)=>{"use strict";var Yo={single_source_shortest_paths:function(t,e,r){var n={},s={};s[e]=0;var i=Yo.PriorityQueue.make();i.push(e,0);for(var o,a,c,u,f,l,h,d,p;!i.empty();){o=i.pop(),a=o.value,u=o.cost,f=t[a]||{};for(c in f)f.hasOwnProperty(c)&&(l=f[c],h=u+l,d=s[c],p=typeof s[c]>"u",(p||d>h)&&(s[c]=h,i.push(c,h),n[c]=a))}if(typeof r<"u"&&typeof s[r]>"u"){var g=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(g)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,s;n;)r.push(n),s=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Yo.single_source_shortest_paths(t,e,r);return Yo.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Yo.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof Mp<"u"&&(Mp.exports=Yo)});var LE=X(Pi=>{var ce=qn(),OE=EE(),CE=_E(),NE=IE(),PE=AE(),Jo=Np(),$u=kn(),PR=TE();function RE(t){return unescape(encodeURIComponent(t)).length}function Xo(t,e,r){let n=[],s;for(;(s=t.exec(r))!==null;)n.push({data:s[0],index:s.index,mode:e,length:s[0].length});return n}function UE(t){let e=Xo(Jo.NUMERIC,ce.NUMERIC,t),r=Xo(Jo.ALPHANUMERIC,ce.ALPHANUMERIC,t),n,s;return $u.isKanjiModeEnabled()?(n=Xo(Jo.BYTE,ce.BYTE,t),s=Xo(Jo.KANJI,ce.KANJI,t)):(n=Xo(Jo.BYTE_KANJI,ce.BYTE,t),s=[]),e.concat(r,n,s).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function qp(t,e){switch(e){case ce.NUMERIC:return OE.getBitsLength(t);case ce.ALPHANUMERIC:return CE.getBitsLength(t);case ce.KANJI:return PE.getBitsLength(t);case ce.BYTE:return NE.getBitsLength(t)}}function UR(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function LR(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];switch(n.mode){case ce.NUMERIC:e.push([n,{data:n.data,mode:ce.ALPHANUMERIC,length:n.length},{data:n.data,mode:ce.BYTE,length:n.length}]);break;case ce.ALPHANUMERIC:e.push([n,{data:n.data,mode:ce.BYTE,length:n.length}]);break;case ce.KANJI:e.push([n,{data:n.data,mode:ce.BYTE,length:RE(n.data)}]);break;case ce.BYTE:e.push([{data:n.data,mode:ce.BYTE,length:RE(n.data)}])}}return e}function kR(t,e){let r={},n={start:{}},s=["start"];for(let i=0;i<t.length;i++){let o=t[i],a=[];for(let c=0;c<o.length;c++){let u=o[c],f=""+i+c;a.push(f),r[f]={node:u,lastCount:0},n[f]={};for(let l=0;l<s.length;l++){let h=s[l];r[h]&&r[h].node.mode===u.mode?(n[h][f]=qp(r[h].lastCount+u.length,u.mode)-qp(r[h].lastCount,u.mode),r[h].lastCount+=u.length):(r[h]&&(r[h].lastCount=u.length),n[h][f]=qp(u.length,u.mode)+4+ce.getCharCountIndicator(u.mode,e))}}s=a}for(let i=0;i<s.length;i++)n[s[i]].end=0;return{map:n,table:r}}function DE(t,e){let r,n=ce.getBestModeForData(t);if(r=ce.from(e,n),r!==ce.BYTE&&r.bit<n.bit)throw new Error('"'+t+'" cannot be encoded with mode '+ce.toString(r)+`.
|
||||
Suggested mode is: `+ce.toString(n));switch(r===ce.KANJI&&!$u.isKanjiModeEnabled()&&(r=ce.BYTE),r){case ce.NUMERIC:return new OE(t);case ce.ALPHANUMERIC:return new CE(t);case ce.KANJI:return new PE(t);case ce.BYTE:return new NE(t)}}Pi.fromArray=function(e){return e.reduce(function(r,n){return typeof n=="string"?r.push(DE(n,null)):n.data&&r.push(DE(n.data,n.mode)),r},[])};Pi.fromString=function(e,r){let n=UE(e,$u.isKanjiModeEnabled()),s=LR(n),i=kR(s,r),o=PR.find_path(i.map,"start","end"),a=[];for(let c=1;c<o.length-1;c++)a.push(i.table[o[c]].node);return Pi.fromArray(UR(a))};Pi.rawSplit=function(e){return Pi.fromArray(UE(e,$u.isKanjiModeEnabled()))}});var ME=X(kE=>{var Ku=kn(),Fp=ku(),MR=J2(),qR=Z2(),FR=Q2(),HR=rE(),Vp=nE(),$p=Rp(),zR=cE(),ju=gE(),VR=xE(),$R=qn(),Hp=LE();function jR(t,e){let r=t.size,n=HR.getPositions(e);for(let s=0;s<n.length;s++){let i=n[s][0],o=n[s][1];for(let a=-1;a<=7;a++)if(!(i+a<=-1||r<=i+a))for(let c=-1;c<=7;c++)o+c<=-1||r<=o+c||(a>=0&&a<=6&&(c===0||c===6)||c>=0&&c<=6&&(a===0||a===6)||a>=2&&a<=4&&c>=2&&c<=4?t.set(i+a,o+c,!0,!0):t.set(i+a,o+c,!1,!0))}}function KR(t){let e=t.size;for(let r=8;r<e-8;r++){let n=r%2===0;t.set(r,6,n,!0),t.set(6,r,n,!0)}}function WR(t,e){let r=FR.getPositions(e);for(let n=0;n<r.length;n++){let s=r[n][0],i=r[n][1];for(let o=-2;o<=2;o++)for(let a=-2;a<=2;a++)o===-2||o===2||a===-2||a===2||o===0&&a===0?t.set(s+o,i+a,!0,!0):t.set(s+o,i+a,!1,!0)}}function GR(t,e){let r=t.size,n=ju.getEncodedBits(e),s,i,o;for(let a=0;a<18;a++)s=Math.floor(a/3),i=a%3+r-8-3,o=(n>>a&1)===1,t.set(s,i,o,!0),t.set(i,s,o,!0)}function zp(t,e,r){let n=t.size,s=VR.getEncodedBits(e,r),i,o;for(i=0;i<15;i++)o=(s>>i&1)===1,i<6?t.set(i,8,o,!0):i<8?t.set(i+1,8,o,!0):t.set(n-15+i,8,o,!0),i<8?t.set(8,n-i-1,o,!0):i<9?t.set(8,15-i-1+1,o,!0):t.set(8,15-i-1,o,!0);t.set(n-8,8,1,!0)}function YR(t,e){let r=t.size,n=-1,s=r-1,i=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let c=0;c<2;c++)if(!t.isReserved(s,a-c)){let u=!1;o<e.length&&(u=(e[o]>>>i&1)===1),t.set(s,a-c,u),i--,i===-1&&(o++,i=7)}if(s+=n,s<0||r<=s){s-=n,n=-n;break}}}function JR(t,e,r){let n=new MR;r.forEach(function(c){n.put(c.mode.bit,4),n.put(c.getLength(),$R.getCharCountIndicator(c.mode,t)),c.write(n)});let s=Ku.getSymbolTotalCodewords(t),i=$p.getTotalCodewordsCount(t,e),o=(s-i)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let c=0;c<a;c++)n.put(c%2?17:236,8);return XR(n,t,e)}function XR(t,e,r){let n=Ku.getSymbolTotalCodewords(e),s=$p.getTotalCodewordsCount(e,r),i=n-s,o=$p.getBlocksCount(e,r),a=n%o,c=o-a,u=Math.floor(n/o),f=Math.floor(i/o),l=f+1,h=u-f,d=new zR(h),p=0,g=new Array(o),m=new Array(o),b=0,T=new Uint8Array(t.buffer);for(let O=0;O<o;O++){let N=O<c?f:l;g[O]=T.slice(p,p+N),m[O]=d.encode(g[O]),p+=N,b=Math.max(b,N)}let w=new Uint8Array(n),v=0,R,C;for(R=0;R<b;R++)for(C=0;C<o;C++)R<g[C].length&&(w[v++]=g[C][R]);for(R=0;R<h;R++)for(C=0;C<o;C++)w[v++]=m[C][R];return w}function ZR(t,e,r,n){let s;if(Array.isArray(t))s=Hp.fromArray(t);else if(typeof t=="string"){let u=e;if(!u){let f=Hp.rawSplit(t);u=ju.getBestVersionForData(f,r)}s=Hp.fromString(t,u||40)}else throw new Error("Invalid data");let i=ju.getBestVersionForData(s,r);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=i;else if(e<i)throw new Error(`
|
||||
The chosen QR Code version cannot contain this amount of data.
|
||||
Minimum version required to store current data is: `+i+`.
|
||||
`);let o=JR(e,r,s),a=Ku.getSymbolSize(e),c=new qR(a);return jR(c,e),KR(c),WR(c,e),zp(c,r,0),e>=7&&GR(c,e),YR(c,o),isNaN(n)&&(n=Vp.getBestMask(c,zp.bind(null,c,r))),Vp.applyMask(n,c),zp(c,r,n),{modules:c,version:e,errorCorrectionLevel:r,maskPattern:n,segments:s}}kE.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=Fp.M,s,i;return typeof r<"u"&&(n=Fp.from(r.errorCorrectionLevel,Fp.M),s=ju.from(r.version),i=Vp.from(r.maskPattern),r.toSJISFunc&&Ku.setToSJISFunction(r.toSJISFunc)),ZR(e,s,n,i)}});var jp=X(Os=>{function qE(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}Os.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,s=e.scale||4;return{width:n,scale:n?4:s,margin:r,color:{dark:qE(e.color.dark||"#000000ff"),light:qE(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Os.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};Os.getImageWidth=function(e,r){let n=Os.getScale(e,r);return Math.floor((e+r.margin*2)*n)};Os.qrToImageData=function(e,r,n){let s=r.modules.size,i=r.modules.data,o=Os.getScale(s,n),a=Math.floor((s+n.margin*2)*o),c=n.margin*o,u=[n.color.light,n.color.dark];for(let f=0;f<a;f++)for(let l=0;l<a;l++){let h=(f*a+l)*4,d=n.color.light;if(f>=c&&l>=c&&f<a-c&&l<a-c){let p=Math.floor((f-c)/o),g=Math.floor((l-c)/o);d=u[i[p*s+g]?1:0]}e[h++]=d.r,e[h++]=d.g,e[h++]=d.b,e[h]=d.a}}});var FE=X(Wu=>{var Kp=jp();function QR(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function eD(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Wu.render=function(e,r,n){let s=n,i=r;typeof s>"u"&&(!r||!r.getContext)&&(s=r,r=void 0),r||(i=eD()),s=Kp.getOptions(s);let o=Kp.getImageWidth(e.modules.size,s),a=i.getContext("2d"),c=a.createImageData(o,o);return Kp.qrToImageData(c.data,e,s),QR(a,i,o),a.putImageData(c,0,0),i};Wu.renderToDataURL=function(e,r,n){let s=n;typeof s>"u"&&(!r||!r.getContext)&&(s=r,r=void 0),s||(s={});let i=Wu.render(e,r,s),o=s.type||"image/png",a=s.rendererOpts||{};return i.toDataURL(o,a.quality)}});var VE=X(zE=>{var tD=jp();function HE(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function Wp(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function rD(t,e,r){let n="",s=0,i=!1,o=0;for(let a=0;a<t.length;a++){let c=Math.floor(a%e),u=Math.floor(a/e);!c&&!i&&(i=!0),t[a]?(o++,a>0&&c>0&&t[a-1]||(n+=i?Wp("M",c+r,.5+u+r):Wp("m",s,0),s=0,i=!1),c+1<e&&t[a+1]||(n+=Wp("h",o),o=0)):s++}return n}zE.render=function(e,r,n){let s=tD.getOptions(r),i=e.modules.size,o=e.modules.data,a=i+s.margin*2,c=s.color.light.a?"<path "+HE(s.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",u="<path "+HE(s.color.dark,"stroke")+' d="'+rD(o,i,s.margin)+'"/>',f='viewBox="0 0 '+a+" "+a+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+f+' shape-rendering="crispEdges">'+c+u+`</svg>
|
||||
`;return typeof n=="function"&&n(null,h),h}});var jE=X(Zo=>{var nD=W2(),Gp=ME(),$E=FE(),sD=VE();function Yp(t,e,r,n,s){let i=[].slice.call(arguments,1),o=i.length,a=typeof i[o-1]=="function";if(!a&&!nD())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(s=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof s>"u"?(s=n,n=void 0):(s=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(c,u){try{let f=Gp.create(r,n);c(t(f,e,n))}catch(f){u(f)}})}try{let c=Gp.create(r,n);s(null,t(c,e,n))}catch(c){s(c)}}Zo.create=Gp.create;Zo.toCanvas=Yp.bind(null,$E.render);Zo.toDataURL=Yp.bind(null,$E.renderToDataURL);Zo.toString=Yp.bind(null,function(t,e,r){return sD.render(t,r)})});var iD={};Ce(iD,{SignClient:()=>j2,qrDataUrl:()=>GE.toDataURL});var KE=Ie(_0(),1),WE=Ie(T0(),1);var Uu=Ie($n(),1);var en=Ie($n(),1);var Z0=Ie($n()),pa=Ie($s());var $t=class{};var pl=class extends $t{constructor(e){super()}},X0=pa.FIVE_SECONDS,nn={pulse:"heartbeat_pulse"},da=class t extends pl{constructor(e){super(e),this.events=new Z0.EventEmitter,this.interval=X0,this.interval=e?.interval||X0}static async init(e){let r=new t(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,pa.toMiliseconds)(this.interval))}pulse(){this.events.emit(nn.pulse)}};var y8=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,w8=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,x8=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function b8(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){E8(t);return}return e}function E8(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function qi(t,e={}){if(typeof t!="string")return t;if(t[0]==='"'&&t[t.length-1]==='"'&&t.indexOf("\\")===-1)return t.slice(1,-1);let r=t.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!x8.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(y8.test(t)||w8.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,b8)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function v8(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Ae(t,...e){try{return v8(t(...e))}catch(r){return Promise.reject(r)}}function _8(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function S8(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Fi(t){if(_8(t))return String(t);if(S8(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Fi(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}var gl="base64:";function Q0(t){return typeof t=="string"?t:gl+B8(t)}function eg(t){return typeof t!="string"||!t.startsWith(gl)?t:I8(t.slice(gl.length))}function I8(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function B8(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function sn(t){return t&&t.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function ml(t){return t.split(":").some(e=>e==="."||e==="..")}function tg(...t){return sn(t.join(":"))}function yl(t){return t=sn(t),t?t+":":""}function rg(t,e){if(e===void 0)return!0;let r=0,n=t.indexOf(":");for(;n>-1;)r++,n=t.indexOf(":",n+1);return r<=e}function ng(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}var A8="memory",T8=()=>{let t=new Map;return{name:A8,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function og(t={}){let e={mounts:{"":t.driver||T8()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=l=>{let h=sn(l);if(!h||ml(h))throw new Error(`[unstorage] Invalid key: ${JSON.stringify(l)}`);return h},n=l=>{let h=yl(l);if(ml(h))throw new Error(`[unstorage] Invalid base: ${JSON.stringify(l)}`);return h},s=l=>{for(let h of e.mountpoints)if(l.startsWith(h))return{base:h,relativeKey:l.slice(h.length),driver:e.moun
Line truncated
|
||||
Following code pattern:
|
||||
|
||||
if (CID.isCID(value)) {
|
||||
doSomethingWithCID(value)
|
||||
}
|
||||
|
||||
Is replaced with:
|
||||
|
||||
const cid = CID.asCID(value)
|
||||
if (cid) {
|
||||
// Make sure to use cid instead of value
|
||||
doSomethingWithCID(cid)
|
||||
}
|
||||
`;var Df={...gf,...mf,...yf,...wf,...xf,...bf,...Ef,...vf,..._f,...Sf},EO={...Tf,...Rf};function Yn(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ji(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Yn(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Um(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Pm=Um("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Of=Um("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Ji(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),m6={utf8:Pm,"utf-8":Pm,hex:Df.base16,latin1:Of,ascii:Of,binary:Of,...Df},Ya=m6;function Re(t,e="utf8"){let r=Ya[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Yn(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var Lm=function(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},y6=(function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t})();var w6=(function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t})();var x6=(function(){function t(e,r,n,s){this.name=e,this.version=r,this.os=n,this.bot=s,this.type="bot-device"}return t})();var b6=(function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t})();var E6=(function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t})();var v6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,_6=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,km=3,S6=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",v6]],Mm=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Fm(t){return t?qm(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new E6:typeof navigator<"u"?qm(navigator.userAgent):A6()}function I6(t){return t!==""&&S6.reduce(function(e,r){var n=r[0],s=r[1];if(e)return e;var i=s.exec(t);return!!i&&[n,i]},!1)}function qm(t){var e=I6(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new b6;var s=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);s?s.length<km&&(s=Lm(Lm([],s,!0),T6(km-s.length),!0)):s=[];var i=s.join("."),o=B6(t),a=_6.exec(t);return a&&a[1]?new
Line truncated
|
||||
`);super(a,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${py()}`}),this.cause=r.cause,this.details=n,this.docs=o,this.docsPath=s,this.shortMessage=e}walk(e){return gy(this,e)}};function gy(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause?gy(t.cause,e):e?null:t}var ss=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function X6(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function is(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function hr(t,...e){if(!X6(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function my(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");is(t.outputLen),is(t.blockLen)}function Or(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function tc(t,e){hr(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function yy(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function dr(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function rc(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function Wt(t,e){return t<<32-e|t>>>e}var Z6=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Q6(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function e4(t){for(let e=0;e<t.length;e++)t[e]=Q6(t[e]);return t}var kf=Z6?t=>t:e4;function t4(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function os(t){return typeof t=="string"&&(t=t4(t)),hr(t),t}function wy(...t){let e=0;for(let n=0;n<t.length;n++){let s=t[n];hr(s),e+=s.length}let r=new Uint8Array(e);for(let n=0,s=0;n<t.length;n++){let i=t[n];r.set(i,s),s+=i.length}return r}var dn=class{};function nc(t){let e=n=>t().update(os(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function xy(t=32){if(ss&&typeof ss.getRandomValues=="function")return ss.getRandomValues(new Uint8Array(t));if(ss&&typeof ss.randomBytes=="function")return Uint8Array.from(ss.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}function r4(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let s=BigInt(32),i=BigInt(4294967295),o=Number(r>>s&i),a=Number(r&i),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}function by(t,e,r){return t&e^~t&r}function Ey(t,e,r){return t&e^t&r^e&r}var sc=class extends dn{constructor(e,r,n,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=s,this.buffer=new Uint8Array(e),this.view=rc(this.buffer)}update(e){Or(this),e=os(e),hr(e);let{view:r,buffer:n,blockLen:s}=this,i=e.length;for(let o=0;o<i;){let a=Math.min(s-this.pos,i-o);if(a===s){let c=rc(e);for(;s<=i-o;o+=s)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Or(this),tc(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:s,isLE:i}=this,{pos:o}=this;r[o++]=128,dr(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(n,0),o=0);for(let l=o;l<s;l++)r[l]=0;r4(n,s-8,BigInt(this.length*8),i),this.process(n,0);let a=rc(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)a.setUint32(4*l,f[l],i)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:s,finished:i,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=i,e.length=s,e.pos=a,s%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}},Cr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var ic=BigInt(4294967295),vy=BigInt(32);function n4(t,e=!1){return e?{h:Number(t&ic),l:
Line truncated
|
||||
${t.length}`,r=new TextEncoder().encode(e+t);return"0x"+Ee(hy(r),"base16")}async function hT(t,e,r,n,s,i){switch(r.t){case"eip191":return await dT(t,e,r.s);case"eip1271":return await pT(t,e,r.s,n,s,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function dT(t,e,r){let n=Tc.fromHex(r);return Nc.recoverAddress({payload:jx(e),signature:n}).toLowerCase()===t.toLowerCase()}async function pT(t,e,r,n,s,i){let o=Ro(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{let a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",u=r.substring(2),f=(u.length/2).toString(16).padStart(64,"0"),l=(e.startsWith("0x")?e:jx(e)).substring(2),h=a+l+c+f+u,d=await fetch(`${i||fT}/?chainId=${n}&projectId=${s}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:gT(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:h},"latest"]})}),{result:p}=await d.json();return p?p.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function gT(){return Date.now()+Math.floor(Math.random()*1e3)}function Kx(t){let e=bi(t),r=e[0];if(r===0)throw new Error("No signatures found");let n=1+r*64;if(e.length<n)throw new Error("Transaction data too short for claimed signature count");if(e.length<100)throw new Error("Transaction too short");let s=e.slice(1,65);return ci.encode(s)}function Wx(t){let e=bi(t),r=new TextEncoder().encode("TransactionData::"),n=new Uint8Array(r.length+e.length);n.set(r),n.set(e,r.length);let s=n1(n,{dkLen:32});return ci.encode(s)}function Sd(t){let e=new Uint8Array(gs(mT(t)));return ci.encode(e)}function mT(t){if(t instanceof Uint8Array)return t;if(Array.isArray(t))return new Uint8Array(t);if(typeof t=="object"&&t?.data)return new Uint8Array(Object.values(t.data));if(typeof t=="object"&&t)return new Uint8Array(Object.values(t));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function Id(t){let e=bi(t),r=Vh(e).txn;if(!r)throw new Error("Invalid signed transaction: missing 'txn' field");let n=qh(r),s=new TextEncoder().encode("TX"),i=Hr([s,new Uint8Array(n)]),o=t1(i);return qw.encode(o).replace(/=+$/,"")}function yd(t){let e=[],r=BigInt(t);for(;r>=0x80n;)e.push(Number(r&0x7fn|0x80n)),r>>=7n;return e.push(Number(r)),new Uint8Array(e)}function Gx(t){let e=bi(t.signed.bodyBytes),r=bi(t.signed.authInfoBytes),n=bi(t.signature.signature),s=[];s.push(new Uint8Array([10])),s.push(yd(e.length)),s.push(e),s.push(new Uint8Array([18])),s.push(yd(r.length)),s.push(r),s.push(new Uint8Array([26])),s.push(yd(n.length)),s.push(n);let i=Hr(s),o=gs(i);return Ee(o,"base16").toUpperCase()}function Yx(t){let e=[];try{if(typeof t=="string")return e.push(t),e;if(typeof t!="object")return e;t?.id&&e.push(t.id);let r=t?.capabilities?.caip345?.transactionHashes;r&&e.push(...r)}catch(r){console.warn("getWalletSendCallsHashes failed: ",r)}return e}var Jx="did:pkh:",yT={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},wT=t=>t?yT[t]||t:"",gu=t=>t?.split(":"),xT=t=>{let e=t&&gu(t);if(e)return t.includes(Jx)?e[3]:e[1]},bT=t=>{let e=t&&gu(t);if(e)return t.includes(Jx)?e[2]:e[0]},mu=t=>{let e=t&&gu(t);if(e)return e[2]+":"+e[3]},No=t=>{let e=t&&gu(t);if(e)return e.pop()};async function Bd(t){let{cacao:e,projectId:r}=t,{s:n,p:s}=e,i=Ad(s,s.iss),o=No(s.iss);return await hT(o,i,n,mu(s.iss),r)}var Ad=(t,e)=>{let r=bT(e);if(!r)throw new Error("Invalid issuer: "+e);let n=`${t.domain} wants you to sign in with your ${wT(r)} account:`,s=No(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0,o=`URI: ${t.aud||t.uri}`,a=`Version: ${t.version}`,c=`Chain ID: ${xT(e)}`,u=`Nonce: ${t.nonce}`,f=`Issued At: ${t.iat}`,l=t.exp?`Expiration Time: ${t.exp}`:void 0,h=t.nbf?`Not Before: ${t.nbf}`:void 0,d=t.requestId?`Request ID: ${t.requestId}`:void 0,p=t.resources?`Resources:${t.resources.map(m=>`
|
||||
- ${m}`).join("")}`:void 0,g=Po(t.resources);if(g){let m=To(g);i=AT(i,m)}return[n,s,"",i,"",o,a,c,u,f,l,h,d,p].filter(m=>m!=null).join(`
|
||||
`)};function ET(t){let e=JSON.stringify(t),r=new TextEncoder().encode(e),n=new Array(r.length);for(let s=0;s<r.length;s++)n[s]=String.fromCharCode(r[s]);return btoa(n.join(""))}function vT(t){let e=t+"=".repeat((4-t.length%4)%4),r=atob(e),n=new Uint8Array(r.length);for(let s=0;s<r.length;s++)n[s]=r.charCodeAt(s);return JSON.parse(new TextDecoder().decode(n))}function vs(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");let e=Object.keys(t.att);if(!e?.length)throw new Error("No resources found in `att` property");e.forEach(r=>{let n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(s=>{let i=n[s];if(!Array.isArray(i))throw new Error(`Ability limits ${s} must be an array of objects, found: ${i}`);if(!i.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);i.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${o}`)})})})}function _T(t,e,r,n={}){return r?.sort((s,i)=>s.localeCompare(i)),{att:{[t]:ST(e,r,n)}}}function ST(t,e,r={}){e=e?.sort((s,i)=>s.localeCompare(i));let n=e.map(s=>({[`${t}/${s}`]:[r]}));return Object.assign({},...n)}function Xx(t){return vs(t),`urn:recap:${ET(t).replace(/=/g,"")}`}function To(t){let e=vT(t.replace("urn:recap:",""));return vs(e),e}function Zx(t,e,r){let n=_T(t,e,r);return Xx(n)}function IT(t){return t&&t.includes("urn:recap:")}function Qx(t,e){let r=To(t),n=To(e),s=BT(r,n);return Xx(s)}function BT(t,e){vs(t),vs(e);let r=Object.keys(t.att).concat(Object.keys(e.att)).sort((s,i)=>s.localeCompare(i)),n={att:{}};return r.forEach(s=>{Object.keys(t.att?.[s]||{}).concat(Object.keys(e.att?.[s]||{})).sort((i,o)=>i.localeCompare(o)).forEach(i=>{n.att[s]={...n.att[s],[i]:t.att[s]?.[i]||e.att[s]?.[i]}})}),n}function AT(t="",e){vs(e);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;let n=[],s=0;Object.keys(e.att).forEach(a=>{let c=Object.keys(e.att[a]).map(l=>({ability:l.split("/")[0],action:l.split("/")[1]}));c.sort((l,h)=>l.action.localeCompare(h.action));let u={};c.forEach(l=>{u[l.ability]||(u[l.ability]=[]),u[l.ability].push(l.action)});let f=Object.keys(u).map(l=>(s++,`(${s}) '${l}': '${u[l].join("', '")}' for '${a}'.`));n.push(f.join(", ").replace(".,","."))});let i=n.join(" "),o=`${r}${i}`;return`${t?t+" ":""}${o}`}function Td(t){let e=To(t);vs(e);let r=e.att?.eip155;return r?Object.keys(r).map(n=>n.split("/")[1]):[]}function Rd(t){let e=To(t);vs(e);let r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(s=>{s?.[0]?.chains&&r.push(s[0].chains)})}),[...new Set(r.flat())]}function Po(t){if(!t)return;let e=t?.[t.length-1];return IT(e)?e:void 0}var eb="base10",tt="base16",Oe="base64pad",Qr="base64url",Uo="utf8",tb=0,Jt=1,Ei=2,TT=0,Ax=1,Ao=12,Dd=32;function rb(){let t=tu.utils.randomPrivateKey(),e=tu.getPublicKey(t);return{privateKey:Ee(t,tt),publicKey:Ee(e,tt)}}function yu(){let t=bt(Dd);return Ee(t,tt)}function nb(t,e){let r=tu.getSharedSecret(Re(t,tt),Re(e,tt)),n=E1(yo,r,void 0,void 0,Dd);return Ee(n,tt)}function vi(t){let e=yo(Re(t,tt));return Ee(e,tt)}function yt(t){let e=yo(Re(t,Uo));return Ee(e,tt)}function sb(t){return Re(`${t}`,eb)}function An(t){return Number(Ee(t,eb))}function ib(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function uu(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r=(4-e.length%4)%4;return e+"=".repeat(r)}function ob(t){let e=sb(typeof t.type<"u"?t.type:tb);if(An(e)===Jt&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?Re(t.senderPublicKey,tt):void 0,n=typeof t.iv<"u"?Re(t.iv,tt):bt(Ao),s=Re(t.symKey,tt),i=Wh(s,n).encrypt(Re(t.message,Uo)),o=lb({type:e,sealed:i,iv:n,senderPublicKey:r});return t.encoding===Qr?ib(o):o}function ab(t){let e=Re(t.symKey,tt),{sealed:r,iv:n}=_i({encoded:t.encoded,encoding:t.encoding}),s=Wh(e,n).decrypt(r);if(s===null)throw new Error("Failed to decrypt");return Ee(s,Uo)}function cb(t,e){let r=sb(Ei),n=bt(Ao),s=Re(t,Uo),i=lb({type:r,sealed:s,iv:n});return e===Qr?ib(i):i}function ub(t,e){let{sealed:r}=_i({encoded:t,encoding:e});return Ee(r,Uo)}function lb(t){if(An(t.type)===Ei)return Ee(Hr([t.type,t.sealed]),Oe);if(An(t.type)===Jt){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Ee(Hr([t.type,t.senderPublicKey,t.iv,t.sealed]),Oe)}return Ee(Hr([t.type,t.iv,t.sealed]),Oe)}function _i(t){let e=(t.encoding||Oe)===Qr?uu(t.encoded):t.encoded,r=Re(e,Oe),n=r.slice(TT,Ax),s=Ax;if(An(n)===Jt){let c=s+Dd,u=c+Ao,f=r.slice(s,c),l=r.slice(c,u),h=r.slice(u);return{type:n,sealed:h,iv:l,senderPublicKey:f}}if(An(n)===Ei){let c=r.slice(s),u=bt(Ao);return{type:
Line truncated
|
||||
Required: ${f.toString()}
|
||||
Received: ${Object.keys(e).toString()}`)),bs(o,a)||(n=F("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
|
||||
Required: ${o.toString()}
|
||||
Approved: ${a.toString()}`)),Object.keys(e).forEach(l=>{if(!l.includes(":")||n)return;let h=Si(e[l].accounts);h.includes(l)||(n=F("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${l}
|
||||
Required: ${l}
|
||||
Approved: ${h.toString()}`))}),o.forEach(l=>{n||(bs(s[l].methods,i[l].methods)?bs(s[l].events,i[l].events)||(n=F("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${l}`)):n=F("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${l}`))}),n}function $T(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:t[r].chains?.forEach(n=>{e[n]={methods:t[r].methods,events:t[r].events}})}),e}function Dx(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function jT(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Si(t[r].accounts)?.forEach(n=>{e[n]={accounts:t[r].accounts.filter(s=>s.includes(`${n}:`)),methods:t[r].methods,events:t[r].events}})}),e}function Cb(t,e){return Md(t,!1)&&t<=e.max&&t>=e.min}function zd(){let t=Oo();return new Promise(e=>{switch(t){case mt.browser:e(KT());break;case mt.reactNative:e(WT());break;case mt.node:e(GT());break;default:e(!0)}})}function KT(){return _s()&&navigator?.onLine}async function WT(){return Xr()&&typeof globalThis<"u"&&globalThis?.NetInfo?(await globalThis?.NetInfo.fetch())?.isConnected:!0}function GT(){return!0}function Nb(t){switch(Oo()){case mt.browser:YT(t);break;case mt.reactNative:JT(t);break;case mt.node:break}}function YT(t){!Xr()&&_s()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function JT(t){Xr()&&typeof globalThis<"u"&&globalThis?.NetInfo&&globalThis?.NetInfo.addEventListener(e=>t(e?.isConnected))}function Pb(){return _s()&&(0,Yt.getDocument)()?(0,Yt.getDocument)()?.visibilityState==="visible":!0}var wd={},Tn=class{static get(e){return wd[e]}static set(e,r){wd[e]=r}static delete(e){delete wd[e]}};function XT(t){let e=ci.decode(t);if(e.length<33)throw new Error("Too short to contain a public key");return e.slice(1,33)}function ZT({publicKey:t,signature:e,payload:r}){let n=fu(r.method),s=128|parseInt(r.version?.toString()||"4"),i=t5(r.address),o=r.era==="00"?new Uint8Array([0]):fu(r.era);if(o.length!==1&&o.length!==2)throw new Error("Invalid era length");let a=parseInt(r.nonce,16),c=new Uint8Array([a&255,a>>8&255]),u=BigInt(`0x${e5(r.tip)}`),f=n5(u),l=new Uint8Array([0,...t,i,...e,...o,...c,...f,...n]),h=r5(l.length+1);return new Uint8Array([...h,s,...l])}function QT(t){let e=fu(t),r=(0,Cx.blake2b)(e,void 0,32);return"0x"+Ee(r,"base16")}function fu(t){return new Uint8Array(t.replace(/^0x/,"").match(/.{1,2}/g).map(e=>parseInt(e,16)))}function e5(t){return t.startsWith("0x")?t.slice(2):t}function t5(t){let e=ci.decode(t)[0];return e===42?0:e===60?2:1}function r5(t){if(t<64)return new Uint8Array([t<<2]);if(t<16384){let e=t<<2|1;return new Uint8Array([e&255,e>>8&255])}else if(t<1<<30){let e=t<<2|2;return new Uint8Array([e&255,e>>8&255,e>>16&255,e>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function n5(t){if(t<1n<<6n)return new Uint8Array([Number(t<<2n)]);if(t<1n<<14n){let e=t<<2n|0x01n;return new Uint8Array([Number(e&0xffn),Number(e>>8n&0xffn)])}else if(t<1n<<30n){let e=t<<2n|0x02n;return new Uint8Array([Number(e&0xffn),Number(e>>8n&0xffn),Number(e>>16n&0xffn),Number(e>>24n&0xffn)])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Ub(t){let e=fu(t.signature),r=XT(t.transaction.address),n=ZT({publicKey:r,signature:e,payload:t.transaction}),s=Ee(n,"base16");return QT(s)}function xu({logger:t,name:e}){let r=typeof t=="string"?va({opts:{level:t,name:e}}).logger:t;return r.level=typeof t=="string"?t:t.level,r}var Xb=Ie($n());var st={};Ce(st,{DEFAULT_ERROR:()=>qo,IBaseJsonRpcProvider:()=>Tu,IEvents:()=>Fo,IJsonRpcConnection:()=>Wd,IJsonRpcProvider:()=>Ho,INTERNAL_ERROR:()=>bu,INVALID_PARAMS:()=>qb,INVALID_REQUEST:()=>kb,METHOD_NOT_FOUND:()=>Mb,PARSE_ERROR:()=>Lb,RESERVED_ERROR_CODES:()=>Vd,SERVER_ERROR:()=>Mo,SERVER_ERROR_CODE_RANGE:()=>Eu,STANDARD_ERROR_MAP:()=>Rn,formatErrorMessage:()=>Yb,formatJsonRpcError:()=>As,formatJsonRpcRequest:()=>Bt,formatJsonRpcResult:()=>Bs,getBigIntRpcId:()=>Mt,getError:()=>_u,getErrorByCode:()=>Su,isHttpUrl:()=>p5,isJsonRpcError:()=>nt,isJsonRpcPayload:()=>Yd,isJsonRpcRequest:()=>Bi,isJsonRpcResponse:()=>Cn,isJsonRpcResult:()=>At,isJsonRpcValidationInvalid:()=>g5,isLocalhostUrl:()=>Gd,isNodeJs:()=>Gb,isReservedErrorCode:()=>vu,isServerErrorCode:()=>s5,isValidDefaultRoute:()=>Bu,isValidErrorCode:()=>Fb,isValidLeadingWildcardRoute:()=>u5,isValidRoute:()=>c5,isValidTrailingWildcardRoute:()=>l5,isValidWildcardRoute:()=>Au,isWsUrl:()=>Ru,parseConnectionError:()=>$d,payloadId:()=>kt,validateJsonRpcError:()=>i5});var Lb="PARSE_ERROR",kb="INVALID_REQUEST",Mb="METHOD_NOT_FOUND",qb="INVALID_PARAMS",bu="INTERNAL_ERROR",Mo="SERVER_ERROR",Vd=[-32700,-32600,-32601,-32602,-32603],Eu=[-32e3,-32099],Rn={[Lb]:{code:-32700,message:"Parse error"},[kb]:{code:-32600,message:"Invalid Request"},[Mb]:{code:-32601,message:"Method not found"},[qb]:{code:-32602,message:"Invalid params"},[bu]:{code:-32603,message:"Internal error"},[
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
ieee754/index.js:
|
||||
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
||||
|
||||
buffer/index.js:
|
||||
(*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*)
|
||||
|
||||
tslib/tslib.es6.js:
|
||||
(*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** *)
|
||||
|
||||
@walletconnect/relay-auth/dist/index.es.js:
|
||||
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||||
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||||
|
||||
@noble/hashes/esm/utils.js:
|
||||
@noble/hashes/esm/utils.js:
|
||||
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||||
|
||||
@noble/curves/esm/abstract/utils.js:
|
||||
@noble/curves/esm/abstract/modular.js:
|
||||
@noble/curves/esm/abstract/curve.js:
|
||||
@noble/curves/esm/abstract/weierstrass.js:
|
||||
@noble/curves/esm/_shortw_utils.js:
|
||||
@noble/curves/esm/secp256k1.js:
|
||||
@noble/curves/esm/utils.js:
|
||||
@noble/curves/esm/abstract/modular.js:
|
||||
@noble/curves/esm/abstract/curve.js:
|
||||
@noble/curves/esm/abstract/edwards.js:
|
||||
@noble/curves/esm/abstract/montgomery.js:
|
||||
@noble/curves/esm/ed25519.js:
|
||||
@noble/curves/esm/abstract/weierstrass.js:
|
||||
@noble/curves/esm/_shortw_utils.js:
|
||||
@noble/curves/esm/nist.js:
|
||||
@noble/curves/esm/p256.js:
|
||||
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||||
|
||||
@scure/base/lib/esm/index.js:
|
||||
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||||
|
||||
@noble/ciphers/esm/utils.js:
|
||||
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
|
||||
*/
|
||||
@@ -0,0 +1,15 @@
|
||||
// Bundles entry.js into the signing page's vendor directory: npm ci && node build.mjs
|
||||
import { build } from 'esbuild';
|
||||
|
||||
await build({
|
||||
entryPoints: ['entry.js'],
|
||||
bundle: true,
|
||||
format: 'iife',
|
||||
globalName: 'RootSigningWC',
|
||||
platform: 'browser',
|
||||
target: 'es2020',
|
||||
outfile: '../../../docs/root-signing/vendor/walletconnect.js',
|
||||
minify: true,
|
||||
legalComments: 'eof',
|
||||
define: { 'process.env.NODE_ENV': '"production"', global: 'globalThis' },
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
// WalletConnect for the root signing page: the sign client and a QR encoder, as window.RootSigningWC.
|
||||
// Buffer and process are what WalletConnect's dependencies expect a browser to have.
|
||||
import { Buffer } from 'buffer';
|
||||
import process from 'process';
|
||||
if (typeof globalThis.Buffer === 'undefined') globalThis.Buffer = Buffer;
|
||||
if (typeof globalThis.process === 'undefined') globalThis.process = process;
|
||||
if (!globalThis.process.version) globalThis.process.version = 'v18.0.0';
|
||||
|
||||
export { SignClient } from '@walletconnect/sign-client';
|
||||
export { toDataURL as qrDataUrl } from 'qrcode';
|
||||
Generated
+1843
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "pezkuwi-root-signing-walletconnect",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"description": "Builds docs/root-signing/vendor/walletconnect.js: node build.mjs",
|
||||
"dependencies": {
|
||||
"@walletconnect/sign-client": "2.23.9",
|
||||
"buffer": "6.0.3",
|
||||
"process": "0.11.10",
|
||||
"qrcode": "1.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "0.28.1"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user