8 lines
4.2 KiB
JavaScript
8 lines
4.2 KiB
JavaScript
import{v as rr,w as er,x as tr}from"./chunk-DUYWEMAT.js";import{e as x}from"./chunk-WMCBVXPA.js";import{c as v,f as j,n as process,o as f,p as c,q as u}from"./chunk-QTLWQ5AJ.js";var g=v((xr,F)=>{f();u();var nr=Math.pow(2,30)-1;F.exports=function(r,e){if(typeof r!="number")throw new TypeError("Iterations not a number");if(r<0)throw new TypeError("Bad iterations");if(typeof e!="number")throw new TypeError("Key length not a number");if(e<0||e>nr||e!==e)throw new TypeError("Bad key length")}});var A=v((Pr,R)=>{f();u();var d;globalThis.process&&globalThis.process.browser?d="utf-8":globalThis.process&&globalThis.process.version?(C=parseInt(process.version.split(".")[0].slice(1),10),d=C>=6?"utf-8":"binary"):d="utf-8";var C;R.exports=d});var H=v((zr,U)=>{f();u();var P=x().Buffer;U.exports=function(r,e,o){if(P.isBuffer(r))return r;if(typeof r=="string")return P.from(r,e);if(ArrayBuffer.isView(r))return P.from(r.buffer);throw new TypeError(o+" must be a string, a Buffer, a typed array or a DataView")}});var T=v((Kr,O)=>{f();u();var ar=tr(),fr=rr(),ur=er(),l=x().Buffer,ir=g(),L=A(),M=H(),sr=l.alloc(128),B={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function N(r,e,o){var n=cr(r),t=r==="sha512"||r==="sha384"?128:64;e.length>t?e=n(e):e.length<t&&(e=l.concat([e,sr],t));for(var a=l.allocUnsafe(t+B[r]),s=l.allocUnsafe(t+B[r]),i=0;i<t;i++)a[i]=e[i]^54,s[i]=e[i]^92;var h=l.allocUnsafe(t+o+4);a.copy(h,0,0,t),this.ipad1=h,this.ipad2=a,this.opad=s,this.alg=r,this.blocksize=t,this.hash=n,this.size=B[r]}N.prototype.run=function(r,e){r.copy(e,this.blocksize);var o=this.hash(e);return o.copy(this.opad,this.blocksize),this.hash(this.opad)};function cr(r){function e(n){return ur(r).update(n).digest()}function o(n){return new fr().update(n).digest()}return r==="rmd160"||r==="ripemd160"?o:r==="md5"?ar:e}function hr(r,e,o,n,t){ir(o,n),r=M(r,L,"Password"),e=M(e,L,"Salt"),t=t||"sha1";var a=new N(t,r,e.length),s=l.allocUnsafe(n),i=l.allocUnsafe(e.length+4);e.copy(i,0,0,e.length);for(var h=0,y=B[t],Y=Math.ceil(n/y),E=1;E<=Y;E++){i.writeUInt32BE(E,e.length);for(var S=a.run(i,a.ipad1),q=S,K=1;K<o;K++){q=a.run(q,a.ipad2);for(var b=0;b<y;b++)S[b]^=q[b]}S.copy(s,h),h+=y}return s}O.exports=hr});var J=v((Rr,G)=>{f();u();var $=x().Buffer,lr=g(),_=A(),Z=T(),X=H(),w,m=globalThis.crypto&&globalThis.crypto.subtle,pr={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},z=[];function vr(r){if(globalThis.process&&!globalThis.process.browser||!m||!m.importKey||!m.deriveBits)return Promise.resolve(!1);if(z[r]!==void 0)return z[r];w=w||$.alloc(8);var e=k(w,w,10,128,r).then(function(){return!0}).catch(function(){return!1});return z[r]=e,e}var p;function D(){return p||(globalThis.process&&globalThis.process.nextTick?p=globalThis.process.nextTick:globalThis.queueMicrotask?p=globalThis.queueMicrotask:globalThis.setImmediate?p=globalThis.setImmediate:p=globalThis.setTimeout,p)}function k(r,e,o,n,t){return m.importKey("raw",r,{name:"PBKDF2"},!1,["deriveBits"]).then(function(a){return m.deriveBits({name:"PBKDF2",salt:e,iterations:o,hash:{name:t}},a,n<<3)}).then(function(a){return $.from(a)})}function mr(r,e){r.then(function(o){D()(function(){e(null,o)})},function(o){D()(function(){e(o)})})}G.exports=function(r,e,o,n,t,a){typeof t=="function"&&(a=t,t=void 0),t=t||"sha1";var s=pr[t.toLowerCase()];if(!s||typeof globalThis.Promise!="function"){D()(function(){var i;try{i=Z(r,e,o,n,t)}catch(h){return a(h)}a(null,i)});return}if(lr(o,n),r=X(r,_,"Password"),e=X(e,_,"Salt"),typeof a!="function")throw new Error("No callback provided to pbkdf2");mr(vr(s).then(function(i){return i?k(r,e,o,n,s):Z(r,e,o,n,t)}),a)}});var Q=v(I=>{f();u();I.pbkdf2=J();I.pbkdf2Sync=T()});f();u();var dr={PRE_TRADE:80001};f();u();function or(r){return r.then(e=>[null,e.data]).catch(e=>[e])}f();u();var W=j(Q());function V(r){return(r||"").normalize("NFKD")}function br(r){return`mnemonic${r||""}`}var _r=(r,e)=>{let o=c.Buffer.from(V(r),"utf8"),n=c.Buffer.from(br(V(e)),"utf8");return W.default.pbkdf2Sync(o,n,2048,64,"sha512")};export{dr as a,or as b,_r as c};
|
|
|
|
window.inOKXExtension = true;
|
|
window.inMiniApp = false;
|
|
window.ASSETS_BUILD_TYPE = "publish";
|
|
|
|
//# sourceMappingURL=chunk-52LHB4XI.js.map
|