@substrate-system/keys 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_base.min.js +2 -2
- package/dist/_base.min.js.map +4 -4
- package/dist/aes/index.min.js +2 -2
- package/dist/aes/index.min.js.map +3 -3
- package/dist/browser/index.js +118 -34
- package/dist/browser/index.min.js +2 -2
- package/dist/crypto.min.js +2 -2
- package/dist/crypto.min.js.map +4 -4
- package/dist/ecc/index.min.js +2 -2
- package/dist/ecc/index.min.js.map +4 -4
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +4 -4
- package/dist/rsa/index.min.js +2 -2
- package/dist/rsa/index.min.js.map +4 -4
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.min.js +1 -1
- package/dist/util.min.js.map +3 -3
- package/package.json +2 -2
package/dist/aes/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ue=Object.defineProperty;var Br=(r,e,t)=>e in r?ue(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e)=>ue(r,"name",{value:e,configurable:!0});var m=(r,e)=>{for(var t in e)ue(r,t,{get:e[t],enumerable:!0})};var c=(r,e,t)=>Br(r,typeof e!="symbol"?e+"":e,t);function te(r=0){return new Uint8Array(r)}i(te,"allocUnsafe");var Ae={};m(Ae,{base10:()=>Lr});var En=new Uint8Array(0);function We(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}i(We,"equals");function v(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}i(v,"coerce");function Ye(r){return new TextEncoder().encode(r)}i(Ye,"fromString");function Je(r){return new TextDecoder().decode(r)}i(Je,"toString");function Cr(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=o}var y=r.length,g=r.charAt(0),T=Math.log(y)/Math.log(256),L=Math.log(256)/Math.log(y);function pe(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var h=0,P=0,b=0,w=f.length;b!==w&&f[b]===0;)b++,h++;for(var E=(w-b)*L+1>>>0,l=new Uint8Array(E);b!==w;){for(var U=f[b],D=0,x=E-1;(U!==0||D<P)&&x!==-1;x--,D++)U+=256*l[x]>>>0,l[x]=U%y>>>0,U=U/y>>>0;if(U!==0)throw new Error("Non-zero carry");P=D,b++}for(var B=E-P;B!==E&&l[B]===0;)B++;for(var re=g.repeat(h);B<E;++B)re+=r.charAt(l[B]);return re}i(pe,"encode");function ee(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var h=0;if(f[h]!==" "){for(var P=0,b=0;f[h]===g;)P++,h++;for(var w=(f.length-h)*T+1>>>0,E=new Uint8Array(w);f[h];){var l=t[f.charCodeAt(h)];if(l===255)return;for(var U=0,D=w-1;(l!==0||U<b)&&D!==-1;D--,U++)l+=y*E[D]>>>0,E[D]=l%256>>>0,l=l/256>>>0;if(l!==0)throw new Error("Non-zero carry");b=U,h++}if(f[h]!==" "){for(var x=w-b;x!==w&&E[x]===0;)x++;for(var B=new Uint8Array(P+(w-x)),re=P;x!==w;)B[re++]=E[x++];return B}}}i(ee,"decodeUnsafe");function Sr(f){var h=ee(f);if(h)return h;throw new Error(`Non-${e} character`)}return i(Sr,"decode"),{encode:pe,decodeUnsafe:ee,decode:Sr}}i(Cr,"base");var Tr=Cr,Dr=Tr,Qe=Dr;var me=class me{constructor(e,t,n){c(this,"name");c(this,"prefix");c(this,"baseEncode");this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};i(me,"Encoder");var ye=me,ge=class ge{constructor(e,t,n){c(this,"name");c(this,"prefix");c(this,"baseDecode");c(this,"prefixCodePoint");this.name=e,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return er(this,e)}};i(ge,"Decoder");var de=ge,be=class be{constructor(e){c(this,"decoders");this.decoders=e}or(e){return er(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};i(be,"ComposedDecoder");var he=be;function er(r,e){return new he({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}i(er,"or");var xe=class xe{constructor(e,t,n,o){c(this,"name");c(this,"prefix");c(this,"baseEncode");c(this,"baseDecode");c(this,"encoder");c(this,"decoder");this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new ye(e,t,n),this.decoder=new de(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};i(xe,"Codec");var le=xe;function M({name:r,prefix:e,encode:t,decode:n}){return new le(r,e,t,n)}i(M,"from");function I({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=Qe(t,r);return M({prefix:e,name:r,encode:n,decode:i(s=>v(o(s)),"decode")})}i(I,"baseX");function Ir(r,e,t,n){let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),a=0,y=0,g=0;for(let T=0;T<o;++T){let L=e[r[T]];if(L===void 0)throw new SyntaxError(`Non-${n} character`);y=y<<t|L,a+=t,a>=8&&(a-=8,s[g++]=255&y>>a)}if(a>=t||(255&y<<8-a)!==0)throw new SyntaxError("Unexpected end of data");return s}i(Ir,"decode");function Pr(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",a=0,y=0;for(let g=0;g<r.length;++g)for(y=y<<8|r[g],a+=8;a>t;)a-=t,s+=e[o&y>>a];if(a!==0&&(s+=e[o&y<<t-a]),n)for(;(s.length*t&7)!==0;)s+="=";return s}i(Pr,"encode");function Kr(r){let e={};for(let t=0;t<r.length;++t)e[r[t]]=t;return e}i(Kr,"createAlphabetIdx");function p({name:r,prefix:e,bitsPerChar:t,alphabet:n}){let o=Kr(n);return M({prefix:e,name:r,encode(s){return Pr(s,n,t)},decode(s){return Ir(s,o,t,r)}})}i(p,"rfc4648");var Lr=I({prefix:"9",name:"base10",alphabet:"0123456789"});var we={};m(we,{base16:()=>Mr,base16upper:()=>_r});var Mr=p({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_r=p({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ee={};m(Ee,{base2:()=>Rr});var Rr=p({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ue={};m(Ue,{base256emoji:()=>kr});var rr=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Hr=rr.reduce((r,e,t)=>(r[t]=e,r),[]),Or=rr.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);function zr(r){return r.reduce((e,t)=>(e+=Hr[t],e),"")}i(zr,"encode");function Nr(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let o=Or[n];if(o==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}i(Nr,"decode");var kr=M({prefix:"\u{1F680}",name:"base256emoji",encode:zr,decode:Nr});var Se={};m(Se,{base32:()=>_,base32hex:()=>$r,base32hexpad:()=>jr,base32hexpadupper:()=>qr,base32hexupper:()=>Xr,base32pad:()=>Fr,base32padupper:()=>Vr,base32upper:()=>Gr,base32z:()=>Wr});var _=p({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Gr=p({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Fr=p({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Vr=p({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$r=p({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Xr=p({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),jr=p({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),qr=p({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Wr=p({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Be={};m(Be,{base36:()=>q,base36upper:()=>Yr});var q=I({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Yr=I({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var ve={};m(ve,{base58btc:()=>S,base58flickr:()=>Jr});var S=I({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Jr=I({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ce={};m(Ce,{base64:()=>Zr,base64pad:()=>Qr,base64url:()=>et,base64urlpad:()=>rt});var Zr=p({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Qr=p({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),et=p({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),rt=p({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Te={};m(Te,{base8:()=>tt});var tt=p({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var De={};m(De,{identity:()=>nt});var nt=M({prefix:"\0",name:"identity",encode:i(r=>Je(r),"encode"),decode:i(r=>Ye(r),"decode")});var Fn=new TextEncoder,Vn=new TextDecoder;var Ke={};m(Ke,{identity:()=>vt});var st=or,tr=128,at=127,ct=~at,ft=Math.pow(2,31);function or(r,e,t){e=e||[],t=t||0;for(var n=t;r>=ft;)e[t++]=r&255|tr,r/=128;for(;r&ct;)e[t++]=r&255|tr,r>>>=7;return e[t]=r|0,or.bytes=t-n+1,e}i(or,"encode");var pt=Ie,ut=128,nr=127;function Ie(r,n){var t=0,n=n||0,o=0,s=n,a,y=r.length;do{if(s>=y)throw Ie.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=o<28?(a&nr)<<o:(a&nr)*Math.pow(2,o),o+=7}while(a>=ut);return Ie.bytes=s-n,t}i(Ie,"read");var yt=Math.pow(2,7),dt=Math.pow(2,14),ht=Math.pow(2,21),lt=Math.pow(2,28),mt=Math.pow(2,35),gt=Math.pow(2,42),bt=Math.pow(2,49),xt=Math.pow(2,56),At=Math.pow(2,63),wt=i(function(r){return r<yt?1:r<dt?2:r<ht?3:r<lt?4:r<mt?5:r<gt?6:r<bt?7:r<xt?8:r<At?9:10},"length"),Et={encode:st,decode:pt,encodingLength:wt},Ut=Et,W=Ut;function Y(r,e=0){return[W.decode(r,e),W.decode.bytes]}i(Y,"decode");function R(r,e,t=0){return W.encode(r,e,t),e}i(R,"encodeTo");function H(r){return W.encodingLength(r)}i(H,"encodingLength");function z(r,e){let t=e.byteLength,n=H(r),o=n+H(t),s=new Uint8Array(o+t);return R(r,s,0),R(t,s,n),s.set(e,o),new O(r,t,e,s)}i(z,"create");function ir(r){let e=v(r),[t,n]=Y(e),[o,s]=Y(e.subarray(n)),a=e.subarray(n+s);if(a.byteLength!==o)throw new Error("Incorrect length");return new O(t,o,a,e)}i(ir,"decode");function sr(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&We(r.bytes,t.bytes)}}i(sr,"equals");var Pe=class Pe{constructor(e,t,n,o){c(this,"code");c(this,"size");c(this,"digest");c(this,"bytes");this.code=e,this.size=t,this.digest=n,this.bytes=o}};i(Pe,"Digest");var O=Pe;var ar=0,St="identity",cr=v;function Bt(r,e){if(e?.truncate!=null&&e.truncate!==r.byteLength){if(e.truncate<0||e.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e.truncate)}return z(ar,cr(r))}i(Bt,"digest");var vt={code:ar,name:St,encode:cr,digest:Bt};var Re={};m(Re,{sha256:()=>Tt,sha512:()=>Dt});var Ct=20;function Me({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:o}){return new Le(r,e,t,n,o)}i(Me,"from");var _e=class _e{constructor(e,t,n,o,s){c(this,"name");c(this,"code");c(this,"encode");c(this,"minDigestLength");c(this,"maxDigestLength");this.name=e,this.code=t,this.encode=n,this.minDigestLength=o??Ct,this.maxDigestLength=s}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?fr(n,this.code,t?.truncate):n.then(o=>fr(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};i(_e,"Hasher");var Le=_e;function fr(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return z(e,r)}i(fr,"createDigest");function ur(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}i(ur,"sha");var Tt=Me({name:"sha2-256",code:18,encode:ur("SHA-256")}),Dt=Me({name:"sha2-512",code:19,encode:ur("SHA-512")});function yr(r,e){let{bytes:t,version:n}=r;return n===0?Pt(t,He(r),e??S.encoder):Kt(t,He(r),e??_.encoder)}i(yr,"format");var dr=new WeakMap;function He(r){let e=dr.get(r);if(e==null){let t=new Map;return dr.set(r,t),t}return e}i(He,"baseCache");var lr,d=class d{constructor(e,t,n,o){c(this,"code");c(this,"version");c(this,"multihash");c(this,"bytes");c(this,"/");c(this,lr,"CID");this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==Z)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Lt)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return d.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=z(e,t);return d.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return d.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&sr(e.multihash,n.multihash)}toString(e){return yr(this,e)}toJSON(){return{"/":yr(this)}}link(){return this}[(lr=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof d)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:a}=t;return new d(n,o,s,a??hr(n,o,s.bytes))}else if(t[Mt]===!0){let{version:n,multihash:o,code:s}=t,a=ir(o);return d.create(n,s,a)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Z)throw new Error(`Version 0 CID must use dag-pb (code: ${Z}) block encoding`);return new d(e,t,n,n.bytes)}case 1:{let o=hr(e,t,n.bytes);return new d(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return d.create(0,Z,e)}static createV1(e,t){return d.create(1,e,t)}static decode(e){let[t,n]=d.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=d.inspectBytes(e),n=t.size-t.multihashSize,o=v(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),a=new O(t.multihashCode,t.digestSize,s,o);return[t.version===0?d.createV0(a):d.createV1(t.codec,a),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=i(()=>{let[pe,ee]=Y(e.subarray(t));return t+=ee,pe},"next"),o=n(),s=Z;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let a=t,y=n(),g=n(),T=t+g,L=T-a;return{version:o,codec:s,multihashCode:y,digestSize:g,multihashSize:L,size:T}}static parse(e,t){let[n,o]=It(e,t),s=d.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return He(s).set(n,e),s}};i(d,"CID");var oe=d;function It(r,e){switch(r[0]){case"Q":{let t=e??S;return[S.prefix,t.decode(`${S.prefix}${r}`)]}case S.prefix:{let t=e??S;return[S.prefix,t.decode(r)]}case _.prefix:{let t=e??_;return[_.prefix,t.decode(r)]}case q.prefix:{let t=e??q;return[q.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}i(It,"parseCIDtoBytes");function Pt(r,e,t){let{prefix:n}=t;if(n!==S.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}i(Pt,"toStringV0");function Kt(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}i(Kt,"toStringV1");var Z=112,Lt=18;function hr(r,e,t){let n=H(r),o=n+H(e),s=new Uint8Array(o+t.byteLength);return R(r,s,0),R(e,s,n),s.set(t,o),s}i(hr,"encodeCID");var Mt=Symbol.for("@ipld/js-cid/CID");var Oe={...De,...Ee,...Te,...Ae,...we,...Se,...Be,...ve,...Ce,...Ue},Eo={...Re,...Ke};function gr(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}i(gr,"createCodec");var mr=gr("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),ze=gr("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=te(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),_t={utf8:mr,"utf-8":mr,hex:Oe.base16,latin1:ze,ascii:ze,binary:ze,...Oe},ie=_t;function A(r,e="utf8"){let t=ie[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}i(A,"fromString");function N(r,e="utf8"){let t=ie[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}i(N,"toString");var se="did:key:z";var Wo="X25519";var k="RSA-OAEP",G="RSASSA-PKCS1-v1_5",Ne="SHA-256",Ot=new Uint8Array([0,245,2]),Yo=2048,ke="SHA-256",F=8,V="AES-GCM",$=V,Q=256,ae=12;var zt=new Uint8Array([234,1]),Nt=new Uint8Array([237,1]);var Ge=globalThis.crypto,br=new Error("Invalid key use. Please use 'encryption' or 'signing"),Gt=new Error("Max must be less than 256 and greater than 0");function u(r){return new Uint8Array(r).buffer}i(u,"toArrayBuffer");function X(r){let e=A(r,"base64pad");return u(e)}i(X,"base64ToArrBuf");var Fe=i((r,e)=>{if(typeof r=="string")return e(r);if(typeof r=="object"&&r.byteLength!==void 0)return new Uint8Array(r).buffer;throw new Error("Improper value. Must be a string, ArrayBuffer, Uint8Array")},"normalizeToBuf");function ce(r){return Fe(r,X)}i(ce,"normalizeBase64ToBuf");var Ft=i(r=>Fe(r,e=>u(new TextEncoder().encode(e))),"normalizeUtf8ToBuf");function Vt(r,e){let t=e===8?new Uint8Array(r.length):new Uint16Array(r.length);for(let n=0,o=r.length;n<o;n++)t[n]=r.charCodeAt(n);return t.buffer}i(Vt,"strToArrBuf");var $t=i(r=>Fe(r,e=>Vt(e,16)),"normalizeUtf16ToBuf");function j(r,e){return e===8?Ft(r):$t(r)}i(j,"normalizeUnicodeToBuf");var Xt={equal:i((r,e)=>{let t=new Uint8Array(r),n=new Uint8Array(e);if(t.length!==n.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==n[o])return!1;return!0},"equal")};function xr(r,e){return Xt.equal(e,r.slice(0,e.byteLength))}i(xr,"hasPrefix");function Ve(r){return N(r instanceof ArrayBuffer?new Uint8Array(r):r,"base64pad")}i(Ve,"toBase64");async function $e(r,e){let t=typeof r=="string"?X(r):u(r);return Ge.subtle.importKey("raw",t,{name:e?.alg||$,length:e?.length||Q},e?.extractable??!0,["encrypt","decrypt"])}i($e,"importKey");function Ar(r,{max:e}={max:255}){if(e<1||e>255)throw Gt;let t=new Uint8Array(r);if(e===255)return Ge.getRandomValues(t),t.buffer;let n=0,o=e+1,s=Math.floor(256/o)*o,a=new Uint8Array(1);for(;n<t.length;)Ge.getRandomValues(a),a[0]<s&&(t[n]=a[0]%o,n++);return t.buffer}i(Ar,"randomBuf");function wr(r,e){let t=r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(u(r)),n=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(u(e)),o=new Uint8Array(t.length+n.length);return o.set(t),o.set(n,t.length),o.buffer}i(wr,"joinBufs");var C=globalThis.crypto,jt={keyTypes:{"bls12-381":{magicBytes:new Uint8Array([234,1]),verify:i(()=>{throw new Error("Not implemented")},"verify")},rsa:{magicBytes:new Uint8Array([0,245,2]),verify:Wt},ed25519:{magicBytes:new Uint8Array([237,1]),verify:qt}}};async function qt({message:r,publicKey:e,signature:t}){let n=r;typeof r=="string"&&(n=A(r,"utf8"));let o=t;typeof t=="string"&&(o=A(t,"base64pad"));let s=e;if(typeof e=="string"&&(s=Er(e).publicKey),s.length!==32)throw new Error(`Invalid Ed25519 public key size: ${s.length} bytes, expected 32`);if(o.length!==64)throw new Error(`Invalid Ed25519 signature size: ${o.length} bytes, expected 64`);let a=await C.subtle.importKey("raw",u(s),{name:"Ed25519"},!1,["verify"]);return C.subtle.verify({name:"Ed25519"},a,u(o),u(n))}i(qt,"ed25519Verify");async function Wt({message:r,publicKey:e,signature:t}){let n=e;return typeof e=="string"&&(n=Er(e).publicKey),Yt.verify(r,t,await C.subtle.importKey("spki",u(n),{name:G,hash:Ne},!1,["verify"]),8)}i(Wt,"rsaVerify");var Yt={verify:i(async function(e,t,n,o=F,s=ke){return C.subtle.verify({name:G},typeof n=="string"?await Xe(n,s,"signing"):n,ce(t),j(e,o))},"rsaVerify"),sign:i(async function(e,t,n=F){return C.subtle.sign({name:G},t,j(e,n))},"sign"),encrypt:i(async function(e,t,n=F,o=ke){let s;return typeof t=="string"?s=await Xe(t,o,"exchange"):s=t instanceof Uint8Array?await Xe(u(t),o,"exchange"):t,C.subtle.encrypt({name:k},s,j(e,n))},"rsaEncrypt"),decrypt:i(async function(e,t){let n=fe(t)?t:await en(t,["decrypt"]),o;typeof e=="string"?o=A(e,"base64pad"):o=e;let s=await C.subtle.decrypt({name:k},n,o instanceof Uint8Array?u(o):o);return new Uint8Array(s)},"rsaDecrypt")};async function Xe(r,e,t){Jt(t);let n=t==="exchange"?k:G,o=t==="exchange"?["encrypt"]:["verify"],s=typeof r=="string"?X(Qt(r)):r;return C.subtle.importKey("spki",s,{name:n,hash:{name:e}},!0,o)}i(Xe,"rsaImportPublicKey");function Jt(r){Zt(r,["signing","exchange"],br)}i(Jt,"checkValidKeyUse");function Zt(r,e,t){if(!e.some(o=>o===r))throw t}i(Zt,"checkValid");function Qt(r){return r.replace(`-----BEGIN PUBLIC KEY-----
|
|
1
|
+
var ye=Object.defineProperty;var Lr=(e,r,t)=>r in e?ye(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var i=(e,r)=>ye(e,"name",{value:r,configurable:!0});var g=(e,r)=>{for(var t in r)ye(e,t,{get:r[t],enumerable:!0})};var c=(e,r,t)=>Lr(e,typeof r!="symbol"?r+"":r,t);function Y(e=0){return new Uint8Array(e)}i(Y,"allocUnsafe");var we={};g(we,{base10:()=>Or});var Kn=new Uint8Array(0);function Ze(e,r){if(e===r)return!0;if(e.byteLength!==r.byteLength)return!1;for(let t=0;t<e.byteLength;t++)if(e[t]!==r[t])return!1;return!0}i(Ze,"equals");function A(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return K(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return K(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));throw new Error("Unknown type, must be binary type")}i(A,"coerce");function Qe(e){let r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r}i(Qe,"fromString");var Je=4096;function er(e){let r=e.length;if(r<=Je)return String.fromCharCode.apply(String,e);let t="",n=0;for(;n<r;)t+=String.fromCharCode.apply(String,e.subarray(n,n+=Je));return t}i(er,"toString");function Kr(e){return e?.buffer instanceof ArrayBuffer}i(Kr,"isByteArrayWithArrayBuffer");function K(e){return Kr(e)?e:e.slice()}i(K,"toArrayBufferBackedArray");function Mr(e,r,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),o=0;o<n.length;o++)n[o]=255;for(var s=0;s<e.length;s++){var a=e.charAt(s),y=a.charCodeAt(0);if(n[y]!==255)throw new TypeError(a+" is ambiguous");if(n[y]=s,t){var b=a.toLowerCase().charCodeAt(0),S=a.toUpperCase().charCodeAt(0);b!==y&&(n[b]=s),S!==y&&(n[S]=s)}}var E=e.length,ne=e.charAt(0),pe=Math.log(E)/Math.log(256),Cr=Math.log(256)/Math.log(E);function Ir(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var h=0,D=0,x=0,U=f.length;x!==U&&f[x]===0;)x++,h++;for(var v=(U-x)*Cr+1>>>0,L=new Uint8Array(v);x!==U;){for(var d=f[x],P=0,C=v-1;(d!==0||P<D)&&C!==-1;C--,P++)d+=256*L[C]>>>0,L[C]=d%E>>>0,d=d/E>>>0;if(d!==0)throw new Error("Non-zero carry");D=P,x++}for(var m=v-D;m!==v&&L[m]===0;)m++;for(var W=ne.repeat(h);m<v;++m)W+=e.charAt(L[m]);return W}i(Ir,"encode");function Ye(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var h=0;if(f[h]!==" "){for(var D=0,x=0;f[h]===ne;)D++,h++;for(var U=(f.length-h)*pe+1>>>0,v=new Uint8Array(U);f[h];){var L=f.charCodeAt(h);if(L>255)return;var d=n[L];if(d===255)return;for(var P=0,C=U-1;(d!==0||P<x)&&C!==-1;C--,P++)d+=E*v[C]>>>0,v[C]=d%256>>>0,d=d/256>>>0;if(d!==0)throw new Error("Non-zero carry");x=P,h++}if(f[h]!==" "){for(var m=U-x;m!==U&&v[m]===0;)m++;for(var W=new Uint8Array(D+(U-m)),Dr=D;m!==U;)W[Dr++]=v[m++];return W}}}i(Ye,"decodeUnsafe");function Tr(f){var h=Ye(f);if(h)return h;throw new Error(`Non-${r} character`)}return i(Tr,"decode"),{encode:Ir,decodeUnsafe:Ye,decode:Tr}}i(Mr,"base");var _r=Mr,Rr=_r,tr=Rr;var ge=class ge{constructor(r,t,n){c(this,"name");c(this,"prefix");c(this,"baseEncode");this.name=r,this.prefix=t,this.baseEncode=n}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}};i(ge,"Encoder");var le=ge,Ae=class Ae{constructor(r,t,n){c(this,"name");c(this,"prefix");c(this,"baseDecode");c(this,"prefixCodePoint");this.name=r,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return nr(this,r)}};i(Ae,"Decoder");var he=Ae,be=class be{constructor(r){c(this,"decoders");this.decoders=r}or(r){return nr(this,r)}decode(r){let t=r[0],n=this.decoders[t];if(n!=null)return n.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};i(be,"ComposedDecoder");var de=be;function nr(e,r){return new de({...e.decoders??{[e.prefix]:e},...r.decoders??{[r.prefix]:r}})}i(nr,"or");var xe=class xe{constructor(r,t,n,o){c(this,"name");c(this,"prefix");c(this,"baseEncode");c(this,"baseDecode");c(this,"encoder");c(this,"decoder");this.name=r,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new le(r,t,n),this.decoder=new he(r,t,o)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}};i(xe,"Codec");var me=xe;function _({name:e,prefix:r,encode:t,decode:n}){return new me(e,r,t,n)}i(_,"from");function T({name:e,prefix:r,alphabet:t,caseInsensitive:n=!1}){let{encode:o,decode:s}=tr(t,e,n);return _({prefix:r,name:e,encode:o,decode:i(a=>A(s(a)),"decode")})}i(T,"baseX");function kr(e,r,t,n){let o=e.length;for(;e[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),a=0,y=0,b=0;for(let S=0;S<o;++S){let E=r[e[S]];if(E===void 0)throw new SyntaxError(`Non-${n} character`);y=y<<t|E,a+=t,a>=8&&(a-=8,s[b++]=255&y>>a)}if(a>=t||(255&y<<8-a)!==0)throw new SyntaxError("Unexpected end of data");return s}i(kr,"decode");function Hr(e,r,t){let n=r[r.length-1]==="=",o=(1<<t)-1,s="",a=0,y=0;for(let b=0;b<e.length;++b)for(y=y<<8|e[b],a+=8;a>t;)a-=t,s+=r[o&y>>a];if(a!==0&&(s+=r[o&y<<t-a]),n)for(;(s.length*t&7)!==0;)s+="=";return s}i(Hr,"encode");function Nr(e,r){let t={};for(let n=0;n<e.length;++n)if(e[n]!=="="&&(t[e[n]]=n,r)){let o=e[n].toLowerCase(),s=e[n].toUpperCase();o!==e[n]&&(t[o]=n),s!==e[n]&&(t[s]=n)}return t}i(Nr,"createAlphabetIdx");function u({name:e,prefix:r,bitsPerChar:t,alphabet:n,caseInsensitive:o=!1}){let s=Nr(n,o);return _({prefix:r,name:e,encode(a){return Hr(a,n,t)},decode(a){return kr(a,s,t,e)}})}i(u,"rfc4648");var Or=T({prefix:"9",name:"base10",alphabet:"0123456789"});var Ee={};g(Ee,{base16:()=>zr,base16upper:()=>Gr});var zr=u({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4,caseInsensitive:!0}),Gr=u({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4,caseInsensitive:!0});var Ue={};g(Ue,{base2:()=>Fr});var Fr=u({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ve={};g(ve,{base256emoji:()=>qr});var or=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Vr=or.reduce((e,r,t)=>(e[t]=r,e),[]),$r=or.reduce((e,r,t)=>{let n=r.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${r}`);return e[n]=t,e},[]);function Xr(e){return e.reduce((r,t)=>(r+=Vr[t],r),"")}i(Xr,"encode");function jr(e){let r=[];for(let t of e){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let o=$r[n];if(o==null)throw new Error(`Non-base256emoji character: ${t}`);r.push(o)}return new Uint8Array(r)}i(jr,"decode");var qr=_({prefix:"\u{1F680}",name:"base256emoji",encode:Xr,decode:jr});var Be={};g(Be,{base32:()=>R,base32hex:()=>Zr,base32hexpad:()=>et,base32hexpadupper:()=>rt,base32hexupper:()=>Qr,base32pad:()=>Yr,base32padupper:()=>Jr,base32upper:()=>Wr,base32z:()=>tt});var R=u({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5,caseInsensitive:!0}),Wr=u({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5,caseInsensitive:!0}),Yr=u({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5,caseInsensitive:!0}),Jr=u({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5,caseInsensitive:!0}),Zr=u({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5,caseInsensitive:!0}),Qr=u({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5,caseInsensitive:!0}),et=u({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5,caseInsensitive:!0}),rt=u({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5,caseInsensitive:!0}),tt=u({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Se={};g(Se,{base36:()=>J,base36upper:()=>nt});var J=T({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz",caseInsensitive:!0}),nt=T({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",caseInsensitive:!0});var Ce={};g(Ce,{base58btc:()=>B,base58flickr:()=>ot});var B=T({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ot=T({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ie={};g(Ie,{base64:()=>it,base64pad:()=>st,base64url:()=>at,base64urlpad:()=>ct});var it=u({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),st=u({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),at=u({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ct=u({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Te={};g(Te,{base8:()=>ft});var ft=u({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var De={};g(De,{identity:()=>ut});var ut=_({prefix:"\0",name:"identity",encode:i(e=>er(A(e)),"encode"),decode:i(e=>A(Qe(e)),"decode")});var eo=new TextEncoder,ro=new TextDecoder;var Ke={};g(Ke,{identity:()=>Kt});var lt=ar,ir=128,ht=127,dt=~ht,mt=Math.pow(2,31);function ar(e,r,t){r=r||[],t=t||0;for(var n=t;e>=mt;)r[t++]=e&255|ir,e/=128;for(;e&dt;)r[t++]=e&255|ir,e>>>=7;return r[t]=e|0,ar.bytes=t-n+1,r}i(ar,"encode");var gt=Le,At=128,sr=127;function Le(e,n){var t=0,n=n||0,o=0,s=n,a,y=e.length;do{if(s>=y)throw Le.bytes=0,new RangeError("Could not decode varint");a=e[s++],t+=o<28?(a&sr)<<o:(a&sr)*Math.pow(2,o),o+=7}while(a>=At);return Le.bytes=s-n,t}i(Le,"read");var bt=Math.pow(2,7),xt=Math.pow(2,14),wt=Math.pow(2,21),Et=Math.pow(2,28),Ut=Math.pow(2,35),vt=Math.pow(2,42),Bt=Math.pow(2,49),St=Math.pow(2,56),Ct=Math.pow(2,63),It=i(function(e){return e<bt?1:e<xt?2:e<wt?3:e<Et?4:e<Ut?5:e<vt?6:e<Bt?7:e<St?8:e<Ct?9:10},"length"),Tt={encode:lt,decode:gt,encodingLength:It},Dt=Tt,Z=Dt;function Q(e,r=0){let t=Z.decode(e,r),n=Z.decode.bytes;if(n>9)throw new RangeError("Invalid varint: too long");if(n>1&&e[r+n-1]===0)throw new RangeError("Invalid varint: not minimally encoded");return[t,n]}i(Q,"decode");function k(e,r,t=0){return Z.encode(e,r,t),r}i(k,"encodeTo");function H(e){return Z.encodingLength(e)}i(H,"encodingLength");function O(e,r){let t=r.byteLength,n=H(e),o=n+H(t),s=new Uint8Array(o+t);return k(e,s,0),k(t,s,n),s.set(r,o),new N(e,t,r,s)}i(O,"create");function cr(e){let r=A(e),[t,n]=Q(r),[o,s]=Q(r.subarray(n)),a=r.subarray(n+s);if(a.byteLength!==o)throw new Error("Incorrect length");return new N(t,o,a,r)}i(cr,"decode");function fr(e,r){if(e===r)return!0;{let t=r;return e.code===t.code&&e.size===t.size&&t.bytes instanceof Uint8Array&&Ze(e.bytes,t.bytes)}}i(fr,"equals");var Pe=class Pe{constructor(r,t,n,o){c(this,"code");c(this,"size");c(this,"digest");c(this,"bytes");this.code=r,this.size=t,this.digest=K(n),this.bytes=K(o)}};i(Pe,"Digest");var N=Pe;var ur=0,Lt="identity",pr=A;function Pt(e,r){if(r?.truncate!=null&&r.truncate!==e.byteLength){if(r.truncate<0||r.truncate>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,r.truncate)}return O(ur,pr(e))}i(Pt,"digest");var Kt={code:ur,name:Lt,encode:pr,digest:Pt};var ke={};g(ke,{sha256:()=>_t,sha512:()=>Rt});var Mt=20;function _e({name:e,code:r,encode:t,minDigestLength:n,maxDigestLength:o}){return new Me(e,r,t,n,o)}i(_e,"from");var Re=class Re{constructor(r,t,n,o,s){c(this,"name");c(this,"code");c(this,"encode");c(this,"minDigestLength");c(this,"maxDigestLength");this.name=r,this.code=t,this.encode=n,this.minDigestLength=o??Mt,this.maxDigestLength=s}digest(r,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(r instanceof Uint8Array){let n=this.encode(r);return n instanceof Uint8Array?yr(n,this.code,t?.truncate):n.then(o=>yr(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};i(Re,"Hasher");var Me=Re;function yr(e,r,t){if(t!=null&&t!==e.byteLength){if(t>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,t)}return O(r,e)}i(yr,"createDigest");function hr(e){return async r=>new Uint8Array(await crypto.subtle.digest(e,r))}i(hr,"sha");var _t=_e({name:"sha2-256",code:18,encode:hr("SHA-256")}),Rt=_e({name:"sha2-512",code:19,encode:hr("SHA-512")});function dr(e,r){let{bytes:t,version:n}=e;return n===0?Ht(t,He(e),r??B.encoder):Nt(t,He(e),r??R.encoder)}i(dr,"format");var mr=new WeakMap;function He(e){let r=mr.get(e);if(r==null){let t=new Map;return mr.set(e,t),t}return r}i(He,"baseCache");var Ar,l=class l{constructor(r,t,n,o){c(this,"code");c(this,"version");c(this,"multihash");c(this,"bytes");c(this,"/");c(this,Ar,"CID");this.code=t,this.version=r,this.multihash=n,this.bytes=K(o),this["/"]=this.bytes}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:r,multihash:t}=this;if(r!==re)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Ot)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return l.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:r,digest:t}=this.multihash,n=O(r,t);return l.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(r){return l.equals(this,r)}static equals(r,t){let n=t;return n!=null&&r.code===n.code&&r.version===n.version&&fr(r.multihash,n.multihash)}toString(r){return dr(this,r)}toJSON(){return{"/":dr(this)}}link(){return this}[(Ar=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(r){if(r==null)return null;let t=r;if(t instanceof l)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:a}=t;return new l(n,o,s,a??gr(n,o,s.bytes))}else if(t[zt]===!0){let{version:n,multihash:o,code:s}=t,a=cr(o);return l.create(n,s,a)}else return null}static create(r,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(r){case 0:{if(t!==re)throw new Error(`Version 0 CID must use dag-pb (code: ${re}) block encoding`);return new l(r,t,n,n.bytes)}case 1:{let o=gr(r,t,n.bytes);return new l(r,t,n,o)}default:throw new Error("Invalid version")}}static createV0(r){return l.create(0,re,r)}static createV1(r,t){return l.create(1,r,t)}static decode(r){let[t,n]=l.decodeFirst(r);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(r){let t=l.inspectBytes(r),n=t.size-t.multihashSize,o=A(r.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),a=new N(t.multihashCode,t.digestSize,s,o);return[t.version===0?l.createV0(a):l.createV1(t.codec,a),r.subarray(t.size)]}static inspectBytes(r){let t=0,n=i(()=>{let[ne,pe]=Q(r.subarray(t));return t+=pe,ne},"next"),o=n(),s=re;if(o===18)o=0,t=0;else if(o===1)s=n();else throw o===0?new RangeError("Invalid CID version, v0 is always implicit"):new RangeError(`Invalid CID version ${o}`);let a=t,y=n(),b=n(),S=t+b,E=S-a;return{version:o,codec:s,multihashCode:y,digestSize:b,multihashSize:E,size:S}}static parse(r,t){let[n,o]=kt(r,t),s=l.decode(o);if(s.version===0&&r[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return He(s).set(n,r),s}};i(l,"CID");var ie=l;function kt(e,r){switch(e[0]){case"Q":{let t=r??B;return[B.prefix,t.decode(`${B.prefix}${e}`)]}case B.prefix:{let t=r??B;return[B.prefix,t.decode(e)]}case R.prefix:{let t=r??R;return[R.prefix,t.decode(e)]}case J.prefix:{let t=r??J;return[J.prefix,t.decode(e)]}default:{if(r==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],r.decode(e)]}}}i(kt,"parseCIDtoBytes");function Ht(e,r,t){let{prefix:n}=t;if(n!==B.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=r.get(n);if(o==null){let s=t.encode(e).slice(1);return r.set(n,s),s}else return o}i(Ht,"toStringV0");function Nt(e,r,t){let{prefix:n}=t,o=r.get(n);if(o==null){let s=t.encode(e);return r.set(n,s),s}else return o}i(Nt,"toStringV1");var re=112,Ot=18;function gr(e,r,t){let n=H(e),o=n+H(r),s=new Uint8Array(o+t.byteLength);return k(e,s,0),k(r,s,n),s.set(t,o),s}i(gr,"encodeCID");var zt=Symbol.for("@ipld/js-cid/CID");var Ne={...De,...Ue,...Te,...we,...Ee,...Be,...Se,...Ce,...Ie,...ve},Ko={...ke,...Ke};function xr(e,r,t,n){return{name:e,prefix:r,encoder:{name:e,prefix:r,encode:t},decoder:{decode:n}}}i(xr,"createCodec");var br=xr("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),Oe=xr("ascii","a",e=>{let r="a";for(let t=0;t<e.length;t++)r+=String.fromCharCode(e[t]);return r},e=>{e=e.substring(1);let r=Y(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r}),Gt={utf8:br,"utf-8":br,hex:Ne.base16,latin1:Oe,ascii:Oe,binary:Oe,...Ne},se=Gt;function w(e,r="utf8"){let t=se[r];if(t==null)throw new Error(`Unsupported encoding "${r}"`);return t.decoder.decode(`${t.prefix}${e}`)}i(w,"fromString");function z(e,r="utf8"){let t=se[r];if(t==null)throw new Error(`Unsupported encoding "${r}"`);return t.encoder.encode(e).substring(1)}i(z,"toString");var ae="did:key:z";var yi="X25519";var G="RSA-OAEP",F="RSASSA-PKCS1-v1_5",ze="SHA-256",$t=new Uint8Array([0,245,2]),li=2048,Ge="SHA-256",V=8,$="AES-GCM",X=$,te=256,ce=12;var Xt=new Uint8Array([234,1]),jt=new Uint8Array([237,1]);var Fe=globalThis.crypto,wr=new Error("Invalid key use. Please use 'encryption' or 'signing"),Wt=new Error("Max must be less than 256 and greater than 0");function p(e){return new Uint8Array(e).buffer}i(p,"toArrayBuffer");function j(e){let r=w(e,"base64pad");return p(r)}i(j,"base64ToArrBuf");var Ve=i((e,r)=>{if(typeof e=="string")return r(e);if(typeof e=="object"&&e.byteLength!==void 0)return new Uint8Array(e).buffer;throw new Error("Improper value. Must be a string, ArrayBuffer, Uint8Array")},"normalizeToBuf");function fe(e){return Ve(e,j)}i(fe,"normalizeBase64ToBuf");var Yt=i(e=>Ve(e,r=>p(new TextEncoder().encode(r))),"normalizeUtf8ToBuf");function Jt(e,r){let t=r===8?new Uint8Array(e.length):new Uint16Array(e.length);for(let n=0,o=e.length;n<o;n++)t[n]=e.charCodeAt(n);return t.buffer}i(Jt,"strToArrBuf");var Zt=i(e=>Ve(e,r=>Jt(r,16)),"normalizeUtf16ToBuf");function q(e,r){return r===8?Yt(e):Zt(e)}i(q,"normalizeUnicodeToBuf");var Qt={equal:i((e,r)=>{let t=new Uint8Array(e),n=new Uint8Array(r);if(t.length!==n.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==n[o])return!1;return!0},"equal")};function Er(e,r){return Qt.equal(r,e.slice(0,r.byteLength))}i(Er,"hasPrefix");function $e(e){return z(e instanceof ArrayBuffer?new Uint8Array(e):e,"base64pad")}i($e,"toBase64");async function Xe(e,r){let t=typeof e=="string"?j(e):p(e);return Fe.subtle.importKey("raw",t,{name:r?.alg||X,length:r?.length||te},r?.extractable??!0,["encrypt","decrypt"])}i(Xe,"importKey");function Ur(e,{max:r}={max:255}){if(r<1||r>255)throw Wt;let t=new Uint8Array(e);if(r===255)return Fe.getRandomValues(t),t.buffer;let n=0,o=r+1,s=Math.floor(256/o)*o,a=new Uint8Array(1);for(;n<t.length;)Fe.getRandomValues(a),a[0]<s&&(t[n]=a[0]%o,n++);return t.buffer}i(Ur,"randomBuf");function vr(e,r){let t=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(p(e)),n=r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(p(r)),o=new Uint8Array(t.length+n.length);return o.set(t),o.set(n,t.length),o.buffer}i(vr,"joinBufs");var I=globalThis.crypto,en={keyTypes:{"bls12-381":{magicBytes:new Uint8Array([234,1]),verify:i(()=>{throw new Error("Not implemented")},"verify")},rsa:{magicBytes:new Uint8Array([0,245,2]),verify:tn},ed25519:{magicBytes:new Uint8Array([237,1]),verify:rn}}};async function rn({message:e,publicKey:r,signature:t}){let n=e;typeof e=="string"&&(n=w(e,"utf8"));let o=t;typeof t=="string"&&(o=w(t,"base64pad"));let s=r;if(typeof r=="string"&&(s=Br(r).publicKey),s.length!==32)throw new Error(`Invalid Ed25519 public key size: ${s.length} bytes, expected 32`);if(o.length!==64)throw new Error(`Invalid Ed25519 signature size: ${o.length} bytes, expected 64`);let a=await I.subtle.importKey("raw",p(s),{name:"Ed25519"},!1,["verify"]);return I.subtle.verify({name:"Ed25519"},a,p(o),p(n))}i(rn,"ed25519Verify");async function tn({message:e,publicKey:r,signature:t}){let n=r;return typeof r=="string"&&(n=Br(r).publicKey),nn.verify(e,t,await I.subtle.importKey("spki",p(n),{name:F,hash:ze},!1,["verify"]),8)}i(tn,"rsaVerify");var nn={verify:i(async function(r,t,n,o=V,s=Ge){return I.subtle.verify({name:F},typeof n=="string"?await je(n,s,"signing"):n,fe(t),q(r,o))},"rsaVerify"),sign:i(async function(r,t,n=V){return I.subtle.sign({name:F},t,q(r,n))},"sign"),encrypt:i(async function(r,t,n=V,o=Ge){let s;return typeof t=="string"?s=await je(t,o,"exchange"):s=t instanceof Uint8Array?await je(p(t),o,"exchange"):t,I.subtle.encrypt({name:G},s,q(r,n))},"rsaEncrypt"),decrypt:i(async function(r,t){let n=ue(t)?t:await cn(t,["decrypt"]),o;typeof r=="string"?o=w(r,"base64pad"):o=r;let s=await I.subtle.decrypt({name:G},n,o instanceof Uint8Array?p(o):o);return new Uint8Array(s)},"rsaDecrypt")};async function je(e,r,t){on(t);let n=t==="exchange"?G:F,o=t==="exchange"?["encrypt"]:["verify"],s=typeof e=="string"?j(an(e)):e;return I.subtle.importKey("spki",s,{name:n,hash:{name:r}},!0,o)}i(je,"rsaImportPublicKey");function on(e){sn(e,["signing","exchange"],wr)}i(on,"checkValidKeyUse");function sn(e,r,t){if(!r.some(o=>o===e))throw t}i(sn,"checkValid");function an(e){return e.replace(`-----BEGIN PUBLIC KEY-----
|
|
2
2
|
`,"").replace(`
|
|
3
|
-
-----END PUBLIC KEY-----`,"")}i(
|
|
3
|
+
-----END PUBLIC KEY-----`,"")}i(an,"stripKeyHeader");function ue(e){return typeof CryptoKey<"u"?e instanceof CryptoKey:qe(e,"algorithm")&&qe(e,"extractable")&&qe(e,"type")}i(ue,"isCryptoKey");function qe(e,r){return typeof e=="object"&&e!=null&&r in e}i(qe,"hasProp");function cn(e,r){return I.subtle.importKey("spki",e instanceof Uint8Array?p(e):e,{name:G,hash:ze},!1,r)}i(cn,"importRsaKey");function Br(e){if(!e.startsWith(ae))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let r=e.substring(ae.length),t=w(r,"base58btc"),n=Object.entries(en.keyTypes).find(([s,a])=>Er(p(t),p(a.magicBytes)));if(!n)throw new Error("Unsupported key algorithm.");let o=t.slice(n[1].magicBytes.length);return n[0]==="ed25519"&&o.length===44?{publicKey:o.slice(-32),type:n[0]}:{publicKey:o,type:n[0]}}i(Br,"didToPublicKey");var M=globalThis.crypto,Sr={create(e={alg:X,length:te}){let r=e.length||te,t=e.alg||X,n=e.extractable??!0;return M.subtle.generateKey({name:t,length:r},n,["encrypt","decrypt"])},export:Object.assign(async e=>{let r=await M.subtle.exportKey("raw",e);return new Uint8Array(r)},{asString:i(async(e,r)=>{let t=await Sr.export(e);return r?z(t,r):$e(t)},"asString")}),import(e,r){return We(typeof e=="string"?j(e):e,void 0,r)},async exportAsString(e){let r=await Sr.export(e);return $e(r)},encrypt:fn,async decrypt(e,r,t){let n=ue(r)?r:await We(r),o=t?await M.subtle.decrypt({name:$,iv:p(t)},n,typeof e=="string"?p(w(e,"base64pad")):e instanceof Uint8Array?p(e):e):await pn(e,n);return new Uint8Array(o)}};function We(e,r,t=!0){return M.subtle.importKey("raw",e instanceof Uint8Array?p(e):e,{name:$,length:r||256},t,["encrypt","decrypt"])}i(We,"importAesKey");async function fn(e,r,t,n){let o=ue(r)?r:await We(r),s=n?await M.subtle.encrypt({name:$,iv:p(n)},o,e instanceof ArrayBuffer?e:p(typeof e=="string"?w(e):e)):await un(e,o);return t&&t==="arraybuffer"?s:new Uint8Array(s)}i(fn,"encrypt");async function un(e,r,t){let n=q(e,t?.charsize??V),o=typeof r=="string"?await Xe(r,t):r,s=t?.iv||Ur(ce),a=await M.subtle.encrypt({name:$,iv:s},o,n);return vr(s,a)}i(un,"encryptBytes");async function pn(e,r,t){let n=fe(e),o=typeof r=="string"?await Xe(r,t):r,s=n.slice(0,ce),a=n.slice(ce);return await M.subtle.decrypt({name:X,iv:s},o,a)}i(pn,"decryptBytes");export{Sr as AES,pn as decryptBytes,We as importAesKey};
|
|
4
4
|
//# sourceMappingURL=index.min.js.map
|