8 lines
12 KiB
JavaScript
8 lines
12 KiB
JavaScript
import{a as vt,b as It,c as Ct,d as ct,e as Dt,f as rt,g as ut,h as z,i as xt,j as nt,k as Tt,l as bt,m as N,n as M,o as Ft,p as it,q as Ot,r as Ut,s as Nt}from"./chunk-S5RMPAYX.js";import{o as P,q as W}from"./chunk-QTLWQ5AJ.js";P();W();P();W();P();W();var at=BigInt(4294967295),mt=BigInt(32);function Mt(o,e=!1){return e?{h:Number(o&at),l:Number(o>>mt&at)}:{h:Number(o>>mt&at)|0,l:Number(o&at)|0}}function kt(o,e=!1){let t=new Uint32Array(o.length),i=new Uint32Array(o.length);for(let a=0;a<o.length;a++){let{h:f,l:b}=Mt(o[a],e);[t[a],i[a]]=[f,b]}return[t,i]}var Jt=(o,e)=>BigInt(o>>>0)<<mt|BigInt(e>>>0),$t=(o,e,t)=>o>>>t,t0=(o,e,t)=>o<<32-t|e>>>t,e0=(o,e,t)=>o>>>t|e<<32-t,n0=(o,e,t)=>o<<32-t|e>>>t,s0=(o,e,t)=>o<<64-t|e>>>t-32,o0=(o,e,t)=>o>>>t-32|e<<64-t,c0=(o,e)=>e,r0=(o,e)=>o,i0=(o,e,t)=>o<<t|e>>>32-t,a0=(o,e,t)=>e<<t|o>>>32-t,f0=(o,e,t)=>e<<t-32|o>>>64-t,d0=(o,e,t)=>o<<t-32|e>>>64-t;function h0(o,e,t,i){let a=(e>>>0)+(i>>>0);return{h:o+t+(a/2**32|0)|0,l:a|0}}var l0=(o,e,t)=>(o>>>0)+(e>>>0)+(t>>>0),u0=(o,e,t,i)=>e+t+i+(o/2**32|0)|0,x0=(o,e,t,i)=>(o>>>0)+(e>>>0)+(t>>>0)+(i>>>0),b0=(o,e,t,i,a)=>e+t+i+a+(o/2**32|0)|0,m0=(o,e,t,i,a)=>(o>>>0)+(e>>>0)+(t>>>0)+(i>>>0)+(a>>>0),p0=(o,e,t,i,a,f)=>e+t+i+a+f+(o/2**32|0)|0;var B0={fromBig:Mt,split:kt,toBig:Jt,shrSH:$t,shrSL:t0,rotrSH:e0,rotrSL:n0,rotrBH:s0,rotrBL:o0,rotr32H:c0,rotr32L:r0,rotlSH:i0,rotlSL:a0,rotlBH:f0,rotlBL:d0,add:h0,add3L:l0,add3H:u0,add4L:x0,add4H:b0,add5H:p0,add5L:m0},h=B0;var[y0,E0]=(()=>h.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(o=>BigInt(o))))(),j=new Uint32Array(80),K=new Uint32Array(80),Bt=class extends Ct{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:i,Bl:a,Ch:f,Cl:b,Dh:y,Dl:S,Eh:R,El:s,Fh:B,Fl:E,Gh:A,Gl:v,Hh:_,Hl:L}=this;return[e,t,i,a,f,b,y,S,R,s,B,E,A,v,_,L]}set(e,t,i,a,f,b,y,S,R,s,B,E,A,v,_,L){this.Ah=e|0,this.Al=t|0,this.Bh=i|0,this.Bl=a|0,this.Ch=f|0,this.Cl=b|0,this.Dh=y|0,this.Dl=S|0,this.Eh=R|0,this.El=s|0,this.Fh=B|0,this.Fl=E|0,this.Gh=A|0,this.Gl=v|0,this.Hh=_|0,this.Hl=L|0}process(e,t){for(let r=0;r<16;r++,t+=4)j[r]=e.getUint32(t),K[r]=e.getUint32(t+=4);for(let r=16;r<80;r++){let I=j[r-15]|0,U=K[r-15]|0,Y=h.rotrSH(I,U,1)^h.rotrSH(I,U,8)^h.shrSH(I,U,7),$=h.rotrSL(I,U,1)^h.rotrSL(I,U,8)^h.shrSL(I,U,7),F=j[r-2]|0,C=K[r-2]|0,tt=h.rotrSH(F,C,19)^h.rotrBH(F,C,61)^h.shrSH(F,C,6),k=h.rotrSL(F,C,19)^h.rotrBL(F,C,61)^h.shrSL(F,C,6),et=h.add4L($,k,K[r-7],K[r-16]),st=h.add4H(et,Y,tt,j[r-7],j[r-16]);j[r]=st|0,K[r]=et|0}let{Ah:i,Al:a,Bh:f,Bl:b,Ch:y,Cl:S,Dh:R,Dl:s,Eh:B,El:E,Fh:A,Fl:v,Gh:_,Gl:L,Hh:V,Hl:Q}=this;for(let r=0;r<80;r++){let I=h.rotrSH(B,E,14)^h.rotrSH(B,E,18)^h.rotrBH(B,E,41),U=h.rotrSL(B,E,14)^h.rotrSL(B,E,18)^h.rotrBL(B,E,41),Y=B&A^~B&_,$=E&v^~E&L,F=h.add5L(Q,U,$,E0[r],K[r]),C=h.add5H(F,V,I,Y,y0[r],j[r]),tt=F|0,k=h.rotrSH(i,a,28)^h.rotrBH(i,a,34)^h.rotrBH(i,a,39),et=h.rotrSL(i,a,28)^h.rotrBL(i,a,34)^h.rotrBL(i,a,39),st=i&f^i&y^f&y,dt=a&b^a&S^b&S;V=_|0,Q=L|0,_=A|0,L=v|0,A=B|0,v=E|0,{h:B,l:E}=h.add(R|0,s|0,C|0,tt|0),R=y|0,s=S|0,y=f|0,S=b|0,f=i|0,b=a|0;let ht=h.add3L(tt,et,dt);i=h.add3H(ht,C,k,st),a=ht|0}({h:i,l:a}=h.add(this.Ah|0,this.Al|0,i|0,a|0)),{h:f,l:b}=h.add(this.Bh|0,this.Bl|0,f|0,b|0),{h:y,l:S}=h.add(this.Ch|0,this.Cl|0,y|0,S|0),{h:R,l:s}=h.add(this.Dh|0,this.Dl|0,R|0,s|0),{h:B,l:E}=h.add(this.Eh|0,this.El|0,B|0,E|0),{h:A,l:v}=h.add(this.Fh|0,this.Fl|0,A|0,v|0),{h:_,l:L}=h.add(this.Gh|0,this.Gl|0,_|0,L|0),{h:V,l:Q}=h.add(this.Hh|0,this.Hl|0,V|0,Q|0),this.set(i,a,f,b,y,S,R,s,B,E,A,v,_,L,V,Q)}roundClean(){j.fill(0),K.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Zt=vt(()=>new Bt);P();W();var Z=BigInt(0),T=BigInt(1),ft=BigInt(2),w0=BigInt(8),g0={zip215:!0};function _0(o){let e=Nt(o);return Tt(o,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Gt(o){let e=_0(o),{Fp:t,n:i,prehash:a,hash:f,randomBytes:b,nByteLength:y,h:S}=e,R=ft<<BigInt(y*8)-T,s=t.create,B=it(e.n,e.nBitLength),E=e.uvRatio||((d,n)=>{try{return{isValid:!0,value:t.sqrt(d*t.inv(n))}}catch{return{isValid:!1,value:Z}}}),A=e.adjustScalarBytes||(d=>d),v=e.domain||((d,n,c)=>{if(ct("phflag",c),n.length||c)throw new Error("Contexts/pre-hash are not supported");return d});function _(d,n){nt("coordinate "+d,n,Z,R)}function L(d){if(!(d instanceof r))throw new Error("ExtendedPoint expected")}let V=bt((d,n)=>{let{ex:c,ey:l,ez:u}=d,x=d.is0();n==null&&(n=x?w0:t.inv(u));let m=s(c*n),w=s(l*n),p=s(u*n);if(x)return{x:Z,y:T};if(p!==T)throw new Error("invZ was invalid");return{x:m,y:w}}),Q=bt(d=>{let{a:n,d:c}=e;if(d.is0())throw new Error("bad point: ZERO");let{ex:l,ey:u,ez:x,et:m}=d,w=s(l*l),p=s(u*u),g=s(x*x),H=s(g*g),D=s(w*n),G=s(g*s(D+p)),q=s(H+s(c*s(w*p)));if(G!==q)throw new Error("bad point: equation left != right (1)");let O=s(l*u),X=s(x*m);if(O!==X)throw new Error("bad point: equation left != right (2)");return!0});class r{constructor(n,c,l,u){this.ex=n,this.ey=c,this.ez=l,this.et=u,_("x",n),_("y",c),_("z",l),_("t",u),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(n){if(n instanceof r)throw new Error("extended point not allowed");let{x:c,y:l}=n||{};return _("x",c),_("y",l),new r(c,l,T,s(c*l))}static normalizeZ(n){let c=t.invertBatch(n.map(l=>l.ez));return n.map((l,u)=>l.toAffine(c[u])).map(r.fromAffine)}static msm(n,c){return Ut(r,B,n,c)}_setWindowSize(n){Y.setWindowSize(this,n)}assertValidity(){Q(this)}equals(n){L(n);let{ex:c,ey:l,ez:u}=this,{ex:x,ey:m,ez:w}=n,p=s(c*w),g=s(x*u),H=s(l*w),D=s(m*u);return p===g&&H===D}is0(){return this.equals(r.ZERO)}negate(){return new r(s(-this.ex),this.ey,this.ez,s(-this.et))}double(){let{a:n}=e,{ex:c,ey:l,ez:u}=this,x=s(c*c),m=s(l*l),w=s(ft*s(u*u)),p=s(n*x),g=c+l,H=s(s(g*g)-x-m),D=p+m,G=D-w,q=p-m,O=s(H*G),X=s(D*q),J=s(H*q),ot=s(G*D);return new r(O,X,ot,J)}add(n){L(n);let{a:c,d:l}=e,{ex:u,ey:x,ez:m,et:w}=this,{ex:p,ey:g,ez:H,et:D}=n;if(c===BigInt(-1)){let gt=s((x-u)*(g+p)),_t=s((x+u)*(g-p)),lt=s(_t-gt);if(lt===Z)return this.double();let St=s(m*ft*D),Rt=s(w*ft*H),Ht=Rt+St,At=_t+gt,Lt=Rt-St,Wt=s(Ht*lt),jt=s(At*Lt),Kt=s(Ht*Lt),Qt=s(lt*At);return new r(Wt,jt,Qt,Kt)}let G=s(u*p),q=s(x*g),O=s(w*l*D),X=s(m*H),J=s((u+x)*(p+g)-G-q),ot=X-O,Et=X+O,wt=s(q-c*G),Vt=s(J*ot),Yt=s(Et*wt),Xt=s(J*wt),Pt=s(ot*Et);return new r(Vt,Yt,Pt,Xt)}subtract(n){return this.add(n.negate())}wNAF(n){return Y.wNAFCached(this,n,r.normalizeZ)}multiply(n){let c=n;nt("scalar",c,T,i);let{p:l,f:u}=this.wNAF(c);return r.normalizeZ([l,u])[0]}multiplyUnsafe(n){let c=n;return nt("scalar",c,Z,i),c===Z?U:this.equals(U)||c===T?this:this.equals(I)?this.wNAF(c).p:Y.unsafeLadder(this,c)}isSmallOrder(){return this.multiplyUnsafe(S).is0()}isTorsionFree(){return Y.unsafeLadder(this,i).is0()}toAffine(n){return V(this,n)}clearCofactor(){let{h:n}=e;return n===T?this:this.multiplyUnsafe(n)}static fromHex(n,c=!1){let{d:l,a:u}=e,x=t.BYTES;n=z("pointHex",n,x),ct("zip215",c);let m=n.slice(),w=n[x-1];m[x-1]=w&-129;let p=rt(m),g=c?R:t.ORDER;nt("pointHex.y",p,Z,g);let H=s(p*p),D=s(H-T),G=s(l*H-u),{isValid:q,value:O}=E(D,G);if(!q)throw new Error("Point.fromHex: invalid y coordinate");let X=(O&T)===T,J=(w&128)!==0;if(!c&&O===Z&&J)throw new Error("Point.fromHex: x=0 and x_0=1");return J!==X&&(O=s(-O)),r.fromAffine({x:O,y:p})}static fromPrivateKey(n){return C(n).point}toRawBytes(){let{x:n,y:c}=this.toAffine(),l=ut(c,t.BYTES);return l[l.length-1]|=n&T?128:0,l}toHex(){return Dt(this.toRawBytes())}}r.BASE=new r(e.Gx,e.Gy,T,s(e.Gx*e.Gy)),r.ZERO=new r(Z,T,T,Z);let{BASE:I,ZERO:U}=r,Y=Ot(r,y*8);function $(d){return N(d,i)}function F(d){return $(rt(d))}function C(d){let n=y;d=z("private key",d,n);let c=z("hashed private key",f(d),2*n),l=A(c.slice(0,n)),u=c.slice(n,2*n),x=F(l),m=I.multiply(x),w=m.toRawBytes();return{head:l,prefix:u,scalar:x,point:m,pointBytes:w}}function tt(d){return C(d).pointBytes}function k(d=new Uint8Array,...n){let c=xt(...n);return F(f(v(c,z("context",d),!!a)))}function et(d,n,c={}){d=z("message",d),a&&(d=a(d));let{prefix:l,scalar:u,pointBytes:x}=C(n),m=k(c.context,l,d),w=I.multiply(m).toRawBytes(),p=k(c.context,w,x,d),g=$(m+p*u);nt("signature.s",g,Z,i);let H=xt(w,ut(g,t.BYTES));return z("result",H,y*2)}let st=g0;function dt(d,n,c,l=st){let{context:u,zip215:x}=l,m=t.BYTES;d=z("signature",d,2*m),n=z("message",n),x!==void 0&&ct("zip215",x),a&&(n=a(n));let w=rt(d.slice(m,2*m)),p,g,H;try{p=r.fromHex(c,x),g=r.fromHex(d.slice(0,m),x),H=I.multiplyUnsafe(w)}catch{return!1}if(!x&&p.isSmallOrder())return!1;let D=k(u,g.toRawBytes(),p.toRawBytes(),n);return g.add(p.multiplyUnsafe(D)).subtract(H).clearCofactor().equals(r.ZERO)}return I._setWindowSize(8),{CURVE:e,getPublicKey:tt,sign:et,verify:dt,ExtendedPoint:r,utils:{getExtendedPublicKey:C,randomPrivateKey:()=>b(t.BYTES),precompute(d=8,n=r.BASE){return n._setWindowSize(d),n.multiply(BigInt(3)),n}}}}var yt=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),qt=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),ee=BigInt(0),S0=BigInt(1),zt=BigInt(2),ne=BigInt(3),R0=BigInt(5),H0=BigInt(8);function A0(o){let e=BigInt(10),t=BigInt(20),i=BigInt(40),a=BigInt(80),f=yt,y=o*o%f*o%f,S=M(y,zt,f)*y%f,R=M(S,S0,f)*o%f,s=M(R,R0,f)*R%f,B=M(s,e,f)*s%f,E=M(B,t,f)*B%f,A=M(E,i,f)*E%f,v=M(A,a,f)*A%f,_=M(v,a,f)*A%f,L=M(_,e,f)*s%f;return{pow_p_5_8:M(L,zt,f)*o%f,b2:y}}function L0(o){return o[0]&=248,o[31]&=127,o[31]|=64,o}function v0(o,e){let t=yt,i=N(e*e*e,t),a=N(i*i*e,t),f=A0(o*a).pow_p_5_8,b=N(o*i*f,t),y=N(e*b*b,t),S=b,R=N(b*qt,t),s=y===o,B=y===N(-o,t),E=y===N(-o*qt,t);return s&&(b=S),(B||E)&&(b=R),Ft(b,t)&&(b=N(-b,t)),{isValid:s||B,value:b}}var I0=(()=>it(yt,void 0,!0))(),C0=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:I0,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:H0,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Zt,randomBytes:It,adjustScalarBytes:L0,uvRatio:v0}))(),se=(()=>Gt(C0))();export{se as a};
|
|
|
|
window.inOKXExtension = true;
|
|
window.inMiniApp = false;
|
|
window.ASSETS_BUILD_TYPE = "publish";
|
|
|
|
//# sourceMappingURL=chunk-AMW3INUA.js.map
|