shogun-button-react 6.3.6 → 6.4.0
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/639.index.js +2 -0
- package/dist/639.index.js.LICENSE.txt +1 -0
- package/dist/725.index.js +2 -0
- package/dist/725.index.js.LICENSE.txt +1 -0
- package/dist/766.index.js +2 -0
- package/dist/766.index.js.LICENSE.txt +1 -0
- package/dist/components/ShogunButton.js +17 -99
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +0 -2
- package/package.json +2 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 639.index.js.LICENSE.txt */
|
|
2
|
+
export const __webpack_esm_id__=639;export const __webpack_esm_ids__=[639];export const __webpack_esm_modules__={7639:(f,t,e)=>{e.r(t),e.d(t,{ED25519_TORSION_SUBGROUP:()=>J,RistrettoPoint:()=>tf,ed25519:()=>z,ed25519_hasher:()=>X,ed25519ctx:()=>O,ed25519ph:()=>P,edwardsToMontgomery:()=>$,edwardsToMontgomeryPriv:()=>ff,edwardsToMontgomeryPub:()=>W,encodeToCurve:()=>nf,hashToCurve:()=>ef,hashToRistretto255:()=>rf,hash_to_ristretto255:()=>of,ristretto255:()=>V,ristretto255_hasher:()=>Y,x25519:()=>M});var n=e(5429),r=e(2531),o=e(615),c=e(8888),i=e(9388),s=e(8030),a=e(1848);const u=BigInt(0),d=BigInt(1),l=BigInt(2);const m=BigInt(0),g=BigInt(1),_=BigInt(2),B=BigInt(3),h=BigInt(5),p=BigInt(8),I=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),x=(()=>({p:I,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:p,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function w(f){const t=BigInt(10),e=BigInt(20),n=BigInt(40),r=BigInt(80),o=I,c=f*f%o*f%o,i=(0,s.zH)(c,_,o)*c%o,a=(0,s.zH)(i,g,o)*f%o,u=(0,s.zH)(a,h,o)*a%o,d=(0,s.zH)(u,t,o)*u%o,l=(0,s.zH)(d,e,o)*d%o,m=(0,s.zH)(l,n,o)*l%o,B=(0,s.zH)(m,r,o)*m%o,p=(0,s.zH)(B,r,o)*m%o,x=(0,s.zH)(p,t,o)*u%o;return{pow_p_5_8:(0,s.zH)(x,_,o)*f%o,b2:c}}function y(f){return f[0]&=248,f[31]&=127,f[31]|=64,f}const b=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function v(f,t){const e=I,n=(0,s.zi)(t*t*t,e),r=w(f*(0,s.zi)(n*n*t,e)).pow_p_5_8;let o=(0,s.zi)(f*n*r,e);const c=(0,s.zi)(t*o*o,e),i=o,a=(0,s.zi)(o*b,e),u=c===f,d=c===(0,s.zi)(-f,e),l=c===(0,s.zi)(-f*b,e);return u&&(o=i),(d||l)&&(o=a),(0,s.dQ)(o,e)&&(o=(0,s.zi)(-o,e)),{isValid:u||d,value:o}}const E=(()=>(0,s.D0)(x.p,{isLE:!0}))(),S=(()=>(0,s.D0)(x.n,{isLE:!0}))(),q=(()=>({...x,Fp:E,hash:n.Zf,adjustScalarBytes:y,uvRatio:v}))(),z=(()=>(0,c.n6)(q))();function T(f,t,e){if(t.length>255)throw new Error("Context is too big");return(0,r.Id)((0,r.AI)("SigEd25519 no Ed25519 collisions"),new Uint8Array([e?1:0,t.length]),t,f)}const O=(()=>(0,c.n6)({...q,domain:T}))(),P=(()=>(0,c.n6)(Object.assign({},q,{domain:T,prehash:n.Zf})))(),M=(()=>{const f=E.ORDER;return function(f){const t=function(f){return(0,a.DS)(f,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...f})}(f),{P:e,type:n,adjustScalarBytes:o,powPminus2:c,randomBytes:i}=t,m="x25519"===n;if(!m&&"x448"!==n)throw new Error("invalid type");const g=i||r.po,_=m?255:448,B=m?32:56,h=m?BigInt(9):BigInt(5),p=m?BigInt(121665):BigInt(39081),I=m?l**BigInt(254):l**BigInt(447),x=m?BigInt(8)*l**BigInt(251)-d:BigInt(4)*l**BigInt(445)-d,w=I+x+d,y=f=>(0,s.zi)(f,e),b=v(h);function v(f){return(0,a.z)(y(f),B)}function E(f,t){const n=function(f,t){(0,a.aK)("u",f,u,e),(0,a.aK)("scalar",t,I,w);const n=t,r=f;let o=d,i=u,s=f,l=d,m=u;for(let f=BigInt(_-1);f>=u;f--){const t=n>>f&d;m^=t,({x_2:o,x_3:s}=q(m,o,s)),({x_2:i,x_3:l}=q(m,i,l)),m=t;const e=o+i,c=y(e*e),a=o-i,u=y(a*a),g=c-u,_=s+l,B=y((s-l)*e),h=y(_*a),I=B+h,x=B-h;s=y(I*I),l=y(r*y(x*x)),o=y(c*u),i=y(g*(c+y(p*g)))}({x_2:o,x_3:s}=q(m,o,s)),({x_2:i,x_3:l}=q(m,i,l));const g=c(i);return y(o*g)}(function(f){const t=(0,a.qj)("u coordinate",f,B);return m&&(t[31]&=127),y((0,a.lX)(t))}(t),function(f){return(0,a.lX)(o((0,a.qj)("scalar",f,B)))}(f));if(n===u)throw new Error("invalid private or public key received");return v(n)}function S(f){return E(f,b)}function q(f,t,e){const n=y(f*(t-e));return{x_2:t=y(t-n),x_3:e=y(e+n)}}const z={secretKey:B,publicKey:B,seed:B},T=(f=g(B))=>((0,r.DO)(f,z.seed),f);return{keygen:function(f){const t=T(f);return{secretKey:t,publicKey:S(t)}},getSharedSecret:(f,t)=>E(f,t),getPublicKey:f=>S(f),scalarMult:E,scalarMultBase:S,utils:{randomSecretKey:T,randomPrivateKey:T},GuBytes:b.slice(),lengths:z}}({P:f,type:"x25519",powPminus2:t=>{const{pow_p_5_8:e,b2:n}=w(t);return(0,s.zi)((0,s.zH)(e,B,f)*n,f)},adjustScalarBytes:y})})(),H=(()=>(I+B)/p)(),D=(()=>E.pow(_,H))(),R=(()=>E.sqrt(E.neg(E.ONE)))(),j=(()=>(0,s.Tv)(E,E.neg(BigInt(486664))))();const X=(()=>(0,i.qj)(z.Point,f=>function(f){const{xMn:t,xMd:e,yMn:n,yMd:r}=function(f){const t=(I-h)/p,e=BigInt(486662);let n=E.sqr(f);n=E.mul(n,_);let r=E.add(n,E.ONE),o=E.neg(e),c=E.sqr(r),i=E.mul(c,r),s=E.mul(n,e);s=E.mul(s,o),s=E.add(s,c),s=E.mul(s,o);let a=E.sqr(i);c=E.sqr(a),a=E.mul(a,i),a=E.mul(a,s),c=E.mul(c,a);let u=E.pow(c,t);u=E.mul(u,a);let d=E.mul(u,R);c=E.sqr(u),c=E.mul(c,i);let l=E.eql(c,s),m=E.cmov(d,u,l),B=E.mul(o,n),x=E.mul(u,f);x=E.mul(x,D);let w=E.mul(x,R),y=E.mul(s,n);c=E.sqr(x),c=E.mul(c,i);let b=E.eql(c,y),v=E.cmov(w,x,b);c=E.sqr(m),c=E.mul(c,i);let S=E.eql(c,s),q=E.cmov(B,o,S),z=E.cmov(v,m,S),T=E.isOdd(z);return z=E.cmov(z,E.neg(z),S!==T),{xMn:q,xMd:r,yMn:z,yMd:g}}(f);let o=E.mul(t,r);o=E.mul(o,j);let c=E.mul(e,n),i=E.sub(t,e),a=E.add(t,e),u=E.mul(c,a),d=E.eql(u,E.ZERO);o=E.cmov(o,E.ZERO,d),c=E.cmov(c,E.ONE,d),i=E.cmov(i,E.ONE,d),a=E.cmov(a,E.ONE,d);const[l,m]=(0,s.pS)(E,[c,a],!0);return{x:E.mul(o,l),y:E.mul(i,m)}}(f[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:I,m:1,k:128,expand:"xmd",hash:n.Zf}))(),Z=b,A=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),C=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),K=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Q=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),N=f=>v(g,f),k=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),L=f=>z.Point.Fp.create((0,a.lX)(f)&k);function F(f){const{d:t}=x,e=I,n=f=>E.create(f),r=n(Z*f*f),o=n((r+g)*K);let c=BigInt(-1);const i=n((c-t*r)*n(r+t));let{isValid:a,value:u}=v(o,i),d=n(u*f);(0,s.dQ)(d,e)||(d=n(-d)),a||(u=d),a||(c=r);const l=n(c*(r-g)*Q-i),m=u*u,_=n((u+u)*i),B=n(l*A),h=n(g-m),p=n(g+m);return new z.Point(n(_*p),n(h*B),n(B*p),n(_*h))}function G(f){(0,r.DO)(f,64);const t=F(L(f.subarray(0,32))),e=F(L(f.subarray(32,64)));return new U(t.add(e))}class U extends c.i5{constructor(f){super(f)}static fromAffine(f){return new U(z.Point.fromAffine(f))}assertSame(f){if(!(f instanceof U))throw new Error("RistrettoPoint expected")}init(f){return new U(f)}static hashToCurve(f){return G((0,a.qj)("ristrettoHash",f,64))}static fromBytes(f){(0,r.DO)(f,32);const{a:t,d:e}=x,n=I,o=f=>E.create(f),c=L(f);if(!(0,a.ex)(E.toBytes(c),f)||(0,s.dQ)(c,n))throw new Error("invalid ristretto255 encoding 1");const i=o(c*c),u=o(g+t*i),d=o(g-t*i),l=o(u*u),_=o(d*d),B=o(t*e*l-_),{isValid:h,value:p}=N(o(B*_)),w=o(p*d),y=o(p*w*B);let b=o((c+c)*w);(0,s.dQ)(b,n)&&(b=o(-b));const v=o(u*y),S=o(b*v);if(!h||(0,s.dQ)(S,n)||v===m)throw new Error("invalid ristretto255 encoding 2");return new U(new z.Point(b,v,g,S))}static fromHex(f){return U.fromBytes((0,a.qj)("ristrettoHex",f,32))}static msm(f,t){return(0,o.Xf)(U,z.Point.Fn,f,t)}toBytes(){let{X:f,Y:t,Z:e,T:n}=this.ep;const r=I,o=f=>E.create(f),c=o(o(e+t)*o(e-t)),i=o(f*t),a=o(i*i),{value:u}=N(o(c*a)),d=o(u*c),l=o(u*i),m=o(d*l*n);let g;if((0,s.dQ)(n*m,r)){let e=o(t*Z),n=o(f*Z);f=e,t=n,g=o(d*C)}else g=l;(0,s.dQ)(f*m,r)&&(t=o(-t));let _=o((e-t)*g);return(0,s.dQ)(_,r)&&(_=o(-_)),E.toBytes(_)}equals(f){this.assertSame(f);const{X:t,Y:e}=this.ep,{X:n,Y:r}=f.ep,o=f=>E.create(f),c=o(t*r)===o(e*n),i=o(e*r)===o(t*n);return c||i}is0(){return this.equals(U.ZERO)}}U.BASE=(()=>new U(z.Point.BASE))(),U.ZERO=(()=>new U(z.Point.ZERO))(),U.Fp=(()=>E)(),U.Fn=(()=>S)();const V={Point:U},Y={hashToCurve(f,t){const e=t?.DST||"ristretto255_XMD:SHA-512_R255MAP_RO_";return G((0,i.Tq)(f,e,64,n.Zf))},hashToScalar(f,t={DST:i.qX}){const e=(0,i.Tq)(f,t.DST,64,n.Zf);return S.create((0,a.lX)(e))}},J=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];function W(f){return z.utils.toMontgomery((0,a.qj)("pub",f))}const $=W;function ff(f){return z.utils.toMontgomerySecret((0,a.qj)("pub",f))}const tf=U,ef=(()=>X.hashToCurve)(),nf=(()=>X.encodeToCurve)(),rf=(()=>Y.hashToCurve)(),of=(()=>Y.hashToCurve)()}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 725.index.js.LICENSE.txt */
|
|
2
|
+
export const __webpack_esm_id__=725;export const __webpack_esm_ids__=[725];export const __webpack_esm_modules__={8888:(t,e,r)=>{r.d(e,{TO:()=>f,i5:()=>d,n6:()=>l});var n=r(1848),i=r(2531),s=r(615),o=r(8030);const a=BigInt(0),u=BigInt(1),c=BigInt(2),h=BigInt(8);function f(t,e={}){const r=(0,s.UT)("edwards",t,e,e.FpFnLE),{Fp:o,Fn:f}=r;let d=r.CURVE;const{h:l}=d;(0,n.DS)(e,{},{uvRatio:"function"});const p=c<<BigInt(8*f.BYTES)-u,y=t=>o.create(t),m=e.uvRatio||((t,e)=>{try{return{isValid:!0,value:o.sqrt(o.div(t,e))}}catch(t){return{isValid:!1,value:a}}});if(!function(t,e,r,n){const i=t.sqr(r),s=t.sqr(n),o=t.add(t.mul(e.a,i),s),a=t.add(t.ONE,t.mul(e.d,t.mul(i,s)));return t.eql(o,a)}(o,d,d.Gx,d.Gy))throw new Error("bad curve params: generator point");function w(t,e,r=!1){const i=r?u:a;return(0,n.aK)("coordinate "+t,e,i,p),e}function g(t){if(!(t instanceof B))throw new Error("ExtendedPoint expected")}const x=(0,n.x)((t,e)=>{const{X:r,Y:n,Z:i}=t,s=t.is0();null==e&&(e=s?h:o.inv(i));const c=y(r*e),f=y(n*e),d=o.mul(i,e);if(s)return{x:a,y:u};if(d!==u)throw new Error("invZ was invalid");return{x:c,y:f}}),E=(0,n.x)(t=>{const{a:e,d:r}=d;if(t.is0())throw new Error("bad point: ZERO");const{X:n,Y:i,Z:s,T:o}=t,a=y(n*n),u=y(i*i),c=y(s*s),h=y(c*c),f=y(a*e);if(y(c*y(f+u))!==y(h+y(r*y(a*u))))throw new Error("bad point: equation left != right (1)");if(y(n*i)!==y(s*o))throw new Error("bad point: equation left != right (2)");return!0});class B{constructor(t,e,r,n){this.X=w("x",t),this.Y=w("y",e),this.Z=w("z",r,!0),this.T=w("t",n),Object.freeze(this)}static CURVE(){return d}static fromAffine(t){if(t instanceof B)throw new Error("extended point not allowed");const{x:e,y:r}=t||{};return w("x",e),w("y",r),new B(e,r,u,y(e*r))}static fromBytes(t,e=!1){const r=o.BYTES,{a:i,d:s}=d;t=(0,n.nC)((0,n.eV)(t,r,"point")),(0,n.d6)(e,"zip215");const c=(0,n.nC)(t),h=t[r-1];c[r-1]=-129&h;const f=(0,n.lX)(c),l=e?p:o.ORDER;(0,n.aK)("point.y",f,a,l);const w=y(f*f),g=y(w-u),x=y(s*w-i);let{isValid:E,value:b}=m(g,x);if(!E)throw new Error("bad point: invalid y coordinate");const S=(b&u)===u,v=!!(128&h);if(!e&&b===a&&v)throw new Error("bad point: x=0 and x_0=1");return v!==S&&(b=y(-b)),B.fromAffine({x:b,y:f})}static fromHex(t,e=!1){return B.fromBytes((0,n.qj)("point",t),e)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(t=8,e=!0){return b.createCache(this,t),e||this.multiply(c),this}assertValidity(){E(this)}equals(t){g(t);const{X:e,Y:r,Z:n}=this,{X:i,Y:s,Z:o}=t,a=y(e*o),u=y(i*n),c=y(r*o),h=y(s*n);return a===u&&c===h}is0(){return this.equals(B.ZERO)}negate(){return new B(y(-this.X),this.Y,this.Z,y(-this.T))}double(){const{a:t}=d,{X:e,Y:r,Z:n}=this,i=y(e*e),s=y(r*r),o=y(c*y(n*n)),a=y(t*i),u=e+r,h=y(y(u*u)-i-s),f=a+s,l=f-o,p=a-s,m=y(h*l),w=y(f*p),g=y(h*p),x=y(l*f);return new B(m,w,x,g)}add(t){g(t);const{a:e,d:r}=d,{X:n,Y:i,Z:s,T:o}=this,{X:a,Y:u,Z:c,T:h}=t,f=y(n*a),l=y(i*u),p=y(o*r*h),m=y(s*c),w=y((n+i)*(a+u)-f-l),x=m-p,E=m+p,b=y(l-e*f),S=y(w*x),v=y(E*b),T=y(w*b),A=y(x*E);return new B(S,v,A,T)}subtract(t){return this.add(t.negate())}multiply(t){if(!f.isValidNot0(t))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:e,f:r}=b.cached(this,t,t=>(0,s.Ak)(B,t));return(0,s.Ak)(B,[e,r])[0]}multiplyUnsafe(t,e=B.ZERO){if(!f.isValid(t))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return t===a?B.ZERO:this.is0()||t===u?this:b.unsafe(this,t,t=>(0,s.Ak)(B,t),e)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return b.unsafe(this,d.n).is0()}toAffine(t){return x(this,t)}clearCofactor(){return l===u?this:this.multiplyUnsafe(l)}toBytes(){const{x:t,y:e}=this.toAffine(),r=o.toBytes(e);return r[r.length-1]|=t&u?128:0,r}toHex(){return(0,i.My)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(t){return(0,s.Ak)(B,t)}static msm(t,e){return(0,s.Xf)(B,f,t,e)}_setWindowSize(t){this.precompute(t)}toRawBytes(){return this.toBytes()}}B.BASE=new B(d.Gx,d.Gy,u,y(d.Gx*d.Gy)),B.ZERO=new B(a,u,u,a),B.Fp=o,B.Fn=f;const b=new s.hT(B,f.BITS);return B.BASE.precompute(8),B}class d{constructor(t){this.ep=t}static fromBytes(t){(0,n.SJ)()}static fromHex(t){(0,n.SJ)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(t){return this.ep.toAffine(t)}toHex(){return(0,i.My)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(t){return this.assertSame(t),this.init(this.ep.add(t.ep))}subtract(t){return this.assertSame(t),this.init(this.ep.subtract(t.ep))}multiply(t){return this.init(this.ep.multiply(t))}multiplyUnsafe(t){return this.init(this.ep.multiplyUnsafe(t))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(t,e){return this.init(this.ep.precompute(t,e))}toRawBytes(){return this.toBytes()}}function l(t){const{CURVE:e,curveOpts:r,hash:s,eddsaOpts:a}=function(t){const e={a:t.a,d:t.d,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r={Fp:t.Fp,Fn:(0,o.D0)(e.n,t.nBitLength,!0),uvRatio:t.uvRatio},n={randomBytes:t.randomBytes,adjustScalarBytes:t.adjustScalarBytes,domain:t.domain,prehash:t.prehash,mapToCurve:t.mapToCurve};return{CURVE:e,curveOpts:r,hash:t.hash,eddsaOpts:n}}(t);return function(t,e){const r=e.Point;return Object.assign({},e,{ExtendedPoint:r,CURVE:t,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}(t,function(t,e,r={}){if("function"!=typeof e)throw new Error('"hash" function param is required');(0,n.DS)(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:s}=r,{BASE:o,Fp:a,Fn:c}=t,h=r.randomBytes||i.po,f=r.adjustScalarBytes||(t=>t),d=r.domain||((t,e,r)=>{if((0,n.d6)(r,"phflag"),e.length||r)throw new Error("Contexts/pre-hash are not supported");return t});function l(t){return c.create((0,n.lX)(t))}function p(t){const{head:r,prefix:i,scalar:s}=function(t){const r=x.secretKey;t=(0,n.qj)("private key",t,r);const i=(0,n.qj)("hashed private key",e(t),2*r),s=f(i.slice(0,r));return{head:s,prefix:i.slice(r,2*r),scalar:l(s)}}(t),a=o.multiply(s),u=a.toBytes();return{head:r,prefix:i,scalar:s,point:a,pointBytes:u}}function y(t){return p(t).pointBytes}function m(t=Uint8Array.of(),...r){const o=(0,i.Id)(...r);return l(e(d(o,(0,n.qj)("context",t),!!s)))}const w={zip215:!0},g=a.BYTES,x={secretKey:g,publicKey:g,signature:2*g,seed:g};function E(t=h(x.seed)){return(0,n.eV)(t,x.seed,"seed")}const B={getExtendedPublicKey:p,randomSecretKey:E,isValidSecretKey:function(t){return(0,i.aY)(t)&&t.length===c.BYTES},isValidPublicKey:function(e,r){try{return!!t.fromBytes(e,r)}catch(t){return!1}},toMontgomery(e){const{y:r}=t.fromBytes(e),n=x.publicKey,i=32===n;if(!i&&57!==n)throw new Error("only defined for 25519 and 448");const s=i?a.div(u+r,u-r):a.div(r-u,r+u);return a.toBytes(s)},toMontgomerySecret(t){const r=x.secretKey;(0,n.eV)(t,r);const i=e(t.subarray(0,r));return f(i).subarray(0,r)},randomPrivateKey:E,precompute:(e=8,r=t.BASE)=>r.precompute(e,!1)};return Object.freeze({keygen:function(t){const e=B.randomSecretKey(t);return{secretKey:e,publicKey:y(e)}},getPublicKey:y,sign:function(t,e,r={}){t=(0,n.qj)("message",t),s&&(t=s(t));const{prefix:a,scalar:u,pointBytes:h}=p(e),f=m(r.context,a,t),d=o.multiply(f).toBytes(),l=m(r.context,d,h,t),y=c.create(f+l*u);if(!c.isValid(y))throw new Error("sign failed: invalid s");const w=(0,i.Id)(d,c.toBytes(y));return(0,n.eV)(w,x.signature,"result")},verify:function(e,r,i,a=w){const{context:u,zip215:c}=a,h=x.signature;e=(0,n.qj)("signature",e,h),r=(0,n.qj)("message",r),i=(0,n.qj)("publicKey",i,x.publicKey),void 0!==c&&(0,n.d6)(c,"zip215"),s&&(r=s(r));const f=h/2,d=e.subarray(0,f),l=(0,n.lX)(e.subarray(f,h));let p,y,g;try{p=t.fromBytes(i,c),y=t.fromBytes(d,c),g=o.multiplyUnsafe(l)}catch(t){return!1}if(!c&&p.isSmallOrder())return!1;const E=m(u,y.toBytes(),p.toBytes(),r);return y.add(p.multiplyUnsafe(E)).subtract(g).clearCofactor().is0()},utils:B,Point:t,lengths:x})}(f(e,r),s,a))}},9388:(t,e,r)=>{r.d(e,{Tq:()=>f,qX:()=>p,qj:()=>y,zc:()=>d});var n=r(1848),i=r(2531),s=r(8030);const o=n.Ph;function a(t,e){if(c(t),c(e),t<0||t>=1<<8*e)throw new Error("invalid I2OSP input: "+t);const r=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)r[n]=255&t,t>>>=8;return new Uint8Array(r)}function u(t,e){const r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t[n]^e[n];return r}function c(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function h(t){if(!(0,i.aY)(t)&&"string"!=typeof t)throw new Error("DST must be Uint8Array or string");return"string"==typeof t?(0,i.AI)(t):t}function f(t,e,r,n){(0,i.DO)(t),c(r),(e=h(e)).length>255&&(e=n((0,i.Id)((0,i.AI)("H2C-OVERSIZE-DST-"),e)));const{outputLen:s,blockLen:o}=n,f=Math.ceil(r/s);if(r>65535||f>255)throw new Error("expand_message_xmd: invalid lenInBytes");const d=(0,i.Id)(e,a(e.length,1)),l=a(0,o),p=a(r,2),y=new Array(f),m=n((0,i.Id)(l,t,p,a(0,1),d));y[0]=n((0,i.Id)(m,a(1,1),d));for(let t=1;t<=f;t++){const e=[u(m,y[t-1]),a(t+1,1),d];y[t]=n((0,i.Id)(...e))}return(0,i.Id)(...y).slice(0,r)}function d(t,e,r,n,s){if((0,i.DO)(t),c(r),(e=h(e)).length>255){const t=Math.ceil(2*n/8);e=s.create({dkLen:t}).update((0,i.AI)("H2C-OVERSIZE-DST-")).update(e).digest()}if(r>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return s.create({dkLen:r}).update(t).update(a(r,2)).update(e).update(a(e.length,1)).digest()}function l(t,e,r){(0,n.DS)(r,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:a,k:u,m:h,hash:l,expand:p,DST:y}=r;if(!(0,n.jN)(r.hash))throw new Error("expected valid hash");(0,i.DO)(t),c(e);const m=a.toString(2).length,w=Math.ceil((m+u)/8),g=e*h*w;let x;if("xmd"===p)x=f(t,y,g,l);else if("xof"===p)x=d(t,y,g,u,l);else{if("_internal_pass"!==p)throw new Error('expand must be "xmd" or "xof"');x=t}const E=new Array(e);for(let t=0;t<e;t++){const e=new Array(h);for(let r=0;r<h;r++){const n=w*(r+t*h),i=x.subarray(n,n+w);e[r]=(0,s.zi)(o(i),a)}E[t]=e}return E}const p=(0,i.AI)("HashToScalar-");function y(t,e,r){if("function"!=typeof e)throw new Error("mapToCurve() must be defined");function n(r){return t.fromAffine(e(r))}function i(e){const r=e.clearCofactor();return r.equals(t.ZERO)?t.ZERO:(r.assertValidity(),r)}return{defaults:r,hashToCurve(t,e){const s=l(t,2,Object.assign({},r,e)),o=n(s[0]),a=n(s[1]);return i(o.add(a))},encodeToCurve(t,e){const s=r.encodeDST?{DST:r.encodeDST}:{};return i(n(l(t,1,Object.assign({},r,s,e))[0]))},mapToCurve(t){if(!Array.isArray(t))throw new Error("expected array of bigints");for(const e of t)if("bigint"!=typeof e)throw new Error("expected array of bigints");return i(n(t))},hashToScalar(e,n){const i=t.Fn.ORDER;return l(e,1,Object.assign({},r,{p:i,m:1,DST:p},n))[0][0]}}}}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 766.index.js.LICENSE.txt */
|
|
2
|
+
export const __webpack_esm_id__=766;export const __webpack_esm_ids__=[766];export const __webpack_esm_modules__={3766:(f,e,t)=>{t.d(e,{ed448:()=>O});var n=t(7238),c=t(2531),a=t(615),i=t(8888),r=(t(9388),t(8030)),s=t(1848);const o={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x3fffffffffffffffffffffffffffffffffffffffffffffffffffffff7cca23e9c44edb49aed63690216cc2728dc58f552378c292ab5844f3"),h:BigInt(4),a:BigInt(1),d:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffffffffffffffffffffffffffffffffffffffffffffffff6756"),Gx:BigInt("0x4f1970c66bed0ded221d15a622bf36da9e146570470f1767ea6de324a3d3a46412ae1af72ab66511433b80e18b00938e2626a82bc70cc05e"),Gy:BigInt("0x693f46716eb6bc248876203756c9c7624bea73736ca3984087789c1e05a0c2d73ad3ff1ce67c39c4fdbd132c4ed7c8ad9808795bf230fa14")},d=Object.assign({},o,{d:BigInt("0xd78b4bdc7f0daf19f24f38c29373a2ccad46157242a50f37809b1da3412a12e79ccc9c81264cfe9ad080997058fb61c4243cc32dbaa156b9"),Gx:BigInt("0x79a70b2b70400553ae7c9df416c792c61128751ac92969240c25a07d728bdc93e21f7787ed6972249de732f38496cd11698713093e9c04fc"),Gy:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000000000000000000000000000000000000000000000000001")}),B=(0,c.qj)(()=>n.mh.create({dkLen:114})),u=BigInt(1),g=BigInt(2),b=BigInt(3),I=BigInt(4),l=BigInt(11),h=BigInt(22),m=BigInt(44),w=BigInt(88),p=BigInt(223);function x(f){return f[0]&=252,f[55]|=128,f[56]=0,f}function _(f,e){const t=o.p,n=(0,r.zi)(f*f*e,t),c=(0,r.zi)(n*f,t),a=function(f){const e=o.p,t=f*f*f%e,n=t*t*f%e,c=(0,r.zH)(n,b,e)*n%e,a=(0,r.zH)(c,b,e)*n%e,i=(0,r.zH)(a,g,e)*t%e,s=(0,r.zH)(i,l,e)*i%e,d=(0,r.zH)(s,h,e)*s%e,B=(0,r.zH)(d,m,e)*d%e,I=(0,r.zH)(B,w,e)*B%e,x=(0,r.zH)(I,m,e)*d%e,_=(0,r.zH)(x,g,e)*t%e,z=(0,r.zH)(_,u,e)*f%e;return(0,r.zH)(z,p,e)*_%e}((0,r.zi)(c*n*e,t)),i=(0,r.zi)(c*a,t),s=(0,r.zi)(i*i,t);return{isValid:(0,r.zi)(s*e,t)===f,value:i}}const z=(()=>(0,r.D0)(o.p,{BITS:456,isLE:!0}))(),E=(()=>(0,r.D0)(o.n,{BITS:456,isLE:!0}))(),y=(()=>(0,r.D0)(o.p,{BITS:448,isLE:!0}))(),H=(()=>(0,r.D0)(o.n,{BITS:448,isLE:!0}))();function S(f,e,t){if(e.length>255)throw new Error("context must be smaller than 255, got: "+e.length);return(0,c.Id)((0,s.Mh)("SigEd448"),new Uint8Array([t?1:0,e.length]),e,f)}const D=(()=>({...o,Fp:z,Fn:E,nBitLength:E.BITS,hash:B,adjustScalarBytes:x,domain:S,uvRatio:_}))(),O=(0,i.n6)(D);(0,i.TO)(d);const R=BigInt("39082"),v=BigInt("78163"),T=BigInt("98944233647732219769177004876929019128417576295529901074099889598043702116001257856802131563896515373927712232092845883226922417596214"),L=BigInt("315019913931389607337177038330951043522456072897266928557328499619017160722351061360252776265186336876723201881398623946864393857820716"),P=f=>_(u,f);function j(f){const{d:e}=o,t=z.ORDER,n=f=>z.create(f),c=n(-f*f),a=n(e*(c-u)),i=n((a+u)*(a-c)),{isValid:s,value:d}=_(v,n((c+u)*i));let B=d;s||(B=n(f*d));let b=u;s||(b=n(-u));const I=n(B*(c+u));let l=I;(0,r.dQ)(I,t)&&(l=n(-I));const h=I*I,m=n(l*g),w=n(h+u),p=n(h-u),x=n(B*I*(c-u)*v+b);return new O.Point(n(m*x),n(p*w),n(w*x),n(m*p))}class q extends i.i5{constructor(f){super(f)}static fromAffine(f){return new q(O.Point.fromAffine(f))}assertSame(f){if(!(f instanceof q))throw new Error("DecafPoint expected")}init(f){return new q(f)}static hashToCurve(f){return function(f){(0,c.DO)(f,112);const e=!0,t=j(y.create(y.fromBytes(f.subarray(0,56),e))),n=j(y.create(y.fromBytes(f.subarray(56,112),e)));return new q(t.add(n))}((0,s.qj)("decafHash",f,112))}static fromBytes(f){(0,c.DO)(f,56);const{d:e}=o,t=z.ORDER,n=f=>y.create(f),a=y.fromBytes(f);if(!(0,s.ex)(H.toBytes(a),f)||(0,r.dQ)(a,t))throw new Error("invalid decaf448 encoding 1");const i=n(a*a),d=n(u+i),B=n(d*d),g=n(B-I*e*i),{isValid:b,value:l}=P(n(g*B));let h=n((a+a)*l*d*T);(0,r.dQ)(h,t)&&(h=n(-h));const m=n(h*l*g*L),w=n((u-i)*l*d),p=n(m*w);if(!b)throw new Error("invalid decaf448 encoding 2");return new q(new O.Point(m,w,u,p))}static fromHex(f){return q.fromBytes((0,s.qj)("decafHex",f,56))}static msm(f,e){return(0,a.Xf)(q,E,f,e)}toBytes(){const{X:f,Z:e,T:t}=this.ep,n=z.ORDER,c=f=>z.create(f),a=c(c(f+t)*c(f-t)),i=c(f*f),{value:s}=P(c(a*R*i));let o=c(s*a*T);(0,r.dQ)(o,n)&&(o=c(-o));const d=c(L*o*e-t);let B=c(R*s*f*d);return(0,r.dQ)(B,n)&&(B=c(-B)),H.toBytes(B)}equals(f){this.assertSame(f);const{X:e,Y:t}=this.ep,{X:n,Y:c}=f.ep;return z.create(e*c)===z.create(t*n)}is0(){return this.equals(q.ZERO)}}q.BASE=(()=>new q(O.Point.BASE).multiplyUnsafe(g))(),q.ZERO=(()=>new q(O.Point.ZERO))(),q.Fp=(()=>y)(),q.Fn=(()=>H)()}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
@@ -38,7 +38,6 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
|
|
|
38
38
|
const [isLoggedIn, setIsLoggedIn] = useState(false);
|
|
39
39
|
const [userPub, setUserPub] = useState(null);
|
|
40
40
|
const [username, setUsername] = useState(null);
|
|
41
|
-
const [pendingSignupData, setPendingSignupData] = useState(null);
|
|
42
41
|
// Effetto per gestire l'inizializzazione e pulizia
|
|
43
42
|
useEffect(() => {
|
|
44
43
|
var _a, _b;
|
|
@@ -333,12 +332,7 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
|
|
|
333
332
|
seedPhrase: result.seedPhrase,
|
|
334
333
|
authMethod: authMethod,
|
|
335
334
|
};
|
|
336
|
-
|
|
337
|
-
setPendingSignupData(signupPayload);
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
onSignupSuccess === null || onSignupSuccess === void 0 ? void 0 : onSignupSuccess(signupPayload);
|
|
341
|
-
}
|
|
335
|
+
onSignupSuccess === null || onSignupSuccess === void 0 ? void 0 : onSignupSuccess(signupPayload);
|
|
342
336
|
}
|
|
343
337
|
else {
|
|
344
338
|
onError === null || onError === void 0 ? void 0 : onError(result.error);
|
|
@@ -358,7 +352,6 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
|
|
|
358
352
|
setIsLoggedIn(false);
|
|
359
353
|
setUserPub(null);
|
|
360
354
|
setUsername(null);
|
|
361
|
-
setPendingSignupData(null);
|
|
362
355
|
};
|
|
363
356
|
// Implementazione del metodo setProvider
|
|
364
357
|
const setProvider = (provider) => {
|
|
@@ -472,13 +465,8 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
|
|
|
472
465
|
const gunPlugin = null;
|
|
473
466
|
// Plugin hooks removed - GunAdvancedPlugin no longer available
|
|
474
467
|
const pluginHooks = {};
|
|
475
|
-
const completePendingSignup = React.useCallback(() => {
|
|
476
|
-
|
|
477
|
-
const dataToEmit = pendingSignupData;
|
|
478
|
-
setPendingSignupData(null);
|
|
479
|
-
onSignupSuccess === null || onSignupSuccess === void 0 ? void 0 : onSignupSuccess(dataToEmit);
|
|
480
|
-
}
|
|
481
|
-
}, [pendingSignupData, onSignupSuccess]);
|
|
468
|
+
const completePendingSignup = React.useCallback(() => { }, []);
|
|
469
|
+
const hasPendingSignup = false;
|
|
482
470
|
// Create a properly typed context value
|
|
483
471
|
const contextValue = React.useMemo(() => ({
|
|
484
472
|
core,
|
|
@@ -497,7 +485,7 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
|
|
|
497
485
|
setProvider,
|
|
498
486
|
gunPlugin,
|
|
499
487
|
completePendingSignup,
|
|
500
|
-
hasPendingSignup
|
|
488
|
+
hasPendingSignup,
|
|
501
489
|
put: async (path, data) => {
|
|
502
490
|
if (isShogunCore(core)) {
|
|
503
491
|
if (!core.gun)
|
|
@@ -556,7 +544,6 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
|
|
|
556
544
|
importGunPair,
|
|
557
545
|
gunPlugin,
|
|
558
546
|
pluginHooks,
|
|
559
|
-
pendingSignupData,
|
|
560
547
|
completePendingSignup,
|
|
561
548
|
]);
|
|
562
549
|
// Provide the context value to children
|
|
@@ -607,7 +594,7 @@ const ExportIcon = () => (React.createElement("svg", { xmlns: "http://www.w3.org
|
|
|
607
594
|
// Component for Shogun login button
|
|
608
595
|
export const ShogunButton = (() => {
|
|
609
596
|
const Button = () => {
|
|
610
|
-
const { isLoggedIn, username, logout, login, signUp, core, options, exportGunPair, importGunPair, hasPlugin,
|
|
597
|
+
const { isLoggedIn, username, logout, login, signUp, core, options, exportGunPair, importGunPair, hasPlugin, } = useShogun();
|
|
611
598
|
// Form states
|
|
612
599
|
const [modalIsOpen, setModalIsOpen] = useState(false);
|
|
613
600
|
const [formUsername, setFormUsername] = useState("");
|
|
@@ -629,10 +616,8 @@ export const ShogunButton = (() => {
|
|
|
629
616
|
const [showCopySuccess, setShowCopySuccess] = useState(false);
|
|
630
617
|
const [showImportSuccess, setShowImportSuccess] = useState(false);
|
|
631
618
|
const [zkTrapdoor, setZkTrapdoor] = useState("");
|
|
632
|
-
const [zkGeneratedTrapdoor, setZkGeneratedTrapdoor] = useState("");
|
|
633
619
|
const [webauthnSeedPhrase, setWebauthnSeedPhrase] = useState("");
|
|
634
620
|
const dropdownRef = useRef(null);
|
|
635
|
-
const [pendingZkConfirmation, setPendingZkConfirmation] = useState(false);
|
|
636
621
|
// Handle click outside to close dropdown
|
|
637
622
|
useEffect(() => {
|
|
638
623
|
const handleClickOutside = (event) => {
|
|
@@ -803,15 +788,11 @@ export const ShogunButton = (() => {
|
|
|
803
788
|
setLoading(true);
|
|
804
789
|
try {
|
|
805
790
|
const result = await signUp("zkproof");
|
|
806
|
-
if (result
|
|
807
|
-
|
|
808
|
-
setZkGeneratedTrapdoor(result.seedPhrase);
|
|
809
|
-
setAuthView("zkproof-signup-result");
|
|
810
|
-
setPendingZkConfirmation(true);
|
|
811
|
-
}
|
|
812
|
-
else if (result && !result.success) {
|
|
813
|
-
throw new Error(result.error || "ZK-Proof signup failed");
|
|
791
|
+
if (!result || !result.success) {
|
|
792
|
+
throw new Error((result === null || result === void 0 ? void 0 : result.error) || "ZK-Proof signup failed");
|
|
814
793
|
}
|
|
794
|
+
setAuthView("options");
|
|
795
|
+
setModalIsOpen(false);
|
|
815
796
|
}
|
|
816
797
|
catch (e) {
|
|
817
798
|
setError(e.message || "ZK-Proof signup failed");
|
|
@@ -930,9 +911,7 @@ export const ShogunButton = (() => {
|
|
|
930
911
|
setShowImportSuccess(false);
|
|
931
912
|
setRecoveredHint("");
|
|
932
913
|
setZkTrapdoor("");
|
|
933
|
-
setZkGeneratedTrapdoor("");
|
|
934
914
|
setWebauthnSeedPhrase("");
|
|
935
|
-
setPendingZkConfirmation(false);
|
|
936
915
|
};
|
|
937
916
|
const openModal = () => {
|
|
938
917
|
resetForm();
|
|
@@ -940,17 +919,12 @@ export const ShogunButton = (() => {
|
|
|
940
919
|
setModalIsOpen(true);
|
|
941
920
|
};
|
|
942
921
|
const closeModal = () => {
|
|
943
|
-
|
|
944
|
-
setError("Please save your trapdoor and confirm before leaving this screen.");
|
|
945
|
-
return;
|
|
946
|
-
}
|
|
922
|
+
setError("");
|
|
947
923
|
setModalIsOpen(false);
|
|
948
924
|
};
|
|
949
925
|
const finalizeZkProofSignup = () => {
|
|
950
|
-
completePendingSignup();
|
|
951
926
|
setError("");
|
|
952
|
-
|
|
953
|
-
setAuthView("options");
|
|
927
|
+
resetForm();
|
|
954
928
|
setModalIsOpen(false);
|
|
955
929
|
};
|
|
956
930
|
const toggleMode = () => {
|
|
@@ -1222,52 +1196,6 @@ export const ShogunButton = (() => {
|
|
|
1222
1196
|
textAlign: "center",
|
|
1223
1197
|
} }, "\u2705 You're now logged in with WebAuthn!"),
|
|
1224
1198
|
React.createElement("button", { type: "button", className: "shogun-submit-button", style: { marginTop: "16px" }, onClick: finalizeZkProofSignup }, "Close and Start Using App")));
|
|
1225
|
-
const renderZkProofSignupResult = () => (React.createElement("div", { className: "shogun-auth-form" },
|
|
1226
|
-
React.createElement("h3", null, "ZK-Proof Account Created!"),
|
|
1227
|
-
React.createElement("div", { style: {
|
|
1228
|
-
backgroundColor: "#fef3c7",
|
|
1229
|
-
padding: "12px",
|
|
1230
|
-
borderRadius: "8px",
|
|
1231
|
-
marginBottom: "16px",
|
|
1232
|
-
border: "1px solid #f59e0b",
|
|
1233
|
-
} },
|
|
1234
|
-
React.createElement("p", { style: {
|
|
1235
|
-
fontSize: "14px",
|
|
1236
|
-
color: "#92400e",
|
|
1237
|
-
margin: "0",
|
|
1238
|
-
fontWeight: "500",
|
|
1239
|
-
} }, "\u26A0\uFE0F CRITICAL: Save Your Trapdoor!"),
|
|
1240
|
-
React.createElement("p", { style: { fontSize: "13px", color: "#a16207", margin: "4px 0 0 0" } }, "This is your ONLY way to recover your anonymous account. Save it in a secure location. If you lose it, you will lose access to your account permanently.")),
|
|
1241
|
-
React.createElement("div", { className: "shogun-form-group" },
|
|
1242
|
-
React.createElement("label", null, "Your Trapdoor (Recovery Phrase):"),
|
|
1243
|
-
React.createElement("textarea", { value: zkGeneratedTrapdoor, readOnly: true, rows: 4, style: {
|
|
1244
|
-
fontFamily: "monospace",
|
|
1245
|
-
fontSize: "12px",
|
|
1246
|
-
width: "100%",
|
|
1247
|
-
padding: "8px",
|
|
1248
|
-
border: "2px solid #f59e0b",
|
|
1249
|
-
borderRadius: "4px",
|
|
1250
|
-
backgroundColor: "#fffbeb",
|
|
1251
|
-
} }),
|
|
1252
|
-
React.createElement("button", { type: "button", className: "shogun-submit-button", style: { marginTop: "8px" }, onClick: async () => {
|
|
1253
|
-
if (navigator.clipboard) {
|
|
1254
|
-
await navigator.clipboard.writeText(zkGeneratedTrapdoor);
|
|
1255
|
-
setShowCopySuccess(true);
|
|
1256
|
-
setTimeout(() => setShowCopySuccess(false), 3000);
|
|
1257
|
-
}
|
|
1258
|
-
} }, showCopySuccess ? "✅ Copied!" : "📋 Copy Trapdoor"),
|
|
1259
|
-
!navigator.clipboard && (React.createElement("p", { style: { fontSize: "12px", color: "#666", marginTop: "8px" } }, "\u26A0\uFE0F Please manually copy the trapdoor above."))),
|
|
1260
|
-
React.createElement("div", { style: {
|
|
1261
|
-
backgroundColor: "#dcfce7",
|
|
1262
|
-
color: "#166534",
|
|
1263
|
-
padding: "12px",
|
|
1264
|
-
borderRadius: "8px",
|
|
1265
|
-
marginTop: "16px",
|
|
1266
|
-
fontSize: "14px",
|
|
1267
|
-
border: "1px solid #22c55e",
|
|
1268
|
-
textAlign: "center",
|
|
1269
|
-
} }, "\u2705 You're now logged in anonymously!"),
|
|
1270
|
-
React.createElement("button", { type: "button", className: "shogun-submit-button", style: { marginTop: "16px" }, onClick: finalizeZkProofSignup }, "Close and Start Using App")));
|
|
1271
1199
|
const renderImportForm = () => (React.createElement("div", { className: "shogun-auth-form" },
|
|
1272
1200
|
React.createElement("h3", null, "Import Gun Pair"),
|
|
1273
1201
|
React.createElement("div", { style: {
|
|
@@ -1327,13 +1255,7 @@ export const ShogunButton = (() => {
|
|
|
1327
1255
|
React.createElement("button", { className: "shogun-connect-button", onClick: openModal },
|
|
1328
1256
|
React.createElement(WalletIcon, null),
|
|
1329
1257
|
React.createElement("span", null, "Login / Sign Up")),
|
|
1330
|
-
modalIsOpen && (React.createElement("div", { className: "shogun-modal-overlay", onClick:
|
|
1331
|
-
if (pendingZkConfirmation || hasPendingSignup) {
|
|
1332
|
-
setError("Please copy your trapdoor and press Continue before closing.");
|
|
1333
|
-
return;
|
|
1334
|
-
}
|
|
1335
|
-
closeModal();
|
|
1336
|
-
} },
|
|
1258
|
+
modalIsOpen && (React.createElement("div", { className: "shogun-modal-overlay", onClick: closeModal },
|
|
1337
1259
|
React.createElement("div", { className: "shogun-modal", onClick: (e) => e.stopPropagation() },
|
|
1338
1260
|
React.createElement("div", { className: "shogun-modal-header" },
|
|
1339
1261
|
React.createElement("h2", null, authView === "recover"
|
|
@@ -1348,12 +1270,10 @@ export const ShogunButton = (() => {
|
|
|
1348
1270
|
? "WebAuthn"
|
|
1349
1271
|
: authView === "zkproof-login"
|
|
1350
1272
|
? "ZK-Proof Login"
|
|
1351
|
-
:
|
|
1352
|
-
? "
|
|
1353
|
-
:
|
|
1354
|
-
|
|
1355
|
-
: "Sign Up"),
|
|
1356
|
-
React.createElement("button", { className: "shogun-close-button", onClick: closeModal, "aria-label": "Close", disabled: pendingZkConfirmation || hasPendingSignup },
|
|
1273
|
+
: formMode === "login"
|
|
1274
|
+
? "Login"
|
|
1275
|
+
: "Sign Up"),
|
|
1276
|
+
React.createElement("button", { className: "shogun-close-button", onClick: closeModal, "aria-label": "Close" },
|
|
1357
1277
|
React.createElement(CloseIcon, null))),
|
|
1358
1278
|
React.createElement("div", { className: "shogun-modal-content" },
|
|
1359
1279
|
error && React.createElement("div", { className: "shogun-error-message" }, error),
|
|
@@ -1374,9 +1294,7 @@ export const ShogunButton = (() => {
|
|
|
1374
1294
|
renderWebAuthnUsernameForm(),
|
|
1375
1295
|
authView === "webauthn-signup-result" &&
|
|
1376
1296
|
renderWebauthnSignupResult(),
|
|
1377
|
-
authView === "zkproof-login" && renderZkProofLoginForm()
|
|
1378
|
-
authView === "zkproof-signup-result" &&
|
|
1379
|
-
renderZkProofSignupResult()))))));
|
|
1297
|
+
authView === "zkproof-login" && renderZkProofLoginForm()))))));
|
|
1380
1298
|
};
|
|
1381
1299
|
Button.displayName = "ShogunButton";
|
|
1382
1300
|
return Object.assign(Button, {
|