@substrate-system/keys 0.2.26 → 0.2.27
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.map +1 -1
- package/dist/aes/index.min.js.map +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/index.min.js +1 -1
- package/dist/crypto.cjs +3 -3
- package/dist/crypto.cjs.map +2 -2
- package/dist/crypto.d.ts +2 -2
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +3 -3
- package/dist/crypto.js.map +2 -2
- package/dist/crypto.min.cjs +1 -1
- package/dist/crypto.min.cjs.map +3 -3
- package/dist/crypto.min.js +1 -1
- package/dist/crypto.min.js.map +3 -3
- package/dist/ecc/index.min.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +3 -3
- package/dist/meta.json +4 -4
- package/dist/rsa/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Hi=Object.create;var Le=Object.defineProperty;var Fi=Object.getOwnPropertyDescriptor;var Gi=Object.getOwnPropertyNames;var ki=Object.getPrototypeOf,Vi=Object.prototype.hasOwnProperty;var Xi=(n,e,i)=>e in n?Le(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var x=(n,e)=>Le(n,"name",{value:e,configurable:!0}),kn=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Vn=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),vr=(n,e)=>{for(var i in e)Le(n,i,{get:e[i],enumerable:!0})},Wi=(n,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of Gi(e))!Vi.call(n,c)&&c!==i&&Le(n,c,{get:()=>e[c],enumerable:!(s=Fi(e,c))||s.enumerable});return n};var $i=(n,e,i)=>(i=n!=null?Hi(ki(n)):{},Wi(e||!n||!n.__esModule?Le(i,"default",{value:n,enumerable:!0}):i,n));var M=(n,e,i)=>Xi(n,typeof e!="symbol"?e+"":e,i);var Ki=Vn(()=>{"use strict"});var Ei=Vn((vs,At)=>{"use strict";(function(n){"use strict";var e=x(function(t){var o,f=new Float64Array(16);if(t)for(o=0;o<t.length;o++)f[o]=t[o];return f},"gf"),i=x(function(){throw new Error("no PRNG")},"randombytes"),s=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var g=e(),E=e([1]),L=e([56129,1]),Z=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),or=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),fr=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),mr=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Nr=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function de(t,o,f,r){t[o]=f>>24&255,t[o+1]=f>>16&255,t[o+2]=f>>8&255,t[o+3]=f&255,t[o+4]=r>>24&255,t[o+5]=r>>16&255,t[o+6]=r>>8&255,t[o+7]=r&255}x(de,"ts64");function J(t,o,f,r,a){var u,p=0;for(u=0;u<a;u++)p|=t[o+u]^f[r+u];return(1&p-1>>>8)-1}x(J,"vn");function xr(t,o,f,r){return J(t,o,f,r,16)}x(xr,"crypto_verify_16");function _r(t,o,f,r){return J(t,o,f,r,32)}x(_r,"crypto_verify_32");function Ur(t,o,f,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,p=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,b=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,K=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,S=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,rr=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,C=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,N=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,H=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,j=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,z=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,Y=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,O=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,_=a,D=u,v=p,P=b,B=K,U=T,h=S,d=rr,m=C,l=N,A=R,w=H,I=j,F=z,k=Y,G=O,y,X=0;X<20;X+=2)y=_+I|0,B^=y<<7|y>>>25,y=B+_|0,m^=y<<9|y>>>23,y=m+B|0,I^=y<<13|y>>>19,y=I+m|0,_^=y<<18|y>>>14,y=U+D|0,l^=y<<7|y>>>25,y=l+U|0,F^=y<<9|y>>>23,y=F+l|0,D^=y<<13|y>>>19,y=D+F|0,U^=y<<18|y>>>14,y=A+h|0,k^=y<<7|y>>>25,y=k+A|0,v^=y<<9|y>>>23,y=v+k|0,h^=y<<13|y>>>19,y=h+v|0,A^=y<<18|y>>>14,y=G+w|0,P^=y<<7|y>>>25,y=P+G|0,d^=y<<9|y>>>23,y=d+P|0,w^=y<<13|y>>>19,y=w+d|0,G^=y<<18|y>>>14,y=_+P|0,D^=y<<7|y>>>25,y=D+_|0,v^=y<<9|y>>>23,y=v+D|0,P^=y<<13|y>>>19,y=P+v|0,_^=y<<18|y>>>14,y=U+B|0,h^=y<<7|y>>>25,y=h+U|0,d^=y<<9|y>>>23,y=d+h|0,B^=y<<13|y>>>19,y=B+d|0,U^=y<<18|y>>>14,y=A+l|0,w^=y<<7|y>>>25,y=w+A|0,m^=y<<9|y>>>23,y=m+w|0,l^=y<<13|y>>>19,y=l+m|0,A^=y<<18|y>>>14,y=G+k|0,I^=y<<7|y>>>25,y=I+G|0,F^=y<<9|y>>>23,y=F+I|0,k^=y<<13|y>>>19,y=k+F|0,G^=y<<18|y>>>14;_=_+a|0,D=D+u|0,v=v+p|0,P=P+b|0,B=B+K|0,U=U+T|0,h=h+S|0,d=d+rr|0,m=m+C|0,l=l+N|0,A=A+R|0,w=w+H|0,I=I+j|0,F=F+z|0,k=k+Y|0,G=G+O|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=D>>>0&255,t[5]=D>>>8&255,t[6]=D>>>16&255,t[7]=D>>>24&255,t[8]=v>>>0&255,t[9]=v>>>8&255,t[10]=v>>>16&255,t[11]=v>>>24&255,t[12]=P>>>0&255,t[13]=P>>>8&255,t[14]=P>>>16&255,t[15]=P>>>24&255,t[16]=B>>>0&255,t[17]=B>>>8&255,t[18]=B>>>16&255,t[19]=B>>>24&255,t[20]=U>>>0&255,t[21]=U>>>8&255,t[22]=U>>>16&255,t[23]=U>>>24&255,t[24]=h>>>0&255,t[25]=h>>>8&255,t[26]=h>>>16&255,t[27]=h>>>24&255,t[28]=d>>>0&255,t[29]=d>>>8&255,t[30]=d>>>16&255,t[31]=d>>>24&255,t[32]=m>>>0&255,t[33]=m>>>8&255,t[34]=m>>>16&255,t[35]=m>>>24&255,t[36]=l>>>0&255,t[37]=l>>>8&255,t[38]=l>>>16&255,t[39]=l>>>24&255,t[40]=A>>>0&255,t[41]=A>>>8&255,t[42]=A>>>16&255,t[43]=A>>>24&255,t[44]=w>>>0&255,t[45]=w>>>8&255,t[46]=w>>>16&255,t[47]=w>>>24&255,t[48]=I>>>0&255,t[49]=I>>>8&255,t[50]=I>>>16&255,t[51]=I>>>24&255,t[52]=F>>>0&255,t[53]=F>>>8&255,t[54]=F>>>16&255,t[55]=F>>>24&255,t[56]=k>>>0&255,t[57]=k>>>8&255,t[58]=k>>>16&255,t[59]=k>>>24&255,t[60]=G>>>0&255,t[61]=G>>>8&255,t[62]=G>>>16&255,t[63]=G>>>24&255}x(Ur,"core_salsa20");function lr(t,o,f,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,p=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,b=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,K=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,S=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,rr=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,C=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,N=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,H=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,j=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,z=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,Y=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,O=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,_=a,D=u,v=p,P=b,B=K,U=T,h=S,d=rr,m=C,l=N,A=R,w=H,I=j,F=z,k=Y,G=O,y,X=0;X<20;X+=2)y=_+I|0,B^=y<<7|y>>>25,y=B+_|0,m^=y<<9|y>>>23,y=m+B|0,I^=y<<13|y>>>19,y=I+m|0,_^=y<<18|y>>>14,y=U+D|0,l^=y<<7|y>>>25,y=l+U|0,F^=y<<9|y>>>23,y=F+l|0,D^=y<<13|y>>>19,y=D+F|0,U^=y<<18|y>>>14,y=A+h|0,k^=y<<7|y>>>25,y=k+A|0,v^=y<<9|y>>>23,y=v+k|0,h^=y<<13|y>>>19,y=h+v|0,A^=y<<18|y>>>14,y=G+w|0,P^=y<<7|y>>>25,y=P+G|0,d^=y<<9|y>>>23,y=d+P|0,w^=y<<13|y>>>19,y=w+d|0,G^=y<<18|y>>>14,y=_+P|0,D^=y<<7|y>>>25,y=D+_|0,v^=y<<9|y>>>23,y=v+D|0,P^=y<<13|y>>>19,y=P+v|0,_^=y<<18|y>>>14,y=U+B|0,h^=y<<7|y>>>25,y=h+U|0,d^=y<<9|y>>>23,y=d+h|0,B^=y<<13|y>>>19,y=B+d|0,U^=y<<18|y>>>14,y=A+l|0,w^=y<<7|y>>>25,y=w+A|0,m^=y<<9|y>>>23,y=m+w|0,l^=y<<13|y>>>19,y=l+m|0,A^=y<<18|y>>>14,y=G+k|0,I^=y<<7|y>>>25,y=I+G|0,F^=y<<9|y>>>23,y=F+I|0,k^=y<<13|y>>>19,y=k+F|0,G^=y<<18|y>>>14;t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=U>>>0&255,t[5]=U>>>8&255,t[6]=U>>>16&255,t[7]=U>>>24&255,t[8]=A>>>0&255,t[9]=A>>>8&255,t[10]=A>>>16&255,t[11]=A>>>24&255,t[12]=G>>>0&255,t[13]=G>>>8&255,t[14]=G>>>16&255,t[15]=G>>>24&255,t[16]=h>>>0&255,t[17]=h>>>8&255,t[18]=h>>>16&255,t[19]=h>>>24&255,t[20]=d>>>0&255,t[21]=d>>>8&255,t[22]=d>>>16&255,t[23]=d>>>24&255,t[24]=m>>>0&255,t[25]=m>>>8&255,t[26]=m>>>16&255,t[27]=m>>>24&255,t[28]=l>>>0&255,t[29]=l>>>8&255,t[30]=l>>>16&255,t[31]=l>>>24&255}x(lr,"core_hsalsa20");function Sr(t,o,f,r){Ur(t,o,f,r)}x(Sr,"crypto_core_salsa20");function br(t,o,f,r){lr(t,o,f,r)}x(br,"crypto_core_hsalsa20");var dr=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Rr(t,o,f,r,a,u,p){var b=new Uint8Array(16),K=new Uint8Array(64),T,S;for(S=0;S<16;S++)b[S]=0;for(S=0;S<8;S++)b[S]=u[S];for(;a>=64;){for(Sr(K,b,p,dr),S=0;S<64;S++)t[o+S]=f[r+S]^K[S];for(T=1,S=8;S<16;S++)T=T+(b[S]&255)|0,b[S]=T&255,T>>>=8;a-=64,o+=64,r+=64}if(a>0)for(Sr(K,b,p,dr),S=0;S<a;S++)t[o+S]=f[r+S]^K[S];return 0}x(Rr,"crypto_stream_salsa20_xor");function Pr(t,o,f,r,a){var u=new Uint8Array(16),p=new Uint8Array(64),b,K;for(K=0;K<16;K++)u[K]=0;for(K=0;K<8;K++)u[K]=r[K];for(;f>=64;){for(Sr(p,u,a,dr),K=0;K<64;K++)t[o+K]=p[K];for(b=1,K=8;K<16;K++)b=b+(u[K]&255)|0,u[K]=b&255,b>>>=8;f-=64,o+=64}if(f>0)for(Sr(p,u,a,dr),K=0;K<f;K++)t[o+K]=p[K];return 0}x(Pr,"crypto_stream_salsa20");function Ir(t,o,f,r,a){var u=new Uint8Array(32);br(u,r,a,dr);for(var p=new Uint8Array(8),b=0;b<8;b++)p[b]=r[b+16];return Pr(t,o,f,p,u)}x(Ir,"crypto_stream");function re(t,o,f,r,a,u,p){var b=new Uint8Array(32);br(b,u,p,dr);for(var K=new Uint8Array(8),T=0;T<8;T++)K[T]=u[T+16];return Rr(t,o,f,r,a,K,b)}x(re,"crypto_stream_xor");var Je=x(function(t){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var o,f,r,a,u,p,b,K;o=t[0]&255|(t[1]&255)<<8,this.r[0]=o&8191,f=t[2]&255|(t[3]&255)<<8,this.r[1]=(o>>>13|f<<3)&8191,r=t[4]&255|(t[5]&255)<<8,this.r[2]=(f>>>10|r<<6)&7939,a=t[6]&255|(t[7]&255)<<8,this.r[3]=(r>>>7|a<<9)&8191,u=t[8]&255|(t[9]&255)<<8,this.r[4]=(a>>>4|u<<12)&255,this.r[5]=u>>>1&8190,p=t[10]&255|(t[11]&255)<<8,this.r[6]=(u>>>14|p<<2)&8191,b=t[12]&255|(t[13]&255)<<8,this.r[7]=(p>>>11|b<<5)&8065,K=t[14]&255|(t[15]&255)<<8,this.r[8]=(b>>>8|K<<8)&8191,this.r[9]=K>>>5&127,this.pad[0]=t[16]&255|(t[17]&255)<<8,this.pad[1]=t[18]&255|(t[19]&255)<<8,this.pad[2]=t[20]&255|(t[21]&255)<<8,this.pad[3]=t[22]&255|(t[23]&255)<<8,this.pad[4]=t[24]&255|(t[25]&255)<<8,this.pad[5]=t[26]&255|(t[27]&255)<<8,this.pad[6]=t[28]&255|(t[29]&255)<<8,this.pad[7]=t[30]&255|(t[31]&255)<<8},"poly1305");Je.prototype.blocks=function(t,o,f){for(var r=this.fin?0:2048,a,u,p,b,K,T,S,rr,C,N,R,H,j,z,Y,O,_,D,v,P=this.h[0],B=this.h[1],U=this.h[2],h=this.h[3],d=this.h[4],m=this.h[5],l=this.h[6],A=this.h[7],w=this.h[8],I=this.h[9],F=this.r[0],k=this.r[1],G=this.r[2],y=this.r[3],X=this.r[4],er=this.r[5],tr=this.r[6],V=this.r[7],q=this.r[8],Q=this.r[9];f>=16;)a=t[o+0]&255|(t[o+1]&255)<<8,P+=a&8191,u=t[o+2]&255|(t[o+3]&255)<<8,B+=(a>>>13|u<<3)&8191,p=t[o+4]&255|(t[o+5]&255)<<8,U+=(u>>>10|p<<6)&8191,b=t[o+6]&255|(t[o+7]&255)<<8,h+=(p>>>7|b<<9)&8191,K=t[o+8]&255|(t[o+9]&255)<<8,d+=(b>>>4|K<<12)&8191,m+=K>>>1&8191,T=t[o+10]&255|(t[o+11]&255)<<8,l+=(K>>>14|T<<2)&8191,S=t[o+12]&255|(t[o+13]&255)<<8,A+=(T>>>11|S<<5)&8191,rr=t[o+14]&255|(t[o+15]&255)<<8,w+=(S>>>8|rr<<8)&8191,I+=rr>>>5|r,C=0,N=C,N+=P*F,N+=B*(5*Q),N+=U*(5*q),N+=h*(5*V),N+=d*(5*tr),C=N>>>13,N&=8191,N+=m*(5*er),N+=l*(5*X),N+=A*(5*y),N+=w*(5*G),N+=I*(5*k),C+=N>>>13,N&=8191,R=C,R+=P*k,R+=B*F,R+=U*(5*Q),R+=h*(5*q),R+=d*(5*V),C=R>>>13,R&=8191,R+=m*(5*tr),R+=l*(5*er),R+=A*(5*X),R+=w*(5*y),R+=I*(5*G),C+=R>>>13,R&=8191,H=C,H+=P*G,H+=B*k,H+=U*F,H+=h*(5*Q),H+=d*(5*q),C=H>>>13,H&=8191,H+=m*(5*V),H+=l*(5*tr),H+=A*(5*er),H+=w*(5*X),H+=I*(5*y),C+=H>>>13,H&=8191,j=C,j+=P*y,j+=B*G,j+=U*k,j+=h*F,j+=d*(5*Q),C=j>>>13,j&=8191,j+=m*(5*q),j+=l*(5*V),j+=A*(5*tr),j+=w*(5*er),j+=I*(5*X),C+=j>>>13,j&=8191,z=C,z+=P*X,z+=B*y,z+=U*G,z+=h*k,z+=d*F,C=z>>>13,z&=8191,z+=m*(5*Q),z+=l*(5*q),z+=A*(5*V),z+=w*(5*tr),z+=I*(5*er),C+=z>>>13,z&=8191,Y=C,Y+=P*er,Y+=B*X,Y+=U*y,Y+=h*G,Y+=d*k,C=Y>>>13,Y&=8191,Y+=m*F,Y+=l*(5*Q),Y+=A*(5*q),Y+=w*(5*V),Y+=I*(5*tr),C+=Y>>>13,Y&=8191,O=C,O+=P*tr,O+=B*er,O+=U*X,O+=h*y,O+=d*G,C=O>>>13,O&=8191,O+=m*k,O+=l*F,O+=A*(5*Q),O+=w*(5*q),O+=I*(5*V),C+=O>>>13,O&=8191,_=C,_+=P*V,_+=B*tr,_+=U*er,_+=h*X,_+=d*y,C=_>>>13,_&=8191,_+=m*G,_+=l*k,_+=A*F,_+=w*(5*Q),_+=I*(5*q),C+=_>>>13,_&=8191,D=C,D+=P*q,D+=B*V,D+=U*tr,D+=h*er,D+=d*X,C=D>>>13,D&=8191,D+=m*y,D+=l*G,D+=A*k,D+=w*F,D+=I*(5*Q),C+=D>>>13,D&=8191,v=C,v+=P*Q,v+=B*q,v+=U*V,v+=h*tr,v+=d*er,C=v>>>13,v&=8191,v+=m*X,v+=l*y,v+=A*G,v+=w*k,v+=I*F,C+=v>>>13,v&=8191,C=(C<<2)+C|0,C=C+N|0,N=C&8191,C=C>>>13,R+=C,P=N,B=R,U=H,h=j,d=z,m=Y,l=O,A=_,w=D,I=v,o+=16,f-=16;this.h[0]=P,this.h[1]=B,this.h[2]=U,this.h[3]=h,this.h[4]=d,this.h[5]=m,this.h[6]=l,this.h[7]=A,this.h[8]=w,this.h[9]=I},Je.prototype.finish=function(t,o){var f=new Uint16Array(10),r,a,u,p;if(this.leftover){for(p=this.leftover,this.buffer[p++]=1;p<16;p++)this.buffer[p]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,p=2;p<10;p++)this.h[p]+=r,r=this.h[p]>>>13,this.h[p]&=8191;for(this.h[0]+=r*5,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,f[0]=this.h[0]+5,r=f[0]>>>13,f[0]&=8191,p=1;p<10;p++)f[p]=this.h[p]+r,r=f[p]>>>13,f[p]&=8191;for(f[9]-=8192,a=(r^1)-1,p=0;p<10;p++)f[p]&=a;for(a=~a,p=0;p<10;p++)this.h[p]=this.h[p]&a|f[p];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,u=this.h[0]+this.pad[0],this.h[0]=u&65535,p=1;p<8;p++)u=(this.h[p]+this.pad[p]|0)+(u>>>16)|0,this.h[p]=u&65535;t[o+0]=this.h[0]>>>0&255,t[o+1]=this.h[0]>>>8&255,t[o+2]=this.h[1]>>>0&255,t[o+3]=this.h[1]>>>8&255,t[o+4]=this.h[2]>>>0&255,t[o+5]=this.h[2]>>>8&255,t[o+6]=this.h[3]>>>0&255,t[o+7]=this.h[3]>>>8&255,t[o+8]=this.h[4]>>>0&255,t[o+9]=this.h[4]>>>8&255,t[o+10]=this.h[5]>>>0&255,t[o+11]=this.h[5]>>>8&255,t[o+12]=this.h[6]>>>0&255,t[o+13]=this.h[6]>>>8&255,t[o+14]=this.h[7]>>>0&255,t[o+15]=this.h[7]>>>8&255},Je.prototype.update=function(t,o,f){var r,a;if(this.leftover){for(a=16-this.leftover,a>f&&(a=f),r=0;r<a;r++)this.buffer[this.leftover+r]=t[o+r];if(f-=a,o+=a,this.leftover+=a,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(f>=16&&(a=f-f%16,this.blocks(t,o,a),o+=a,f-=a),f){for(r=0;r<f;r++)this.buffer[this.leftover+r]=t[o+r];this.leftover+=f}};function Ut(t,o,f,r,a,u){var p=new Je(u);return p.update(f,r,a),p.finish(t,o),0}x(Ut,"crypto_onetimeauth");function Tn(t,o,f,r,a,u){var p=new Uint8Array(16);return Ut(p,0,f,r,a,u),xr(t,o,p,0)}x(Tn,"crypto_onetimeauth_verify");function St(t,o,f,r,a){var u;if(f<32)return-1;for(re(t,0,o,0,f,r,a),Ut(t,16,t,32,f-32,t),u=0;u<16;u++)t[u]=0;return 0}x(St,"crypto_secretbox");function vt(t,o,f,r,a){var u,p=new Uint8Array(32);if(f<32||(Ir(p,0,32,r,a),Tn(o,16,o,32,f-32,p)!==0))return-1;for(re(t,0,o,0,f,r,a),u=0;u<32;u++)t[u]=0;return 0}x(vt,"crypto_secretbox_open");function Xr(t,o){var f;for(f=0;f<16;f++)t[f]=o[f]|0}x(Xr,"set25519");function Ct(t){var o,f,r=1;for(o=0;o<16;o++)f=t[o]+r+65535,r=Math.floor(f/65536),t[o]=f-r*65536;t[0]+=r-1+37*(r-1)}x(Ct,"car25519");function ge(t,o,f){for(var r,a=~(f-1),u=0;u<16;u++)r=a&(t[u]^o[u]),t[u]^=r,o[u]^=r}x(ge,"sel25519");function le(t,o){var f,r,a,u=e(),p=e();for(f=0;f<16;f++)p[f]=o[f];for(Ct(p),Ct(p),Ct(p),r=0;r<2;r++){for(u[0]=p[0]-65517,f=1;f<15;f++)u[f]=p[f]-65535-(u[f-1]>>16&1),u[f-1]&=65535;u[15]=p[15]-32767-(u[14]>>16&1),a=u[15]>>16&1,u[14]&=65535,ge(p,u,1-a)}for(f=0;f<16;f++)t[2*f]=p[f]&255,t[2*f+1]=p[f]>>8}x(le,"pack25519");function Dn(t,o){var f=new Uint8Array(32),r=new Uint8Array(32);return le(f,t),le(r,o),_r(f,0,r,0)}x(Dn,"neq25519");function In(t){var o=new Uint8Array(32);return le(o,t),o[0]&1}x(In,"par25519");function _t(t,o){var f;for(f=0;f<16;f++)t[f]=o[2*f]+(o[2*f+1]<<8);t[15]&=32767}x(_t,"unpack25519");function zr(t,o,f){for(var r=0;r<16;r++)t[r]=o[r]+f[r]}x(zr,"A");function Or(t,o,f){for(var r=0;r<16;r++)t[r]=o[r]-f[r]}x(Or,"Z");function W(t,o,f){var r,a,u=0,p=0,b=0,K=0,T=0,S=0,rr=0,C=0,N=0,R=0,H=0,j=0,z=0,Y=0,O=0,_=0,D=0,v=0,P=0,B=0,U=0,h=0,d=0,m=0,l=0,A=0,w=0,I=0,F=0,k=0,G=0,y=f[0],X=f[1],er=f[2],tr=f[3],V=f[4],q=f[5],Q=f[6],ur=f[7],nr=f[8],ar=f[9],sr=f[10],cr=f[11],hr=f[12],wr=f[13],Kr=f[14],Er=f[15];r=o[0],u+=r*y,p+=r*X,b+=r*er,K+=r*tr,T+=r*V,S+=r*q,rr+=r*Q,C+=r*ur,N+=r*nr,R+=r*ar,H+=r*sr,j+=r*cr,z+=r*hr,Y+=r*wr,O+=r*Kr,_+=r*Er,r=o[1],p+=r*y,b+=r*X,K+=r*er,T+=r*tr,S+=r*V,rr+=r*q,C+=r*Q,N+=r*ur,R+=r*nr,H+=r*ar,j+=r*sr,z+=r*cr,Y+=r*hr,O+=r*wr,_+=r*Kr,D+=r*Er,r=o[2],b+=r*y,K+=r*X,T+=r*er,S+=r*tr,rr+=r*V,C+=r*q,N+=r*Q,R+=r*ur,H+=r*nr,j+=r*ar,z+=r*sr,Y+=r*cr,O+=r*hr,_+=r*wr,D+=r*Kr,v+=r*Er,r=o[3],K+=r*y,T+=r*X,S+=r*er,rr+=r*tr,C+=r*V,N+=r*q,R+=r*Q,H+=r*ur,j+=r*nr,z+=r*ar,Y+=r*sr,O+=r*cr,_+=r*hr,D+=r*wr,v+=r*Kr,P+=r*Er,r=o[4],T+=r*y,S+=r*X,rr+=r*er,C+=r*tr,N+=r*V,R+=r*q,H+=r*Q,j+=r*ur,z+=r*nr,Y+=r*ar,O+=r*sr,_+=r*cr,D+=r*hr,v+=r*wr,P+=r*Kr,B+=r*Er,r=o[5],S+=r*y,rr+=r*X,C+=r*er,N+=r*tr,R+=r*V,H+=r*q,j+=r*Q,z+=r*ur,Y+=r*nr,O+=r*ar,_+=r*sr,D+=r*cr,v+=r*hr,P+=r*wr,B+=r*Kr,U+=r*Er,r=o[6],rr+=r*y,C+=r*X,N+=r*er,R+=r*tr,H+=r*V,j+=r*q,z+=r*Q,Y+=r*ur,O+=r*nr,_+=r*ar,D+=r*sr,v+=r*cr,P+=r*hr,B+=r*wr,U+=r*Kr,h+=r*Er,r=o[7],C+=r*y,N+=r*X,R+=r*er,H+=r*tr,j+=r*V,z+=r*q,Y+=r*Q,O+=r*ur,_+=r*nr,D+=r*ar,v+=r*sr,P+=r*cr,B+=r*hr,U+=r*wr,h+=r*Kr,d+=r*Er,r=o[8],N+=r*y,R+=r*X,H+=r*er,j+=r*tr,z+=r*V,Y+=r*q,O+=r*Q,_+=r*ur,D+=r*nr,v+=r*ar,P+=r*sr,B+=r*cr,U+=r*hr,h+=r*wr,d+=r*Kr,m+=r*Er,r=o[9],R+=r*y,H+=r*X,j+=r*er,z+=r*tr,Y+=r*V,O+=r*q,_+=r*Q,D+=r*ur,v+=r*nr,P+=r*ar,B+=r*sr,U+=r*cr,h+=r*hr,d+=r*wr,m+=r*Kr,l+=r*Er,r=o[10],H+=r*y,j+=r*X,z+=r*er,Y+=r*tr,O+=r*V,_+=r*q,D+=r*Q,v+=r*ur,P+=r*nr,B+=r*ar,U+=r*sr,h+=r*cr,d+=r*hr,m+=r*wr,l+=r*Kr,A+=r*Er,r=o[11],j+=r*y,z+=r*X,Y+=r*er,O+=r*tr,_+=r*V,D+=r*q,v+=r*Q,P+=r*ur,B+=r*nr,U+=r*ar,h+=r*sr,d+=r*cr,m+=r*hr,l+=r*wr,A+=r*Kr,w+=r*Er,r=o[12],z+=r*y,Y+=r*X,O+=r*er,_+=r*tr,D+=r*V,v+=r*q,P+=r*Q,B+=r*ur,U+=r*nr,h+=r*ar,d+=r*sr,m+=r*cr,l+=r*hr,A+=r*wr,w+=r*Kr,I+=r*Er,r=o[13],Y+=r*y,O+=r*X,_+=r*er,D+=r*tr,v+=r*V,P+=r*q,B+=r*Q,U+=r*ur,h+=r*nr,d+=r*ar,m+=r*sr,l+=r*cr,A+=r*hr,w+=r*wr,I+=r*Kr,F+=r*Er,r=o[14],O+=r*y,_+=r*X,D+=r*er,v+=r*tr,P+=r*V,B+=r*q,U+=r*Q,h+=r*ur,d+=r*nr,m+=r*ar,l+=r*sr,A+=r*cr,w+=r*hr,I+=r*wr,F+=r*Kr,k+=r*Er,r=o[15],_+=r*y,D+=r*X,v+=r*er,P+=r*tr,B+=r*V,U+=r*q,h+=r*Q,d+=r*ur,m+=r*nr,l+=r*ar,A+=r*sr,w+=r*cr,I+=r*hr,F+=r*wr,k+=r*Kr,G+=r*Er,u+=38*D,p+=38*v,b+=38*P,K+=38*B,T+=38*U,S+=38*h,rr+=38*d,C+=38*m,N+=38*l,R+=38*A,H+=38*w,j+=38*I,z+=38*F,Y+=38*k,O+=38*G,a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=b+a+65535,a=Math.floor(r/65536),b=r-a*65536,r=K+a+65535,a=Math.floor(r/65536),K=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=S+a+65535,a=Math.floor(r/65536),S=r-a*65536,r=rr+a+65535,a=Math.floor(r/65536),rr=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=H+a+65535,a=Math.floor(r/65536),H=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=O+a+65535,a=Math.floor(r/65536),O=r-a*65536,r=_+a+65535,a=Math.floor(r/65536),_=r-a*65536,u+=a-1+37*(a-1),a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=b+a+65535,a=Math.floor(r/65536),b=r-a*65536,r=K+a+65535,a=Math.floor(r/65536),K=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=S+a+65535,a=Math.floor(r/65536),S=r-a*65536,r=rr+a+65535,a=Math.floor(r/65536),rr=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=H+a+65535,a=Math.floor(r/65536),H=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=O+a+65535,a=Math.floor(r/65536),O=r-a*65536,r=_+a+65535,a=Math.floor(r/65536),_=r-a*65536,u+=a-1+37*(a-1),t[0]=u,t[1]=p,t[2]=b,t[3]=K,t[4]=T,t[5]=S,t[6]=rr,t[7]=C,t[8]=N,t[9]=R,t[10]=H,t[11]=j,t[12]=z,t[13]=Y,t[14]=O,t[15]=_}x(W,"M");function Mr(t,o){W(t,o,o)}x(Mr,"S");function Mn(t,o){var f=e(),r;for(r=0;r<16;r++)f[r]=o[r];for(r=253;r>=0;r--)Mr(f,f),r!==2&&r!==4&&W(f,f,o);for(r=0;r<16;r++)t[r]=f[r]}x(Mn,"inv25519");function Ln(t,o){var f=e(),r;for(r=0;r<16;r++)f[r]=o[r];for(r=250;r>=0;r--)Mr(f,f),r!==1&&W(f,f,o);for(r=0;r<16;r++)t[r]=f[r]}x(Ln,"pow2523");function qe(t,o,f){var r=new Uint8Array(32),a=new Float64Array(80),u,p,b=e(),K=e(),T=e(),S=e(),rr=e(),C=e();for(p=0;p<31;p++)r[p]=o[p];for(r[31]=o[31]&127|64,r[0]&=248,_t(a,f),p=0;p<16;p++)K[p]=a[p],S[p]=b[p]=T[p]=0;for(b[0]=S[0]=1,p=254;p>=0;--p)u=r[p>>>3]>>>(p&7)&1,ge(b,K,u),ge(T,S,u),zr(rr,b,T),Or(b,b,T),zr(T,K,S),Or(K,K,S),Mr(S,rr),Mr(C,b),W(b,T,b),W(T,K,rr),zr(rr,b,T),Or(b,b,T),Mr(K,b),Or(T,S,C),W(b,T,L),zr(b,b,S),W(T,T,b),W(b,S,C),W(S,K,a),Mr(K,rr),ge(b,K,u),ge(T,S,u);for(p=0;p<16;p++)a[p+16]=b[p],a[p+32]=T[p],a[p+48]=K[p],a[p+64]=S[p];var N=a.subarray(32),R=a.subarray(16);return Mn(N,N),W(R,R,N),le(t,R),0}x(qe,"crypto_scalarmult");function Qe(t,o){return qe(t,o,c)}x(Qe,"crypto_scalarmult_base");function Nn(t,o){return i(o,32),Qe(t,o)}x(Nn,"crypto_box_keypair");function rt(t,o,f){var r=new Uint8Array(32);return qe(r,f,o),br(t,s,r,dr)}x(rt,"crypto_box_beforenm");var Rn=St,Li=vt;function Ni(t,o,f,r,a,u){var p=new Uint8Array(32);return rt(p,a,u),Rn(t,o,f,r,p)}x(Ni,"crypto_box");function Ri(t,o,f,r,a,u){var p=new Uint8Array(32);return rt(p,a,u),Li(t,o,f,r,p)}x(Ri,"crypto_box_open");var zn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function On(t,o,f,r){for(var a=new Int32Array(16),u=new Int32Array(16),p,b,K,T,S,rr,C,N,R,H,j,z,Y,O,_,D,v,P,B,U,h,d,m,l,A,w,I=t[0],F=t[1],k=t[2],G=t[3],y=t[4],X=t[5],er=t[6],tr=t[7],V=o[0],q=o[1],Q=o[2],ur=o[3],nr=o[4],ar=o[5],sr=o[6],cr=o[7],hr=0;r>=128;){for(B=0;B<16;B++)U=8*B+hr,a[B]=f[U+0]<<24|f[U+1]<<16|f[U+2]<<8|f[U+3],u[B]=f[U+4]<<24|f[U+5]<<16|f[U+6]<<8|f[U+7];for(B=0;B<80;B++)if(p=I,b=F,K=k,T=G,S=y,rr=X,C=er,N=tr,R=V,H=q,j=Q,z=ur,Y=nr,O=ar,_=sr,D=cr,h=tr,d=cr,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=(y>>>14|nr<<18)^(y>>>18|nr<<14)^(nr>>>9|y<<23),d=(nr>>>14|y<<18)^(nr>>>18|y<<14)^(y>>>9|nr<<23),m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,h=y&X^~y&er,d=nr&ar^~nr&sr,m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,h=zn[B*2],d=zn[B*2+1],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,h=a[B%16],d=u[B%16],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,v=A&65535|w<<16,P=m&65535|l<<16,h=v,d=P,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=(I>>>28|V<<4)^(V>>>2|I<<30)^(V>>>7|I<<25),d=(V>>>28|I<<4)^(I>>>2|V<<30)^(I>>>7|V<<25),m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,h=I&F^I&k^F&k,d=V&q^V&Q^q&Q,m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,N=A&65535|w<<16,D=m&65535|l<<16,h=T,d=z,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=v,d=P,m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,T=A&65535|w<<16,z=m&65535|l<<16,F=p,k=b,G=K,y=T,X=S,er=rr,tr=C,I=N,q=R,Q=H,ur=j,nr=z,ar=Y,sr=O,cr=_,V=D,B%16===15)for(U=0;U<16;U++)h=a[U],d=u[U],m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=a[(U+9)%16],d=u[(U+9)%16],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,v=a[(U+1)%16],P=u[(U+1)%16],h=(v>>>1|P<<31)^(v>>>8|P<<24)^v>>>7,d=(P>>>1|v<<31)^(P>>>8|v<<24)^(P>>>7|v<<25),m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,v=a[(U+14)%16],P=u[(U+14)%16],h=(v>>>19|P<<13)^(P>>>29|v<<3)^v>>>6,d=(P>>>19|v<<13)^(v>>>29|P<<3)^(P>>>6|v<<26),m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,a[U]=A&65535|w<<16,u[U]=m&65535|l<<16;h=I,d=V,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[0],d=o[0],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[0]=I=A&65535|w<<16,o[0]=V=m&65535|l<<16,h=F,d=q,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[1],d=o[1],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[1]=F=A&65535|w<<16,o[1]=q=m&65535|l<<16,h=k,d=Q,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[2],d=o[2],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[2]=k=A&65535|w<<16,o[2]=Q=m&65535|l<<16,h=G,d=ur,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[3],d=o[3],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[3]=G=A&65535|w<<16,o[3]=ur=m&65535|l<<16,h=y,d=nr,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[4],d=o[4],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[4]=y=A&65535|w<<16,o[4]=nr=m&65535|l<<16,h=X,d=ar,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[5],d=o[5],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[5]=X=A&65535|w<<16,o[5]=ar=m&65535|l<<16,h=er,d=sr,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[6],d=o[6],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[6]=er=A&65535|w<<16,o[6]=sr=m&65535|l<<16,h=tr,d=cr,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[7],d=o[7],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[7]=tr=A&65535|w<<16,o[7]=cr=m&65535|l<<16,hr+=128,r-=128}return r}x(On,"crypto_hashblocks_hl");function se(t,o,f){var r=new Int32Array(8),a=new Int32Array(8),u=new Uint8Array(256),p,b=f;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,On(r,a,o,f),f%=128,p=0;p<f;p++)u[p]=o[b-f+p];for(u[f]=128,f=256-128*(f<112?1:0),u[f-9]=0,de(u,f-8,b/536870912|0,b<<3),On(r,a,u,f),p=0;p<8;p++)de(t,8*p,r[p],a[p]);return 0}x(se,"crypto_hash");function et(t,o){var f=e(),r=e(),a=e(),u=e(),p=e(),b=e(),K=e(),T=e(),S=e();Or(f,t[1],t[0]),Or(S,o[1],o[0]),W(f,f,S),zr(r,t[0],t[1]),zr(S,o[0],o[1]),W(r,r,S),W(a,t[3],o[3]),W(a,a,or),W(u,t[2],o[2]),zr(u,u,u),Or(p,r,f),Or(b,u,a),zr(K,u,a),zr(T,r,f),W(t[0],p,b),W(t[1],T,K),W(t[2],K,b),W(t[3],p,T)}x(et,"add");function Yn(t,o,f){var r;for(r=0;r<4;r++)ge(t[r],o[r],f)}x(Yn,"cswap");function Pt(t,o){var f=e(),r=e(),a=e();Mn(a,o[2]),W(f,o[0],a),W(r,o[1],a),le(t,r),t[31]^=In(f)<<7}x(Pt,"pack");function Bt(t,o,f){var r,a;for(Xr(t[0],g),Xr(t[1],E),Xr(t[2],E),Xr(t[3],g),a=255;a>=0;--a)r=f[a/8|0]>>(a&7)&1,Yn(t,o,r),et(o,t),et(t,t),Yn(t,o,r)}x(Bt,"scalarmult");function tt(t,o){var f=[e(),e(),e(),e()];Xr(f[0],fr),Xr(f[1],mr),Xr(f[2],E),W(f[3],fr,mr),Bt(t,f,o)}x(tt,"scalarbase");function Tt(t,o,f){var r=new Uint8Array(64),a=[e(),e(),e(),e()],u;for(f||i(o,32),se(r,o,32),r[0]&=248,r[31]&=127,r[31]|=64,tt(a,r),Pt(t,a),u=0;u<32;u++)o[u+32]=t[u];return 0}x(Tt,"crypto_sign_keypair");var nt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Dt(t,o){var f,r,a,u;for(r=63;r>=32;--r){for(f=0,a=r-32,u=r-12;a<u;++a)o[a]+=f-16*o[r]*nt[a-(r-32)],f=Math.floor((o[a]+128)/256),o[a]-=f*256;o[a]+=f,o[r]=0}for(f=0,a=0;a<32;a++)o[a]+=f-(o[31]>>4)*nt[a],f=o[a]>>8,o[a]&=255;for(a=0;a<32;a++)o[a]-=f*nt[a];for(r=0;r<32;r++)o[r+1]+=o[r]>>8,t[r]=o[r]&255}x(Dt,"modL");function It(t){var o=new Float64Array(64),f;for(f=0;f<64;f++)o[f]=t[f];for(f=0;f<64;f++)t[f]=0;Dt(t,o)}x(It,"reduce");function jn(t,o,f,r){var a=new Uint8Array(64),u=new Uint8Array(64),p=new Uint8Array(64),b,K,T=new Float64Array(64),S=[e(),e(),e(),e()];se(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64;var rr=f+64;for(b=0;b<f;b++)t[64+b]=o[b];for(b=0;b<32;b++)t[32+b]=a[32+b];for(se(p,t.subarray(32),f+32),It(p),tt(S,p),Pt(t,S),b=32;b<64;b++)t[b]=r[b];for(se(u,t,f+64),It(u),b=0;b<64;b++)T[b]=0;for(b=0;b<32;b++)T[b]=p[b];for(b=0;b<32;b++)for(K=0;K<32;K++)T[b+K]+=u[b]*a[K];return Dt(t.subarray(32),T),rr}x(jn,"crypto_sign");function zi(t,o){var f=e(),r=e(),a=e(),u=e(),p=e(),b=e(),K=e();return Xr(t[2],E),_t(t[1],o),Mr(a,t[1]),W(u,a,Z),Or(a,a,t[2]),zr(u,t[2],u),Mr(p,u),Mr(b,p),W(K,b,p),W(f,K,a),W(f,f,u),Ln(f,f),W(f,f,a),W(f,f,u),W(f,f,u),W(t[0],f,u),Mr(r,t[0]),W(r,r,u),Dn(r,a)&&W(t[0],t[0],Nr),Mr(r,t[0]),W(r,r,u),Dn(r,a)?-1:(In(t[0])===o[31]>>7&&Or(t[0],g,t[0]),W(t[3],t[0],t[1]),0)}x(zi,"unpackneg");function Mt(t,o,f,r){var a,u=new Uint8Array(32),p=new Uint8Array(64),b=[e(),e(),e(),e()],K=[e(),e(),e(),e()];if(f<64||zi(K,r))return-1;for(a=0;a<f;a++)t[a]=o[a];for(a=0;a<32;a++)t[a+32]=r[a];if(se(p,t,f),It(p),Bt(b,K,p),tt(K,o.subarray(32)),et(b,K),Pt(u,b),f-=64,_r(o,0,u,0)){for(a=0;a<f;a++)t[a]=0;return-1}for(a=0;a<f;a++)t[a]=o[a+64];return f}x(Mt,"crypto_sign_open");var Lt=32,it=24,Te=32,be=16,De=32,ft=32,Ie=32,Me=32,Nt=32,Hn=it,Oi=Te,Yi=be,Wr=64,ce=32,Ae=64,Rt=32,zt=64;n.lowlevel={crypto_core_hsalsa20:br,crypto_stream_xor:re,crypto_stream:Ir,crypto_stream_salsa20_xor:Rr,crypto_stream_salsa20:Pr,crypto_onetimeauth:Ut,crypto_onetimeauth_verify:Tn,crypto_verify_16:xr,crypto_verify_32:_r,crypto_secretbox:St,crypto_secretbox_open:vt,crypto_scalarmult:qe,crypto_scalarmult_base:Qe,crypto_box_beforenm:rt,crypto_box_afternm:Rn,crypto_box:Ni,crypto_box_open:Ri,crypto_box_keypair:Nn,crypto_hash:se,crypto_sign:jn,crypto_sign_keypair:Tt,crypto_sign_open:Mt,crypto_secretbox_KEYBYTES:Lt,crypto_secretbox_NONCEBYTES:it,crypto_secretbox_ZEROBYTES:Te,crypto_secretbox_BOXZEROBYTES:be,crypto_scalarmult_BYTES:De,crypto_scalarmult_SCALARBYTES:ft,crypto_box_PUBLICKEYBYTES:Ie,crypto_box_SECRETKEYBYTES:Me,crypto_box_BEFORENMBYTES:Nt,crypto_box_NONCEBYTES:Hn,crypto_box_ZEROBYTES:Oi,crypto_box_BOXZEROBYTES:Yi,crypto_sign_BYTES:Wr,crypto_sign_PUBLICKEYBYTES:ce,crypto_sign_SECRETKEYBYTES:Ae,crypto_sign_SEEDBYTES:Rt,crypto_hash_BYTES:zt,gf:e,D:Z,L:nt,pack25519:le,unpack25519:_t,M:W,A:zr,S:Mr,Z:Or,pow2523:Ln,add:et,set25519:Xr,modL:Dt,scalarmult:Bt,scalarbase:tt};function Fn(t,o){if(t.length!==Lt)throw new Error("bad key size");if(o.length!==it)throw new Error("bad nonce size")}x(Fn,"checkLengths");function ji(t,o){if(t.length!==Ie)throw new Error("bad public key size");if(o.length!==Me)throw new Error("bad secret key size")}x(ji,"checkBoxLengths");function Tr(){for(var t=0;t<arguments.length;t++)if(!(arguments[t]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}x(Tr,"checkArrayTypes");function Gn(t){for(var o=0;o<t.length;o++)t[o]=0}x(Gn,"cleanup"),n.randomBytes=function(t){var o=new Uint8Array(t);return i(o,t),o},n.secretbox=function(t,o,f){Tr(t,o,f),Fn(f,o);for(var r=new Uint8Array(Te+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+Te]=t[u];return St(a,r,r.length,o,f),a.subarray(be)},n.secretbox.open=function(t,o,f){Tr(t,o,f),Fn(f,o);for(var r=new Uint8Array(be+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+be]=t[u];return r.length<32||vt(a,r,r.length,o,f)!==0?null:a.subarray(Te)},n.secretbox.keyLength=Lt,n.secretbox.nonceLength=it,n.secretbox.overheadLength=be,n.scalarMult=function(t,o){if(Tr(t,o),t.length!==ft)throw new Error("bad n size");if(o.length!==De)throw new Error("bad p size");var f=new Uint8Array(De);return qe(f,t,o),f},n.scalarMult.base=function(t){if(Tr(t),t.length!==ft)throw new Error("bad n size");var o=new Uint8Array(De);return Qe(o,t),o},n.scalarMult.scalarLength=ft,n.scalarMult.groupElementLength=De,n.box=function(t,o,f,r){var a=n.box.before(f,r);return n.secretbox(t,o,a)},n.box.before=function(t,o){Tr(t,o),ji(t,o);var f=new Uint8Array(Nt);return rt(f,t,o),f},n.box.after=n.secretbox,n.box.open=function(t,o,f,r){var a=n.box.before(f,r);return n.secretbox.open(t,o,a)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var t=new Uint8Array(Ie),o=new Uint8Array(Me);return Nn(t,o),{publicKey:t,secretKey:o}},n.box.keyPair.fromSecretKey=function(t){if(Tr(t),t.length!==Me)throw new Error("bad secret key size");var o=new Uint8Array(Ie);return Qe(o,t),{publicKey:o,secretKey:new Uint8Array(t)}},n.box.publicKeyLength=Ie,n.box.secretKeyLength=Me,n.box.sharedKeyLength=Nt,n.box.nonceLength=Hn,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(t,o){if(Tr(t,o),o.length!==Ae)throw new Error("bad secret key size");var f=new Uint8Array(Wr+t.length);return jn(f,t,t.length,o),f},n.sign.open=function(t,o){if(Tr(t,o),o.length!==ce)throw new Error("bad public key size");var f=new Uint8Array(t.length),r=Mt(f,t,t.length,o);if(r<0)return null;for(var a=new Uint8Array(r),u=0;u<a.length;u++)a[u]=f[u];return a},n.sign.detached=function(t,o){for(var f=n.sign(t,o),r=new Uint8Array(Wr),a=0;a<r.length;a++)r[a]=f[a];return r},n.sign.detached.verify=function(t,o,f){if(Tr(t,o,f),o.length!==Wr)throw new Error("bad signature size");if(f.length!==ce)throw new Error("bad public key size");var r=new Uint8Array(Wr+t.length),a=new Uint8Array(Wr+t.length),u;for(u=0;u<Wr;u++)r[u]=o[u];for(u=0;u<t.length;u++)r[u+Wr]=t[u];return Mt(a,r,r.length,f)>=0},n.sign.keyPair=function(){var t=new Uint8Array(ce),o=new Uint8Array(Ae);return Tt(t,o),{publicKey:t,secretKey:o}},n.sign.keyPair.fromSecretKey=function(t){if(Tr(t),t.length!==Ae)throw new Error("bad secret key size");for(var o=new Uint8Array(ce),f=0;f<o.length;f++)o[f]=t[32+f];return{publicKey:o,secretKey:new Uint8Array(t)}},n.sign.keyPair.fromSeed=function(t){if(Tr(t),t.length!==Rt)throw new Error("bad seed size");for(var o=new Uint8Array(ce),f=new Uint8Array(Ae),r=0;r<32;r++)f[r]=t[r];return Tt(o,f,!0),{publicKey:o,secretKey:f}},n.sign.publicKeyLength=ce,n.sign.secretKeyLength=Ae,n.sign.seedLength=Rt,n.sign.signatureLength=Wr,n.hash=function(t){Tr(t);var o=new Uint8Array(zt);return se(o,t,t.length),o},n.hash.hashLength=zt,n.verify=function(t,o){return Tr(t,o),t.length===0||o.length===0||t.length!==o.length?!1:J(t,0,o,0,t.length)===0},n.setPRNG=function(t){i=t},function(){var t=typeof self<"u"?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){var o=65536;n.setPRNG(function(f,r){var a,u=new Uint8Array(r);for(a=0;a<r;a+=o)t.getRandomValues(u.subarray(a,a+Math.min(r-a,o)));for(a=0;a<r;a++)f[a]=u[a];Gn(u)})}else typeof kn<"u"&&(t=Ki(),t&&t.randomBytes&&n.setPRNG(function(f,r){var a,u=t.randomBytes(r);for(a=0;a<r;a++)f[a]=u[a];Gn(u)}))}()})(typeof At<"u"&&At.exports?At.exports:self.nacl=self.nacl||{})});var Xn=(s=>(s[s.B1024=1024]="B1024",s[s.B2048=2048]="B2048",s[s.B4096=4096]="B4096",s))(Xn||{}),Wn=(s=>(s[s.B128=128]="B128",s[s.B192=192]="B192",s[s.B256=256]="B256",s))(Wn||{}),$n=(i=>(i.ECC="ecc",i.RSA="rsa",i))($n||{}),Ot=(c=>(c.SHA_1="SHA-1",c.SHA_256="SHA-256",c.SHA_384="SHA-384",c.SHA_512="SHA-512",c))(Ot||{}),Yt=(c=>(c.P_256="P-256",c.P_384="P-384",c.P_521="P-521",c.X25519="X25519",c))(Yt||{}),ye=(s=>(s.Sign="signing",s.Exchange="exchange",s.Write="write",s))(ye||{}),jt=(i=>(i[i.B8=8]="B8",i[i.B16=16]="B16",i))(jt||{});var Di={};vr(Di,{AES_GCM:()=>Gr,BASE58_DID_PREFIX:()=>te,BLS_DID_PREFIX:()=>ut,DEFAULT_CHAR_SIZE:()=>Fr,DEFAULT_ECC_EXCHANGE:()=>Fe,DEFAULT_ECC_EXCHANGE_CURVE:()=>oo,DEFAULT_ECC_WRITE:()=>Ge,DEFAULT_HASH_ALGORITHM:()=>ue,DEFAULT_RSA_EXCHANGE:()=>ht,DEFAULT_RSA_SIZE:()=>xt,DEFAULT_RSA_WRITE:()=>dt,DEFAULT_SYMM_ALGORITHM:()=>kr,DEFAULT_SYMM_LENGTH:()=>Vr,ECC_EXCHANGE_ALG:()=>bn,ECC_EXCHANGE_NAME:()=>mn,ECC_WRITE_ALG:()=>Se,ECC_WRITE_NAME:()=>An,EDWARDS_DID_PREFIX:()=>pt,IV_LENGTH:()=>Yr,KEY_TYPE:()=>He,KEY_USE:()=>bi,RSA_ALGORITHM:()=>ne,RSA_DID_PREFIX:()=>yt,RSA_HASHING_ALGORITHM:()=>ct,RSA_SIGN_ALGORITHM:()=>ie,RsaKeys:()=>he,SALT_LENGTH:()=>jr,encrypt:()=>Uo,encryptKeyTo:()=>Be,encryptTo:()=>Ti,getPublicKeyAsArrayBuffer:()=>qr,getPublicKeyAsUint8Array:()=>Un,publicKeyToDid:()=>We,verify:()=>Eo});var Zi=globalThis||window||self,$=Zi.crypto;function Ne(n=0){return new Uint8Array(n)}x(Ne,"allocUnsafe");function Ht(n,e){e==null&&(e=n.reduce((c,g)=>c+g.length,0));let i=Ne(e),s=0;for(let c of n)i.set(c,s),s+=c.length;return i}x(Ht,"concat");var Jt={};vr(Jt,{base10:()=>nf});var $o=new Uint8Array(0);function Zn(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let i=0;i<n.byteLength;i++)if(n[i]!==e[i])return!1;return!0}x(Zn,"equals");function $r(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")}x($r,"coerce");function Jn(n){return new TextEncoder().encode(n)}x(Jn,"fromString");function qn(n){return new TextDecoder().decode(n)}x(qn,"toString");function qi(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),s=0;s<i.length;s++)i[s]=255;for(var c=0;c<n.length;c++){var g=n.charAt(c),E=g.charCodeAt(0);if(i[E]!==255)throw new TypeError(g+" is ambiguous");i[E]=c}var L=n.length,Z=n.charAt(0),or=Math.log(L)/Math.log(256),fr=Math.log(256)/Math.log(L);function mr(J){if(J instanceof Uint8Array||(ArrayBuffer.isView(J)?J=new Uint8Array(J.buffer,J.byteOffset,J.byteLength):Array.isArray(J)&&(J=Uint8Array.from(J))),!(J instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(J.length===0)return"";for(var xr=0,_r=0,Ur=0,lr=J.length;Ur!==lr&&J[Ur]===0;)Ur++,xr++;for(var Sr=(lr-Ur)*fr+1>>>0,br=new Uint8Array(Sr);Ur!==lr;){for(var dr=J[Ur],Rr=0,Pr=Sr-1;(dr!==0||Rr<_r)&&Pr!==-1;Pr--,Rr++)dr+=256*br[Pr]>>>0,br[Pr]=dr%L>>>0,dr=dr/L>>>0;if(dr!==0)throw new Error("Non-zero carry");_r=Rr,Ur++}for(var Ir=Sr-_r;Ir!==Sr&&br[Ir]===0;)Ir++;for(var re=Z.repeat(xr);Ir<Sr;++Ir)re+=n.charAt(br[Ir]);return re}x(mr,"encode");function Nr(J){if(typeof J!="string")throw new TypeError("Expected String");if(J.length===0)return new Uint8Array;var xr=0;if(J[xr]!==" "){for(var _r=0,Ur=0;J[xr]===Z;)_r++,xr++;for(var lr=(J.length-xr)*or+1>>>0,Sr=new Uint8Array(lr);J[xr];){var br=i[J.charCodeAt(xr)];if(br===255)return;for(var dr=0,Rr=lr-1;(br!==0||dr<Ur)&&Rr!==-1;Rr--,dr++)br+=L*Sr[Rr]>>>0,Sr[Rr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");Ur=dr,xr++}if(J[xr]!==" "){for(var Pr=lr-Ur;Pr!==lr&&Sr[Pr]===0;)Pr++;for(var Ir=new Uint8Array(_r+(lr-Pr)),re=_r;Pr!==lr;)Ir[re++]=Sr[Pr++];return Ir}}}x(Nr,"decodeUnsafe");function de(J){var xr=Nr(J);if(xr)return xr;throw new Error(`Non-${e} character`)}return x(de,"decode"),{encode:mr,decodeUnsafe:Nr,decode:de}}x(qi,"base");var Qi=qi,rf=Qi,ri=rf;var Xt=class Xt{constructor(e,i,s){M(this,"name");M(this,"prefix");M(this,"baseEncode");this.name=e,this.prefix=i,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};x(Xt,"Encoder");var Ft=Xt,Wt=class Wt{constructor(e,i,s){M(this,"name");M(this,"prefix");M(this,"baseDecode");M(this,"prefixCodePoint");this.name=e,this.prefix=i;let c=i.codePointAt(0);if(c===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=c,this.baseDecode=s}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 ei(this,e)}};x(Wt,"Decoder");var Gt=Wt,$t=class $t{constructor(e){M(this,"decoders");this.decoders=e}or(e){return ei(this,e)}decode(e){let i=e[0],s=this.decoders[i];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};x($t,"ComposedDecoder");var kt=$t;function ei(n,e){return new kt({...n.decoders??{[n.prefix]:n},...e.decoders??{[e.prefix]:e}})}x(ei,"or");var Zt=class Zt{constructor(e,i,s,c){M(this,"name");M(this,"prefix");M(this,"baseEncode");M(this,"baseDecode");M(this,"encoder");M(this,"decoder");this.name=e,this.prefix=i,this.baseEncode=s,this.baseDecode=c,this.encoder=new Ft(e,i,s),this.decoder=new Gt(e,i,c)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};x(Zt,"Codec");var Vt=Zt;function me({name:n,prefix:e,encode:i,decode:s}){return new Vt(n,e,i,s)}x(me,"from");function ee({name:n,prefix:e,alphabet:i}){let{encode:s,decode:c}=ri(i,n);return me({prefix:e,name:n,encode:s,decode:x(g=>$r(c(g)),"decode")})}x(ee,"baseX");function ef(n,e,i,s){let c={};for(let fr=0;fr<e.length;++fr)c[e[fr]]=fr;let g=n.length;for(;n[g-1]==="=";)--g;let E=new Uint8Array(g*i/8|0),L=0,Z=0,or=0;for(let fr=0;fr<g;++fr){let mr=c[n[fr]];if(mr===void 0)throw new SyntaxError(`Non-${s} character`);Z=Z<<i|mr,L+=i,L>=8&&(L-=8,E[or++]=255&Z>>L)}if(L>=i||(255&Z<<8-L)!==0)throw new SyntaxError("Unexpected end of data");return E}x(ef,"decode");function tf(n,e,i){let s=e[e.length-1]==="=",c=(1<<i)-1,g="",E=0,L=0;for(let Z=0;Z<n.length;++Z)for(L=L<<8|n[Z],E+=8;E>i;)E-=i,g+=e[c&L>>E];if(E!==0&&(g+=e[c&L<<i-E]),s)for(;(g.length*i&7)!==0;)g+="=";return g}x(tf,"encode");function yr({name:n,prefix:e,bitsPerChar:i,alphabet:s}){return me({prefix:e,name:n,encode(c){return tf(c,s,i)},decode(c){return ef(c,s,i,n)}})}x(yr,"rfc4648");var nf=ee({prefix:"9",name:"base10",alphabet:"0123456789"});var qt={};vr(qt,{base16:()=>ff,base16upper:()=>of});var ff=yr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),of=yr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Qt={};vr(Qt,{base2:()=>af});var af=yr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var rn={};vr(rn,{base256emoji:()=>uf});var ti=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}"),sf=ti.reduce((n,e,i)=>(n[i]=e,n),[]),cf=ti.reduce((n,e,i)=>{let s=e.codePointAt(0);if(s==null)throw new Error(`Invalid character: ${e}`);return n[s]=i,n},[]);function yf(n){return n.reduce((e,i)=>(e+=sf[i],e),"")}x(yf,"encode");function xf(n){let e=[];for(let i of n){let s=i.codePointAt(0);if(s==null)throw new Error(`Invalid character: ${i}`);let c=cf[s];if(c==null)throw new Error(`Non-base256emoji character: ${i}`);e.push(c)}return new Uint8Array(e)}x(xf,"decode");var uf=me({prefix:"\u{1F680}",name:"base256emoji",encode:yf,decode:xf});var en={};vr(en,{base32:()=>we,base32hex:()=>gf,base32hexpad:()=>bf,base32hexpadupper:()=>Af,base32hexupper:()=>lf,base32pad:()=>hf,base32padupper:()=>df,base32upper:()=>pf,base32z:()=>mf});var we=yr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pf=yr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),hf=yr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),df=yr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),gf=yr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),lf=yr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),bf=yr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Af=yr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mf=yr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var tn={};vr(tn,{base36:()=>Re,base36upper:()=>wf});var Re=ee({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wf=ee({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var nn={};vr(nn,{base58btc:()=>Hr,base58flickr:()=>Kf});var Hr=ee({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Kf=ee({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var fn={};vr(fn,{base64:()=>Ef,base64pad:()=>Uf,base64url:()=>Sf,base64urlpad:()=>vf});var Ef=yr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Uf=yr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Sf=yr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),vf=yr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var on={};vr(on,{base8:()=>Cf});var Cf=yr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var an={};vr(an,{identity:()=>_f});var _f=me({prefix:"\0",name:"identity",encode:x(n=>qn(n),"encode"),decode:x(n=>Jn(n),"decode")});var ga=new TextEncoder,la=new TextDecoder;var yn={};vr(yn,{identity:()=>Jf});var Tf=fi,ni=128,Df=127,If=~Df,Mf=Math.pow(2,31);function fi(n,e,i){e=e||[],i=i||0;for(var s=i;n>=Mf;)e[i++]=n&255|ni,n/=128;for(;n&If;)e[i++]=n&255|ni,n>>>=7;return e[i]=n|0,fi.bytes=i-s+1,e}x(fi,"encode");var Lf=sn,Nf=128,ii=127;function sn(n,s){var i=0,s=s||0,c=0,g=s,E,L=n.length;do{if(g>=L)throw sn.bytes=0,new RangeError("Could not decode varint");E=n[g++],i+=c<28?(E&ii)<<c:(E&ii)*Math.pow(2,c),c+=7}while(E>=Nf);return sn.bytes=g-s,i}x(sn,"read");var Rf=Math.pow(2,7),zf=Math.pow(2,14),Of=Math.pow(2,21),Yf=Math.pow(2,28),jf=Math.pow(2,35),Hf=Math.pow(2,42),Ff=Math.pow(2,49),Gf=Math.pow(2,56),kf=Math.pow(2,63),Vf=x(function(n){return n<Rf?1:n<zf?2:n<Of?3:n<Yf?4:n<jf?5:n<Hf?6:n<Ff?7:n<Gf?8:n<kf?9:10},"length"),Xf={encode:Tf,decode:Lf,encodingLength:Vf},Wf=Xf,ze=Wf;function Oe(n,e=0){return[ze.decode(n,e),ze.decode.bytes]}x(Oe,"decode");function Ke(n,e,i=0){return ze.encode(n,e,i),e}x(Ke,"encodeTo");function Ee(n){return ze.encodingLength(n)}x(Ee,"encodingLength");function xe(n,e){let i=e.byteLength,s=Ee(n),c=s+Ee(i),g=new Uint8Array(c+i);return Ke(n,g,0),Ke(i,g,s),g.set(e,c),new Ue(n,i,e,g)}x(xe,"create");function oi(n){let e=$r(n),[i,s]=Oe(e),[c,g]=Oe(e.subarray(s)),E=e.subarray(s+g);if(E.byteLength!==c)throw new Error("Incorrect length");return new Ue(i,c,E,e)}x(oi,"decode");function ai(n,e){if(n===e)return!0;{let i=e;return n.code===i.code&&n.size===i.size&&i.bytes instanceof Uint8Array&&Zn(n.bytes,i.bytes)}}x(ai,"equals");var cn=class cn{constructor(e,i,s,c){M(this,"code");M(this,"size");M(this,"digest");M(this,"bytes");this.code=e,this.size=i,this.digest=s,this.bytes=c}};x(cn,"Digest");var Ue=cn;var si=0,$f="identity",ci=$r;function Zf(n){return xe(si,ci(n))}x(Zf,"digest");var Jf={code:si,name:$f,encode:ci,digest:Zf};var hn={};vr(hn,{sha256:()=>qf,sha512:()=>Qf});function un({name:n,code:e,encode:i}){return new xn(n,e,i)}x(un,"from");var pn=class pn{constructor(e,i,s){M(this,"name");M(this,"code");M(this,"encode");this.name=e,this.code=i,this.encode=s}digest(e){if(e instanceof Uint8Array){let i=this.encode(e);return i instanceof Uint8Array?xe(this.code,i):i.then(s=>xe(this.code,s))}else throw Error("Unknown type, must be binary type")}};x(pn,"Hasher");var xn=pn;function xi(n){return async e=>new Uint8Array(await crypto.subtle.digest(n,e))}x(xi,"sha");var qf=un({name:"sha2-256",code:18,encode:xi("SHA-256")}),Qf=un({name:"sha2-512",code:19,encode:xi("SHA-512")});function ui(n,e){let{bytes:i,version:s}=n;switch(s){case 0:return eo(i,dn(n),e??Hr.encoder);default:return to(i,dn(n),e??we.encoder)}}x(ui,"format");var pi=new WeakMap;function dn(n){let e=pi.get(n);if(e==null){let i=new Map;return pi.set(n,i),i}return e}x(dn,"baseCache");var di,gr=class gr{constructor(e,i,s,c){M(this,"code");M(this,"version");M(this,"multihash");M(this,"bytes");M(this,"/");M(this,di,"CID");this.code=i,this.version=e,this.multihash=s,this.bytes=c,this["/"]=c}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:i}=this;if(e!==je)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(i.code!==no)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return gr.createV0(i)}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:i}=this.multihash,s=xe(e,i);return gr.createV1(this.code,s)}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 gr.equals(this,e)}static equals(e,i){let s=i;return s!=null&&e.code===s.code&&e.version===s.version&&ai(e.multihash,s.multihash)}toString(e){return ui(this,e)}toJSON(){return{"/":ui(this)}}link(){return this}[(di=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let i=e;if(i instanceof gr)return i;if(i["/"]!=null&&i["/"]===i.bytes||i.asCID===i){let{version:s,code:c,multihash:g,bytes:E}=i;return new gr(s,c,g,E??hi(s,c,g.bytes))}else if(i[io]===!0){let{version:s,multihash:c,code:g}=i,E=oi(c);return gr.create(s,g,E)}else return null}static create(e,i,s){if(typeof i!="number")throw new Error("String codecs are no longer supported");if(!(s.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(i!==je)throw new Error(`Version 0 CID must use dag-pb (code: ${je}) block encoding`);return new gr(e,i,s,s.bytes)}case 1:{let c=hi(e,i,s.bytes);return new gr(e,i,s,c)}default:throw new Error("Invalid version")}}static createV0(e){return gr.create(0,je,e)}static createV1(e,i){return gr.create(1,e,i)}static decode(e){let[i,s]=gr.decodeFirst(e);if(s.length!==0)throw new Error("Incorrect length");return i}static decodeFirst(e){let i=gr.inspectBytes(e),s=i.size-i.multihashSize,c=$r(e.subarray(s,s+i.multihashSize));if(c.byteLength!==i.multihashSize)throw new Error("Incorrect length");let g=c.subarray(i.multihashSize-i.digestSize),E=new Ue(i.multihashCode,i.digestSize,g,c);return[i.version===0?gr.createV0(E):gr.createV1(i.codec,E),e.subarray(i.size)]}static inspectBytes(e){let i=0,s=x(()=>{let[mr,Nr]=Oe(e.subarray(i));return i+=Nr,mr},"next"),c=s(),g=je;if(c===18?(c=0,i=0):g=s(),c!==0&&c!==1)throw new RangeError(`Invalid CID version ${c}`);let E=i,L=s(),Z=s(),or=i+Z,fr=or-E;return{version:c,codec:g,multihashCode:L,digestSize:Z,multihashSize:fr,size:or}}static parse(e,i){let[s,c]=ro(e,i),g=gr.decode(c);if(g.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return dn(g).set(s,e),g}};x(gr,"CID");var at=gr;function ro(n,e){switch(n[0]){case"Q":{let i=e??Hr;return[Hr.prefix,i.decode(`${Hr.prefix}${n}`)]}case Hr.prefix:{let i=e??Hr;return[Hr.prefix,i.decode(n)]}case we.prefix:{let i=e??we;return[we.prefix,i.decode(n)]}case Re.prefix:{let i=e??Re;return[Re.prefix,i.decode(n)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}}}x(ro,"parseCIDtoBytes");function eo(n,e,i){let{prefix:s}=i;if(s!==Hr.prefix)throw Error(`Cannot string encode V0 in ${i.name} encoding`);let c=e.get(s);if(c==null){let g=i.encode(n).slice(1);return e.set(s,g),g}else return c}x(eo,"toStringV0");function to(n,e,i){let{prefix:s}=i,c=e.get(s);if(c==null){let g=i.encode(n);return e.set(s,g),g}else return c}x(to,"toStringV1");var je=112,no=18;function hi(n,e,i){let s=Ee(n),c=s+Ee(e),g=new Uint8Array(c+i.byteLength);return Ke(n,g,0),Ke(e,g,s),g.set(i,c),g}x(hi,"encodeCID");var io=Symbol.for("@ipld/js-cid/CID");var gn={...an,...Qt,...on,...Jt,...qt,...en,...tn,...nn,...fn,...rn},Wa={...hn,...yn};function li(n,e,i,s){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:i},decoder:{decode:s}}}x(li,"createCodec");var gi=li("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),ln=li("ascii","a",n=>{let e="a";for(let i=0;i<n.length;i++)e+=String.fromCharCode(n[i]);return e},n=>{n=n.substring(1);let e=Ne(n.length);for(let i=0;i<n.length;i++)e[i]=n.charCodeAt(i);return e}),fo={utf8:gi,"utf-8":gi,hex:gn.base16,latin1:ln,ascii:ln,binary:ln,...gn},st=fo;function Ar(n,e="utf8"){let i=st[e];if(i==null)throw new Error(`Unsupported encoding "${e}"`);return i.decoder.decode(`${i.prefix}${n}`)}x(Ar,"fromString");function ir(n,e="utf8"){let i=st[e];if(i==null)throw new Error(`Unsupported encoding "${e}"`);return i.encoder.encode(n).substring(1)}x(ir,"toString");var _i={};vr(_i,{AES:()=>pr,decryptBytes:()=>Ci,importAesKey:()=>_e});var te="did:key:z",Se="Ed25519",bn="X25519",oo="X25519",An="Ed25519",mn="X25519",bi={sign:["sign","verify"],encrypt:["deriveKey","deriveBits"]},ne="RSA-OAEP",ie="RSASSA-PKCS1-v1_5",ct="SHA-256",yt=new Uint8Array([0,245,2]),xt=2048,ue="SHA-256",Fr=8,Gr="AES-GCM",kr=Gr,Vr=256,Yr=12,ut=new Uint8Array([234,1]),pt=new Uint8Array([237,1]),He={RSA:"rsa",Edwards:"ed25519",BLS:"bls12-381"},ht="rsa-exchange-key",dt="rsa-write-key",Fe="ecc-exchange",Ge="ecc-write",jr=16;var Ai=new Error("Invalid key use. Please use 'encryption' or 'signing"),ao=new Error("Max must be less than 256 and greater than 0");function Dr(n){return new Uint8Array(n).buffer}x(Dr,"toArrayBuffer");async function mi(n){return new Uint8Array(await $.subtle.digest("sha-256",n.buffer))}x(mi,"sha256");function Lr(n){let e=Ar(n,"base64pad");return Dr(e)}x(Lr,"base64ToArrBuf");var pe=x((n,e)=>{if(typeof n=="string")return e(n);if(typeof n=="object"&&n.byteLength!==void 0)return new Uint8Array(n).buffer;throw new Error("Improper value. Must be a string, ArrayBuffer, Uint8Array")},"normalizeToBuf");function gt(n){return pe(n,Lr)}x(gt,"normalizeBase64ToBuf");var so=x(n=>pe(n,e=>wi(e,8)),"normalizeUtf8ToBuf");function wi(n,e){let i=e===8?new Uint8Array(n.length):new Uint16Array(n.length);for(let s=0,c=n.length;s<c;s++)i[s]=n.charCodeAt(s);return i.buffer}x(wi,"strToArrBuf");var co=x(n=>pe(n,e=>wi(e,16)),"normalizeUtf16ToBuf");function fe(n,e){switch(e){case 8:return so(n);default:return co(n)}}x(fe,"normalizeUnicodeToBuf");function lt(n){if(!n.startsWith(te))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let e=""+n.substring(te.length),i=Ar(e,"base58btc"),{keyBuffer:s,type:c}=yo(Dr(i));return{publicKey:new Uint8Array(s),type:c}}x(lt,"didToPublicKey");function yo(n){if(ke(n,Dr(yt)))return{keyBuffer:n.slice(yt.byteLength),type:He.RSA};if(ke(n,Dr(pt)))return{keyBuffer:n.slice(pt.byteLength),type:He.Edwards};if(ke(n,Dr(ut)))return{keyBuffer:n.slice(ut.byteLength),type:He.BLS};throw new Error("Unsupported key algorithm. Try using RSA.")}x(yo,"parseMagicBytes");var xo={equal:x((n,e)=>{let i=new Uint8Array(n),s=new Uint8Array(e);if(i.length!==s.length)return!1;for(let c=0;c<i.length;c++)if(i[c]!==s[c])return!1;return!0},"equal")};function ke(n,e){return xo.equal(e,n.slice(0,e.byteLength))}x(ke,"hasPrefix");function Cr(n){return ir(n instanceof ArrayBuffer?new Uint8Array(n):n,"base64pad")}x(Cr,"toBase64");async function Ve(n,e){let i=typeof n=="string"?Lr(n):Dr(n);return $.subtle.importKey("raw",i,{name:e?.alg||kr,length:e?.length||Vr},!0,["encrypt","decrypt"])}x(Ve,"importKey");function bt(n,{max:e}={max:255}){if(e<1||e>255)throw ao;let i=new Uint8Array(n);if(e===255)return $.getRandomValues(i),i.buffer;let s=0,c=e+1,g=Math.floor(256/c)*c,E=new Uint8Array(1);for(;s<i.length;)$.getRandomValues(E),E[0]<g&&(i[s]=E[0]%c,s++);return i.buffer}x(bt,"randomBuf");function Zr(n,e){let i=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(Dr(n)),s=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(Dr(e)),c=new Uint8Array(i.length+s.length);return c.set(i),c.set(s,i.length),c.buffer}x(Zr,"joinBufs");async function wn(n,e,i,s=!1){let c=s;if(!Object.values(ye).includes(i))throw new Error("invalid key use");let g=i==="exchange"?ne:ie,E=i==="exchange"?["encrypt","decrypt"]:["sign","verify"];return $.subtle.generateKey({name:g,modulusLength:n,publicExponent:uo(),hash:{name:e}},c,E)}x(wn,"makeRSAKeypair");function uo(){return new Uint8Array([1,0,1])}x(uo,"publicExponent");var Ui=$i(Ei(),1);var En={keyTypes:{"bls12-381":{magicBytes:new Uint8Array([234,1]),verify:x(()=>{throw new Error("Not implemented")},"verify")},rsa:{magicBytes:new Uint8Array([0,245,2]),verify:vi},ed25519:{magicBytes:new Uint8Array([237,1]),verify:Si}}};async function Is({message:n,publicKey:e,signature:i}){let s=po(e),c=mt(e).publicKey;if(s==="ed25519")return Si({message:n,publicKey:c,signature:i});if(s==="rsa")return vi({message:n,publicKey:c,signature:i});throw new Error("Unknown key format")}x(Is,"verify");function po(n){try{let{type:e}=mt(n);return e}catch{return"unknown"}}x(po,"getAlgorithm");async function Si({message:n,publicKey:e,signature:i}){let s=n;typeof n=="string"&&(s=Ar(n,"utf8"));let c=i;typeof i=="string"&&(c=Ar(i,"base64pad"));let g=e;if(typeof e=="string"&&(g=mt(e).publicKey),g.length!==32)throw new Error(`Invalid Ed25519 public key size: ${g.length} bytes, expected 32`);if(c.length!==64)throw new Error(`Invalid Ed25519 signature size: ${c.length} bytes, expected 64`);return Ui.default.sign.detached.verify(s,c,g)}x(Si,"ed25519Verify");async function vi({message:n,publicKey:e,signature:i}){let s=e;return typeof e=="string"&&(s=mt(e).publicKey),Jr.verify(n,i,await $.subtle.importKey("spki",Dr(s),{name:ie,hash:ct},!1,["verify"]),8)}x(vi,"rsaVerify");var Jr={verify:x(async function(e,i,s,c=Fr,g=ue){return $.subtle.verify({name:ie,saltLength:jr},typeof s=="string"?await Xe(s,g,"signing"):s,gt(i),fe(e,c))},"rsaVerify"),sign:x(async function(e,i,s=Fr){return $.subtle.sign({name:ie,saltLength:jr},i,fe(e,s))},"sign"),encrypt:x(async function(e,i,s=Fr,c=ue){let g;return typeof i=="string"?g=await Xe(i,c,"exchange"):g=i instanceof Uint8Array?await Xe(Dr(i),c,"exchange"):i,$.subtle.encrypt({name:ne},g,fe(e,s))},"rsaEncrypt"),decrypt:x(async function(e,i){let s=ve(i)?i:await bo(i,["decrypt"]),c;typeof e=="string"?c=Ar(e,"base64pad"):c=e;let g=await $.subtle.decrypt({name:ne},s,c instanceof Uint8Array?Dr(c):c);return new Uint8Array(g)},"rsaDecrypt")};async function Xe(n,e,i){ho(i);let s=i==="exchange"?ne:ie,c=i==="exchange"?["encrypt"]:["verify"],g=typeof n=="string"?Lr(lo(n)):n;return $.subtle.importKey("spki",g,{name:s,hash:{name:e}},!0,c)}x(Xe,"importPublicKey");function ho(n){go(n,["signing","exchange"],Ai)}x(ho,"checkValidKeyUse");function go(n,e,i){if(!e.some(c=>c===n))throw i}x(go,"checkValid");function lo(n){return n.replace(`-----BEGIN PUBLIC KEY-----
|
|
1
|
+
var Hi=Object.create;var Le=Object.defineProperty;var Fi=Object.getOwnPropertyDescriptor;var Gi=Object.getOwnPropertyNames;var ki=Object.getPrototypeOf,Vi=Object.prototype.hasOwnProperty;var Xi=(n,e,i)=>e in n?Le(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var x=(n,e)=>Le(n,"name",{value:e,configurable:!0}),kn=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Vn=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),vr=(n,e)=>{for(var i in e)Le(n,i,{get:e[i],enumerable:!0})},Wi=(n,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of Gi(e))!Vi.call(n,c)&&c!==i&&Le(n,c,{get:()=>e[c],enumerable:!(s=Fi(e,c))||s.enumerable});return n};var $i=(n,e,i)=>(i=n!=null?Hi(ki(n)):{},Wi(e||!n||!n.__esModule?Le(i,"default",{value:n,enumerable:!0}):i,n));var M=(n,e,i)=>Xi(n,typeof e!="symbol"?e+"":e,i);var Ki=Vn(()=>{"use strict"});var Ei=Vn((vs,At)=>{"use strict";(function(n){"use strict";var e=x(function(t){var o,f=new Float64Array(16);if(t)for(o=0;o<t.length;o++)f[o]=t[o];return f},"gf"),i=x(function(){throw new Error("no PRNG")},"randombytes"),s=new Uint8Array(16),c=new Uint8Array(32);c[0]=9;var g=e(),E=e([1]),L=e([56129,1]),Z=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),or=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),fr=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),mr=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Nr=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function de(t,o,f,r){t[o]=f>>24&255,t[o+1]=f>>16&255,t[o+2]=f>>8&255,t[o+3]=f&255,t[o+4]=r>>24&255,t[o+5]=r>>16&255,t[o+6]=r>>8&255,t[o+7]=r&255}x(de,"ts64");function J(t,o,f,r,a){var u,p=0;for(u=0;u<a;u++)p|=t[o+u]^f[r+u];return(1&p-1>>>8)-1}x(J,"vn");function xr(t,o,f,r){return J(t,o,f,r,16)}x(xr,"crypto_verify_16");function _r(t,o,f,r){return J(t,o,f,r,32)}x(_r,"crypto_verify_32");function Ur(t,o,f,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,p=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,b=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,K=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,S=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,rr=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,C=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,N=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,H=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,j=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,z=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,Y=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,O=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,_=a,D=u,v=p,P=b,B=K,U=T,h=S,d=rr,m=C,l=N,A=R,w=H,I=j,F=z,k=Y,G=O,y,X=0;X<20;X+=2)y=_+I|0,B^=y<<7|y>>>25,y=B+_|0,m^=y<<9|y>>>23,y=m+B|0,I^=y<<13|y>>>19,y=I+m|0,_^=y<<18|y>>>14,y=U+D|0,l^=y<<7|y>>>25,y=l+U|0,F^=y<<9|y>>>23,y=F+l|0,D^=y<<13|y>>>19,y=D+F|0,U^=y<<18|y>>>14,y=A+h|0,k^=y<<7|y>>>25,y=k+A|0,v^=y<<9|y>>>23,y=v+k|0,h^=y<<13|y>>>19,y=h+v|0,A^=y<<18|y>>>14,y=G+w|0,P^=y<<7|y>>>25,y=P+G|0,d^=y<<9|y>>>23,y=d+P|0,w^=y<<13|y>>>19,y=w+d|0,G^=y<<18|y>>>14,y=_+P|0,D^=y<<7|y>>>25,y=D+_|0,v^=y<<9|y>>>23,y=v+D|0,P^=y<<13|y>>>19,y=P+v|0,_^=y<<18|y>>>14,y=U+B|0,h^=y<<7|y>>>25,y=h+U|0,d^=y<<9|y>>>23,y=d+h|0,B^=y<<13|y>>>19,y=B+d|0,U^=y<<18|y>>>14,y=A+l|0,w^=y<<7|y>>>25,y=w+A|0,m^=y<<9|y>>>23,y=m+w|0,l^=y<<13|y>>>19,y=l+m|0,A^=y<<18|y>>>14,y=G+k|0,I^=y<<7|y>>>25,y=I+G|0,F^=y<<9|y>>>23,y=F+I|0,k^=y<<13|y>>>19,y=k+F|0,G^=y<<18|y>>>14;_=_+a|0,D=D+u|0,v=v+p|0,P=P+b|0,B=B+K|0,U=U+T|0,h=h+S|0,d=d+rr|0,m=m+C|0,l=l+N|0,A=A+R|0,w=w+H|0,I=I+j|0,F=F+z|0,k=k+Y|0,G=G+O|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=D>>>0&255,t[5]=D>>>8&255,t[6]=D>>>16&255,t[7]=D>>>24&255,t[8]=v>>>0&255,t[9]=v>>>8&255,t[10]=v>>>16&255,t[11]=v>>>24&255,t[12]=P>>>0&255,t[13]=P>>>8&255,t[14]=P>>>16&255,t[15]=P>>>24&255,t[16]=B>>>0&255,t[17]=B>>>8&255,t[18]=B>>>16&255,t[19]=B>>>24&255,t[20]=U>>>0&255,t[21]=U>>>8&255,t[22]=U>>>16&255,t[23]=U>>>24&255,t[24]=h>>>0&255,t[25]=h>>>8&255,t[26]=h>>>16&255,t[27]=h>>>24&255,t[28]=d>>>0&255,t[29]=d>>>8&255,t[30]=d>>>16&255,t[31]=d>>>24&255,t[32]=m>>>0&255,t[33]=m>>>8&255,t[34]=m>>>16&255,t[35]=m>>>24&255,t[36]=l>>>0&255,t[37]=l>>>8&255,t[38]=l>>>16&255,t[39]=l>>>24&255,t[40]=A>>>0&255,t[41]=A>>>8&255,t[42]=A>>>16&255,t[43]=A>>>24&255,t[44]=w>>>0&255,t[45]=w>>>8&255,t[46]=w>>>16&255,t[47]=w>>>24&255,t[48]=I>>>0&255,t[49]=I>>>8&255,t[50]=I>>>16&255,t[51]=I>>>24&255,t[52]=F>>>0&255,t[53]=F>>>8&255,t[54]=F>>>16&255,t[55]=F>>>24&255,t[56]=k>>>0&255,t[57]=k>>>8&255,t[58]=k>>>16&255,t[59]=k>>>24&255,t[60]=G>>>0&255,t[61]=G>>>8&255,t[62]=G>>>16&255,t[63]=G>>>24&255}x(Ur,"core_salsa20");function lr(t,o,f,r){for(var a=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,u=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,p=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,b=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,K=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,T=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,S=o[0]&255|(o[1]&255)<<8|(o[2]&255)<<16|(o[3]&255)<<24,rr=o[4]&255|(o[5]&255)<<8|(o[6]&255)<<16|(o[7]&255)<<24,C=o[8]&255|(o[9]&255)<<8|(o[10]&255)<<16|(o[11]&255)<<24,N=o[12]&255|(o[13]&255)<<8|(o[14]&255)<<16|(o[15]&255)<<24,R=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,H=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,j=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,z=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,Y=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,O=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,_=a,D=u,v=p,P=b,B=K,U=T,h=S,d=rr,m=C,l=N,A=R,w=H,I=j,F=z,k=Y,G=O,y,X=0;X<20;X+=2)y=_+I|0,B^=y<<7|y>>>25,y=B+_|0,m^=y<<9|y>>>23,y=m+B|0,I^=y<<13|y>>>19,y=I+m|0,_^=y<<18|y>>>14,y=U+D|0,l^=y<<7|y>>>25,y=l+U|0,F^=y<<9|y>>>23,y=F+l|0,D^=y<<13|y>>>19,y=D+F|0,U^=y<<18|y>>>14,y=A+h|0,k^=y<<7|y>>>25,y=k+A|0,v^=y<<9|y>>>23,y=v+k|0,h^=y<<13|y>>>19,y=h+v|0,A^=y<<18|y>>>14,y=G+w|0,P^=y<<7|y>>>25,y=P+G|0,d^=y<<9|y>>>23,y=d+P|0,w^=y<<13|y>>>19,y=w+d|0,G^=y<<18|y>>>14,y=_+P|0,D^=y<<7|y>>>25,y=D+_|0,v^=y<<9|y>>>23,y=v+D|0,P^=y<<13|y>>>19,y=P+v|0,_^=y<<18|y>>>14,y=U+B|0,h^=y<<7|y>>>25,y=h+U|0,d^=y<<9|y>>>23,y=d+h|0,B^=y<<13|y>>>19,y=B+d|0,U^=y<<18|y>>>14,y=A+l|0,w^=y<<7|y>>>25,y=w+A|0,m^=y<<9|y>>>23,y=m+w|0,l^=y<<13|y>>>19,y=l+m|0,A^=y<<18|y>>>14,y=G+k|0,I^=y<<7|y>>>25,y=I+G|0,F^=y<<9|y>>>23,y=F+I|0,k^=y<<13|y>>>19,y=k+F|0,G^=y<<18|y>>>14;t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=U>>>0&255,t[5]=U>>>8&255,t[6]=U>>>16&255,t[7]=U>>>24&255,t[8]=A>>>0&255,t[9]=A>>>8&255,t[10]=A>>>16&255,t[11]=A>>>24&255,t[12]=G>>>0&255,t[13]=G>>>8&255,t[14]=G>>>16&255,t[15]=G>>>24&255,t[16]=h>>>0&255,t[17]=h>>>8&255,t[18]=h>>>16&255,t[19]=h>>>24&255,t[20]=d>>>0&255,t[21]=d>>>8&255,t[22]=d>>>16&255,t[23]=d>>>24&255,t[24]=m>>>0&255,t[25]=m>>>8&255,t[26]=m>>>16&255,t[27]=m>>>24&255,t[28]=l>>>0&255,t[29]=l>>>8&255,t[30]=l>>>16&255,t[31]=l>>>24&255}x(lr,"core_hsalsa20");function Sr(t,o,f,r){Ur(t,o,f,r)}x(Sr,"crypto_core_salsa20");function br(t,o,f,r){lr(t,o,f,r)}x(br,"crypto_core_hsalsa20");var dr=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Rr(t,o,f,r,a,u,p){var b=new Uint8Array(16),K=new Uint8Array(64),T,S;for(S=0;S<16;S++)b[S]=0;for(S=0;S<8;S++)b[S]=u[S];for(;a>=64;){for(Sr(K,b,p,dr),S=0;S<64;S++)t[o+S]=f[r+S]^K[S];for(T=1,S=8;S<16;S++)T=T+(b[S]&255)|0,b[S]=T&255,T>>>=8;a-=64,o+=64,r+=64}if(a>0)for(Sr(K,b,p,dr),S=0;S<a;S++)t[o+S]=f[r+S]^K[S];return 0}x(Rr,"crypto_stream_salsa20_xor");function Pr(t,o,f,r,a){var u=new Uint8Array(16),p=new Uint8Array(64),b,K;for(K=0;K<16;K++)u[K]=0;for(K=0;K<8;K++)u[K]=r[K];for(;f>=64;){for(Sr(p,u,a,dr),K=0;K<64;K++)t[o+K]=p[K];for(b=1,K=8;K<16;K++)b=b+(u[K]&255)|0,u[K]=b&255,b>>>=8;f-=64,o+=64}if(f>0)for(Sr(p,u,a,dr),K=0;K<f;K++)t[o+K]=p[K];return 0}x(Pr,"crypto_stream_salsa20");function Ir(t,o,f,r,a){var u=new Uint8Array(32);br(u,r,a,dr);for(var p=new Uint8Array(8),b=0;b<8;b++)p[b]=r[b+16];return Pr(t,o,f,p,u)}x(Ir,"crypto_stream");function re(t,o,f,r,a,u,p){var b=new Uint8Array(32);br(b,u,p,dr);for(var K=new Uint8Array(8),T=0;T<8;T++)K[T]=u[T+16];return Rr(t,o,f,r,a,K,b)}x(re,"crypto_stream_xor");var Je=x(function(t){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var o,f,r,a,u,p,b,K;o=t[0]&255|(t[1]&255)<<8,this.r[0]=o&8191,f=t[2]&255|(t[3]&255)<<8,this.r[1]=(o>>>13|f<<3)&8191,r=t[4]&255|(t[5]&255)<<8,this.r[2]=(f>>>10|r<<6)&7939,a=t[6]&255|(t[7]&255)<<8,this.r[3]=(r>>>7|a<<9)&8191,u=t[8]&255|(t[9]&255)<<8,this.r[4]=(a>>>4|u<<12)&255,this.r[5]=u>>>1&8190,p=t[10]&255|(t[11]&255)<<8,this.r[6]=(u>>>14|p<<2)&8191,b=t[12]&255|(t[13]&255)<<8,this.r[7]=(p>>>11|b<<5)&8065,K=t[14]&255|(t[15]&255)<<8,this.r[8]=(b>>>8|K<<8)&8191,this.r[9]=K>>>5&127,this.pad[0]=t[16]&255|(t[17]&255)<<8,this.pad[1]=t[18]&255|(t[19]&255)<<8,this.pad[2]=t[20]&255|(t[21]&255)<<8,this.pad[3]=t[22]&255|(t[23]&255)<<8,this.pad[4]=t[24]&255|(t[25]&255)<<8,this.pad[5]=t[26]&255|(t[27]&255)<<8,this.pad[6]=t[28]&255|(t[29]&255)<<8,this.pad[7]=t[30]&255|(t[31]&255)<<8},"poly1305");Je.prototype.blocks=function(t,o,f){for(var r=this.fin?0:2048,a,u,p,b,K,T,S,rr,C,N,R,H,j,z,Y,O,_,D,v,P=this.h[0],B=this.h[1],U=this.h[2],h=this.h[3],d=this.h[4],m=this.h[5],l=this.h[6],A=this.h[7],w=this.h[8],I=this.h[9],F=this.r[0],k=this.r[1],G=this.r[2],y=this.r[3],X=this.r[4],er=this.r[5],tr=this.r[6],V=this.r[7],q=this.r[8],Q=this.r[9];f>=16;)a=t[o+0]&255|(t[o+1]&255)<<8,P+=a&8191,u=t[o+2]&255|(t[o+3]&255)<<8,B+=(a>>>13|u<<3)&8191,p=t[o+4]&255|(t[o+5]&255)<<8,U+=(u>>>10|p<<6)&8191,b=t[o+6]&255|(t[o+7]&255)<<8,h+=(p>>>7|b<<9)&8191,K=t[o+8]&255|(t[o+9]&255)<<8,d+=(b>>>4|K<<12)&8191,m+=K>>>1&8191,T=t[o+10]&255|(t[o+11]&255)<<8,l+=(K>>>14|T<<2)&8191,S=t[o+12]&255|(t[o+13]&255)<<8,A+=(T>>>11|S<<5)&8191,rr=t[o+14]&255|(t[o+15]&255)<<8,w+=(S>>>8|rr<<8)&8191,I+=rr>>>5|r,C=0,N=C,N+=P*F,N+=B*(5*Q),N+=U*(5*q),N+=h*(5*V),N+=d*(5*tr),C=N>>>13,N&=8191,N+=m*(5*er),N+=l*(5*X),N+=A*(5*y),N+=w*(5*G),N+=I*(5*k),C+=N>>>13,N&=8191,R=C,R+=P*k,R+=B*F,R+=U*(5*Q),R+=h*(5*q),R+=d*(5*V),C=R>>>13,R&=8191,R+=m*(5*tr),R+=l*(5*er),R+=A*(5*X),R+=w*(5*y),R+=I*(5*G),C+=R>>>13,R&=8191,H=C,H+=P*G,H+=B*k,H+=U*F,H+=h*(5*Q),H+=d*(5*q),C=H>>>13,H&=8191,H+=m*(5*V),H+=l*(5*tr),H+=A*(5*er),H+=w*(5*X),H+=I*(5*y),C+=H>>>13,H&=8191,j=C,j+=P*y,j+=B*G,j+=U*k,j+=h*F,j+=d*(5*Q),C=j>>>13,j&=8191,j+=m*(5*q),j+=l*(5*V),j+=A*(5*tr),j+=w*(5*er),j+=I*(5*X),C+=j>>>13,j&=8191,z=C,z+=P*X,z+=B*y,z+=U*G,z+=h*k,z+=d*F,C=z>>>13,z&=8191,z+=m*(5*Q),z+=l*(5*q),z+=A*(5*V),z+=w*(5*tr),z+=I*(5*er),C+=z>>>13,z&=8191,Y=C,Y+=P*er,Y+=B*X,Y+=U*y,Y+=h*G,Y+=d*k,C=Y>>>13,Y&=8191,Y+=m*F,Y+=l*(5*Q),Y+=A*(5*q),Y+=w*(5*V),Y+=I*(5*tr),C+=Y>>>13,Y&=8191,O=C,O+=P*tr,O+=B*er,O+=U*X,O+=h*y,O+=d*G,C=O>>>13,O&=8191,O+=m*k,O+=l*F,O+=A*(5*Q),O+=w*(5*q),O+=I*(5*V),C+=O>>>13,O&=8191,_=C,_+=P*V,_+=B*tr,_+=U*er,_+=h*X,_+=d*y,C=_>>>13,_&=8191,_+=m*G,_+=l*k,_+=A*F,_+=w*(5*Q),_+=I*(5*q),C+=_>>>13,_&=8191,D=C,D+=P*q,D+=B*V,D+=U*tr,D+=h*er,D+=d*X,C=D>>>13,D&=8191,D+=m*y,D+=l*G,D+=A*k,D+=w*F,D+=I*(5*Q),C+=D>>>13,D&=8191,v=C,v+=P*Q,v+=B*q,v+=U*V,v+=h*tr,v+=d*er,C=v>>>13,v&=8191,v+=m*X,v+=l*y,v+=A*G,v+=w*k,v+=I*F,C+=v>>>13,v&=8191,C=(C<<2)+C|0,C=C+N|0,N=C&8191,C=C>>>13,R+=C,P=N,B=R,U=H,h=j,d=z,m=Y,l=O,A=_,w=D,I=v,o+=16,f-=16;this.h[0]=P,this.h[1]=B,this.h[2]=U,this.h[3]=h,this.h[4]=d,this.h[5]=m,this.h[6]=l,this.h[7]=A,this.h[8]=w,this.h[9]=I},Je.prototype.finish=function(t,o){var f=new Uint16Array(10),r,a,u,p;if(this.leftover){for(p=this.leftover,this.buffer[p++]=1;p<16;p++)this.buffer[p]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,p=2;p<10;p++)this.h[p]+=r,r=this.h[p]>>>13,this.h[p]&=8191;for(this.h[0]+=r*5,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,f[0]=this.h[0]+5,r=f[0]>>>13,f[0]&=8191,p=1;p<10;p++)f[p]=this.h[p]+r,r=f[p]>>>13,f[p]&=8191;for(f[9]-=8192,a=(r^1)-1,p=0;p<10;p++)f[p]&=a;for(a=~a,p=0;p<10;p++)this.h[p]=this.h[p]&a|f[p];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,u=this.h[0]+this.pad[0],this.h[0]=u&65535,p=1;p<8;p++)u=(this.h[p]+this.pad[p]|0)+(u>>>16)|0,this.h[p]=u&65535;t[o+0]=this.h[0]>>>0&255,t[o+1]=this.h[0]>>>8&255,t[o+2]=this.h[1]>>>0&255,t[o+3]=this.h[1]>>>8&255,t[o+4]=this.h[2]>>>0&255,t[o+5]=this.h[2]>>>8&255,t[o+6]=this.h[3]>>>0&255,t[o+7]=this.h[3]>>>8&255,t[o+8]=this.h[4]>>>0&255,t[o+9]=this.h[4]>>>8&255,t[o+10]=this.h[5]>>>0&255,t[o+11]=this.h[5]>>>8&255,t[o+12]=this.h[6]>>>0&255,t[o+13]=this.h[6]>>>8&255,t[o+14]=this.h[7]>>>0&255,t[o+15]=this.h[7]>>>8&255},Je.prototype.update=function(t,o,f){var r,a;if(this.leftover){for(a=16-this.leftover,a>f&&(a=f),r=0;r<a;r++)this.buffer[this.leftover+r]=t[o+r];if(f-=a,o+=a,this.leftover+=a,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(f>=16&&(a=f-f%16,this.blocks(t,o,a),o+=a,f-=a),f){for(r=0;r<f;r++)this.buffer[this.leftover+r]=t[o+r];this.leftover+=f}};function Ut(t,o,f,r,a,u){var p=new Je(u);return p.update(f,r,a),p.finish(t,o),0}x(Ut,"crypto_onetimeauth");function Tn(t,o,f,r,a,u){var p=new Uint8Array(16);return Ut(p,0,f,r,a,u),xr(t,o,p,0)}x(Tn,"crypto_onetimeauth_verify");function St(t,o,f,r,a){var u;if(f<32)return-1;for(re(t,0,o,0,f,r,a),Ut(t,16,t,32,f-32,t),u=0;u<16;u++)t[u]=0;return 0}x(St,"crypto_secretbox");function vt(t,o,f,r,a){var u,p=new Uint8Array(32);if(f<32||(Ir(p,0,32,r,a),Tn(o,16,o,32,f-32,p)!==0))return-1;for(re(t,0,o,0,f,r,a),u=0;u<32;u++)t[u]=0;return 0}x(vt,"crypto_secretbox_open");function Xr(t,o){var f;for(f=0;f<16;f++)t[f]=o[f]|0}x(Xr,"set25519");function Ct(t){var o,f,r=1;for(o=0;o<16;o++)f=t[o]+r+65535,r=Math.floor(f/65536),t[o]=f-r*65536;t[0]+=r-1+37*(r-1)}x(Ct,"car25519");function ge(t,o,f){for(var r,a=~(f-1),u=0;u<16;u++)r=a&(t[u]^o[u]),t[u]^=r,o[u]^=r}x(ge,"sel25519");function le(t,o){var f,r,a,u=e(),p=e();for(f=0;f<16;f++)p[f]=o[f];for(Ct(p),Ct(p),Ct(p),r=0;r<2;r++){for(u[0]=p[0]-65517,f=1;f<15;f++)u[f]=p[f]-65535-(u[f-1]>>16&1),u[f-1]&=65535;u[15]=p[15]-32767-(u[14]>>16&1),a=u[15]>>16&1,u[14]&=65535,ge(p,u,1-a)}for(f=0;f<16;f++)t[2*f]=p[f]&255,t[2*f+1]=p[f]>>8}x(le,"pack25519");function Dn(t,o){var f=new Uint8Array(32),r=new Uint8Array(32);return le(f,t),le(r,o),_r(f,0,r,0)}x(Dn,"neq25519");function In(t){var o=new Uint8Array(32);return le(o,t),o[0]&1}x(In,"par25519");function _t(t,o){var f;for(f=0;f<16;f++)t[f]=o[2*f]+(o[2*f+1]<<8);t[15]&=32767}x(_t,"unpack25519");function zr(t,o,f){for(var r=0;r<16;r++)t[r]=o[r]+f[r]}x(zr,"A");function Or(t,o,f){for(var r=0;r<16;r++)t[r]=o[r]-f[r]}x(Or,"Z");function W(t,o,f){var r,a,u=0,p=0,b=0,K=0,T=0,S=0,rr=0,C=0,N=0,R=0,H=0,j=0,z=0,Y=0,O=0,_=0,D=0,v=0,P=0,B=0,U=0,h=0,d=0,m=0,l=0,A=0,w=0,I=0,F=0,k=0,G=0,y=f[0],X=f[1],er=f[2],tr=f[3],V=f[4],q=f[5],Q=f[6],ur=f[7],nr=f[8],ar=f[9],sr=f[10],cr=f[11],hr=f[12],wr=f[13],Kr=f[14],Er=f[15];r=o[0],u+=r*y,p+=r*X,b+=r*er,K+=r*tr,T+=r*V,S+=r*q,rr+=r*Q,C+=r*ur,N+=r*nr,R+=r*ar,H+=r*sr,j+=r*cr,z+=r*hr,Y+=r*wr,O+=r*Kr,_+=r*Er,r=o[1],p+=r*y,b+=r*X,K+=r*er,T+=r*tr,S+=r*V,rr+=r*q,C+=r*Q,N+=r*ur,R+=r*nr,H+=r*ar,j+=r*sr,z+=r*cr,Y+=r*hr,O+=r*wr,_+=r*Kr,D+=r*Er,r=o[2],b+=r*y,K+=r*X,T+=r*er,S+=r*tr,rr+=r*V,C+=r*q,N+=r*Q,R+=r*ur,H+=r*nr,j+=r*ar,z+=r*sr,Y+=r*cr,O+=r*hr,_+=r*wr,D+=r*Kr,v+=r*Er,r=o[3],K+=r*y,T+=r*X,S+=r*er,rr+=r*tr,C+=r*V,N+=r*q,R+=r*Q,H+=r*ur,j+=r*nr,z+=r*ar,Y+=r*sr,O+=r*cr,_+=r*hr,D+=r*wr,v+=r*Kr,P+=r*Er,r=o[4],T+=r*y,S+=r*X,rr+=r*er,C+=r*tr,N+=r*V,R+=r*q,H+=r*Q,j+=r*ur,z+=r*nr,Y+=r*ar,O+=r*sr,_+=r*cr,D+=r*hr,v+=r*wr,P+=r*Kr,B+=r*Er,r=o[5],S+=r*y,rr+=r*X,C+=r*er,N+=r*tr,R+=r*V,H+=r*q,j+=r*Q,z+=r*ur,Y+=r*nr,O+=r*ar,_+=r*sr,D+=r*cr,v+=r*hr,P+=r*wr,B+=r*Kr,U+=r*Er,r=o[6],rr+=r*y,C+=r*X,N+=r*er,R+=r*tr,H+=r*V,j+=r*q,z+=r*Q,Y+=r*ur,O+=r*nr,_+=r*ar,D+=r*sr,v+=r*cr,P+=r*hr,B+=r*wr,U+=r*Kr,h+=r*Er,r=o[7],C+=r*y,N+=r*X,R+=r*er,H+=r*tr,j+=r*V,z+=r*q,Y+=r*Q,O+=r*ur,_+=r*nr,D+=r*ar,v+=r*sr,P+=r*cr,B+=r*hr,U+=r*wr,h+=r*Kr,d+=r*Er,r=o[8],N+=r*y,R+=r*X,H+=r*er,j+=r*tr,z+=r*V,Y+=r*q,O+=r*Q,_+=r*ur,D+=r*nr,v+=r*ar,P+=r*sr,B+=r*cr,U+=r*hr,h+=r*wr,d+=r*Kr,m+=r*Er,r=o[9],R+=r*y,H+=r*X,j+=r*er,z+=r*tr,Y+=r*V,O+=r*q,_+=r*Q,D+=r*ur,v+=r*nr,P+=r*ar,B+=r*sr,U+=r*cr,h+=r*hr,d+=r*wr,m+=r*Kr,l+=r*Er,r=o[10],H+=r*y,j+=r*X,z+=r*er,Y+=r*tr,O+=r*V,_+=r*q,D+=r*Q,v+=r*ur,P+=r*nr,B+=r*ar,U+=r*sr,h+=r*cr,d+=r*hr,m+=r*wr,l+=r*Kr,A+=r*Er,r=o[11],j+=r*y,z+=r*X,Y+=r*er,O+=r*tr,_+=r*V,D+=r*q,v+=r*Q,P+=r*ur,B+=r*nr,U+=r*ar,h+=r*sr,d+=r*cr,m+=r*hr,l+=r*wr,A+=r*Kr,w+=r*Er,r=o[12],z+=r*y,Y+=r*X,O+=r*er,_+=r*tr,D+=r*V,v+=r*q,P+=r*Q,B+=r*ur,U+=r*nr,h+=r*ar,d+=r*sr,m+=r*cr,l+=r*hr,A+=r*wr,w+=r*Kr,I+=r*Er,r=o[13],Y+=r*y,O+=r*X,_+=r*er,D+=r*tr,v+=r*V,P+=r*q,B+=r*Q,U+=r*ur,h+=r*nr,d+=r*ar,m+=r*sr,l+=r*cr,A+=r*hr,w+=r*wr,I+=r*Kr,F+=r*Er,r=o[14],O+=r*y,_+=r*X,D+=r*er,v+=r*tr,P+=r*V,B+=r*q,U+=r*Q,h+=r*ur,d+=r*nr,m+=r*ar,l+=r*sr,A+=r*cr,w+=r*hr,I+=r*wr,F+=r*Kr,k+=r*Er,r=o[15],_+=r*y,D+=r*X,v+=r*er,P+=r*tr,B+=r*V,U+=r*q,h+=r*Q,d+=r*ur,m+=r*nr,l+=r*ar,A+=r*sr,w+=r*cr,I+=r*hr,F+=r*wr,k+=r*Kr,G+=r*Er,u+=38*D,p+=38*v,b+=38*P,K+=38*B,T+=38*U,S+=38*h,rr+=38*d,C+=38*m,N+=38*l,R+=38*A,H+=38*w,j+=38*I,z+=38*F,Y+=38*k,O+=38*G,a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=b+a+65535,a=Math.floor(r/65536),b=r-a*65536,r=K+a+65535,a=Math.floor(r/65536),K=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=S+a+65535,a=Math.floor(r/65536),S=r-a*65536,r=rr+a+65535,a=Math.floor(r/65536),rr=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=H+a+65535,a=Math.floor(r/65536),H=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=O+a+65535,a=Math.floor(r/65536),O=r-a*65536,r=_+a+65535,a=Math.floor(r/65536),_=r-a*65536,u+=a-1+37*(a-1),a=1,r=u+a+65535,a=Math.floor(r/65536),u=r-a*65536,r=p+a+65535,a=Math.floor(r/65536),p=r-a*65536,r=b+a+65535,a=Math.floor(r/65536),b=r-a*65536,r=K+a+65535,a=Math.floor(r/65536),K=r-a*65536,r=T+a+65535,a=Math.floor(r/65536),T=r-a*65536,r=S+a+65535,a=Math.floor(r/65536),S=r-a*65536,r=rr+a+65535,a=Math.floor(r/65536),rr=r-a*65536,r=C+a+65535,a=Math.floor(r/65536),C=r-a*65536,r=N+a+65535,a=Math.floor(r/65536),N=r-a*65536,r=R+a+65535,a=Math.floor(r/65536),R=r-a*65536,r=H+a+65535,a=Math.floor(r/65536),H=r-a*65536,r=j+a+65535,a=Math.floor(r/65536),j=r-a*65536,r=z+a+65535,a=Math.floor(r/65536),z=r-a*65536,r=Y+a+65535,a=Math.floor(r/65536),Y=r-a*65536,r=O+a+65535,a=Math.floor(r/65536),O=r-a*65536,r=_+a+65535,a=Math.floor(r/65536),_=r-a*65536,u+=a-1+37*(a-1),t[0]=u,t[1]=p,t[2]=b,t[3]=K,t[4]=T,t[5]=S,t[6]=rr,t[7]=C,t[8]=N,t[9]=R,t[10]=H,t[11]=j,t[12]=z,t[13]=Y,t[14]=O,t[15]=_}x(W,"M");function Mr(t,o){W(t,o,o)}x(Mr,"S");function Mn(t,o){var f=e(),r;for(r=0;r<16;r++)f[r]=o[r];for(r=253;r>=0;r--)Mr(f,f),r!==2&&r!==4&&W(f,f,o);for(r=0;r<16;r++)t[r]=f[r]}x(Mn,"inv25519");function Ln(t,o){var f=e(),r;for(r=0;r<16;r++)f[r]=o[r];for(r=250;r>=0;r--)Mr(f,f),r!==1&&W(f,f,o);for(r=0;r<16;r++)t[r]=f[r]}x(Ln,"pow2523");function qe(t,o,f){var r=new Uint8Array(32),a=new Float64Array(80),u,p,b=e(),K=e(),T=e(),S=e(),rr=e(),C=e();for(p=0;p<31;p++)r[p]=o[p];for(r[31]=o[31]&127|64,r[0]&=248,_t(a,f),p=0;p<16;p++)K[p]=a[p],S[p]=b[p]=T[p]=0;for(b[0]=S[0]=1,p=254;p>=0;--p)u=r[p>>>3]>>>(p&7)&1,ge(b,K,u),ge(T,S,u),zr(rr,b,T),Or(b,b,T),zr(T,K,S),Or(K,K,S),Mr(S,rr),Mr(C,b),W(b,T,b),W(T,K,rr),zr(rr,b,T),Or(b,b,T),Mr(K,b),Or(T,S,C),W(b,T,L),zr(b,b,S),W(T,T,b),W(b,S,C),W(S,K,a),Mr(K,rr),ge(b,K,u),ge(T,S,u);for(p=0;p<16;p++)a[p+16]=b[p],a[p+32]=T[p],a[p+48]=K[p],a[p+64]=S[p];var N=a.subarray(32),R=a.subarray(16);return Mn(N,N),W(R,R,N),le(t,R),0}x(qe,"crypto_scalarmult");function Qe(t,o){return qe(t,o,c)}x(Qe,"crypto_scalarmult_base");function Nn(t,o){return i(o,32),Qe(t,o)}x(Nn,"crypto_box_keypair");function rt(t,o,f){var r=new Uint8Array(32);return qe(r,f,o),br(t,s,r,dr)}x(rt,"crypto_box_beforenm");var Rn=St,Li=vt;function Ni(t,o,f,r,a,u){var p=new Uint8Array(32);return rt(p,a,u),Rn(t,o,f,r,p)}x(Ni,"crypto_box");function Ri(t,o,f,r,a,u){var p=new Uint8Array(32);return rt(p,a,u),Li(t,o,f,r,p)}x(Ri,"crypto_box_open");var zn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function On(t,o,f,r){for(var a=new Int32Array(16),u=new Int32Array(16),p,b,K,T,S,rr,C,N,R,H,j,z,Y,O,_,D,v,P,B,U,h,d,m,l,A,w,I=t[0],F=t[1],k=t[2],G=t[3],y=t[4],X=t[5],er=t[6],tr=t[7],V=o[0],q=o[1],Q=o[2],ur=o[3],nr=o[4],ar=o[5],sr=o[6],cr=o[7],hr=0;r>=128;){for(B=0;B<16;B++)U=8*B+hr,a[B]=f[U+0]<<24|f[U+1]<<16|f[U+2]<<8|f[U+3],u[B]=f[U+4]<<24|f[U+5]<<16|f[U+6]<<8|f[U+7];for(B=0;B<80;B++)if(p=I,b=F,K=k,T=G,S=y,rr=X,C=er,N=tr,R=V,H=q,j=Q,z=ur,Y=nr,O=ar,_=sr,D=cr,h=tr,d=cr,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=(y>>>14|nr<<18)^(y>>>18|nr<<14)^(nr>>>9|y<<23),d=(nr>>>14|y<<18)^(nr>>>18|y<<14)^(y>>>9|nr<<23),m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,h=y&X^~y&er,d=nr&ar^~nr&sr,m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,h=zn[B*2],d=zn[B*2+1],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,h=a[B%16],d=u[B%16],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,v=A&65535|w<<16,P=m&65535|l<<16,h=v,d=P,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=(I>>>28|V<<4)^(V>>>2|I<<30)^(V>>>7|I<<25),d=(V>>>28|I<<4)^(I>>>2|V<<30)^(I>>>7|V<<25),m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,h=I&F^I&k^F&k,d=V&q^V&Q^q&Q,m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,N=A&65535|w<<16,D=m&65535|l<<16,h=T,d=z,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=v,d=P,m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,T=A&65535|w<<16,z=m&65535|l<<16,F=p,k=b,G=K,y=T,X=S,er=rr,tr=C,I=N,q=R,Q=H,ur=j,nr=z,ar=Y,sr=O,cr=_,V=D,B%16===15)for(U=0;U<16;U++)h=a[U],d=u[U],m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=a[(U+9)%16],d=u[(U+9)%16],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,v=a[(U+1)%16],P=u[(U+1)%16],h=(v>>>1|P<<31)^(v>>>8|P<<24)^v>>>7,d=(P>>>1|v<<31)^(P>>>8|v<<24)^(P>>>7|v<<25),m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,v=a[(U+14)%16],P=u[(U+14)%16],h=(v>>>19|P<<13)^(P>>>29|v<<3)^v>>>6,d=(P>>>19|v<<13)^(v>>>29|P<<3)^(P>>>6|v<<26),m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,a[U]=A&65535|w<<16,u[U]=m&65535|l<<16;h=I,d=V,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[0],d=o[0],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[0]=I=A&65535|w<<16,o[0]=V=m&65535|l<<16,h=F,d=q,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[1],d=o[1],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[1]=F=A&65535|w<<16,o[1]=q=m&65535|l<<16,h=k,d=Q,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[2],d=o[2],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[2]=k=A&65535|w<<16,o[2]=Q=m&65535|l<<16,h=G,d=ur,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[3],d=o[3],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[3]=G=A&65535|w<<16,o[3]=ur=m&65535|l<<16,h=y,d=nr,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[4],d=o[4],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[4]=y=A&65535|w<<16,o[4]=nr=m&65535|l<<16,h=X,d=ar,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[5],d=o[5],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[5]=X=A&65535|w<<16,o[5]=ar=m&65535|l<<16,h=er,d=sr,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[6],d=o[6],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[6]=er=A&65535|w<<16,o[6]=sr=m&65535|l<<16,h=tr,d=cr,m=d&65535,l=d>>>16,A=h&65535,w=h>>>16,h=t[7],d=o[7],m+=d&65535,l+=d>>>16,A+=h&65535,w+=h>>>16,l+=m>>>16,A+=l>>>16,w+=A>>>16,t[7]=tr=A&65535|w<<16,o[7]=cr=m&65535|l<<16,hr+=128,r-=128}return r}x(On,"crypto_hashblocks_hl");function se(t,o,f){var r=new Int32Array(8),a=new Int32Array(8),u=new Uint8Array(256),p,b=f;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,On(r,a,o,f),f%=128,p=0;p<f;p++)u[p]=o[b-f+p];for(u[f]=128,f=256-128*(f<112?1:0),u[f-9]=0,de(u,f-8,b/536870912|0,b<<3),On(r,a,u,f),p=0;p<8;p++)de(t,8*p,r[p],a[p]);return 0}x(se,"crypto_hash");function et(t,o){var f=e(),r=e(),a=e(),u=e(),p=e(),b=e(),K=e(),T=e(),S=e();Or(f,t[1],t[0]),Or(S,o[1],o[0]),W(f,f,S),zr(r,t[0],t[1]),zr(S,o[0],o[1]),W(r,r,S),W(a,t[3],o[3]),W(a,a,or),W(u,t[2],o[2]),zr(u,u,u),Or(p,r,f),Or(b,u,a),zr(K,u,a),zr(T,r,f),W(t[0],p,b),W(t[1],T,K),W(t[2],K,b),W(t[3],p,T)}x(et,"add");function Yn(t,o,f){var r;for(r=0;r<4;r++)ge(t[r],o[r],f)}x(Yn,"cswap");function Pt(t,o){var f=e(),r=e(),a=e();Mn(a,o[2]),W(f,o[0],a),W(r,o[1],a),le(t,r),t[31]^=In(f)<<7}x(Pt,"pack");function Bt(t,o,f){var r,a;for(Xr(t[0],g),Xr(t[1],E),Xr(t[2],E),Xr(t[3],g),a=255;a>=0;--a)r=f[a/8|0]>>(a&7)&1,Yn(t,o,r),et(o,t),et(t,t),Yn(t,o,r)}x(Bt,"scalarmult");function tt(t,o){var f=[e(),e(),e(),e()];Xr(f[0],fr),Xr(f[1],mr),Xr(f[2],E),W(f[3],fr,mr),Bt(t,f,o)}x(tt,"scalarbase");function Tt(t,o,f){var r=new Uint8Array(64),a=[e(),e(),e(),e()],u;for(f||i(o,32),se(r,o,32),r[0]&=248,r[31]&=127,r[31]|=64,tt(a,r),Pt(t,a),u=0;u<32;u++)o[u+32]=t[u];return 0}x(Tt,"crypto_sign_keypair");var nt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Dt(t,o){var f,r,a,u;for(r=63;r>=32;--r){for(f=0,a=r-32,u=r-12;a<u;++a)o[a]+=f-16*o[r]*nt[a-(r-32)],f=Math.floor((o[a]+128)/256),o[a]-=f*256;o[a]+=f,o[r]=0}for(f=0,a=0;a<32;a++)o[a]+=f-(o[31]>>4)*nt[a],f=o[a]>>8,o[a]&=255;for(a=0;a<32;a++)o[a]-=f*nt[a];for(r=0;r<32;r++)o[r+1]+=o[r]>>8,t[r]=o[r]&255}x(Dt,"modL");function It(t){var o=new Float64Array(64),f;for(f=0;f<64;f++)o[f]=t[f];for(f=0;f<64;f++)t[f]=0;Dt(t,o)}x(It,"reduce");function jn(t,o,f,r){var a=new Uint8Array(64),u=new Uint8Array(64),p=new Uint8Array(64),b,K,T=new Float64Array(64),S=[e(),e(),e(),e()];se(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64;var rr=f+64;for(b=0;b<f;b++)t[64+b]=o[b];for(b=0;b<32;b++)t[32+b]=a[32+b];for(se(p,t.subarray(32),f+32),It(p),tt(S,p),Pt(t,S),b=32;b<64;b++)t[b]=r[b];for(se(u,t,f+64),It(u),b=0;b<64;b++)T[b]=0;for(b=0;b<32;b++)T[b]=p[b];for(b=0;b<32;b++)for(K=0;K<32;K++)T[b+K]+=u[b]*a[K];return Dt(t.subarray(32),T),rr}x(jn,"crypto_sign");function zi(t,o){var f=e(),r=e(),a=e(),u=e(),p=e(),b=e(),K=e();return Xr(t[2],E),_t(t[1],o),Mr(a,t[1]),W(u,a,Z),Or(a,a,t[2]),zr(u,t[2],u),Mr(p,u),Mr(b,p),W(K,b,p),W(f,K,a),W(f,f,u),Ln(f,f),W(f,f,a),W(f,f,u),W(f,f,u),W(t[0],f,u),Mr(r,t[0]),W(r,r,u),Dn(r,a)&&W(t[0],t[0],Nr),Mr(r,t[0]),W(r,r,u),Dn(r,a)?-1:(In(t[0])===o[31]>>7&&Or(t[0],g,t[0]),W(t[3],t[0],t[1]),0)}x(zi,"unpackneg");function Mt(t,o,f,r){var a,u=new Uint8Array(32),p=new Uint8Array(64),b=[e(),e(),e(),e()],K=[e(),e(),e(),e()];if(f<64||zi(K,r))return-1;for(a=0;a<f;a++)t[a]=o[a];for(a=0;a<32;a++)t[a+32]=r[a];if(se(p,t,f),It(p),Bt(b,K,p),tt(K,o.subarray(32)),et(b,K),Pt(u,b),f-=64,_r(o,0,u,0)){for(a=0;a<f;a++)t[a]=0;return-1}for(a=0;a<f;a++)t[a]=o[a+64];return f}x(Mt,"crypto_sign_open");var Lt=32,it=24,Te=32,be=16,De=32,ft=32,Ie=32,Me=32,Nt=32,Hn=it,Oi=Te,Yi=be,Wr=64,ce=32,Ae=64,Rt=32,zt=64;n.lowlevel={crypto_core_hsalsa20:br,crypto_stream_xor:re,crypto_stream:Ir,crypto_stream_salsa20_xor:Rr,crypto_stream_salsa20:Pr,crypto_onetimeauth:Ut,crypto_onetimeauth_verify:Tn,crypto_verify_16:xr,crypto_verify_32:_r,crypto_secretbox:St,crypto_secretbox_open:vt,crypto_scalarmult:qe,crypto_scalarmult_base:Qe,crypto_box_beforenm:rt,crypto_box_afternm:Rn,crypto_box:Ni,crypto_box_open:Ri,crypto_box_keypair:Nn,crypto_hash:se,crypto_sign:jn,crypto_sign_keypair:Tt,crypto_sign_open:Mt,crypto_secretbox_KEYBYTES:Lt,crypto_secretbox_NONCEBYTES:it,crypto_secretbox_ZEROBYTES:Te,crypto_secretbox_BOXZEROBYTES:be,crypto_scalarmult_BYTES:De,crypto_scalarmult_SCALARBYTES:ft,crypto_box_PUBLICKEYBYTES:Ie,crypto_box_SECRETKEYBYTES:Me,crypto_box_BEFORENMBYTES:Nt,crypto_box_NONCEBYTES:Hn,crypto_box_ZEROBYTES:Oi,crypto_box_BOXZEROBYTES:Yi,crypto_sign_BYTES:Wr,crypto_sign_PUBLICKEYBYTES:ce,crypto_sign_SECRETKEYBYTES:Ae,crypto_sign_SEEDBYTES:Rt,crypto_hash_BYTES:zt,gf:e,D:Z,L:nt,pack25519:le,unpack25519:_t,M:W,A:zr,S:Mr,Z:Or,pow2523:Ln,add:et,set25519:Xr,modL:Dt,scalarmult:Bt,scalarbase:tt};function Fn(t,o){if(t.length!==Lt)throw new Error("bad key size");if(o.length!==it)throw new Error("bad nonce size")}x(Fn,"checkLengths");function ji(t,o){if(t.length!==Ie)throw new Error("bad public key size");if(o.length!==Me)throw new Error("bad secret key size")}x(ji,"checkBoxLengths");function Tr(){for(var t=0;t<arguments.length;t++)if(!(arguments[t]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}x(Tr,"checkArrayTypes");function Gn(t){for(var o=0;o<t.length;o++)t[o]=0}x(Gn,"cleanup"),n.randomBytes=function(t){var o=new Uint8Array(t);return i(o,t),o},n.secretbox=function(t,o,f){Tr(t,o,f),Fn(f,o);for(var r=new Uint8Array(Te+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+Te]=t[u];return St(a,r,r.length,o,f),a.subarray(be)},n.secretbox.open=function(t,o,f){Tr(t,o,f),Fn(f,o);for(var r=new Uint8Array(be+t.length),a=new Uint8Array(r.length),u=0;u<t.length;u++)r[u+be]=t[u];return r.length<32||vt(a,r,r.length,o,f)!==0?null:a.subarray(Te)},n.secretbox.keyLength=Lt,n.secretbox.nonceLength=it,n.secretbox.overheadLength=be,n.scalarMult=function(t,o){if(Tr(t,o),t.length!==ft)throw new Error("bad n size");if(o.length!==De)throw new Error("bad p size");var f=new Uint8Array(De);return qe(f,t,o),f},n.scalarMult.base=function(t){if(Tr(t),t.length!==ft)throw new Error("bad n size");var o=new Uint8Array(De);return Qe(o,t),o},n.scalarMult.scalarLength=ft,n.scalarMult.groupElementLength=De,n.box=function(t,o,f,r){var a=n.box.before(f,r);return n.secretbox(t,o,a)},n.box.before=function(t,o){Tr(t,o),ji(t,o);var f=new Uint8Array(Nt);return rt(f,t,o),f},n.box.after=n.secretbox,n.box.open=function(t,o,f,r){var a=n.box.before(f,r);return n.secretbox.open(t,o,a)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var t=new Uint8Array(Ie),o=new Uint8Array(Me);return Nn(t,o),{publicKey:t,secretKey:o}},n.box.keyPair.fromSecretKey=function(t){if(Tr(t),t.length!==Me)throw new Error("bad secret key size");var o=new Uint8Array(Ie);return Qe(o,t),{publicKey:o,secretKey:new Uint8Array(t)}},n.box.publicKeyLength=Ie,n.box.secretKeyLength=Me,n.box.sharedKeyLength=Nt,n.box.nonceLength=Hn,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(t,o){if(Tr(t,o),o.length!==Ae)throw new Error("bad secret key size");var f=new Uint8Array(Wr+t.length);return jn(f,t,t.length,o),f},n.sign.open=function(t,o){if(Tr(t,o),o.length!==ce)throw new Error("bad public key size");var f=new Uint8Array(t.length),r=Mt(f,t,t.length,o);if(r<0)return null;for(var a=new Uint8Array(r),u=0;u<a.length;u++)a[u]=f[u];return a},n.sign.detached=function(t,o){for(var f=n.sign(t,o),r=new Uint8Array(Wr),a=0;a<r.length;a++)r[a]=f[a];return r},n.sign.detached.verify=function(t,o,f){if(Tr(t,o,f),o.length!==Wr)throw new Error("bad signature size");if(f.length!==ce)throw new Error("bad public key size");var r=new Uint8Array(Wr+t.length),a=new Uint8Array(Wr+t.length),u;for(u=0;u<Wr;u++)r[u]=o[u];for(u=0;u<t.length;u++)r[u+Wr]=t[u];return Mt(a,r,r.length,f)>=0},n.sign.keyPair=function(){var t=new Uint8Array(ce),o=new Uint8Array(Ae);return Tt(t,o),{publicKey:t,secretKey:o}},n.sign.keyPair.fromSecretKey=function(t){if(Tr(t),t.length!==Ae)throw new Error("bad secret key size");for(var o=new Uint8Array(ce),f=0;f<o.length;f++)o[f]=t[32+f];return{publicKey:o,secretKey:new Uint8Array(t)}},n.sign.keyPair.fromSeed=function(t){if(Tr(t),t.length!==Rt)throw new Error("bad seed size");for(var o=new Uint8Array(ce),f=new Uint8Array(Ae),r=0;r<32;r++)f[r]=t[r];return Tt(o,f,!0),{publicKey:o,secretKey:f}},n.sign.publicKeyLength=ce,n.sign.secretKeyLength=Ae,n.sign.seedLength=Rt,n.sign.signatureLength=Wr,n.hash=function(t){Tr(t);var o=new Uint8Array(zt);return se(o,t,t.length),o},n.hash.hashLength=zt,n.verify=function(t,o){return Tr(t,o),t.length===0||o.length===0||t.length!==o.length?!1:J(t,0,o,0,t.length)===0},n.setPRNG=function(t){i=t},function(){var t=typeof self<"u"?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){var o=65536;n.setPRNG(function(f,r){var a,u=new Uint8Array(r);for(a=0;a<r;a+=o)t.getRandomValues(u.subarray(a,a+Math.min(r-a,o)));for(a=0;a<r;a++)f[a]=u[a];Gn(u)})}else typeof kn<"u"&&(t=Ki(),t&&t.randomBytes&&n.setPRNG(function(f,r){var a,u=t.randomBytes(r);for(a=0;a<r;a++)f[a]=u[a];Gn(u)}))}()})(typeof At<"u"&&At.exports?At.exports:self.nacl=self.nacl||{})});var Xn=(s=>(s[s.B1024=1024]="B1024",s[s.B2048=2048]="B2048",s[s.B4096=4096]="B4096",s))(Xn||{}),Wn=(s=>(s[s.B128=128]="B128",s[s.B192=192]="B192",s[s.B256=256]="B256",s))(Wn||{}),$n=(i=>(i.ECC="ecc",i.RSA="rsa",i))($n||{}),Ot=(c=>(c.SHA_1="SHA-1",c.SHA_256="SHA-256",c.SHA_384="SHA-384",c.SHA_512="SHA-512",c))(Ot||{}),Yt=(c=>(c.P_256="P-256",c.P_384="P-384",c.P_521="P-521",c.X25519="X25519",c))(Yt||{}),ye=(s=>(s.Sign="signing",s.Exchange="exchange",s.Write="write",s))(ye||{}),jt=(i=>(i[i.B8=8]="B8",i[i.B16=16]="B16",i))(jt||{});var Di={};vr(Di,{AES_GCM:()=>Gr,BASE58_DID_PREFIX:()=>te,BLS_DID_PREFIX:()=>ut,DEFAULT_CHAR_SIZE:()=>Fr,DEFAULT_ECC_EXCHANGE:()=>Fe,DEFAULT_ECC_EXCHANGE_CURVE:()=>oo,DEFAULT_ECC_WRITE:()=>Ge,DEFAULT_HASH_ALGORITHM:()=>ue,DEFAULT_RSA_EXCHANGE:()=>ht,DEFAULT_RSA_SIZE:()=>xt,DEFAULT_RSA_WRITE:()=>dt,DEFAULT_SYMM_ALGORITHM:()=>kr,DEFAULT_SYMM_LENGTH:()=>Vr,ECC_EXCHANGE_ALG:()=>bn,ECC_EXCHANGE_NAME:()=>mn,ECC_WRITE_ALG:()=>Se,ECC_WRITE_NAME:()=>An,EDWARDS_DID_PREFIX:()=>pt,IV_LENGTH:()=>Yr,KEY_TYPE:()=>He,KEY_USE:()=>bi,RSA_ALGORITHM:()=>ne,RSA_DID_PREFIX:()=>yt,RSA_HASHING_ALGORITHM:()=>ct,RSA_SIGN_ALGORITHM:()=>ie,RsaKeys:()=>he,SALT_LENGTH:()=>jr,encrypt:()=>Uo,encryptKeyTo:()=>Be,encryptTo:()=>Ti,getPublicKeyAsArrayBuffer:()=>qr,getPublicKeyAsUint8Array:()=>Un,publicKeyToDid:()=>We,verify:()=>Eo});var Zi=globalThis||window||self,$=Zi.crypto;function Ne(n=0){return new Uint8Array(n)}x(Ne,"allocUnsafe");function Ht(n,e){e==null&&(e=n.reduce((c,g)=>c+g.length,0));let i=Ne(e),s=0;for(let c of n)i.set(c,s),s+=c.length;return i}x(Ht,"concat");var Jt={};vr(Jt,{base10:()=>nf});var $o=new Uint8Array(0);function Zn(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let i=0;i<n.byteLength;i++)if(n[i]!==e[i])return!1;return!0}x(Zn,"equals");function $r(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")}x($r,"coerce");function Jn(n){return new TextEncoder().encode(n)}x(Jn,"fromString");function qn(n){return new TextDecoder().decode(n)}x(qn,"toString");function qi(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),s=0;s<i.length;s++)i[s]=255;for(var c=0;c<n.length;c++){var g=n.charAt(c),E=g.charCodeAt(0);if(i[E]!==255)throw new TypeError(g+" is ambiguous");i[E]=c}var L=n.length,Z=n.charAt(0),or=Math.log(L)/Math.log(256),fr=Math.log(256)/Math.log(L);function mr(J){if(J instanceof Uint8Array||(ArrayBuffer.isView(J)?J=new Uint8Array(J.buffer,J.byteOffset,J.byteLength):Array.isArray(J)&&(J=Uint8Array.from(J))),!(J instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(J.length===0)return"";for(var xr=0,_r=0,Ur=0,lr=J.length;Ur!==lr&&J[Ur]===0;)Ur++,xr++;for(var Sr=(lr-Ur)*fr+1>>>0,br=new Uint8Array(Sr);Ur!==lr;){for(var dr=J[Ur],Rr=0,Pr=Sr-1;(dr!==0||Rr<_r)&&Pr!==-1;Pr--,Rr++)dr+=256*br[Pr]>>>0,br[Pr]=dr%L>>>0,dr=dr/L>>>0;if(dr!==0)throw new Error("Non-zero carry");_r=Rr,Ur++}for(var Ir=Sr-_r;Ir!==Sr&&br[Ir]===0;)Ir++;for(var re=Z.repeat(xr);Ir<Sr;++Ir)re+=n.charAt(br[Ir]);return re}x(mr,"encode");function Nr(J){if(typeof J!="string")throw new TypeError("Expected String");if(J.length===0)return new Uint8Array;var xr=0;if(J[xr]!==" "){for(var _r=0,Ur=0;J[xr]===Z;)_r++,xr++;for(var lr=(J.length-xr)*or+1>>>0,Sr=new Uint8Array(lr);J[xr];){var br=i[J.charCodeAt(xr)];if(br===255)return;for(var dr=0,Rr=lr-1;(br!==0||dr<Ur)&&Rr!==-1;Rr--,dr++)br+=L*Sr[Rr]>>>0,Sr[Rr]=br%256>>>0,br=br/256>>>0;if(br!==0)throw new Error("Non-zero carry");Ur=dr,xr++}if(J[xr]!==" "){for(var Pr=lr-Ur;Pr!==lr&&Sr[Pr]===0;)Pr++;for(var Ir=new Uint8Array(_r+(lr-Pr)),re=_r;Pr!==lr;)Ir[re++]=Sr[Pr++];return Ir}}}x(Nr,"decodeUnsafe");function de(J){var xr=Nr(J);if(xr)return xr;throw new Error(`Non-${e} character`)}return x(de,"decode"),{encode:mr,decodeUnsafe:Nr,decode:de}}x(qi,"base");var Qi=qi,rf=Qi,ri=rf;var Xt=class Xt{constructor(e,i,s){M(this,"name");M(this,"prefix");M(this,"baseEncode");this.name=e,this.prefix=i,this.baseEncode=s}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};x(Xt,"Encoder");var Ft=Xt,Wt=class Wt{constructor(e,i,s){M(this,"name");M(this,"prefix");M(this,"baseDecode");M(this,"prefixCodePoint");this.name=e,this.prefix=i;let c=i.codePointAt(0);if(c===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=c,this.baseDecode=s}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 ei(this,e)}};x(Wt,"Decoder");var Gt=Wt,$t=class $t{constructor(e){M(this,"decoders");this.decoders=e}or(e){return ei(this,e)}decode(e){let i=e[0],s=this.decoders[i];if(s!=null)return s.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};x($t,"ComposedDecoder");var kt=$t;function ei(n,e){return new kt({...n.decoders??{[n.prefix]:n},...e.decoders??{[e.prefix]:e}})}x(ei,"or");var Zt=class Zt{constructor(e,i,s,c){M(this,"name");M(this,"prefix");M(this,"baseEncode");M(this,"baseDecode");M(this,"encoder");M(this,"decoder");this.name=e,this.prefix=i,this.baseEncode=s,this.baseDecode=c,this.encoder=new Ft(e,i,s),this.decoder=new Gt(e,i,c)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};x(Zt,"Codec");var Vt=Zt;function me({name:n,prefix:e,encode:i,decode:s}){return new Vt(n,e,i,s)}x(me,"from");function ee({name:n,prefix:e,alphabet:i}){let{encode:s,decode:c}=ri(i,n);return me({prefix:e,name:n,encode:s,decode:x(g=>$r(c(g)),"decode")})}x(ee,"baseX");function ef(n,e,i,s){let c={};for(let fr=0;fr<e.length;++fr)c[e[fr]]=fr;let g=n.length;for(;n[g-1]==="=";)--g;let E=new Uint8Array(g*i/8|0),L=0,Z=0,or=0;for(let fr=0;fr<g;++fr){let mr=c[n[fr]];if(mr===void 0)throw new SyntaxError(`Non-${s} character`);Z=Z<<i|mr,L+=i,L>=8&&(L-=8,E[or++]=255&Z>>L)}if(L>=i||(255&Z<<8-L)!==0)throw new SyntaxError("Unexpected end of data");return E}x(ef,"decode");function tf(n,e,i){let s=e[e.length-1]==="=",c=(1<<i)-1,g="",E=0,L=0;for(let Z=0;Z<n.length;++Z)for(L=L<<8|n[Z],E+=8;E>i;)E-=i,g+=e[c&L>>E];if(E!==0&&(g+=e[c&L<<i-E]),s)for(;(g.length*i&7)!==0;)g+="=";return g}x(tf,"encode");function yr({name:n,prefix:e,bitsPerChar:i,alphabet:s}){return me({prefix:e,name:n,encode(c){return tf(c,s,i)},decode(c){return ef(c,s,i,n)}})}x(yr,"rfc4648");var nf=ee({prefix:"9",name:"base10",alphabet:"0123456789"});var qt={};vr(qt,{base16:()=>ff,base16upper:()=>of});var ff=yr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),of=yr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Qt={};vr(Qt,{base2:()=>af});var af=yr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var rn={};vr(rn,{base256emoji:()=>uf});var ti=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}"),sf=ti.reduce((n,e,i)=>(n[i]=e,n),[]),cf=ti.reduce((n,e,i)=>{let s=e.codePointAt(0);if(s==null)throw new Error(`Invalid character: ${e}`);return n[s]=i,n},[]);function yf(n){return n.reduce((e,i)=>(e+=sf[i],e),"")}x(yf,"encode");function xf(n){let e=[];for(let i of n){let s=i.codePointAt(0);if(s==null)throw new Error(`Invalid character: ${i}`);let c=cf[s];if(c==null)throw new Error(`Non-base256emoji character: ${i}`);e.push(c)}return new Uint8Array(e)}x(xf,"decode");var uf=me({prefix:"\u{1F680}",name:"base256emoji",encode:yf,decode:xf});var en={};vr(en,{base32:()=>we,base32hex:()=>gf,base32hexpad:()=>bf,base32hexpadupper:()=>Af,base32hexupper:()=>lf,base32pad:()=>hf,base32padupper:()=>df,base32upper:()=>pf,base32z:()=>mf});var we=yr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),pf=yr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),hf=yr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),df=yr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),gf=yr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),lf=yr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),bf=yr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Af=yr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mf=yr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var tn={};vr(tn,{base36:()=>Re,base36upper:()=>wf});var Re=ee({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wf=ee({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var nn={};vr(nn,{base58btc:()=>Hr,base58flickr:()=>Kf});var Hr=ee({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Kf=ee({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var fn={};vr(fn,{base64:()=>Ef,base64pad:()=>Uf,base64url:()=>Sf,base64urlpad:()=>vf});var Ef=yr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Uf=yr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Sf=yr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),vf=yr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var on={};vr(on,{base8:()=>Cf});var Cf=yr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var an={};vr(an,{identity:()=>_f});var _f=me({prefix:"\0",name:"identity",encode:x(n=>qn(n),"encode"),decode:x(n=>Jn(n),"decode")});var ga=new TextEncoder,la=new TextDecoder;var yn={};vr(yn,{identity:()=>Jf});var Tf=fi,ni=128,Df=127,If=~Df,Mf=Math.pow(2,31);function fi(n,e,i){e=e||[],i=i||0;for(var s=i;n>=Mf;)e[i++]=n&255|ni,n/=128;for(;n&If;)e[i++]=n&255|ni,n>>>=7;return e[i]=n|0,fi.bytes=i-s+1,e}x(fi,"encode");var Lf=sn,Nf=128,ii=127;function sn(n,s){var i=0,s=s||0,c=0,g=s,E,L=n.length;do{if(g>=L)throw sn.bytes=0,new RangeError("Could not decode varint");E=n[g++],i+=c<28?(E&ii)<<c:(E&ii)*Math.pow(2,c),c+=7}while(E>=Nf);return sn.bytes=g-s,i}x(sn,"read");var Rf=Math.pow(2,7),zf=Math.pow(2,14),Of=Math.pow(2,21),Yf=Math.pow(2,28),jf=Math.pow(2,35),Hf=Math.pow(2,42),Ff=Math.pow(2,49),Gf=Math.pow(2,56),kf=Math.pow(2,63),Vf=x(function(n){return n<Rf?1:n<zf?2:n<Of?3:n<Yf?4:n<jf?5:n<Hf?6:n<Ff?7:n<Gf?8:n<kf?9:10},"length"),Xf={encode:Tf,decode:Lf,encodingLength:Vf},Wf=Xf,ze=Wf;function Oe(n,e=0){return[ze.decode(n,e),ze.decode.bytes]}x(Oe,"decode");function Ke(n,e,i=0){return ze.encode(n,e,i),e}x(Ke,"encodeTo");function Ee(n){return ze.encodingLength(n)}x(Ee,"encodingLength");function xe(n,e){let i=e.byteLength,s=Ee(n),c=s+Ee(i),g=new Uint8Array(c+i);return Ke(n,g,0),Ke(i,g,s),g.set(e,c),new Ue(n,i,e,g)}x(xe,"create");function oi(n){let e=$r(n),[i,s]=Oe(e),[c,g]=Oe(e.subarray(s)),E=e.subarray(s+g);if(E.byteLength!==c)throw new Error("Incorrect length");return new Ue(i,c,E,e)}x(oi,"decode");function ai(n,e){if(n===e)return!0;{let i=e;return n.code===i.code&&n.size===i.size&&i.bytes instanceof Uint8Array&&Zn(n.bytes,i.bytes)}}x(ai,"equals");var cn=class cn{constructor(e,i,s,c){M(this,"code");M(this,"size");M(this,"digest");M(this,"bytes");this.code=e,this.size=i,this.digest=s,this.bytes=c}};x(cn,"Digest");var Ue=cn;var si=0,$f="identity",ci=$r;function Zf(n){return xe(si,ci(n))}x(Zf,"digest");var Jf={code:si,name:$f,encode:ci,digest:Zf};var hn={};vr(hn,{sha256:()=>qf,sha512:()=>Qf});function un({name:n,code:e,encode:i}){return new xn(n,e,i)}x(un,"from");var pn=class pn{constructor(e,i,s){M(this,"name");M(this,"code");M(this,"encode");this.name=e,this.code=i,this.encode=s}digest(e){if(e instanceof Uint8Array){let i=this.encode(e);return i instanceof Uint8Array?xe(this.code,i):i.then(s=>xe(this.code,s))}else throw Error("Unknown type, must be binary type")}};x(pn,"Hasher");var xn=pn;function xi(n){return async e=>new Uint8Array(await crypto.subtle.digest(n,e))}x(xi,"sha");var qf=un({name:"sha2-256",code:18,encode:xi("SHA-256")}),Qf=un({name:"sha2-512",code:19,encode:xi("SHA-512")});function ui(n,e){let{bytes:i,version:s}=n;switch(s){case 0:return eo(i,dn(n),e??Hr.encoder);default:return to(i,dn(n),e??we.encoder)}}x(ui,"format");var pi=new WeakMap;function dn(n){let e=pi.get(n);if(e==null){let i=new Map;return pi.set(n,i),i}return e}x(dn,"baseCache");var di,gr=class gr{constructor(e,i,s,c){M(this,"code");M(this,"version");M(this,"multihash");M(this,"bytes");M(this,"/");M(this,di,"CID");this.code=i,this.version=e,this.multihash=s,this.bytes=c,this["/"]=c}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:i}=this;if(e!==je)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(i.code!==no)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return gr.createV0(i)}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:i}=this.multihash,s=xe(e,i);return gr.createV1(this.code,s)}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 gr.equals(this,e)}static equals(e,i){let s=i;return s!=null&&e.code===s.code&&e.version===s.version&&ai(e.multihash,s.multihash)}toString(e){return ui(this,e)}toJSON(){return{"/":ui(this)}}link(){return this}[(di=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let i=e;if(i instanceof gr)return i;if(i["/"]!=null&&i["/"]===i.bytes||i.asCID===i){let{version:s,code:c,multihash:g,bytes:E}=i;return new gr(s,c,g,E??hi(s,c,g.bytes))}else if(i[io]===!0){let{version:s,multihash:c,code:g}=i,E=oi(c);return gr.create(s,g,E)}else return null}static create(e,i,s){if(typeof i!="number")throw new Error("String codecs are no longer supported");if(!(s.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(i!==je)throw new Error(`Version 0 CID must use dag-pb (code: ${je}) block encoding`);return new gr(e,i,s,s.bytes)}case 1:{let c=hi(e,i,s.bytes);return new gr(e,i,s,c)}default:throw new Error("Invalid version")}}static createV0(e){return gr.create(0,je,e)}static createV1(e,i){return gr.create(1,e,i)}static decode(e){let[i,s]=gr.decodeFirst(e);if(s.length!==0)throw new Error("Incorrect length");return i}static decodeFirst(e){let i=gr.inspectBytes(e),s=i.size-i.multihashSize,c=$r(e.subarray(s,s+i.multihashSize));if(c.byteLength!==i.multihashSize)throw new Error("Incorrect length");let g=c.subarray(i.multihashSize-i.digestSize),E=new Ue(i.multihashCode,i.digestSize,g,c);return[i.version===0?gr.createV0(E):gr.createV1(i.codec,E),e.subarray(i.size)]}static inspectBytes(e){let i=0,s=x(()=>{let[mr,Nr]=Oe(e.subarray(i));return i+=Nr,mr},"next"),c=s(),g=je;if(c===18?(c=0,i=0):g=s(),c!==0&&c!==1)throw new RangeError(`Invalid CID version ${c}`);let E=i,L=s(),Z=s(),or=i+Z,fr=or-E;return{version:c,codec:g,multihashCode:L,digestSize:Z,multihashSize:fr,size:or}}static parse(e,i){let[s,c]=ro(e,i),g=gr.decode(c);if(g.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return dn(g).set(s,e),g}};x(gr,"CID");var at=gr;function ro(n,e){switch(n[0]){case"Q":{let i=e??Hr;return[Hr.prefix,i.decode(`${Hr.prefix}${n}`)]}case Hr.prefix:{let i=e??Hr;return[Hr.prefix,i.decode(n)]}case we.prefix:{let i=e??we;return[we.prefix,i.decode(n)]}case Re.prefix:{let i=e??Re;return[Re.prefix,i.decode(n)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}}}x(ro,"parseCIDtoBytes");function eo(n,e,i){let{prefix:s}=i;if(s!==Hr.prefix)throw Error(`Cannot string encode V0 in ${i.name} encoding`);let c=e.get(s);if(c==null){let g=i.encode(n).slice(1);return e.set(s,g),g}else return c}x(eo,"toStringV0");function to(n,e,i){let{prefix:s}=i,c=e.get(s);if(c==null){let g=i.encode(n);return e.set(s,g),g}else return c}x(to,"toStringV1");var je=112,no=18;function hi(n,e,i){let s=Ee(n),c=s+Ee(e),g=new Uint8Array(c+i.byteLength);return Ke(n,g,0),Ke(e,g,s),g.set(i,c),g}x(hi,"encodeCID");var io=Symbol.for("@ipld/js-cid/CID");var gn={...an,...Qt,...on,...Jt,...qt,...en,...tn,...nn,...fn,...rn},Wa={...hn,...yn};function li(n,e,i,s){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:i},decoder:{decode:s}}}x(li,"createCodec");var gi=li("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),ln=li("ascii","a",n=>{let e="a";for(let i=0;i<n.length;i++)e+=String.fromCharCode(n[i]);return e},n=>{n=n.substring(1);let e=Ne(n.length);for(let i=0;i<n.length;i++)e[i]=n.charCodeAt(i);return e}),fo={utf8:gi,"utf-8":gi,hex:gn.base16,latin1:ln,ascii:ln,binary:ln,...gn},st=fo;function Ar(n,e="utf8"){let i=st[e];if(i==null)throw new Error(`Unsupported encoding "${e}"`);return i.decoder.decode(`${i.prefix}${n}`)}x(Ar,"fromString");function ir(n,e="utf8"){let i=st[e];if(i==null)throw new Error(`Unsupported encoding "${e}"`);return i.encoder.encode(n).substring(1)}x(ir,"toString");var _i={};vr(_i,{AES:()=>pr,decryptBytes:()=>Ci,importAesKey:()=>_e});var te="did:key:z",Se="Ed25519",bn="X25519",oo="X25519",An="Ed25519",mn="X25519",bi={sign:["sign","verify"],encrypt:["deriveKey","deriveBits"]},ne="RSA-OAEP",ie="RSASSA-PKCS1-v1_5",ct="SHA-256",yt=new Uint8Array([0,245,2]),xt=2048,ue="SHA-256",Fr=8,Gr="AES-GCM",kr=Gr,Vr=256,Yr=12,ut=new Uint8Array([234,1]),pt=new Uint8Array([237,1]),He={RSA:"rsa",Edwards:"ed25519",BLS:"bls12-381"},ht="rsa-exchange-key",dt="rsa-write-key",Fe="ecc-exchange",Ge="ecc-write",jr=16;var Ai=new Error("Invalid key use. Please use 'encryption' or 'signing"),ao=new Error("Max must be less than 256 and greater than 0");function Dr(n){return new Uint8Array(n).buffer}x(Dr,"toArrayBuffer");async function mi(n){return new Uint8Array(await $.subtle.digest("sha-256",n.buffer))}x(mi,"sha256");function Lr(n){let e=Ar(n,"base64pad");return Dr(e)}x(Lr,"base64ToArrBuf");var pe=x((n,e)=>{if(typeof n=="string")return e(n);if(typeof n=="object"&&n.byteLength!==void 0)return new Uint8Array(n).buffer;throw new Error("Improper value. Must be a string, ArrayBuffer, Uint8Array")},"normalizeToBuf");function gt(n){return pe(n,Lr)}x(gt,"normalizeBase64ToBuf");var so=x(n=>pe(n,e=>wi(e,8)),"normalizeUtf8ToBuf");function wi(n,e){let i=e===8?new Uint8Array(n.length):new Uint16Array(n.length);for(let s=0,c=n.length;s<c;s++)i[s]=n.charCodeAt(s);return i.buffer}x(wi,"strToArrBuf");var co=x(n=>pe(n,e=>wi(e,16)),"normalizeUtf16ToBuf");function fe(n,e){switch(e){case 8:return so(n);default:return co(n)}}x(fe,"normalizeUnicodeToBuf");function lt(n){if(!n.startsWith(te))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let e=""+n.substring(te.length),i=Ar(e,"base58btc"),{keyBuffer:s,type:c}=yo(Dr(i));return{publicKey:new Uint8Array(s),type:c}}x(lt,"didToPublicKey");function yo(n){if(ke(n,Dr(yt)))return{keyBuffer:n.slice(yt.byteLength),type:He.RSA};if(ke(n,Dr(pt)))return{keyBuffer:n.slice(pt.byteLength),type:He.Edwards};if(ke(n,Dr(ut)))return{keyBuffer:n.slice(ut.byteLength),type:He.BLS};throw new Error("Unsupported key algorithm. Try using RSA.")}x(yo,"parseMagicBytes");var xo={equal:x((n,e)=>{let i=new Uint8Array(n),s=new Uint8Array(e);if(i.length!==s.length)return!1;for(let c=0;c<i.length;c++)if(i[c]!==s[c])return!1;return!0},"equal")};function ke(n,e){return xo.equal(e,n.slice(0,e.byteLength))}x(ke,"hasPrefix");function Cr(n){return ir(n instanceof ArrayBuffer?new Uint8Array(n):n,"base64pad")}x(Cr,"toBase64");async function Ve(n,e){let i=typeof n=="string"?Lr(n):Dr(n);return $.subtle.importKey("raw",i,{name:e?.alg||kr,length:e?.length||Vr},!0,["encrypt","decrypt"])}x(Ve,"importKey");function bt(n,{max:e}={max:255}){if(e<1||e>255)throw ao;let i=new Uint8Array(n);if(e===255)return $.getRandomValues(i),i.buffer;let s=0,c=e+1,g=Math.floor(256/c)*c,E=new Uint8Array(1);for(;s<i.length;)$.getRandomValues(E),E[0]<g&&(i[s]=E[0]%c,s++);return i.buffer}x(bt,"randomBuf");function Zr(n,e){let i=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(Dr(n)),s=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(Dr(e)),c=new Uint8Array(i.length+s.length);return c.set(i),c.set(s,i.length),c.buffer}x(Zr,"joinBufs");async function wn(n,e,i,s=!1){let c=s;if(!Object.values(ye).includes(i))throw new Error("invalid key use");let g=i==="exchange"?ne:ie,E=i==="exchange"?["encrypt","decrypt"]:["sign","verify"];return $.subtle.generateKey({name:g,modulusLength:n,publicExponent:uo(),hash:{name:e}},c,E)}x(wn,"makeRSAKeypair");function uo(){return new Uint8Array([1,0,1])}x(uo,"publicExponent");var Ui=$i(Ei(),1);var En={keyTypes:{"bls12-381":{magicBytes:new Uint8Array([234,1]),verify:x(()=>{throw new Error("Not implemented")},"verify")},rsa:{magicBytes:new Uint8Array([0,245,2]),verify:vi},ed25519:{magicBytes:new Uint8Array([237,1]),verify:Si}}};async function Is({message:n,did:e,signature:i}){let s=po(e),c=mt(e).publicKey;if(s==="ed25519")return Si({message:n,publicKey:c,signature:i});if(s==="rsa")return vi({message:n,publicKey:c,signature:i});throw new Error("Unknown key format")}x(Is,"verify");function po(n){try{let{type:e}=mt(n);return e}catch{return"unknown"}}x(po,"getAlgorithm");async function Si({message:n,publicKey:e,signature:i}){let s=n;typeof n=="string"&&(s=Ar(n,"utf8"));let c=i;typeof i=="string"&&(c=Ar(i,"base64pad"));let g=e;if(typeof e=="string"&&(g=mt(e).publicKey),g.length!==32)throw new Error(`Invalid Ed25519 public key size: ${g.length} bytes, expected 32`);if(c.length!==64)throw new Error(`Invalid Ed25519 signature size: ${c.length} bytes, expected 64`);return Ui.default.sign.detached.verify(s,c,g)}x(Si,"ed25519Verify");async function vi({message:n,publicKey:e,signature:i}){let s=e;return typeof e=="string"&&(s=mt(e).publicKey),Jr.verify(n,i,await $.subtle.importKey("spki",Dr(s),{name:ie,hash:ct},!1,["verify"]),8)}x(vi,"rsaVerify");var Jr={verify:x(async function(e,i,s,c=Fr,g=ue){return $.subtle.verify({name:ie,saltLength:jr},typeof s=="string"?await Xe(s,g,"signing"):s,gt(i),fe(e,c))},"rsaVerify"),sign:x(async function(e,i,s=Fr){return $.subtle.sign({name:ie,saltLength:jr},i,fe(e,s))},"sign"),encrypt:x(async function(e,i,s=Fr,c=ue){let g;return typeof i=="string"?g=await Xe(i,c,"exchange"):g=i instanceof Uint8Array?await Xe(Dr(i),c,"exchange"):i,$.subtle.encrypt({name:ne},g,fe(e,s))},"rsaEncrypt"),decrypt:x(async function(e,i){let s=ve(i)?i:await bo(i,["decrypt"]),c;typeof e=="string"?c=Ar(e,"base64pad"):c=e;let g=await $.subtle.decrypt({name:ne},s,c instanceof Uint8Array?Dr(c):c);return new Uint8Array(g)},"rsaDecrypt")};async function Xe(n,e,i){ho(i);let s=i==="exchange"?ne:ie,c=i==="exchange"?["encrypt"]:["verify"],g=typeof n=="string"?Lr(lo(n)):n;return $.subtle.importKey("spki",g,{name:s,hash:{name:e}},!0,c)}x(Xe,"importPublicKey");function ho(n){go(n,["signing","exchange"],Ai)}x(ho,"checkValidKeyUse");function go(n,e,i){if(!e.some(c=>c===n))throw i}x(go,"checkValid");function lo(n){return n.replace(`-----BEGIN PUBLIC KEY-----
|
|
2
2
|
`,"").replace(`
|
|
3
3
|
-----END PUBLIC KEY-----`,"")}x(lo,"stripKeyHeader");function ve(n){return Kn(n,"algorithm")&&Kn(n,"extractable")&&Kn(n,"type")}x(ve,"isCryptoKey");function Kn(n,e){return typeof n=="object"&&n!=null&&e in n}x(Kn,"hasProp");function bo(n,e){return $.subtle.importKey("spki",n instanceof Uint8Array?Dr(n):n,{name:ne,hash:ct},!1,e)}x(bo,"importRsaKey");async function We(n,e="rsa"){let i=n instanceof CryptoKey?new Uint8Array(await qr(n)):n,s=En.keyTypes[e]?.magicBytes;if(!s)throw new Error(`Key type '${e}' not supported, available types: ${Object.keys(En.keyTypes).join(", ")}`);let c=Ht([s,i]);return te+ir(c,"base58btc")}x(We,"publicKeyToDid");async function qr(n){return n instanceof CryptoKey?await $.subtle.exportKey("spki",n):await $.subtle.exportKey("spki",n.publicKey)}x(qr,"getPublicKeyAsArrayBuffer");async function Un(n){let e=await qr(n);return new Uint8Array(e)}x(Un,"getPublicKeyAsUint8Array");function mt(n){if(!n.startsWith(te))throw new Error("Please use a base58-encoded DID formatted `did:key:z...`");let e=n.substr(te.length),i=Ar(e,"base58btc"),s=Object.entries(En.keyTypes).find(([g,E])=>ke(i.buffer,E.magicBytes.buffer));if(!s)throw new Error("Unsupported key algorithm.");let c=i.slice(s[1].magicBytes.length);return s[0]==="ed25519"&&c.length===44?{publicKey:c.slice(-32),type:s[0]}:{publicKey:c,type:s[0]}}x(mt,"didToPublicKey");function Ce(n){return new Uint8Array(n).buffer}x(Ce,"toArrayBuffer");var pr={create(n={alg:kr,length:Vr}){let e=n.length||Vr,i=n.alg||kr;return $.subtle.generateKey({name:i,length:e},!0,["encrypt","decrypt"])},export:Object.assign(async n=>{let e=await $.subtle.exportKey("raw",n);return new Uint8Array(e)},{asString:x(async(n,e)=>{let i=await pr.export(n);return e?ir(i,e):Cr(i)},"asString")}),import(n){return _e(typeof n=="string"?Lr(n):n)},async exportAsString(n){let e=await pr.export(n);return Cr(e)},encrypt:Ao,async decrypt(n,e,i){let s=ve(e)?e:await _e(e),c=i?await $.subtle.decrypt({name:Gr,iv:Ce(i)},s,typeof n=="string"?Ce(Ar(n)):n instanceof Uint8Array?Ce(n):n):await Ci(n,s);return new Uint8Array(c)}};function _e(n,e){return $.subtle.importKey("raw",n instanceof Uint8Array?Ce(n):n,{name:Gr,length:e||256},!0,["encrypt","decrypt"])}x(_e,"importAesKey");async function Ao(n,e,i,s){let c=ve(e)?e:await _e(e),g=s?await $.subtle.encrypt({name:Gr,iv:Ce(s)},c,Ce(n)):await mo(n,c);return i&&i==="arraybuffer"?g:new Uint8Array(g)}x(Ao,"encrypt");async function mo(n,e,i){let s=fe(n,i?.charsize??Fr),c=typeof e=="string"?await Ve(e,i):e,g=i?.iv||bt(Yr),E=await $.subtle.encrypt({name:Gr,iv:g},c,s);return Zr(g,E)}x(mo,"encryptBytes");async function Ci(n,e,i){let s=gt(n),c=typeof e=="string"?await Ve(e,i):e,g=s.slice(0,Yr),E=s.slice(Yr);return await $.subtle.decrypt({name:kr,iv:g},c,E)}x(Ci,"decryptBytes");function wt(n){return new Promise((e,i)=>{n.oncomplete=n.onsuccess=()=>e(n.result),n.onabort=n.onerror=()=>i(n.error)})}x(wt,"promisifyRequest");function wo(n,e){let i,s=x(()=>{if(i)return i;let c=indexedDB.open(n);return c.onupgradeneeded=()=>c.result.createObjectStore(e),i=wt(c),i.then(g=>{g.onclose=()=>i=void 0},()=>{}),i},"getDB");return(c,g)=>s().then(E=>g(E.transaction(e,c).objectStore(e)))}x(wo,"createStore");var Sn;function vn(){return Sn||(Sn=wo("keyval-store","keyval")),Sn}x(vn,"defaultGetStore");function Cn(n,e=vn()){return e("readonly",i=>wt(i.get(n)))}x(Cn,"get");function _n(n,e,i=vn()){return i("readwrite",s=>(s.put(e,n),wt(s.transaction)))}x(_n,"set");function Pi(n,e=vn()){return e("readwrite",i=>(n.forEach(s=>i.delete(s)),wt(i.transaction)))}x(Pi,"delMany");var oe=class oe{constructor(e){M(this,"DID");M(this,"exchangeKey");M(this,"writeKey");M(this,"hasPersisted");M(this,"isSessionOnly");let{keys:i}=e;this.DID=e.did,this.exchangeKey=i.exchange,this.writeKey=i.write,this.hasPersisted=e.hasPersisted,this.isSessionOnly=!!e.isSessionOnly}publicExchangeKeyAsString(e){return this.publicExchangeKey.asString(e)}publicWriteKeyAsString(e){return this.publicWriteKey.asString(e)}get publicWriteKey(){let e=this.writeKey.publicKey;return Object.assign(e,{asString:x(async i=>{let s=await qr(this.writeKey),c=new Uint8Array(s);return i?ir(c,i):Cr(c)},"asString")})}get publicExchangeKey(){let e=this.exchangeKey.publicKey;return Object.assign(e,{asString:x(async i=>{let s=await qr(this.exchangeKey),c=new Uint8Array(s);return i?ir(c,i):Cr(c)},"asString")})}get privateWriteKey(){return this.writeKey.privateKey}get privateExchangeKey(){return this.exchangeKey.privateKey}get deviceName(){return oe.deviceName(this.DID)}static deviceName(e){return Ko(e)}async persist(){if(this.isSessionOnly)return;let e=this.constructor.EXCHANGE_KEY_NAME,i=this.constructor.WRITE_KEY_NAME;await Promise.all([_n(e,this.exchangeKey),_n(i,this.writeKey)]),this.hasPersisted=!0}async delete(){await Pi([this.constructor.EXCHANGE_KEY_NAME,this.constructor.WRITE_KEY_NAME]),this.hasPersisted=!1}async getDeviceName(){return oe.deviceName(this.DID)}static _createExchangeKeys(e){throw new Error("The child should implement this")}static _createWriteKeys(e){throw new Error("The child should implement this")}static async create(e,i,s){let c=s?.exchangeKeys||await this._createExchangeKeys(i),g=s?.writeKeys||await this._createWriteKeys(i),E=await qr(g),L=await We(new Uint8Array(E),this.TYPE==="ecc"?"ed25519":"rsa"),Z=new this({keys:{exchange:c,write:g},did:L,hasPersisted:!1,isSessionOnly:!!e});return this._instance=Z,Z}static async load(e={session:!1}){if(this._instance)return this._instance;let i=!0,s=await Cn(e.encryptionKeyName||this.EXCHANGE_KEY_NAME),c=await Cn(e.signingKeyName||this.WRITE_KEY_NAME);s||(i=!1,s=await this._createExchangeKeys(e.extractable)),c||(i=!1,c=await this._createWriteKeys(e.extractable));let g=await qr(c),E=await We(new Uint8Array(g),this.TYPE==="ecc"?"ed25519":"rsa"),L=new this({keys:{exchange:s,write:c},did:E,hasPersisted:i,isSessionOnly:!!e.session});return this._instance=L,L}};x(oe,"AbstractKeys"),M(oe,"EXCHANGE_KEY_NAME"),M(oe,"WRITE_KEY_NAME"),M(oe,"_instance");var Pe=oe;async function Bi(n,e){let{content:i,publicKey:s}=n,c=e||await pr.create(),g=await pr.encrypt(typeof i=="string"?Ar(i):i,typeof c=="string"?await pr.import(c):c),E=await Pn({key:c,publicKey:s});return Zr(E,g)}x(Bi,"encryptTo");Bi.asString=async function(n,e){let i=await Bi(n,e);return ir(new Uint8Array(i),"base64pad")};async function Pn({key:n,publicKey:e},i){let s;n instanceof CryptoKey?s=await pr.export(n):s=n;let c=await Jr.encrypt(s,e);return i&&i==="arraybuffer"?c:new Uint8Array(c)}x(Pn,"encryptKeyTo");Pn.asString=async function({key:n,publicKey:e},i){let s=await Pn({key:n,publicKey:e});return i?ir(s,i):Cr(s)};async function Ko(n){let e=await mi(new TextEncoder().encode(n.normalize("NFD")));return ir(e,"base32").slice(0,32)}x(Ko,"getDeviceName");function Bn(n){return new Uint8Array(n).buffer}x(Bn,"toArrayBuffer");var Qr=class Qr extends Pe{static async create(e,i,s){return await super.create(e,i,s)}constructor(e){super(e),Qr.EXCHANGE_KEY_NAME=e.exchangeKeyName||ht,Qr.WRITE_KEY_NAME=e.writeKeyName||dt}static async _createExchangeKeys(e=!1){return await wn(xt,ue,"exchange",e)}static async _createWriteKeys(e=!1){return await wn(xt,ue,"write",e)}async toJson(e){let i=this.publicExchangeKey,s=this.DID,c=await $.subtle.exportKey("spki",i);return{publicExchangeKey:e?ir(new Uint8Array(c),e):Cr(c),DID:s}}async sign(e,i=Fr){let s=this.writeKey,c=await Jr.sign(e,s.privateKey,i);return new Uint8Array(c)}async signAsString(e,i){let s=await this.sign(e,i);return Cr(s)}async encrypt(e,i,s,c,g){let E=i||this.exchangeKey.publicKey,L=s,Z=c,or=L||await pr.create({length:Z||g}),fr=await pr.encrypt(typeof e=="string"?Ar(e):e,typeof or=="string"?await pr.import(or):or),mr=await Be({key:or,publicKey:E}),Nr=Zr(mr,fr);return new Uint8Array(Nr)}async encryptAsString(e,i,s,c,g){let E=await this.encrypt(e,i,s,c,g);return ir(E,"base64pad")}async decrypt(e,i,s){let c=(typeof i=="number"?i:void 0)||Vr,g=pe(e,Lr),E=g.slice(0,c),L=g.slice(c),Z=await this.decryptKey(E);return await pr.decrypt(L,Z)}async decryptAsString(e,i,s){let c=await this.decrypt(e,i,s);return ir(c)}async decryptKey(e){return await Jr.decrypt(e,this.exchangeKey.privateKey)}async decryptKeyAsString(e,i){let s=await Jr.decrypt(e,this.exchangeKey.privateKey);return ir(s,i)}async getAesKey(e,i){if(!e)throw new Error("RSA requires an encrypted AES key to decrypt");if(typeof e=="string"){let s=await this.decryptKey(e);return await pr.import(s)}else return e}};x(Qr,"RsaKeys"),M(Qr,"TYPE","rsa"),M(Qr,"INFO","keys"),M(Qr,"EXCHANGE_KEY_NAME",ht),M(Qr,"WRITE_KEY_NAME",dt);var he=Qr;Object.assign(he.prototype.sign,{asString:x(async function(n,e){return this.signAsString(n,e)},"asString")});Object.assign(he.prototype.encrypt,{asString:x(async function(n,e,i,s){return this.encryptAsString(n,e,i,s)},"asString")});Object.assign(he.prototype.decrypt,{asString:x(async function(n,e){return this.decryptAsString(n,e)},"asString")});async function Eo(n,e,i){let s=lt(i),c=await Xe(Bn(s.publicKey),"SHA-256","signing");try{return Jr.verify(n,e,c)}catch{return!1}}x(Eo,"verify");Object.assign(he.prototype.decryptKey,{asString:x(async function(n,e){return this.decryptKeyAsString(n,e)},"asString")});async function Ti(n,e){let{content:i,publicKey:s}=n,c=e||await pr.create(),g=await pr.encrypt(typeof i=="string"?Ar(i):i,typeof c=="string"?await pr.import(c):c),E=await Be({key:c,publicKey:s});return Zr(E,g)}x(Ti,"encryptTo");Ti.asString=async function(n,e){let{content:i,publicKey:s}=n,c=e||await pr.create(),g=await pr.encrypt(typeof i=="string"?Ar(i):i,typeof c=="string"?await pr.import(c):c,"arraybuffer"),E=await Be({key:c,publicKey:s}),L=Zr(E,g);return ir(new Uint8Array(L),"base64pad")};async function Be({key:n,publicKey:e},i){let s;n instanceof CryptoKey?s=await pr.export(n):s=n;let c=await Jr.encrypt(s,e);return i&&i==="arraybuffer"?c:new Uint8Array(c)}x(Be,"encryptKeyTo");Be.asString=async function({key:n,publicKey:e},i){let s=await Be({key:n,publicKey:e});return i?ir(s,i):Cr(s)};async function Uo(n,e,i,s){let c=ve(e)?e:await _e(e),g=s?await $.subtle.encrypt({name:Gr,iv:Bn(s)},c,Bn(n)):await So(n,c);return i&&i==="arraybuffer"?g:new Uint8Array(g)}x(Uo,"encrypt");async function So(n,e,i){let s=fe(n,i?.charsize??Fr),c=typeof e=="string"?await Ve(e,i):e,g=i?.iv||bt(Yr),E=await $.subtle.encrypt({name:Gr,iv:g},c,s);return Zr(g,E)}x(So,"encryptBytes");var Mi={};vr(Mi,{EccKeys:()=>ae,default:()=>_o,exportPublicKey:()=>Et,importPublicKey:()=>$e,verify:()=>Po});var uc=new Error("Key does not exist. Make sure you properly instantiated the keystore."),pc=new Error("Retrieved a symmetric key when an asymmetric keypair was expected. Please use a different key name."),hc=new Error("Retrieved an asymmetric keypair when an symmetric key was expected. Please use a different key name."),dc=new Error("ECC is not enabled for this browser. Please use RSA instead."),gc=new Error("Cryptosystem not supported. Please use ECC or RSA"),vo=new Error("Invalid key use. Please use 'exchange' or 'write'"),lc=new Error("Max must be less than 256 and greater than 0");function Ii(n){Co(n,["exchange","write","signing"],vo)}x(Ii,"checkValidKeyUse");function Co(n,e,i){if(!e.some(c=>c===n))throw i}x(Co,"checkValid");function Ze(n){return new Uint8Array(n).buffer}x(Ze,"toArrayBuffer");var Br=class Br extends Pe{static async create(e,i,s){return await super.create(e,i,s)}constructor(e){super(e),Br.EXCHANGE_KEY_NAME=e.exchangeKeyName||Fe,Br.WRITE_KEY_NAME=e.writeKeyName||Ge}get publicExchangeKey(){let e=this.exchangeKey.publicKey;return Object.assign(e,{asString:x(async i=>{let s=await Et(this.exchangeKey),c=new Uint8Array(s);return i?ir(c,i):Cr(s)},"asString")})}get publicWriteKey(){let e=this.writeKey.publicKey;return Object.assign(e,{asString:x(async i=>{let s=await Et(this.writeKey),c=new Uint8Array(s);return i?ir(c,i):Cr(s)},"asString")})}static async _createExchangeKeys(e=!1){return await $.subtle.generateKey({name:mn},e,["deriveKey","deriveBits"])}static async _createWriteKeys(e=!1){return await $.subtle.generateKey({name:An},e,["sign","verify"])}static async load(e={session:!1}){if(this._instance)return this._instance;let i=e.encryptionKeyName||Fe,s=e.signingKeyName||Ge;return super.load({...e,encryptionKeyName:i,signingKeyName:s})}async toJson(e){let i=this.DID,s=await Et(this.exchangeKey);return{publicExchangeKey:e?ir(new Uint8Array(s),e):Cr(s),DID:i}}async encrypt(e,i,s,c,g){let E=new TextEncoder,L=crypto.getRandomValues(new Uint8Array(jr)),Z=i||this.exchangeKey.publicKey,or;typeof Z=="string"?or=await $e(Z,"X25519","exchange"):or=Z;let fr=c||await Kt(this.exchangeKey.privateKey,or,L,s||Br.INFO,g);fr instanceof CryptoKey||(fr=await Kt(this.exchangeKey.privateKey,or,L,s||Br.INFO));let mr=crypto.getRandomValues(new Uint8Array(Yr)),Nr=typeof e=="string"?E.encode(e):e,de=await crypto.subtle.encrypt({name:kr,iv:mr},fr,Ze(Nr)),J=new Uint8Array(L),xr=new Uint8Array(mr),_r=new Uint8Array(de),Ur=J.length+xr.length+_r.length,lr=new Uint8Array(Ur);return lr.set(J,0),lr.set(xr,J.length),lr.set(_r,J.length+xr.length),lr}async encryptAsString(e,i,s,c,g){let E=await this.encrypt(e,i,s||Br.INFO,c,g);return ir(new Uint8Array(E),"base64pad")}async decrypt(e,i,s,c){let g=typeof i=="string"?await $e(i,"X25519","write"):i;g||(g=this.publicExchangeKey);let E=pe(e,Lr),L=E.slice(0,jr),Z=E.slice(jr,jr+Yr),or=E.slice(jr+Yr),{privateKey:fr}=this.exchangeKey,mr=await Kt(fr,g,L,c||Br.INFO);return await crypto.subtle.decrypt({name:s||kr,iv:Z},mr,or)}async decryptAsString(e,i,s,c){let g=await this.decrypt(e,i,s,c);return ir(new Uint8Array(g))}async getAesKey(e,i){e||(e=this.publicExchangeKey);let s;typeof e=="string"?s=await $e(e,"X25519","exchange"):s=e;let c=crypto.getRandomValues(new Uint8Array(jr));return await Kt(this.exchangeKey.privateKey,s,c,i||Br.INFO)}async sign(e,i){let s=new TextEncoder,c;typeof e=="string"?c=s.encode(e):e instanceof ArrayBuffer?c=new Uint8Array(e):c=e;let g=await $.subtle.sign({name:Se},this.writeKey.privateKey,Ze(c));return new Uint8Array(g)}async signAsString(e,i){let s=await this.sign(e,i);return ir(s,"base64pad")}};x(Br,"EccKeys"),M(Br,"TYPE","ecc"),M(Br,"EXCHANGE_KEY_NAME",Fe),M(Br,"WRITE_KEY_NAME",Ge),M(Br,"INFO","keys");var ae=Br;Object.assign(ae.prototype.sign,{asString:x(async function(n,e){let i=await this.sign(n,e);return ir(i,"base64pad")},"asString")});async function Et(n,e="raw"){return await crypto.subtle.exportKey(e,n.publicKey)}x(Et,"exportPublicKey");async function $e(n,e,i){Ii(i);let s=i==="exchange"?bn:Se,c=i==="exchange"?[]:["verify"],g=Lr(n),E=e==="X25519"?{name:s}:{name:s,namedCurve:e};return $.subtle.importKey("raw",g,E,!0,c)}x($e,"importPublicKey");var _o={EccKeys:ae,importPublicKey:$e};Object.assign(ae.prototype.encrypt,{asString:x(async function(n,e,i,s,c){return this.encryptAsString(n,e,i,s,c)},"asString")});Object.assign(ae.prototype.decrypt,{asString:x(async function(n,e,i){return this.decryptAsString(n,e,i)},"asString")});Object.assign(ae.prototype.sign,{asString:x(async function(n,e){return this.signAsString(n,e)},"asString")});async function Po(n,e,i){try{let s=lt(i);if(s.type!=="ed25519")throw new Error(`Expected Ed25519 key for ECC verification, got ${s.type}`);let c=s.publicKey.slice(-32),g=await $.subtle.importKey("raw",c,{name:Se},!0,["verify"]),E=new TextEncoder,L;typeof n=="string"?L=E.encode(n):n instanceof ArrayBuffer?L=new Uint8Array(n):L=n;let Z;return typeof e=="string"?Z=new Uint8Array(Lr(e)):Z=e,await $.subtle.verify({name:Se},g,Ze(Z),Ze(L))}catch{return!1}}x(Po,"verify");async function Kt(n,e,i,s,c){let g=new TextEncoder,E=await crypto.subtle.deriveBits({name:"X25519",public:e},n,256),L=await crypto.subtle.importKey("raw",E,"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:i instanceof Uint8Array?Ze(i):i,info:g.encode(s)},L,{name:"AES-GCM",length:c||Vr},!1,["encrypt","decrypt"])}x(Kt,"deriveKey");export{Gr as AES_GCM,Pe as AbstractKeys,te as BASE58_DID_PREFIX,ut as BLS_DID_PREFIX,jt as CharSize,$n as CryptoSystem,Fr as DEFAULT_CHAR_SIZE,Fe as DEFAULT_ECC_EXCHANGE,oo as DEFAULT_ECC_EXCHANGE_CURVE,Ge as DEFAULT_ECC_WRITE,ue as DEFAULT_HASH_ALGORITHM,ht as DEFAULT_RSA_EXCHANGE,xt as DEFAULT_RSA_SIZE,dt as DEFAULT_RSA_WRITE,kr as DEFAULT_SYMM_ALGORITHM,Vr as DEFAULT_SYMM_LENGTH,bn as ECC_EXCHANGE_ALG,mn as ECC_EXCHANGE_NAME,Se as ECC_WRITE_ALG,An as ECC_WRITE_NAME,pt as EDWARDS_DID_PREFIX,Yt as EccCurve,Ot as HashAlg,Yr as IV_LENGTH,He as KEY_TYPE,bi as KEY_USE,ye as KeyUse,ne as RSA_ALGORITHM,yt as RSA_DID_PREFIX,ct as RSA_HASHING_ALGORITHM,ie as RSA_SIGN_ALGORITHM,Xn as RsaSize,jr as SALT_LENGTH,Wn as SymmKeyLength,_i as aes,ho as checkValidKeyUse,En as did,mt as didToPublicKey,Mi as ecc,Si as ed25519Verify,Pn as encryptKeyTo,Bi as encryptTo,po as getAlgorithm,Ko as getDeviceName,qr as getPublicKeyAsArrayBuffer,Un as getPublicKeyAsUint8Array,Xe as importPublicKey,bo as importRsaKey,ve as isCryptoKey,We as publicKeyToDid,Di as rsa,Jr as rsaOperations,vi as rsaVerify,Is as verify};
|
|
4
4
|
//# sourceMappingURL=index.min.js.map
|