mirror of
https://github.com/logos-messaging/examples.waku.org.git
synced 2026-01-07 07:13:12 +00:00
2 lines
23 KiB
JavaScript
2 lines
23 KiB
JavaScript
"use strict";(self.webpackChunkrln_reactts=self.webpackChunkrln_reactts||[]).push([[440],{2497:function(n,t,e){e.d(t,{BG:function(){return U},Di:function(){return S},LK:function(){return k},Of:function(){return x},RP:function(){return W},T8:function(){return Z},ur:function(){return A},xG:function(){return B}});var r,i=e(6097),a=e(7324);n=e.hmd(n);var o=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});o.decode();var s=new Uint8Array;function u(){return 0===s.byteLength&&(s=new Uint8Array(r.memory.buffer)),s}function c(n,t){return o.decode(u().subarray(n,n+t))}var f=new Array(32).fill(void 0);f.push(void 0,null,!0,!1);var _=f.length;function b(n){_===f.length&&f.push(f.length+1);var t=_;return _=f[t],f[t]=n,t}function w(n){return f[n]}function g(n){var t=w(n);return function(n){n<36||(f[n]=_,_=n)}(n),t}var l=0,h=new TextEncoder("utf-8"),p="function"===typeof h.encodeInto?function(n,t){return h.encodeInto(n,t)}:function(n,t){var e=h.encode(n);return t.set(e),{read:n.length,written:e.length}};function d(n,t,e){if(void 0===e){var r=h.encode(n),i=t(r.length);return u().subarray(i,i+r.length).set(r),l=r.length,i}for(var a=n.length,o=t(a),s=u(),c=0;c<a;c++){var f=n.charCodeAt(c);if(f>127)break;s[o+c]=f}if(c!==a){0!==c&&(n=n.slice(c)),o=e(o,a,a=c+3*n.length);var _=u().subarray(o+c,o+a);c+=p(n,_).written}return l=c,o}var y=new Int32Array;function v(){return 0===y.byteLength&&(y=new Int32Array(r.memory.buffer)),y}function m(n){var t=typeof n;if("number"==t||"boolean"==t||null==n)return"".concat(n);if("string"==t)return'"'.concat(n,'"');if("symbol"==t){var e=n.description;return null==e?"Symbol":"Symbol(".concat(e,")")}if("function"==t){var r=n.name;return"string"==typeof r&&r.length>0?"Function(".concat(r,")"):"Function"}if(Array.isArray(n)){var i=n.length,a="[";i>0&&(a+=m(n[0]));for(var o=1;o<i;o++)a+=", "+m(n[o]);return a+="]"}var s,u=/\[object ([^\]]+)\]/.exec(toString.call(n));if(!(u.length>1))return toString.call(n);if("Object"==(s=u[1]))try{return"Object("+JSON.stringify(n)+")"}catch(c){return"Object"}return n instanceof Error?"".concat(n.name,": ").concat(n.message,"\n").concat(n.stack):s}function x(){r.init_panic_hook()}function k(n,t,e){return r.newRLN(n,b(t),b(e))}function A(n,t){return g(r.getSerializedRLNWitness(n,b(t)))}function S(n,t){try{var e=r.__wbindgen_add_to_stack_pointer(-16);r.insertMember(e,n,b(t));var i=v()[e/4+0];if(v()[e/4+1])throw g(i)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function Z(n,t){return g(r.RLNWitnessToJson(n,b(t)))}var I=new Uint32Array;function R(n,t){for(var e=t(4*n.length),i=(0===I.byteLength&&(I=new Uint32Array(r.memory.buffer)),I),a=0;a<n.length;a++)i[e/4+a]=b(n[a]);return l=n.length,e}function W(n,t,e){try{var i=r.__wbindgen_add_to_stack_pointer(-16),a=R(t,r.__wbindgen_malloc),o=l;r.generate_rln_proof_with_witness(i,n,a,o,b(e));var s=v()[i/4+0],u=v()[i/4+1];if(v()[i/4+2])throw g(u);return g(s)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function U(n){try{var t=r.__wbindgen_add_to_stack_pointer(-16);r.generateMembershipKey(t,n);var e=v()[t/4+0],i=v()[t/4+1];if(v()[t/4+2])throw g(i);return g(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function B(n,t){return 0!==r.verifyProof(n,b(t))}function C(n,t){try{return n.apply(this,t)}catch(e){r.__wbindgen_exn_store(b(e))}}function M(n,t){return u().subarray(n/1,n/1+t)}function L(n,t){return z.apply(this,arguments)}function z(){return z=(0,a.Z)((0,i.Z)().mark((function n(t,e){var r,a;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!("function"===typeof Response&&t instanceof Response)){n.next=23;break}if("function"!==typeof WebAssembly.instantiateStreaming){n.next=15;break}return n.prev=2,n.next=5,WebAssembly.instantiateStreaming(t,e);case 5:case 20:return n.abrupt("return",n.sent);case 8:if(n.prev=8,n.t0=n.catch(2),"application/wasm"==t.headers.get("Content-Type")){n.next=14;break}console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n.t0),n.next=15;break;case 14:throw n.t0;case 15:return n.next=17,t.arrayBuffer();case 17:return r=n.sent,n.next=20,WebAssembly.instantiate(r,e);case 23:return n.next=25,WebAssembly.instantiate(t,e);case 25:if(!((a=n.sent)instanceof WebAssembly.Instance)){n.next=30;break}return n.abrupt("return",{instance:a,module:t});case 30:return n.abrupt("return",a);case 31:case"end":return n.stop()}}),n,null,[[2,8]])}))),z.apply(this,arguments)}function E(){var t={wbg:{}};return t.wbg.__wbindgen_string_new=function(n,t){return b(c(n,t))},t.wbg.__wbindgen_object_drop_ref=function(n){g(n)},t.wbg.__wbindgen_is_string=function(n){return"string"===typeof w(n)},t.wbg.__wbindgen_string_get=function(n,t){var e,i=w(t),a="string"===typeof i?i:void 0,o=void 0===(e=a)||null===e?0:d(a,r.__wbindgen_malloc,r.__wbindgen_realloc),s=l;v()[n/4+1]=s,v()[n/4+0]=o},t.wbg.__wbg_BigInt_d0c7d465bfa30d3b=function(n){return b(BigInt(n))},t.wbg.__wbindgen_number_new=function(n){return b(n)},t.wbg.__wbg_BigInt_1fab4952b6c4a499=function(n){return b(BigInt(BigInt.asUintN(64,n)))},t.wbg.__wbindgen_object_clone_ref=function(n){return b(w(n))},t.wbg.__wbindgen_is_undefined=function(n){return void 0===w(n)},t.wbg.__wbindgen_is_object=function(n){var t=w(n);return"object"===typeof t&&null!==t},t.wbg.__wbg_set_c943d600fa71e4dd=function(n,t,e){w(n)[g(t)]=g(e)},t.wbg.__wbg_new_abda76e883ba8a5f=function(){return b(new Error)},t.wbg.__wbg_stack_658279fe44541cf6=function(n,t){var e=d(w(t).stack,r.__wbindgen_malloc,r.__wbindgen_realloc),i=l;v()[n/4+1]=i,v()[n/4+0]=e},t.wbg.__wbg_error_f851667af71bcfc6=function(n,t){try{console.error(c(n,t))}finally{r.__wbindgen_free(n,t)}},t.wbg.__wbg_randomFillSync_065afffde01daa66=function(){return C((function(n,t,e){w(n).randomFillSync(M(t,e))}),arguments)},t.wbg.__wbg_getRandomValues_b99eec4244a475bb=function(){return C((function(n,t){w(n).getRandomValues(w(t))}),arguments)},t.wbg.__wbg_process_0cc2ada8524d6f83=function(n){return b(w(n).process)},t.wbg.__wbg_versions_c11acceab27a6c87=function(n){return b(w(n).versions)},t.wbg.__wbg_node_7ff1ce49caf23815=function(n){return b(w(n).node)},t.wbg.__wbg_static_accessor_NODE_MODULE_cf6401cc1091279e=function(){return b(n)},t.wbg.__wbg_require_a746e79b322b9336=function(){return C((function(n,t,e){return b(w(n).require(c(t,e)))}),arguments)},t.wbg.__wbg_crypto_2036bed7c44c25e7=function(n){return b(w(n).crypto)},t.wbg.__wbg_msCrypto_a21fc88caf1ecdc8=function(n){return b(w(n).msCrypto)},t.wbg.__wbg_new_1d9a920c6bfc44a8=function(){return b(new Array)},t.wbg.__wbg_newnoargs_b5b063fc6c2f0376=function(n,t){return b(new Function(c(n,t)))},t.wbg.__wbg_new_268f7b7dd3430798=function(){return b(new Map)},t.wbg.__wbg_call_97ae9d8645dc388b=function(){return C((function(n,t){return b(w(n).call(w(t)))}),arguments)},t.wbg.__wbg_new_0b9bfdd97583284e=function(){return b(new Object)},t.wbg.__wbg_self_6d479506f72c6a71=function(){return C((function(){return b(self.self)}),arguments)},t.wbg.__wbg_window_f2557cc78490aceb=function(){return C((function(){return b(window.window)}),arguments)},t.wbg.__wbg_globalThis_7f206bda628d5286=function(){return C((function(){return b(globalThis.globalThis)}),arguments)},t.wbg.__wbg_global_ba75c50d1cf384f4=function(){return C((function(){return b(e.g.global)}),arguments)},t.wbg.__wbg_set_a68214f35c417fa9=function(n,t,e){w(n)[t>>>0]=g(e)},t.wbg.__wbg_toString_d9cd5f001405e8ff=function(){return C((function(n,t){return b(w(n).toString(t))}),arguments)},t.wbg.__wbg_new_8d2af00bc1e329ee=function(n,t){return b(new Error(c(n,t)))},t.wbg.__wbg_set_933729cf5b66ac11=function(n,t,e){return b(w(n).set(w(t),w(e)))},t.wbg.__wbg_fromEntries_7abdcb92016eb4b9=function(){return C((function(n){return b(Object.fromEntries(w(n)))}),arguments)},t.wbg.__wbg_buffer_3f3d764d4747d564=function(n){return b(w(n).buffer)},t.wbg.__wbg_newwithbyteoffsetandlength_d9aa266703cb98be=function(n,t,e){return b(new Uint8Array(w(n),t>>>0,e>>>0))},t.wbg.__wbg_new_8c3f0052272a457a=function(n){return b(new Uint8Array(w(n)))},t.wbg.__wbg_set_83db9690f9353e79=function(n,t,e){w(n).set(w(t),e>>>0)},t.wbg.__wbg_length_9e1ae1900cb0fbd5=function(n){return w(n).length},t.wbg.__wbg_newwithlength_f5933855e4f48a19=function(n){return b(new Uint8Array(n>>>0))},t.wbg.__wbg_subarray_58ad4efbb5bcb886=function(n,t,e){return b(w(n).subarray(t>>>0,e>>>0))},t.wbg.__wbindgen_debug_string=function(n,t){var e=d(m(w(t)),r.__wbindgen_malloc,r.__wbindgen_realloc),i=l;v()[n/4+1]=i,v()[n/4+0]=e},t.wbg.__wbindgen_throw=function(n,t){throw new Error(c(n,t))},t.wbg.__wbindgen_memory=function(){return b(r.memory)},t}function N(n,t){return r=n.exports,O.__wbindgen_wasm_module=t,y=new Int32Array,I=new Uint32Array,s=new Uint8Array,r}function O(n){return T.apply(this,arguments)}function T(){return T=(0,a.Z)((0,i.Z)().mark((function n(t){var r,a,o,s;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return"undefined"===typeof t&&(t=new URL(e(3526),e.b)),r=E(),("string"===typeof t||"function"===typeof Request&&t instanceof Request||"function"===typeof URL&&t instanceof URL)&&(t=fetch(t)),n.t0=L,n.next=7,t;case 7:return n.t1=n.sent,n.t2=r,n.next=11,(0,n.t0)(n.t1,n.t2);case 11:return a=n.sent,o=a.instance,s=a.module,n.abrupt("return",N(o,s));case 15:case"end":return n.stop()}}),n)}))),T.apply(this,arguments)}t.ZP=O},8787:function(n,t,e){n.exports=e.p+"static/media/rln.f6192b0957fff38c1530.wasm"},7094:function(n,t,e){n.exports=e.p+"static/media/rln_final.e5ef772309f5b4cb8510.zkey"},3526:function(n,t,e){n.exports=e.p+"static/media/rln_wasm_bg.2d6b5f9857f37ea8a65b.wasm"},440:function(n,t,e){e.r(t),e.d(t,{MembershipKey:function(){return S},RLNInstance:function(){return W},RateLimitProof:function(){return R},create:function(){return k},toEpoch:function(){return I}});var r={};e.r(r),e.d(r,{builder:function(){return f}});var i=e(6097),a=e(6568),o=e(1584),s=e(7324),u=e(2497),c={protocol:"groth16",curve:"bn128",nPublic:6,vk_alpha_1:["1805378556360488226980822394597799963030511477964155500103132920745199284516","11990395240534218699464972016456017378439762088320057798320175886595281336136","1"],vk_beta_2:[["11031529986141021025408838211017932346992429731488270384177563837022796743627","16042159910707312759082561183373181639420894978640710177581040523252926273854"],["20112698439519222240302944148895052359035104222313380895334495118294612255131","19441583024670359810872018179190533814486480928824742448673677460151702019379"],["1","0"]],vk_gamma_2:[["10857046999023057135944570762232829481370756359578518086990519993285655852781","11559732032986387107991004021392285783925812861821192530917403151452391805634"],["8495653923123431417604973247489272438418190587263600148770280649306958101930","4082367875863433681332203403145435568316851327593401208105741076214120093531"],["1","0"]],vk_delta_2:[["1948496782571164085469528023647105317580208688174386157591917599801657832035","20445814069256658101339037520922621162739470138213615104905368409238414511981"],["10024680869920840984813249386422727863826862577760330492647062850849851925340","10512156247842686783409460795717734694774542185222602679117887145206209285142"],["1","0"]],vk_alphabeta_12:[[["5151991366823434428398919091000210787450832786814248297320989361921939794156","15735191313289001022885148627913534790382722933676436876510746491415970766821"],["3387907257437913904447588318761906430938415556102110876587455322225272831272","1998779853452712881084781956683721603875246565720647583735935725110674288056"],["14280074182991498185075387990446437410077692353432005297922275464876153151820","17092408446352310039633488224969232803092763095456307462247653153107223117633"]],[["4359046709531668109201634396816565829237358165496082832279660960675584351266","4511888308846208349307186938266411423935335853916317436093178288331845821336"],["11429499807090785857812316277335883295048773373068683863667725283965356423273","16232274853200678548795010078253506586114563833318973594428907292096178657392"],["18068999605870933925311275504102553573815570223888590384919752303726860800970","17309569111965782732372130116757295842160193489132771344011460471298173784984"]]],IC:[["18693301901828818437917730940595978397160482710354161265484535387752523310572","17985273354976640088538673802000794244421192643855111089693820179790551470769","1"],["21164641723988537620541455173278629777250883365474191521194244273980931825942","998385854410718613441067082771678946155853656328717326195057262123686425518","1"],["21666968581672145768705229094968410656430989593283335488162701230986314747515","17996457608540683483506630273632100555125353447506062045735279661096094677264","1"],["20137761979695192602424300886442379728165712610493092740175904438282083668117","19184814924890679891263780109959113289320127263583260218200636509492157834679","1"],["10943171273393803842589314082509655332154393332394322726077270895078286354146","10872472035685319847811233167729172672344935625121511932198535224727331126439","1"],["13049169779481227658517545034348883391527506091990880778783387628208561946597","10083689369261379027228809473568899816311684698866922944902456565434209079955","1"],["19633516378466409167014413361365552102431118630694133723053441455184566611083","8059525100726933978719058611146131904598011633549012007359165766216730722269","1"]]};function f(n,t){return _.apply(this,arguments)}function _(){return(_=(0,s.Z)((0,i.Z)().mark((function n(t,e){var r,a,o,s,u,c,f;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return f=function(){for(var n=u.exports.getFieldNumLen32(),t=new Uint32Array(n),e=0;e<n;e++)t[n-1-e]=u.exports.readSharedRWMemory(e);""!==s&&(s+=" "),s+=g(t).toString()},c=function(){for(var n="",t=u.exports.getMessageChar();0!=t;)n+=String.fromCharCode(t),t=u.exports.getMessageChar();return n},e=e||{},n.prev=3,n.next=6,WebAssembly.compile(t);case 6:r=n.sent,n.next=14;break;case 9:throw n.prev=9,n.t0=n.catch(3),console.log(n.t0),console.log("\nTry to run circom --c in order to generate c++ code instead\n"),new Error(n.t0);case 14:return o="",s="",n.next=18,WebAssembly.instantiate(r,{runtime:{exceptionHandler:function(n){var t;throw t=1==n?"Signal not found.\n":2==n?"Too many signals set.\n":3==n?"Signal already set.\n":4==n?"Assert Failed.\n":5==n?"Not enough memory.\n":6==n?"Input signal array access exceeds the size.\n":"Unknown error.\n",new Error(t+o)},printErrorMessage:function(){o+=c()+"\n"},writeBufferMessage:function(){var n=c();"\n"===n?(console.log(s),s=""):(""!==s&&(s+=" "),s+=n)},showSharedRWMemory:function(){f()}}});case 18:return u=n.sent,a=new b(u,e),n.abrupt("return",a);case 22:case"end":return n.stop()}}),n,null,[[3,9]])})))).apply(this,arguments)}var b=function(){function n(t,e){(0,o.Z)(this,n),this.instance=t,this.version=this.instance.exports.getVersion(),this.n32=this.instance.exports.getFieldNumLen32(),this.instance.exports.getRawPrime();for(var r=new Uint32Array(this.n32),i=0;i<this.n32;i++)r[this.n32-1-i]=this.instance.exports.readSharedRWMemory(i);this.prime=g(r),this.witnessSize=this.instance.exports.getWitnessSize(),this.sanityCheck=e}return(0,a.Z)(n,[{key:"circom_version",value:function(){return this.instance.exports.getVersion()}},{key:"_doCalculateWitness",value:function(){var n=(0,s.Z)((0,i.Z)().mark((function n(t,e){var r,a,o=this;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.instance.exports.init(this.sanityCheck||e?1:0),r=Object.keys(t),a=0,r.forEach((function(n){var e=h(n),r=parseInt(e.slice(0,8),16),i=parseInt(e.slice(8,16),16),s=l(t[n]),u=o.instance.exports.getInputSignalSize(r,i);if(u<0)throw new Error("Signal ".concat(n," not found\n"));if(s.length<u)throw new Error("Not enough values for input signal ".concat(n,"\n"));if(s.length>u)throw new Error("Too many values for input signal ".concat(n,"\n"));for(var c=0;c<s.length;c++){for(var f=w(BigInt(s[c])%o.prime,o.n32),_=0;_<o.n32;_++)o.instance.exports.writeSharedRWMemory(_,f[o.n32-1-_]);try{o.instance.exports.setInputSignal(r,i,c),a++}catch(b){throw new Error(b)}}})),!(a<this.instance.exports.getInputSize())){n.next=6;break}throw new Error("Not all inputs have been set. Only ".concat(a," out of ").concat(this.instance.exports.getInputSize()));case 6:case"end":return n.stop()}}),n,this)})));return function(t,e){return n.apply(this,arguments)}}()},{key:"calculateWitness",value:function(){var n=(0,s.Z)((0,i.Z)().mark((function n(t,e){var r,a,o,s;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=[],n.next=3,this._doCalculateWitness(t,e);case 3:for(a=0;a<this.witnessSize;a++){for(this.instance.exports.getWitness(a),o=new Uint32Array(this.n32),s=0;s<this.n32;s++)o[this.n32-1-s]=this.instance.exports.readSharedRWMemory(s);r.push(g(o))}return n.abrupt("return",r);case 5:case"end":return n.stop()}}),n,this)})));return function(t,e){return n.apply(this,arguments)}}()},{key:"calculateBinWitness",value:function(){var n=(0,s.Z)((0,i.Z)().mark((function n(t,e){var r,a,o,s,u;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new Uint32Array(this.witnessSize*this.n32),a=new Uint8Array(r.buffer),n.next=4,this._doCalculateWitness(t,e);case 4:for(o=0;o<this.witnessSize;o++)for(this.instance.exports.getWitness(o),s=o*this.n32,u=0;u<this.n32;u++)r[s+u]=this.instance.exports.readSharedRWMemory(u);return n.abrupt("return",a);case 6:case"end":return n.stop()}}),n,this)})));return function(t,e){return n.apply(this,arguments)}}()},{key:"calculateWTNSBin",value:function(){var n=(0,s.Z)((0,i.Z)().mark((function n(t,e){var r,a,o,s,u,c,f,_,b,w;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new Uint32Array(this.witnessSize*this.n32+this.n32+11),a=new Uint8Array(r.buffer),n.next=4,this._doCalculateWitness(t,e);case 4:for(a[0]="w".charCodeAt(0),a[1]="t".charCodeAt(0),a[2]="n".charCodeAt(0),a[3]="s".charCodeAt(0),r[1]=2,r[2]=2,r[3]=1,o=4*this.n32,s=(8+o).toString(16),r[4]=parseInt(s.slice(0,8),16),r[5]=parseInt(s.slice(8,16),16),r[6]=o,this.instance.exports.getRawPrime(),u=7,c=0;c<this.n32;c++)r[u+c]=this.instance.exports.readSharedRWMemory(c);for(u+=this.n32,r[u]=this.witnessSize,u++,r[u]=2,u++,f=o*this.witnessSize,_=f.toString(16),r[u]=parseInt(_.slice(0,8),16),r[u+1]=parseInt(_.slice(8,16),16),u+=2,b=0;b<this.witnessSize;b++){for(this.instance.exports.getWitness(b),w=0;w<this.n32;w++)r[u+w]=this.instance.exports.readSharedRWMemory(w);u+=this.n32}return n.abrupt("return",a);case 32:case"end":return n.stop()}}),n,this)})));return function(t,e){return n.apply(this,arguments)}}()}]),n}();function w(n,t){for(var e=[],r=BigInt(4294967296);n;)e.unshift(Number(n%r)),n/=r;if(t)for(var i=t-e.length;i>0;)e.unshift(0),i--;return e}function g(n){for(var t=BigInt(0),e=BigInt(4294967296),r=0;r<n.length;r++)t=t*e+BigInt(n[r]);return t}function l(n){var t=[];return function n(t,e){if(Array.isArray(e))for(var r=0;r<e.length;r++)n(t,e[r]);else t.push(e)}(t,n),t}function h(n){for(var t=Math.pow(BigInt(2),BigInt(64)),e=BigInt("0xCBF29CE484222325"),r=0;r<n.length;r++)e^=BigInt(n[r].charCodeAt()),e*=BigInt(1099511628211),e%=t;var i=e.toString(16),a=16-i.length;return i="0".repeat(a).concat(i)}function p(){for(var n=0,t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(var i=0,a=e;i<a.length;i++){var o=a[i];n+=o.length}for(var s=new Uint8Array(n),u=0,c=0,f=e;c<f.length;c++){var _=f[c];s.set(_,u),u+=_.length}return s}var d=new TextEncoder;function y(){return v.apply(this,arguments)}function v(){return(v=(0,s.Z)((0,i.Z)().mark((function n(){var t,a;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=new URL(e(8787),e.b),n.next=3,fetch(t);case 3:return a=n.sent,n.t0=r,n.t1=Uint8Array,n.next=8,a.arrayBuffer();case 8:return n.t2=n.sent,n.t3=new n.t1(n.t2),n.next=12,n.t0.builder.call(n.t0,n.t3,!1);case 12:return n.abrupt("return",n.sent);case 13:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function m(){return x.apply(this,arguments)}function x(){return(x=(0,s.Z)((0,i.Z)().mark((function n(){var t,r;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=new URL(e(7094),e.b),n.next=3,fetch(t);case 3:return r=n.sent,n.t0=Uint8Array,n.next=7,r.arrayBuffer();case 7:return n.t1=n.sent,n.abrupt("return",new n.t0(n.t1));case 9:case"end":return n.stop()}}),n)})))).apply(this,arguments)}function k(){return A.apply(this,arguments)}function A(){return(A=(0,s.Z)((0,i.Z)().mark((function n(){var t,e,r,a;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,u.ZP)();case 2:return u.Of(),n.next=5,y();case 5:return t=n.sent,n.next=8,m();case 8:return e=n.sent,r=d.encode(JSON.stringify(c)),a=u.LK(20,e,r),n.abrupt("return",new W(a,t));case 12:case"end":return n.stop()}}),n)})))).apply(this,arguments)}var S=(0,a.Z)((function n(t){(0,o.Z)(this,n),this.IDKey=t.subarray(0,32),this.IDCommitment=t.subarray(32)}));var Z=function(n,t,e,r,i){(t=+t,e>>>=0,r>>>=0,i)||function(n,t,e,r,i,a){if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(e+r>n.length)throw new RangeError("Index out of range")}(n,t,e,r,Math.pow(2,8*r)-1,0);var a=1,o=0;for(n[e]=255&t;++o<r&&(a*=256);)n[e+o]=t/a&255;return n};function I(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,e=Math.floor(n.getTime()/1e3/t);return Z(new Uint8Array(32),e,0,8)}var R=function(){function n(t){if((0,o.Z)(this,n),t.length<320)throw"invalid proof";this.proof=t.subarray(0,128),this.merkleRoot=t.subarray(128,160),this.epoch=t.subarray(160,192),this.shareX=t.subarray(192,224),this.shareY=t.subarray(224,256),this.nullifier=t.subarray(256,288),this.rlnIdentifier=t.subarray(288,320)}return(0,a.Z)(n,[{key:"toBytes",value:function(){return p(this.proof,this.merkleRoot,this.epoch,this.shareX,this.shareY,this.nullifier,this.rlnIdentifier)}}]),n}(),W=function(){function n(t,e){(0,o.Z)(this,n),this.zkRLN=t,this.witnessCalculator=e}return(0,a.Z)(n,[{key:"generateMembershipKey",value:function(){var n=u.BG(this.zkRLN);return new S(n)}},{key:"insertMember",value:function(n){u.Di(this.zkRLN,n)}},{key:"serializeMessage",value:function(n,t,e,r){var i=Z(new Uint8Array(8),n.length,0,8);return p(r,Z(new Uint8Array(8),t,0,8),e,i,n)}},{key:"generateProof",value:function(){var n=(0,s.Z)((0,i.Z)().mark((function n(t,e,r,a){var o,s,c,f,_;return(0,i.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(void 0==r?r=I(new Date):r instanceof Date&&(r=I(r)),32==r.length){n.next=3;break}throw"invalid epoch";case 3:if(32==a.length){n.next=5;break}throw"invalid id key";case 5:if(!(e<0)){n.next=7;break}throw"index must be >= 0";case 7:return o=this.serializeMessage(t,e,r,a),s=u.ur(this.zkRLN,o),c=u.T8(this.zkRLN,s),n.next=12,this.witnessCalculator.calculateWitness(c,!1);case 12:return f=n.sent,_=u.RP(this.zkRLN,f,s),n.abrupt("return",new R(_));case 15:case"end":return n.stop()}}),n,this)})));return function(t,e,r,i){return n.apply(this,arguments)}}()},{key:"verifyProof",value:function(n){return n instanceof R&&(n=n.toBytes()),u.xG(this.zkRLN,n)}}]),n}()}}]);
|
|
//# sourceMappingURL=440.b375a52d.chunk.js.map
|