oneie 5.10.2 → 5.10.3
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/README.md +1 -0
- package/dist/package.json +1 -1
- package/dist/src/{age-8m0v06sc.js → age-74tmaw4t.js} +1 -1
- package/dist/src/client-3daam667.js +1 -0
- package/dist/src/{evm-tx-mfhhgpsb.js → evm-tx-33z1n2zx.js} +1 -1
- package/dist/src/{hl-run-z8bwmhf8.js → hl-run-bx11y304.js} +1 -1
- package/dist/src/{index-abbkxz62.js → index-exa86q8e.js} +7 -7
- package/dist/src/{index-sdgefh6q.js → index-stdwesmk.js} +1 -1
- package/dist/src/index.js +261 -256
- package/dist/src/{message-key-eqq90drz.js → message-key-sy2jmj5v.js} +1 -1
- package/dist/src/{message-lock-y872a869.js → message-lock-9p4jbjtc.js} +1 -1
- package/dist/src/{sweep-runner-f1ee3pdt.js → sweep-runner-mk3ek1mk.js} +1 -1
- package/dist/src/{wallet-zjprdjn2.js → wallet-e3473qat.js} +1 -1
- package/package.json +1 -1
- package/dist/src/client-vgmvv2zt.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{k,d,$e,p,_,H,ie,Vt,Te,S}from"./index-abbkxz62.js";/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function jt(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function dt(t){if(typeof t!=="boolean")throw TypeError(`boolean expected, not ${t}`)}function ft(t){if(typeof t!=="number")throw TypeError("number expected, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw RangeError("positive integer expected, got "+t)}function j(t,e,o=""){let n=jt(t),r=t?.length,i=e!==void 0;if(!n||i&&r!==e){let s=o&&`"${o}" `,a=i?` of length ${e}`:"",f=n?`length=${r}`:`type=${typeof t}`,h=s+"expected Uint8Array"+a+", got "+f;if(!n)throw TypeError(h);throw RangeError(h)}return t}function wt(t,e=!0){if(t.destroyed)throw Error("Hash instance has been destroyed");if(e&&t.finished)throw Error("Hash#digest() has already been called")}function bt(t,e,o=!1){j(t,void 0,"output");let n=e.outputLen;if(t.length<n)throw RangeError("digestInto() expects output buffer of length at least "+n);if(o&&!ct(t))throw Error("invalid output, must be aligned")}function Y(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function V(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function $t(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}var et=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),Wt=(t)=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var Xt=(t)=>{for(let e=0;e<t.length;e++)t[e]=Wt(t[e]);return t},Z=et?(t)=>t:Xt;function mt(t,e){if(e==null||typeof e!=="object")throw Error("options must be defined");return Object.assign(t,e)}function Lt(t,e){if(t.length!==e.length)return!1;let o=0;for(let n=0;n<t.length;n++)o|=t[n]^e[n];return o===0}function Ut(t,e,o){let n=e,r=o||(()=>[]),i=(a,f)=>n(f,...r(a)).update(a).digest(),s=n(new Uint8Array(t),...r(new Uint8Array(0)));return i.outputLen=s.outputLen,i.blockLen=s.blockLen,i.create=(a,...f)=>n(a,...f),i}var Et=(t,e)=>{function o(n,...r){if(j(n,void 0,"key"),t.nonceLength!==void 0){let l=r[0];j(l,t.varSizeNonce?void 0:t.nonceLength,"nonce")}let i=t.tagLength;if(i&&r[1]!==void 0)j(r[1],void 0,"AAD");let s=e(n,...r),a=(l,y)=>{if(y!==void 0){if(l!==2)throw Error("cipher output not supported");j(y,void 0,"output")}},f=!1;return{encrypt(l,y){if(f)throw Error("cannot encrypt() twice with same key + nonce");return f=!0,j(l),a(s.encrypt.length,y),s.encrypt(l,y)},decrypt(l,y){if(j(l),i&&l.length<i)throw Error('"ciphertext" expected length bigger than tagLength='+i);return a(s.decrypt.length,y),s.decrypt(l,y)}}}return Object.assign(o,t),o};function ht(t,e,o=!0){if(e===void 0)return new Uint8Array(t);if(j(e,void 0,"output"),e.length!==t)throw Error('"output" expected Uint8Array of length '+t+", got: "+e.length);if(o&&!ct(e))throw Error("invalid output, must be aligned");return e}function _t(t,e,o){ft(t),ft(e),dt(o);let n=new Uint8Array(16),r=$t(n);return r.setBigUint64(0,BigInt(e),o),r.setBigUint64(8,BigInt(t),o),n}function ct(t){return t.byteOffset%4===0}function at(t){return Uint8Array.from(j(t))}var Tt=(t)=>Uint8Array.from(t.split(""),(e)=>e.charCodeAt(0)),Ft=(()=>Z(Y(Tt("expand 16-byte k"))))(),Gt=(()=>Z(Y(Tt("expand 32-byte k"))))();function m(t,e){return t<<e|t>>>32-e}var lt=64,Dt=16,gt=(()=>4294967295)(),Bt=Uint32Array.of();function Yt(t,e,o,n,r,i,s,a){let f=r.length,h=new Uint8Array(lt),l=Y(h),y=et&&ct(r)&&ct(i),x=y?Y(r):Bt,g=y?Y(i):Bt;if(!et){for(let w=0;w<f;s++){if(t(e,o,n,l,s,a),Z(l),s>=gt)throw Error("arx: counter overflow");let b=Math.min(lt,f-w);for(let U=0,L;U<b;U++)L=w+U,i[L]=r[L]^h[U];w+=b}return}for(let w=0;w<f;s++){if(t(e,o,n,l,s,a),s>=gt)throw Error("arx: counter overflow");let b=Math.min(lt,f-w);if(y&&b===lt){let U=w/4;if(w%4!==0)throw Error("arx: invalid block position");for(let L=0,W;L<Dt;L++)W=U+L,g[W]=x[W]^l[L];w+=lt;continue}for(let U=0,L;U<b;U++)L=w+U,i[L]=r[L]^h[U];w+=b}}function It(t,e){let{allowShortKeys:o,extendNonceFn:n,counterLength:r,counterRight:i,rounds:s}=mt({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!=="function")throw Error("core must be a function");return ft(r),ft(s),dt(i),dt(o),(a,f,h,l,y=0)=>{j(a,void 0,"key"),j(f,void 0,"nonce"),j(h,void 0,"data");let x=h.length;if(l=ht(x,l,!1),ft(y),y<0||y>=gt)throw Error("arx: counter overflow");let g=[],w=a.length,b,U;if(w===32)g.push(b=at(a)),U=Gt;else if(w===16&&o)b=new Uint8Array(32),b.set(a),b.set(a,16),U=Ft,g.push(b);else throw j(a,32,"arx key"),Error("invalid key size");if(!et||!ct(f))g.push(f=at(f));let L=Y(b);if(n){if(f.length!==24)throw Error("arx: extended nonce must be 24 bytes");let D=f.subarray(0,16);if(et)n(U,L,Y(D),L);else{let J=Z(Uint32Array.from(U));n(J,L,Y(D),L),V(J),Z(L)}f=f.subarray(16)}else if(!et)Z(L);let W=16-r;if(W!==f.length)throw Error(`arx: nonce must be ${W} or 16 bytes`);if(W!==12){let D=new Uint8Array(12);D.set(f,i?0:12-f.length),f=D,g.push(f)}let tt=Z(Y(f));try{return Yt(t,U,L,tt,h,l,y,s),l}finally{V(...g)}}}function X(t,e){return t[e++]&255|(t[e++]&255)<<8}class kt{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(t){t=at(j(t,32,"key"));let e=X(t,0),o=X(t,2),n=X(t,4),r=X(t,6),i=X(t,8),s=X(t,10),a=X(t,12),f=X(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|o<<3)&8191,this.r[2]=(o>>>10|n<<6)&7939,this.r[3]=(n>>>7|r<<9)&8191,this.r[4]=(r>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|s<<2)&8191,this.r[7]=(s>>>11|a<<5)&8065,this.r[8]=(a>>>8|f<<8)&8191,this.r[9]=f>>>5&127;for(let h=0;h<8;h++)this.pad[h]=X(t,16+2*h)}process(t,e,o=!1){let n=o?0:2048,{h:r,r:i}=this,s=i[0],a=i[1],f=i[2],h=i[3],l=i[4],y=i[5],x=i[6],g=i[7],w=i[8],b=i[9],U=X(t,e+0),L=X(t,e+2),W=X(t,e+4),tt=X(t,e+6),D=X(t,e+8),J=X(t,e+10),F=X(t,e+12),G=X(t,e+14),E=r[0]+(U&8191),B=r[1]+((U>>>13|L<<3)&8191),T=r[2]+((L>>>10|W<<6)&8191),I=r[3]+((W>>>7|tt<<9)&8191),A=r[4]+((tt>>>4|D<<12)&8191),R=r[5]+(D>>>1&8191),C=r[6]+((D>>>14|J<<2)&8191),O=r[7]+((J>>>11|F<<5)&8191),N=r[8]+((F>>>8|G<<8)&8191),M=r[9]+(G>>>5|n),u=0,K=u+E*s+B*(5*b)+T*(5*w)+I*(5*g)+A*(5*x);u=K>>>13,K&=8191,K+=R*(5*y)+C*(5*l)+O*(5*h)+N*(5*f)+M*(5*a),u+=K>>>13,K&=8191;let P=u+E*a+B*s+T*(5*b)+I*(5*w)+A*(5*g);u=P>>>13,P&=8191,P+=R*(5*x)+C*(5*y)+O*(5*l)+N*(5*h)+M*(5*f),u+=P>>>13,P&=8191;let z=u+E*f+B*a+T*s+I*(5*b)+A*(5*w);u=z>>>13,z&=8191,z+=R*(5*g)+C*(5*x)+O*(5*y)+N*(5*l)+M*(5*h),u+=z>>>13,z&=8191;let v=u+E*h+B*f+T*a+I*s+A*(5*b);u=v>>>13,v&=8191,v+=R*(5*w)+C*(5*g)+O*(5*x)+N*(5*y)+M*(5*l),u+=v>>>13,v&=8191;let q=u+E*l+B*h+T*f+I*a+A*s;u=q>>>13,q&=8191,q+=R*(5*b)+C*(5*w)+O*(5*g)+N*(5*x)+M*(5*y),u+=q>>>13,q&=8191;let nt=u+E*y+B*l+T*h+I*f+A*a;u=nt>>>13,nt&=8191,nt+=R*s+C*(5*b)+O*(5*w)+N*(5*g)+M*(5*x),u+=nt>>>13,nt&=8191;let ot=u+E*x+B*y+T*l+I*h+A*f;u=ot>>>13,ot&=8191,ot+=R*a+C*s+O*(5*b)+N*(5*w)+M*(5*g),u+=ot>>>13,ot&=8191;let rt=u+E*g+B*x+T*y+I*l+A*h;u=rt>>>13,rt&=8191,rt+=R*f+C*a+O*s+N*(5*b)+M*(5*w),u+=rt>>>13,rt&=8191;let st=u+E*w+B*g+T*x+I*y+A*l;u=st>>>13,st&=8191,st+=R*h+C*f+O*a+N*s+M*(5*b),u+=st>>>13,st&=8191;let it=u+E*b+B*w+T*g+I*x+A*y;u=it>>>13,it&=8191,it+=R*l+C*h+O*f+N*a+M*s,u+=it>>>13,it&=8191,u=(u<<2)+u|0,u=u+K|0,K=u&8191,u=u>>>13,P+=u,r[0]=K,r[1]=P,r[2]=z,r[3]=v,r[4]=q,r[5]=nt,r[6]=ot,r[7]=rt,r[8]=st,r[9]=it}finalize(){let{h:t,pad:e}=this,o=new Uint16Array(10),n=t[1]>>>13;t[1]&=8191;for(let s=2;s<10;s++)t[s]+=n,n=t[s]>>>13,t[s]&=8191;t[0]+=n*5,n=t[0]>>>13,t[0]&=8191,t[1]+=n,n=t[1]>>>13,t[1]&=8191,t[2]+=n,o[0]=t[0]+5,n=o[0]>>>13,o[0]&=8191;for(let s=1;s<10;s++)o[s]=t[s]+n,n=o[s]>>>13,o[s]&=8191;o[9]-=8192;let r=(n^1)-1;for(let s=0;s<10;s++)o[s]&=r;r=~r;for(let s=0;s<10;s++)t[s]=t[s]&r|o[s];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let i=t[0]+e[0];t[0]=i&65535;for(let s=1;s<8;s++)i=(t[s]+e[s]|0)+(i>>>16)|0,t[s]=i&65535;V(o)}update(t){wt(this),j(t),t=at(t);let{buffer:e,blockLen:o}=this,n=t.length;for(let r=0;r<n;){let i=Math.min(o-this.pos,n-r);if(i===o){for(;o<=n-r;r+=o)this.process(t,r);continue}if(e.set(t.subarray(r,r+i),this.pos),this.pos+=i,r+=i,this.pos===o)this.process(e,0,!1),this.pos=0}return this}destroy(){this.destroyed=!0,V(this.h,this.r,this.buffer,this.pad)}digestInto(t){wt(this),bt(t,this),this.finished=!0;let{buffer:e,h:o}=this,{pos:n}=this;if(n){e[n++]=1;for(;n<16;n++)e[n]=0;this.process(e,0,!0)}this.finalize();let r=0;for(let i=0;i<8;i++)t[r++]=o[i]>>>0,t[r++]=o[i]>>>8}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let o=t.slice(0,e);return this.destroy(),o}}var At=Ut(32,(t)=>new kt(t));function qt(t,e,o,n,r,i=20){let s=t[0],a=t[1],f=t[2],h=t[3],l=e[0],y=e[1],x=e[2],g=e[3],w=e[4],b=e[5],U=e[6],L=e[7],W=r,tt=o[0],D=o[1],J=o[2],F=s,G=a,E=f,B=h,T=l,I=y,A=x,R=g,C=w,O=b,N=U,M=L,u=W,K=tt,P=D,z=J;for(let q=0;q<i;q+=2)F=F+T|0,u=m(u^F,16),C=C+u|0,T=m(T^C,12),F=F+T|0,u=m(u^F,8),C=C+u|0,T=m(T^C,7),G=G+I|0,K=m(K^G,16),O=O+K|0,I=m(I^O,12),G=G+I|0,K=m(K^G,8),O=O+K|0,I=m(I^O,7),E=E+A|0,P=m(P^E,16),N=N+P|0,A=m(A^N,12),E=E+A|0,P=m(P^E,8),N=N+P|0,A=m(A^N,7),B=B+R|0,z=m(z^B,16),M=M+z|0,R=m(R^M,12),B=B+R|0,z=m(z^B,8),M=M+z|0,R=m(R^M,7),F=F+I|0,z=m(z^F,16),N=N+z|0,I=m(I^N,12),F=F+I|0,z=m(z^F,8),N=N+z|0,I=m(I^N,7),G=G+A|0,u=m(u^G,16),M=M+u|0,A=m(A^M,12),G=G+A|0,u=m(u^G,8),M=M+u|0,A=m(A^M,7),E=E+R|0,K=m(K^E,16),C=C+K|0,R=m(R^C,12),E=E+R|0,K=m(K^E,8),C=C+K|0,R=m(R^C,7),B=B+T|0,P=m(P^B,16),O=O+P|0,T=m(T^O,12),B=B+T|0,P=m(P^B,8),O=O+P|0,T=m(T^O,7);let v=0;n[v++]=s+F|0,n[v++]=a+G|0,n[v++]=f+E|0,n[v++]=h+B|0,n[v++]=l+T|0,n[v++]=y+I|0,n[v++]=x+A|0,n[v++]=g+R|0,n[v++]=w+C|0,n[v++]=b+O|0,n[v++]=U+N|0,n[v++]=L+M|0,n[v++]=W+u|0,n[v++]=tt+K|0,n[v++]=D+P|0,n[v++]=J+z|0}var Zt=It(qt,{counterRight:!1,counterLength:4,allowShortKeys:!1});var Qt=new Uint8Array(16),Rt=(t,e)=>{t.update(e);let o=e.length%16;if(o)t.update(Qt.subarray(o))},Jt=new Uint8Array(32);function Ct(t,e,o,n,r){if(r!==void 0)j(r,void 0,"AAD");let i=t(e,o,Jt),s=_t(n.length,r?r.length:0,!0),a=At.create(i);if(r)Rt(a,r);Rt(a,n),a.update(s);let f=a.digest();return V(i,s),f}var te=(t)=>(e,o,n)=>({encrypt(i,s){let a=i.length;s=ht(a+16,s,!1),s.set(i);let f=s.subarray(0,-16);t(e,o,f,f,1);let h=Ct(t,e,o,f,n);return s.set(h,a),V(h),s},decrypt(i,s){s=ht(i.length-16,s,!1);let a=i.subarray(0,-16),f=i.subarray(-16),h=Ct(t,e,o,a,n);if(!Lt(f,h))throw V(h),Error("invalid tag");return s.set(i.subarray(0,-16)),t(e,o,s,s,1),V(h),s}}),ut=Et({blockSize:64,nonceLength:12,tagLength:16},te(Zt));var pt=Uint8Array.of(0),ee=Uint8Array.of();function ne(t,e,o,n=32,r){$e(t),k(n,"length"),d(e,void 0,"prk");let i=t.outputLen;if(e.length<i)throw Error('"prk" must be at least HashLen octets');if(n>255*i)throw Error("Length must be <= 255*HashLen");let s=Math.ceil(n/i);if(o===void 0)o=ee;else d(o,void 0,"info");if(!s){if(r)p(e);return new Uint8Array}let a=r&&s===1?e:new Uint8Array(s*i),{iHash:f,oHash:h}=H.create(t,e),l=r?e:new Uint8Array(i),y=s>1?r?.iHash||t.create():void 0;for(let g=0;g<s-1;g++){pt[0]=g+1;let w=f._cloneInto(y);if(g)w.update(l);w.update(o).update(pt).digestInto(l),h._cloneInto(y).update(l).digestInto(l),a.set(l,i*g)}if(pt[0]=s,s>1)f.update(l);if(f.update(o).update(pt).digestInto(l),h.update(l).digestInto(l),a.set(l,i*(s-1)),f.destroy(),h.destroy(),y?.destroy(),l!==a)p(l);if(p(pt),n===a.length)return a;let x=a.slice(0,n);return p(a),x}var Se=(t,e,o,n,r)=>{if($e(t),o===void 0)o=new Uint8Array(t.outputLen);let i=H.create(t,o).update(e);return ne(t,i.digest(),n,r,i)};var sn="age-encryption.org/v1",Be="-----BEGIN AGE ENCRYPTED FILE-----",Ht="-----END AGE ENCRYPTED FILE-----",Ot="age-encryption.org/v1/X25519",St="age",Nt="age-secret-key-",yt=65536,In=128,xt=16,oe=new TextEncoder,Mt=new TextDecoder,Q=(t)=>oe.encode(t);class c extends Error{code;constructor(t,e){super(e);this.code=t,this.name="AgeError"}}function zt(t){if(t.length!==32)throw new c("bad_key","an X25519 public key is 32 bytes");return S.encode(St,S.toWords(t),!1)}function jn(t){let e=t.trim(),o;try{o=S.decode(e,!1)}catch{throw new c("bad_key","not an age recipient (age1…)")}if(o.prefix!==St)throw new c("bad_key",`not an age recipient: prefix ${o.prefix}`);let n=S.fromWords(o.words);if(n.length!==32)throw new c("bad_key","an age recipient carries 32 bytes");return n}function an(t){if(t.length!==32)throw new c("bad_key","an X25519 secret is 32 bytes");return S.encode(Nt,S.toWords(t),!1).toUpperCase()}function Mn(t){let e=t.trim().toLowerCase(),o;try{o=S.decode(e,!1)}catch{throw new c("bad_key","not an age identity (AGE-SECRET-KEY-1…)")}if(o.prefix!==Nt)throw new c("bad_key",`not an age identity: prefix ${o.prefix}`);let n=S.fromWords(o.words);if(n.length!==32)throw new c("bad_key","an age identity carries 32 bytes");return n}function Fn(t){return zt(ie.getPublicKey(t))}function re(t,e){let o=ie.utils.randomSecretKey(),n=null,r=null;try{let i=ie.getPublicKey(o);try{n=ie.getSharedSecret(o,e)}catch{throw new c("bad_key","low-order recipient point")}if(n.every((f)=>f===0))throw new c("bad_key","low-order recipient point");let s=new Uint8Array(64);s.set(i,0),s.set(e,32),r=Se(_,n,s,Q(Ot),32);let a=ut(r,new Uint8Array(12)).encrypt(t);return{share:i,body:a}}finally{o.fill(0),n?.fill(0),r?.fill(0)}}function vt(t,e){let o=Se(_,t,new Uint8Array(0),Q("header"),32),n=H(_,o,e);return o.fill(0),n}function Kt(t,e){let o=new Uint8Array(12),n=t;for(let r=10;r>=0&&n>0;r--)o[r]=n%256,n=Math.floor(n/256);return o[11]=e?1:0,o}function Pt(t){let e=new Uint8Array(t.reduce((n,r)=>n+r.length,0)),o=0;for(let n of t)e.set(n,o),o+=n.length;return e}function Nn(t,e){if(e.length===0)throw new c("bad_key","seal it for at least one recipient");let o=e.map(jn),n=crypto.getRandomValues(new Uint8Array(16));try{let r=[sn];for(let x of o){let{share:g,body:w}=re(n,x);r.push(`-> X25519 ${Te.encode(g)}`,Te.encode(w))}r.push("---");let i=Q(r.join(`
|
|
1
|
+
import{k,d,$e,p,_,H,ie,Vt,Te,S}from"./index-exa86q8e.js";/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function jt(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function dt(t){if(typeof t!=="boolean")throw TypeError(`boolean expected, not ${t}`)}function ft(t){if(typeof t!=="number")throw TypeError("number expected, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw RangeError("positive integer expected, got "+t)}function j(t,e,o=""){let n=jt(t),r=t?.length,i=e!==void 0;if(!n||i&&r!==e){let s=o&&`"${o}" `,a=i?` of length ${e}`:"",f=n?`length=${r}`:`type=${typeof t}`,h=s+"expected Uint8Array"+a+", got "+f;if(!n)throw TypeError(h);throw RangeError(h)}return t}function wt(t,e=!0){if(t.destroyed)throw Error("Hash instance has been destroyed");if(e&&t.finished)throw Error("Hash#digest() has already been called")}function bt(t,e,o=!1){j(t,void 0,"output");let n=e.outputLen;if(t.length<n)throw RangeError("digestInto() expects output buffer of length at least "+n);if(o&&!ct(t))throw Error("invalid output, must be aligned")}function Y(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function V(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function $t(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}var et=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)(),Wt=(t)=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var Xt=(t)=>{for(let e=0;e<t.length;e++)t[e]=Wt(t[e]);return t},Z=et?(t)=>t:Xt;function mt(t,e){if(e==null||typeof e!=="object")throw Error("options must be defined");return Object.assign(t,e)}function Lt(t,e){if(t.length!==e.length)return!1;let o=0;for(let n=0;n<t.length;n++)o|=t[n]^e[n];return o===0}function Ut(t,e,o){let n=e,r=o||(()=>[]),i=(a,f)=>n(f,...r(a)).update(a).digest(),s=n(new Uint8Array(t),...r(new Uint8Array(0)));return i.outputLen=s.outputLen,i.blockLen=s.blockLen,i.create=(a,...f)=>n(a,...f),i}var Et=(t,e)=>{function o(n,...r){if(j(n,void 0,"key"),t.nonceLength!==void 0){let l=r[0];j(l,t.varSizeNonce?void 0:t.nonceLength,"nonce")}let i=t.tagLength;if(i&&r[1]!==void 0)j(r[1],void 0,"AAD");let s=e(n,...r),a=(l,y)=>{if(y!==void 0){if(l!==2)throw Error("cipher output not supported");j(y,void 0,"output")}},f=!1;return{encrypt(l,y){if(f)throw Error("cannot encrypt() twice with same key + nonce");return f=!0,j(l),a(s.encrypt.length,y),s.encrypt(l,y)},decrypt(l,y){if(j(l),i&&l.length<i)throw Error('"ciphertext" expected length bigger than tagLength='+i);return a(s.decrypt.length,y),s.decrypt(l,y)}}}return Object.assign(o,t),o};function ht(t,e,o=!0){if(e===void 0)return new Uint8Array(t);if(j(e,void 0,"output"),e.length!==t)throw Error('"output" expected Uint8Array of length '+t+", got: "+e.length);if(o&&!ct(e))throw Error("invalid output, must be aligned");return e}function _t(t,e,o){ft(t),ft(e),dt(o);let n=new Uint8Array(16),r=$t(n);return r.setBigUint64(0,BigInt(e),o),r.setBigUint64(8,BigInt(t),o),n}function ct(t){return t.byteOffset%4===0}function at(t){return Uint8Array.from(j(t))}var Tt=(t)=>Uint8Array.from(t.split(""),(e)=>e.charCodeAt(0)),Ft=(()=>Z(Y(Tt("expand 16-byte k"))))(),Gt=(()=>Z(Y(Tt("expand 32-byte k"))))();function m(t,e){return t<<e|t>>>32-e}var lt=64,Dt=16,gt=(()=>4294967295)(),Bt=Uint32Array.of();function Yt(t,e,o,n,r,i,s,a){let f=r.length,h=new Uint8Array(lt),l=Y(h),y=et&&ct(r)&&ct(i),x=y?Y(r):Bt,g=y?Y(i):Bt;if(!et){for(let w=0;w<f;s++){if(t(e,o,n,l,s,a),Z(l),s>=gt)throw Error("arx: counter overflow");let b=Math.min(lt,f-w);for(let U=0,L;U<b;U++)L=w+U,i[L]=r[L]^h[U];w+=b}return}for(let w=0;w<f;s++){if(t(e,o,n,l,s,a),s>=gt)throw Error("arx: counter overflow");let b=Math.min(lt,f-w);if(y&&b===lt){let U=w/4;if(w%4!==0)throw Error("arx: invalid block position");for(let L=0,W;L<Dt;L++)W=U+L,g[W]=x[W]^l[L];w+=lt;continue}for(let U=0,L;U<b;U++)L=w+U,i[L]=r[L]^h[U];w+=b}}function It(t,e){let{allowShortKeys:o,extendNonceFn:n,counterLength:r,counterRight:i,rounds:s}=mt({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!=="function")throw Error("core must be a function");return ft(r),ft(s),dt(i),dt(o),(a,f,h,l,y=0)=>{j(a,void 0,"key"),j(f,void 0,"nonce"),j(h,void 0,"data");let x=h.length;if(l=ht(x,l,!1),ft(y),y<0||y>=gt)throw Error("arx: counter overflow");let g=[],w=a.length,b,U;if(w===32)g.push(b=at(a)),U=Gt;else if(w===16&&o)b=new Uint8Array(32),b.set(a),b.set(a,16),U=Ft,g.push(b);else throw j(a,32,"arx key"),Error("invalid key size");if(!et||!ct(f))g.push(f=at(f));let L=Y(b);if(n){if(f.length!==24)throw Error("arx: extended nonce must be 24 bytes");let D=f.subarray(0,16);if(et)n(U,L,Y(D),L);else{let J=Z(Uint32Array.from(U));n(J,L,Y(D),L),V(J),Z(L)}f=f.subarray(16)}else if(!et)Z(L);let W=16-r;if(W!==f.length)throw Error(`arx: nonce must be ${W} or 16 bytes`);if(W!==12){let D=new Uint8Array(12);D.set(f,i?0:12-f.length),f=D,g.push(f)}let tt=Z(Y(f));try{return Yt(t,U,L,tt,h,l,y,s),l}finally{V(...g)}}}function X(t,e){return t[e++]&255|(t[e++]&255)<<8}class kt{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(t){t=at(j(t,32,"key"));let e=X(t,0),o=X(t,2),n=X(t,4),r=X(t,6),i=X(t,8),s=X(t,10),a=X(t,12),f=X(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|o<<3)&8191,this.r[2]=(o>>>10|n<<6)&7939,this.r[3]=(n>>>7|r<<9)&8191,this.r[4]=(r>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|s<<2)&8191,this.r[7]=(s>>>11|a<<5)&8065,this.r[8]=(a>>>8|f<<8)&8191,this.r[9]=f>>>5&127;for(let h=0;h<8;h++)this.pad[h]=X(t,16+2*h)}process(t,e,o=!1){let n=o?0:2048,{h:r,r:i}=this,s=i[0],a=i[1],f=i[2],h=i[3],l=i[4],y=i[5],x=i[6],g=i[7],w=i[8],b=i[9],U=X(t,e+0),L=X(t,e+2),W=X(t,e+4),tt=X(t,e+6),D=X(t,e+8),J=X(t,e+10),F=X(t,e+12),G=X(t,e+14),E=r[0]+(U&8191),B=r[1]+((U>>>13|L<<3)&8191),T=r[2]+((L>>>10|W<<6)&8191),I=r[3]+((W>>>7|tt<<9)&8191),A=r[4]+((tt>>>4|D<<12)&8191),R=r[5]+(D>>>1&8191),C=r[6]+((D>>>14|J<<2)&8191),O=r[7]+((J>>>11|F<<5)&8191),N=r[8]+((F>>>8|G<<8)&8191),M=r[9]+(G>>>5|n),u=0,K=u+E*s+B*(5*b)+T*(5*w)+I*(5*g)+A*(5*x);u=K>>>13,K&=8191,K+=R*(5*y)+C*(5*l)+O*(5*h)+N*(5*f)+M*(5*a),u+=K>>>13,K&=8191;let P=u+E*a+B*s+T*(5*b)+I*(5*w)+A*(5*g);u=P>>>13,P&=8191,P+=R*(5*x)+C*(5*y)+O*(5*l)+N*(5*h)+M*(5*f),u+=P>>>13,P&=8191;let z=u+E*f+B*a+T*s+I*(5*b)+A*(5*w);u=z>>>13,z&=8191,z+=R*(5*g)+C*(5*x)+O*(5*y)+N*(5*l)+M*(5*h),u+=z>>>13,z&=8191;let v=u+E*h+B*f+T*a+I*s+A*(5*b);u=v>>>13,v&=8191,v+=R*(5*w)+C*(5*g)+O*(5*x)+N*(5*y)+M*(5*l),u+=v>>>13,v&=8191;let q=u+E*l+B*h+T*f+I*a+A*s;u=q>>>13,q&=8191,q+=R*(5*b)+C*(5*w)+O*(5*g)+N*(5*x)+M*(5*y),u+=q>>>13,q&=8191;let nt=u+E*y+B*l+T*h+I*f+A*a;u=nt>>>13,nt&=8191,nt+=R*s+C*(5*b)+O*(5*w)+N*(5*g)+M*(5*x),u+=nt>>>13,nt&=8191;let ot=u+E*x+B*y+T*l+I*h+A*f;u=ot>>>13,ot&=8191,ot+=R*a+C*s+O*(5*b)+N*(5*w)+M*(5*g),u+=ot>>>13,ot&=8191;let rt=u+E*g+B*x+T*y+I*l+A*h;u=rt>>>13,rt&=8191,rt+=R*f+C*a+O*s+N*(5*b)+M*(5*w),u+=rt>>>13,rt&=8191;let st=u+E*w+B*g+T*x+I*y+A*l;u=st>>>13,st&=8191,st+=R*h+C*f+O*a+N*s+M*(5*b),u+=st>>>13,st&=8191;let it=u+E*b+B*w+T*g+I*x+A*y;u=it>>>13,it&=8191,it+=R*l+C*h+O*f+N*a+M*s,u+=it>>>13,it&=8191,u=(u<<2)+u|0,u=u+K|0,K=u&8191,u=u>>>13,P+=u,r[0]=K,r[1]=P,r[2]=z,r[3]=v,r[4]=q,r[5]=nt,r[6]=ot,r[7]=rt,r[8]=st,r[9]=it}finalize(){let{h:t,pad:e}=this,o=new Uint16Array(10),n=t[1]>>>13;t[1]&=8191;for(let s=2;s<10;s++)t[s]+=n,n=t[s]>>>13,t[s]&=8191;t[0]+=n*5,n=t[0]>>>13,t[0]&=8191,t[1]+=n,n=t[1]>>>13,t[1]&=8191,t[2]+=n,o[0]=t[0]+5,n=o[0]>>>13,o[0]&=8191;for(let s=1;s<10;s++)o[s]=t[s]+n,n=o[s]>>>13,o[s]&=8191;o[9]-=8192;let r=(n^1)-1;for(let s=0;s<10;s++)o[s]&=r;r=~r;for(let s=0;s<10;s++)t[s]=t[s]&r|o[s];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let i=t[0]+e[0];t[0]=i&65535;for(let s=1;s<8;s++)i=(t[s]+e[s]|0)+(i>>>16)|0,t[s]=i&65535;V(o)}update(t){wt(this),j(t),t=at(t);let{buffer:e,blockLen:o}=this,n=t.length;for(let r=0;r<n;){let i=Math.min(o-this.pos,n-r);if(i===o){for(;o<=n-r;r+=o)this.process(t,r);continue}if(e.set(t.subarray(r,r+i),this.pos),this.pos+=i,r+=i,this.pos===o)this.process(e,0,!1),this.pos=0}return this}destroy(){this.destroyed=!0,V(this.h,this.r,this.buffer,this.pad)}digestInto(t){wt(this),bt(t,this),this.finished=!0;let{buffer:e,h:o}=this,{pos:n}=this;if(n){e[n++]=1;for(;n<16;n++)e[n]=0;this.process(e,0,!0)}this.finalize();let r=0;for(let i=0;i<8;i++)t[r++]=o[i]>>>0,t[r++]=o[i]>>>8}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let o=t.slice(0,e);return this.destroy(),o}}var At=Ut(32,(t)=>new kt(t));function qt(t,e,o,n,r,i=20){let s=t[0],a=t[1],f=t[2],h=t[3],l=e[0],y=e[1],x=e[2],g=e[3],w=e[4],b=e[5],U=e[6],L=e[7],W=r,tt=o[0],D=o[1],J=o[2],F=s,G=a,E=f,B=h,T=l,I=y,A=x,R=g,C=w,O=b,N=U,M=L,u=W,K=tt,P=D,z=J;for(let q=0;q<i;q+=2)F=F+T|0,u=m(u^F,16),C=C+u|0,T=m(T^C,12),F=F+T|0,u=m(u^F,8),C=C+u|0,T=m(T^C,7),G=G+I|0,K=m(K^G,16),O=O+K|0,I=m(I^O,12),G=G+I|0,K=m(K^G,8),O=O+K|0,I=m(I^O,7),E=E+A|0,P=m(P^E,16),N=N+P|0,A=m(A^N,12),E=E+A|0,P=m(P^E,8),N=N+P|0,A=m(A^N,7),B=B+R|0,z=m(z^B,16),M=M+z|0,R=m(R^M,12),B=B+R|0,z=m(z^B,8),M=M+z|0,R=m(R^M,7),F=F+I|0,z=m(z^F,16),N=N+z|0,I=m(I^N,12),F=F+I|0,z=m(z^F,8),N=N+z|0,I=m(I^N,7),G=G+A|0,u=m(u^G,16),M=M+u|0,A=m(A^M,12),G=G+A|0,u=m(u^G,8),M=M+u|0,A=m(A^M,7),E=E+R|0,K=m(K^E,16),C=C+K|0,R=m(R^C,12),E=E+R|0,K=m(K^E,8),C=C+K|0,R=m(R^C,7),B=B+T|0,P=m(P^B,16),O=O+P|0,T=m(T^O,12),B=B+T|0,P=m(P^B,8),O=O+P|0,T=m(T^O,7);let v=0;n[v++]=s+F|0,n[v++]=a+G|0,n[v++]=f+E|0,n[v++]=h+B|0,n[v++]=l+T|0,n[v++]=y+I|0,n[v++]=x+A|0,n[v++]=g+R|0,n[v++]=w+C|0,n[v++]=b+O|0,n[v++]=U+N|0,n[v++]=L+M|0,n[v++]=W+u|0,n[v++]=tt+K|0,n[v++]=D+P|0,n[v++]=J+z|0}var Zt=It(qt,{counterRight:!1,counterLength:4,allowShortKeys:!1});var Qt=new Uint8Array(16),Rt=(t,e)=>{t.update(e);let o=e.length%16;if(o)t.update(Qt.subarray(o))},Jt=new Uint8Array(32);function Ct(t,e,o,n,r){if(r!==void 0)j(r,void 0,"AAD");let i=t(e,o,Jt),s=_t(n.length,r?r.length:0,!0),a=At.create(i);if(r)Rt(a,r);Rt(a,n),a.update(s);let f=a.digest();return V(i,s),f}var te=(t)=>(e,o,n)=>({encrypt(i,s){let a=i.length;s=ht(a+16,s,!1),s.set(i);let f=s.subarray(0,-16);t(e,o,f,f,1);let h=Ct(t,e,o,f,n);return s.set(h,a),V(h),s},decrypt(i,s){s=ht(i.length-16,s,!1);let a=i.subarray(0,-16),f=i.subarray(-16),h=Ct(t,e,o,a,n);if(!Lt(f,h))throw V(h),Error("invalid tag");return s.set(i.subarray(0,-16)),t(e,o,s,s,1),V(h),s}}),ut=Et({blockSize:64,nonceLength:12,tagLength:16},te(Zt));var pt=Uint8Array.of(0),ee=Uint8Array.of();function ne(t,e,o,n=32,r){$e(t),k(n,"length"),d(e,void 0,"prk");let i=t.outputLen;if(e.length<i)throw Error('"prk" must be at least HashLen octets');if(n>255*i)throw Error("Length must be <= 255*HashLen");let s=Math.ceil(n/i);if(o===void 0)o=ee;else d(o,void 0,"info");if(!s){if(r)p(e);return new Uint8Array}let a=r&&s===1?e:new Uint8Array(s*i),{iHash:f,oHash:h}=H.create(t,e),l=r?e:new Uint8Array(i),y=s>1?r?.iHash||t.create():void 0;for(let g=0;g<s-1;g++){pt[0]=g+1;let w=f._cloneInto(y);if(g)w.update(l);w.update(o).update(pt).digestInto(l),h._cloneInto(y).update(l).digestInto(l),a.set(l,i*g)}if(pt[0]=s,s>1)f.update(l);if(f.update(o).update(pt).digestInto(l),h.update(l).digestInto(l),a.set(l,i*(s-1)),f.destroy(),h.destroy(),y?.destroy(),l!==a)p(l);if(p(pt),n===a.length)return a;let x=a.slice(0,n);return p(a),x}var Se=(t,e,o,n,r)=>{if($e(t),o===void 0)o=new Uint8Array(t.outputLen);let i=H.create(t,o).update(e);return ne(t,i.digest(),n,r,i)};var sn="age-encryption.org/v1",Be="-----BEGIN AGE ENCRYPTED FILE-----",Ht="-----END AGE ENCRYPTED FILE-----",Ot="age-encryption.org/v1/X25519",St="age",Nt="age-secret-key-",yt=65536,In=128,xt=16,oe=new TextEncoder,Mt=new TextDecoder,Q=(t)=>oe.encode(t);class c extends Error{code;constructor(t,e){super(e);this.code=t,this.name="AgeError"}}function zt(t){if(t.length!==32)throw new c("bad_key","an X25519 public key is 32 bytes");return S.encode(St,S.toWords(t),!1)}function jn(t){let e=t.trim(),o;try{o=S.decode(e,!1)}catch{throw new c("bad_key","not an age recipient (age1…)")}if(o.prefix!==St)throw new c("bad_key",`not an age recipient: prefix ${o.prefix}`);let n=S.fromWords(o.words);if(n.length!==32)throw new c("bad_key","an age recipient carries 32 bytes");return n}function an(t){if(t.length!==32)throw new c("bad_key","an X25519 secret is 32 bytes");return S.encode(Nt,S.toWords(t),!1).toUpperCase()}function Mn(t){let e=t.trim().toLowerCase(),o;try{o=S.decode(e,!1)}catch{throw new c("bad_key","not an age identity (AGE-SECRET-KEY-1…)")}if(o.prefix!==Nt)throw new c("bad_key",`not an age identity: prefix ${o.prefix}`);let n=S.fromWords(o.words);if(n.length!==32)throw new c("bad_key","an age identity carries 32 bytes");return n}function Fn(t){return zt(ie.getPublicKey(t))}function re(t,e){let o=ie.utils.randomSecretKey(),n=null,r=null;try{let i=ie.getPublicKey(o);try{n=ie.getSharedSecret(o,e)}catch{throw new c("bad_key","low-order recipient point")}if(n.every((f)=>f===0))throw new c("bad_key","low-order recipient point");let s=new Uint8Array(64);s.set(i,0),s.set(e,32),r=Se(_,n,s,Q(Ot),32);let a=ut(r,new Uint8Array(12)).encrypt(t);return{share:i,body:a}}finally{o.fill(0),n?.fill(0),r?.fill(0)}}function vt(t,e){let o=Se(_,t,new Uint8Array(0),Q("header"),32),n=H(_,o,e);return o.fill(0),n}function Kt(t,e){let o=new Uint8Array(12),n=t;for(let r=10;r>=0&&n>0;r--)o[r]=n%256,n=Math.floor(n/256);return o[11]=e?1:0,o}function Pt(t){let e=new Uint8Array(t.reduce((n,r)=>n+r.length,0)),o=0;for(let n of t)e.set(n,o),o+=n.length;return e}function Nn(t,e){if(e.length===0)throw new c("bad_key","seal it for at least one recipient");let o=e.map(jn),n=crypto.getRandomValues(new Uint8Array(16));try{let r=[sn];for(let x of o){let{share:g,body:w}=re(n,x);r.push(`-> X25519 ${Te.encode(g)}`,Te.encode(w))}r.push("---");let i=Q(r.join(`
|
|
2
2
|
`)),s=vt(n,i),a=Q(`${r.join(`
|
|
3
3
|
`)} ${Te.encode(s)}
|
|
4
4
|
`),f=crypto.getRandomValues(new Uint8Array(16)),h=Se(_,n,f,Q("payload"),32),l=[a,f],y=Math.max(1,Math.ceil(t.length/yt));for(let x=0;x<y;x++){let g=t.subarray(x*yt,Math.min(t.length,(x+1)*yt));l.push(ut(h,Kt(x,x===y-1)).encrypt(g))}return h.fill(0),Pt(l)}finally{n.fill(0)}}var se=1048576,fe=/^[\x21-\x7e]+$/;function Pn(t){let e=Math.min(t.length,se),o=0,n=()=>{let f=o;while(f<e&&t[f]!==10){if(t[f]<32||t[f]>126)throw new c("malformed","header byte outside printable ASCII");f++}if(f>=e)throw new c("malformed","header runs off the end of the file");let h=Mt.decode(t.subarray(o,f));return o=f+1,h};if(n()!==sn)throw new c("malformed","not an age file: missing version line");let r=[],i=null,s=0;while(i===null){s=o;let f=n();if(f.startsWith("---")){i=f;break}if(!f.startsWith("-> "))throw new c("malformed","unexpected header line");let h=f.slice(3).split(" ");if(!h.every((w)=>fe.test(w)))throw new c("malformed","stanza arguments must be non-empty visible ASCII");let[l,...y]=h,x=[];for(;;){let w=n();if(x.push(w),w.length<64)break;if(w.length>64)throw new c("malformed","stanza body line over 64 columns")}let g;try{g=Te.decode(x.join(""))}catch{throw new c("malformed","stanza body is not base64")}if(r.push({type:l,args:y,body:g}),r.length>In)throw new c("unsupported",`sealed for more than ${In} readers`)}if(!i.startsWith("--- "))throw new c("malformed","header footer must be `--- ` and a MAC");let a;try{a=Te.decode(i.slice(4))}catch{throw new c("malformed","header MAC is not base64")}if(a.length!==32)throw new c("malformed","header MAC is not 32 bytes");if(r.some((f)=>f.type==="scrypt")&&r.length!==1)throw new c("malformed","scrypt must be the only recipient");return{stanzas:r,mac:a,upToDashes:t.subarray(0,s+3),payload:t.subarray(o)}}function ce(t,e){if(t.length!==e.length)return!1;let o=0;for(let n=0;n<t.length;n++)o|=t[n]^e[n];return o===0}function Un(t,e){if(e.length===0)throw new c("no_identity","no identity to open it with");let{stanzas:o,mac:n,upToDashes:r,payload:i}=Pn(t),s=o.filter((h)=>h.type==="X25519");if(s.length===0){let h=[...new Set(o.map((l)=>l.type))].join(", ")||"none";throw new c("unsupported",`no X25519 recipient in this file (stanzas: ${h})`)}let a=null,f=e.map((h)=>ie.getPublicKey(h));for(let h of s){if(h.args.length!==1||h.body.length!==32)throw new c("malformed","bad X25519 stanza");let l;try{l=Te.decode(h.args[0])}catch{throw new c("malformed","X25519 share is not base64")}if(l.length!==32)throw new c("malformed","X25519 share is not 32 bytes");for(let y=0;y<e.length;y++){let x;try{x=ie.getSharedSecret(e[y],l)}catch{throw new c("malformed","X25519 share is a low-order point")}if(x.every((b)=>b===0))throw new c("malformed","X25519 share is a low-order point");let g=new Uint8Array(64);g.set(l,0),g.set(f[y],32);let w=Se(_,x,g,Q(Ot),32);x.fill(0);try{a=ut(w,new Uint8Array(12)).decrypt(h.body)}catch{a=null}finally{w.fill(0)}if(a)break}if(a)break}if(!a)throw new c("no_identity","none of your keys opens this");try{if(!ce(vt(a,r),n))throw new c("tampered","header MAC does not match");if(i.length<16)throw new c("malformed","payload shorter than its nonce");let h=i.subarray(0,16),l=Se(_,a,h,Q("payload"),32);try{let y=i.subarray(16),x=yt+xt,g=[],w=0,b=0;for(;;){let U=y.length-b;if(U<xt)throw new c("malformed","payload chunk shorter than its tag");let L=U<=x,W=L?U:x;if(L&&W===xt&&w>0)throw new c("malformed","empty final chunk");try{g.push(ut(l,Kt(w,L)).decrypt(y.subarray(b,b+W)))}catch{throw new c("tampered",`payload chunk ${w} does not authenticate`)}if(b+=W,w++,L)break}return Pt(g)}finally{l.fill(0)}}finally{a.fill(0)}}function Ln(t){let e=Vt.encode(t),o=[];for(let n=0;n<e.length;n+=64)o.push(e.slice(n,n+64));return[Be,...o,Ht].join(`
|