@waku/rln 0.0.3 → 0.0.5
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/bundle/index.js +1 -1
- package/bundle/{rln-0e12a076.js → rln-f4682a81.js} +580 -173
- package/dist/.tsbuildinfo +1 -1
- package/dist/rln.js +5 -4
- package/dist/rln.js.map +1 -1
- package/package.json +6 -4
- package/src/rln.ts +7 -5
- package/src/witness_calculator.js +335 -0
- package/bundle/02bce7e5f3bcf834.wasm +0 -0
- package/bundle/20ff36861f56116ae72f.module.wasm +0 -0
- package/bundle/939.index.js +0 -1
- package/bundle/rln-a1a9aa71.js +0 -574
- package/bundle/rln-affbe9d4.js +0 -574
- package/dist/resources/files.d.ts +0 -4
- package/dist/resources/files.js +0 -5
- package/dist/resources/files.js.map +0 -1
- package/dist/resources/rln.wasm +0 -0
- package/dist/webpack.config.d.ts +0 -6
- package/dist/webpack.config.js +0 -11
- package/dist/webpack.config.js.map +0 -1
- package/dist/witness_calculator.cjs +0 -294
- package/dist/witness_calculator.cjs.map +0 -1
- package/dist/witness_calculator.d.cts +0 -17
- package/dist/zerokit/rln_wasm.d.ts +0 -1
- package/dist/zerokit/rln_wasm.js +0 -2
- package/dist/zerokit/rln_wasm.js.map +0 -1
- package/dist/zerokit/rln_wasm_bg.d.ts +0 -108
- package/dist/zerokit/rln_wasm_bg.js +0 -592
- package/dist/zerokit/rln_wasm_bg.js.map +0 -1
- package/dist/zerokit/rln_wasm_bg.wasm +0 -0
package/dist/.tsbuildinfo
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../src/resources.ts","../src/witness_calculator.d.ts","../src/zerokit/rln_wasm.d.ts","../src/rln.ts","../src/index.ts","../src/witness_calculator.js","../src/zerokit/rln_wasm_bg.wasm.d.ts","../src/zerokit/rln_wasm_bg.js","../src/zerokit/rln_wasm.js","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@types/mocha/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},{"version":"832ec1c9d3001b9b6dc75dcb536b30ad2fc278af20e8bd2a951348f71b6ce1ff","signature":"528a4c000f46e7b8d04033eae2c99107a14a4faeae58d8f172e730157c4604d0"},"18e63e4f6a513425aaf40a04e557d486a7b3bb6304807efea8493af640a157ce","d538c5190b091b2c55d8c9d0c743f29f70ac199dd1006907892db4999106f759",{"version":"85136e25f71168b80870652326212f6b21790af3d6e732fbfdd03790703737a6","signature":"1b7a4830dd5380cdb4d889df6c0285b22a94bc5be1f9ae22a8ce670d571902f0"},{"version":"6c05eeb2b32d8d89458e91c45274f4330fd543784bf2839b4e7735f93f9eb3d9","signature":"e3dd5733f8e4834a1a91c4499cdeb28337e40336da31fcec8e705319b2ea4c55"},{"version":"cb732dfea79ca2a9a5fd4ed240df67d6c47fd5b66fe188c645367efd1762ed24","signature":"39257e47f71a52d198342c47d3a6b35338a3c8618e4335b56530f2cb3b0dc511"},"ed2ca9c26aa1f7847a7edaae6a9ea6584f3fb8ea7d71cce7271de5b987c72f0b",{"version":"ff682c0a5ea90d89c05d1b8c94970057a0fc56c99f6c924f5312d799a446f456","signature":"7ec505c3a1feb7705fc8bf5921617c8dd2759a1d385787190621456f82d32d4c"},{"version":"00e10803e106181f7ca7b3e9ff55ce919200e1937bf949a6a5db59c27cba9308","signature":"dba888cc0cb4ae7a8e32b8df4c6d693d8029d93f92b7fbfb9d1c645279f465ef"},"0cba3a5d7b81356222594442753cf90dd2892e5ccfe1d262aaca6896ba6c1380","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"77f0b5c6a193a699c9f7d7fb0578e64e562d271afa740783665d2a827104a873","affectsGlobalScope":true},"e5979905796fe2740d85fbaf4f11f42b7ee1851421afe750823220813421b1af",{"version":"fcdcb42da18dd98dc286b1876dd425791772036012ae61263c011a76b13a190f","affectsGlobalScope":true},"1dab5ab6bcf11de47ab9db295df8c4f1d92ffa750e8f095e88c71ce4c3299628","f71f46ccd5a90566f0a37b25b23bc4684381ab2180bdf6733f4e6624474e1894",{"version":"54e65985a3ee3cec182e6a555e20974ea936fc8b8d1738c14e8ed8a42bd921d4","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5b30f550565fd0a7524282c81c27fe8534099e2cd26170ca80852308f07ae68d","34e5de87d983bc6aefef8b17658556e3157003e8d9555d3cb098c6bef0b5fbc8","d97cd8a4a42f557fc62271369ed0461c8e50d47b7f9c8ad0b5462f53306f6060","f27371653aded82b2b160f7a7033fb4a5b1534b6f6081ef7be1468f0f15327d3","c762cd6754b13a461c54b59d0ae0ab7aeef3c292c6cf889873f786ee4d8e75c9","f4ea7d5df644785bd9fbf419930cbaec118f0d8b4160037d2339b8e23c059e79",{"version":"bfea28e6162ed21a0aeed181b623dcf250aa79abf49e24a6b7e012655af36d81","affectsGlobalScope":true},"b8aca9d0c81abb02bec9b7621983ae65bde71da6727580070602bd2500a9ce2a","ae97e20f2e10dbeec193d6a2f9cd9a367a1e293e7d6b33b68bacea166afd7792","10d4796a130577d57003a77b95d8723530bbec84718e364aa2129fa8ffba0378","063f53ff674228c190efa19dd9448bcbd540acdbb48a928f4cf3a1b9f9478e43","bf73c576885408d4a176f44a9035d798827cc5020d58284cb18d7573430d9022","7ae078ca42a670445ae0c6a97c029cb83d143d62abd1730efb33f68f0b2c0e82",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"287b21dc1d1b9701c92e15e7dd673dfe6044b15812956377adffb6f08825b1bc","12eea70b5e11e924bb0543aea5eadc16ced318aa26001b453b0d561c2fd0bd1e","08777cd9318d294646b121838574e1dd7acbb22c21a03df84e1f2c87b1ad47f2","08a90bcdc717df3d50a2ce178d966a8c353fd23e5c392fd3594a6e39d9bb6304",{"version":"4cd4cff679c9b3d9239fd7bf70293ca4594583767526916af8e5d5a47d0219c7","affectsGlobalScope":true},"2a12d2da5ac4c4979401a3f6eaafa874747a37c365e4bc18aa2b171ae134d21b","002b837927b53f3714308ecd96f72ee8a053b8aeb28213d8ec6de23ed1608b66","1dc9c847473bb47279e398b22c740c83ea37a5c88bf66629666e3cf4c5b9f99c","a9e4a5a24bf2c44de4c98274975a1a705a0abbaad04df3557c2d3cd8b1727949","00fa7ce8bc8acc560dc341bbfdf37840a8c59e6a67c9bfa3fa5f36254df35db2","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","5f0ed51db151c2cdc4fa3bb0f44ce6066912ad001b607a34e65a96c52eb76248",{"version":"af9771b066ec35ffa1c7db391b018d2469d55e51b98ae95e62b6cbef1b0169ca","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","103d70bfbeb3cd3a3f26d1705bf986322d8738c2c143f38ebb743b1e228d7444","f52fbf64c7e480271a9096763c4882d356b05cab05bf56a64e68a95313cd2ce2","59bdb65f28d7ce52ccfc906e9aaf422f8b8534b2d21c32a27d7819be5ad81df7",{"version":"3a2da34079a2567161c1359316a32e712404b56566c45332ac9dcee015ecce9f","affectsGlobalScope":true},"28a2e7383fd898c386ffdcacedf0ec0845e5d1a86b5a43f25b86bc315f556b79","3aff9c8c36192e46a84afe7b926136d520487155154ab9ba982a8b544ea8fc95","a880cf8d85af2e4189c709b0fea613741649c0e40fffb4360ec70762563d5de0","85bbf436a15bbeda4db888be3062d47f99c66fd05d7c50f0f6473a9151b6a070","9f9c49c95ecd25e0cb2587751925976cf64fd184714cb11e213749c80cf0f927","f0c75c08a71f9212c93a719a25fb0320d53f2e50ca89a812640e08f8ad8c408c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"9cafe917bf667f1027b2bb62e2de454ecd2119c80873ad76fc41d941089753b8",{"version":"3f6d6465811321abc30a1e5f667feed63e5b3917b3d6c8d6645daf96c75f97ba","affectsGlobalScope":true}],"options":{"alwaysStrict":true,"declaration":true,"esModuleInterop":true,"module":6,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":true,"noImplicitThis":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"strictFunctionTypes":true,"strictNullChecks":true,"strictPropertyInitialization":true,"target":7,"tsBuildInfoFile":"./.tsbuildinfo"},"fileIdsList":[[94],[51,94],[54,94],[55,60,94],[56,66,67,74,83,93,94],[56,57,66,74,94],[58,94],[59,60,67,75,94],[60,83,90,94],[61,63,66,74,94],[62,94],[63,64,94],[65,66,94],[66,94],[66,67,68,83,93,94],[66,67,68,83,94],[94,98],[69,74,83,93,94],[66,67,69,70,74,83,90,93,94],[69,71,83,90,93,94],[51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100],[66,72,94],[73,93,94],[63,66,74,83,94],[75,94],[76,94],[54,77,94],[78,92,94,98],[79,94],[80,94],[66,81,94],[81,82,94,96],[66,83,84,85,94],[83,85,94],[83,84,94],[86,94],[87,94],[66,88,89,94],[88,89,94],[60,74,83,90,94],[91,94],[74,92,94],[55,69,80,93,94],[60,94],[83,94,95],[94,96],[94,97],[55,60,66,68,77,83,93,94,96,98],[83,94,99],[45,94],[42,43,44,94],[48,49,94],[48,94],[45]],"referencedMap":[[102,1],[51,2],[52,2],[54,3],[55,4],[56,5],[57,6],[58,7],[59,8],[60,9],[61,10],[62,11],[63,12],[64,12],[65,13],[66,14],[67,15],[68,16],[53,17],[100,1],[69,18],[70,19],[71,20],[101,21],[72,22],[73,23],[74,24],[75,25],[76,26],[77,27],[78,28],[79,29],[80,30],[81,31],[82,32],[83,33],[85,34],[84,35],[86,36],[87,37],[88,38],[89,39],[90,40],[91,41],[92,42],[93,43],[94,44],[95,45],[96,46],[97,47],[98,48],[99,49],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[34,1],[39,1],[40,1],[35,1],[36,1],[37,1],[38,1],[1,1],[41,1],[46,50],[42,1],[45,51],[43,1],[47,1],[44,1],[50,52],[49,53],[48,1]],"exportedModulesMap":[[102,1],[51,2],[52,2],[54,3],[55,4],[56,5],[57,6],[58,7],[59,8],[60,9],[61,10],[62,11],[63,12],[64,12],[65,13],[66,14],[67,15],[68,16],[53,17],[100,1],[69,18],[70,19],[71,20],[101,21],[72,22],[73,23],[74,24],[75,25],[76,26],[77,27],[78,28],[79,29],[80,30],[81,31],[82,32],[83,33],[85,34],[84,35],[86,36],[87,37],[88,38],[89,39],[90,40],[91,41],[92,42],[93,43],[94,44],[95,45],[96,46],[97,47],[98,48],[99,49],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[34,1],[39,1],[40,1],[35,1],[36,1],[37,1],[38,1],[1,1],[41,1],[46,54],[43,1],[44,1],[48,1]],"semanticDiagnosticsPerFile":[102,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,53,100,69,70,71,101,72,73,74,75,76,77,78,79,80,81,82,83,85,84,86,87,88,89,90,91,92,93,94,95,96,97,98,99,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,34,39,40,35,36,37,38,1,41,46,42,45,43,47,44,50,49,48]},"version":"4.8.2"}
|
1
|
+
{"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/@waku/zerokit-rln-wasm/rln_wasm.d.ts","../src/resources.ts","../src/witness_calculator.d.ts","../src/rln.ts","../src/index.ts","../src/witness_calculator.js","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@types/mocha/index.d.ts"],"fileInfos":[{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9",{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true},{"version":"8cc8c5a3bac513368b0157f3d8b31cfdcfe78b56d3724f30f80ed9715e404af8","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"55f400eec64d17e888e278f4def2f254b41b89515d3b88ad75d5e05f019daddd","affectsGlobalScope":true},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"81cac4cbc92c0c839c70f8ffb94eb61e2d32dc1c3cf6d95844ca099463cf37ea","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"775d9c9fd150d5de79e0450f35bc8b8f94ae64e3eb5da12725ff2a649dccc777","affectsGlobalScope":true},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true},{"version":"52d1bb7ab7a3306fd0375c8bff560feed26ed676a5b0457fa8027b563aecb9a4","affectsGlobalScope":true},"75c9b7689a1a1d946866a34ab936eaf661ad4ea6eb2dda6b56e1971934893cb5",{"version":"832ec1c9d3001b9b6dc75dcb536b30ad2fc278af20e8bd2a951348f71b6ce1ff","signature":"528a4c000f46e7b8d04033eae2c99107a14a4faeae58d8f172e730157c4604d0"},"18e63e4f6a513425aaf40a04e557d486a7b3bb6304807efea8493af640a157ce",{"version":"d72974a84a5439eecb8d845ae13c7885ab33d59fd8f9717099709b0d543d20c7","signature":"1b7a4830dd5380cdb4d889df6c0285b22a94bc5be1f9ae22a8ce670d571902f0"},{"version":"6c05eeb2b32d8d89458e91c45274f4330fd543784bf2839b4e7735f93f9eb3d9","signature":"e3dd5733f8e4834a1a91c4499cdeb28337e40336da31fcec8e705319b2ea4c55"},{"version":"cb732dfea79ca2a9a5fd4ed240df67d6c47fd5b66fe188c645367efd1762ed24","signature":"39257e47f71a52d198342c47d3a6b35338a3c8618e4335b56530f2cb3b0dc511"},"0cba3a5d7b81356222594442753cf90dd2892e5ccfe1d262aaca6896ba6c1380","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"77f0b5c6a193a699c9f7d7fb0578e64e562d271afa740783665d2a827104a873","affectsGlobalScope":true},"e5979905796fe2740d85fbaf4f11f42b7ee1851421afe750823220813421b1af",{"version":"fcdcb42da18dd98dc286b1876dd425791772036012ae61263c011a76b13a190f","affectsGlobalScope":true},"1dab5ab6bcf11de47ab9db295df8c4f1d92ffa750e8f095e88c71ce4c3299628","f71f46ccd5a90566f0a37b25b23bc4684381ab2180bdf6733f4e6624474e1894",{"version":"54e65985a3ee3cec182e6a555e20974ea936fc8b8d1738c14e8ed8a42bd921d4","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","5b30f550565fd0a7524282c81c27fe8534099e2cd26170ca80852308f07ae68d","34e5de87d983bc6aefef8b17658556e3157003e8d9555d3cb098c6bef0b5fbc8","d97cd8a4a42f557fc62271369ed0461c8e50d47b7f9c8ad0b5462f53306f6060","f27371653aded82b2b160f7a7033fb4a5b1534b6f6081ef7be1468f0f15327d3","c762cd6754b13a461c54b59d0ae0ab7aeef3c292c6cf889873f786ee4d8e75c9","f4ea7d5df644785bd9fbf419930cbaec118f0d8b4160037d2339b8e23c059e79",{"version":"bfea28e6162ed21a0aeed181b623dcf250aa79abf49e24a6b7e012655af36d81","affectsGlobalScope":true},"b8aca9d0c81abb02bec9b7621983ae65bde71da6727580070602bd2500a9ce2a","ae97e20f2e10dbeec193d6a2f9cd9a367a1e293e7d6b33b68bacea166afd7792","10d4796a130577d57003a77b95d8723530bbec84718e364aa2129fa8ffba0378","063f53ff674228c190efa19dd9448bcbd540acdbb48a928f4cf3a1b9f9478e43","bf73c576885408d4a176f44a9035d798827cc5020d58284cb18d7573430d9022","7ae078ca42a670445ae0c6a97c029cb83d143d62abd1730efb33f68f0b2c0e82",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"287b21dc1d1b9701c92e15e7dd673dfe6044b15812956377adffb6f08825b1bc","12eea70b5e11e924bb0543aea5eadc16ced318aa26001b453b0d561c2fd0bd1e","08777cd9318d294646b121838574e1dd7acbb22c21a03df84e1f2c87b1ad47f2","08a90bcdc717df3d50a2ce178d966a8c353fd23e5c392fd3594a6e39d9bb6304",{"version":"4cd4cff679c9b3d9239fd7bf70293ca4594583767526916af8e5d5a47d0219c7","affectsGlobalScope":true},"2a12d2da5ac4c4979401a3f6eaafa874747a37c365e4bc18aa2b171ae134d21b","002b837927b53f3714308ecd96f72ee8a053b8aeb28213d8ec6de23ed1608b66","1dc9c847473bb47279e398b22c740c83ea37a5c88bf66629666e3cf4c5b9f99c","a9e4a5a24bf2c44de4c98274975a1a705a0abbaad04df3557c2d3cd8b1727949","00fa7ce8bc8acc560dc341bbfdf37840a8c59e6a67c9bfa3fa5f36254df35db2","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","5f0ed51db151c2cdc4fa3bb0f44ce6066912ad001b607a34e65a96c52eb76248",{"version":"af9771b066ec35ffa1c7db391b018d2469d55e51b98ae95e62b6cbef1b0169ca","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","103d70bfbeb3cd3a3f26d1705bf986322d8738c2c143f38ebb743b1e228d7444","f52fbf64c7e480271a9096763c4882d356b05cab05bf56a64e68a95313cd2ce2","59bdb65f28d7ce52ccfc906e9aaf422f8b8534b2d21c32a27d7819be5ad81df7",{"version":"3a2da34079a2567161c1359316a32e712404b56566c45332ac9dcee015ecce9f","affectsGlobalScope":true},"28a2e7383fd898c386ffdcacedf0ec0845e5d1a86b5a43f25b86bc315f556b79","3aff9c8c36192e46a84afe7b926136d520487155154ab9ba982a8b544ea8fc95","a880cf8d85af2e4189c709b0fea613741649c0e40fffb4360ec70762563d5de0","85bbf436a15bbeda4db888be3062d47f99c66fd05d7c50f0f6473a9151b6a070","9f9c49c95ecd25e0cb2587751925976cf64fd184714cb11e213749c80cf0f927","f0c75c08a71f9212c93a719a25fb0320d53f2e50ca89a812640e08f8ad8c408c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"9cafe917bf667f1027b2bb62e2de454ecd2119c80873ad76fc41d941089753b8",{"version":"3f6d6465811321abc30a1e5f667feed63e5b3917b3d6c8d6645daf96c75f97ba","affectsGlobalScope":true}],"options":{"alwaysStrict":true,"declaration":true,"esModuleInterop":true,"module":6,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":true,"noImplicitThis":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"strictFunctionTypes":true,"strictNullChecks":true,"strictPropertyInitialization":true,"target":7,"tsBuildInfoFile":"./.tsbuildinfo"},"fileIdsList":[[91],[48,91],[51,91],[52,57,91],[53,63,64,71,80,90,91],[53,54,63,71,91],[55,91],[56,57,64,72,91],[57,80,87,91],[58,60,63,71,91],[59,91],[60,61,91],[62,63,91],[63,91],[63,64,65,80,90,91],[63,64,65,80,91],[91,95],[66,71,80,90,91],[63,64,66,67,71,80,87,90,91],[66,68,80,87,90,91],[48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97],[63,69,91],[70,90,91],[60,63,71,80,91],[72,91],[73,91],[51,74,91],[75,89,91,95],[76,91],[77,91],[63,78,91],[78,79,91,93],[63,80,81,82,91],[80,82,91],[80,81,91],[83,91],[84,91],[63,85,86,91],[85,86,91],[57,71,80,87,91],[88,91],[71,89,91],[52,66,77,90,91],[57,91],[80,91,92],[91,93],[91,94],[52,57,63,65,74,80,90,91,93,95],[80,91,96],[45,91],[42,43,44,91],[45]],"referencedMap":[[99,1],[48,2],[49,2],[51,3],[52,4],[53,5],[54,6],[55,7],[56,8],[57,9],[58,10],[59,11],[60,12],[61,12],[62,13],[63,14],[64,15],[65,16],[50,17],[97,1],[66,18],[67,19],[68,20],[98,21],[69,22],[70,23],[71,24],[72,25],[73,26],[74,27],[75,28],[76,29],[77,30],[78,31],[79,32],[80,33],[82,34],[81,35],[83,36],[84,37],[85,38],[86,39],[87,40],[88,41],[89,42],[90,43],[91,44],[92,45],[93,46],[94,47],[95,48],[96,49],[42,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[34,1],[39,1],[40,1],[35,1],[36,1],[37,1],[38,1],[1,1],[41,1],[46,50],[43,1],[45,51],[44,1],[47,1]],"exportedModulesMap":[[99,1],[48,2],[49,2],[51,3],[52,4],[53,5],[54,6],[55,7],[56,8],[57,9],[58,10],[59,11],[60,12],[61,12],[62,13],[63,14],[64,15],[65,16],[50,17],[97,1],[66,18],[67,19],[68,20],[98,21],[69,22],[70,23],[71,24],[72,25],[73,26],[74,27],[75,28],[76,29],[77,30],[78,31],[79,32],[80,33],[82,34],[81,35],[83,36],[84,37],[85,38],[86,39],[87,40],[88,41],[89,42],[90,43],[91,44],[92,45],[93,46],[94,47],[95,48],[96,49],[42,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[34,1],[39,1],[40,1],[35,1],[36,1],[37,1],[38,1],[1,1],[41,1],[46,52],[44,1]],"semanticDiagnosticsPerFile":[99,48,49,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,50,97,66,67,68,98,69,70,71,72,73,74,75,76,77,78,79,80,82,81,83,84,85,86,87,88,89,90,91,92,93,94,95,96,42,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,34,39,40,35,36,37,38,1,41,46,43,45,44,47]},"version":"4.8.2"}
|
package/dist/rln.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import * as
|
2
|
-
import * as
|
3
|
-
import * as
|
1
|
+
import init, * as zerokitRLN from "@waku/zerokit-rln-wasm";
|
2
|
+
import * as resources from "./resources.js";
|
3
|
+
import * as wc from "./witness_calculator.js";
|
4
4
|
/**
|
5
5
|
* Convert a base64 string into uint8Array
|
6
6
|
* @param base64
|
@@ -37,12 +37,13 @@ const DEPTH = 20;
|
|
37
37
|
const VERIFICATION_KEY = base64ToUint8Array(resources.verification_key);
|
38
38
|
const ZKEY = base64ToUint8Array(resources.zkey);
|
39
39
|
const CIRCUIT = base64ToUint8Array(resources.circuit);
|
40
|
-
zerokitRLN.init_panic_hook();
|
41
40
|
/**
|
42
41
|
* Create an instance of RLN
|
43
42
|
* @returns RLNInstance
|
44
43
|
*/
|
45
44
|
export async function create() {
|
45
|
+
await init();
|
46
|
+
zerokitRLN.init_panic_hook();
|
46
47
|
const witnessCalculator = await wc.builder(CIRCUIT, false);
|
47
48
|
const zkRLN = zerokitRLN.newRLN(DEPTH, ZKEY, VERIFICATION_KEY);
|
48
49
|
return new RLNInstance(zkRLN, witnessCalculator);
|
package/dist/rln.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rln.js","sourceRoot":"","sources":["../src/rln.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"rln.js","sourceRoot":"","sources":["../src/rln.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAE9C;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,MAAc;IACxC,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QAC5B,KAAK,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACxC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAA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
1
|
{
|
2
2
|
"name": "@waku/rln",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.5",
|
4
4
|
"description": "Rate Limit Nullifier for js-waku",
|
5
5
|
"types": "./dist/index.d.ts",
|
6
6
|
"module": "./dist/index.js",
|
@@ -106,9 +106,8 @@
|
|
106
106
|
"files": [
|
107
107
|
"dist",
|
108
108
|
"bundle",
|
109
|
-
"src
|
110
|
-
"src
|
111
|
-
"src/proto/**/*.ts",
|
109
|
+
"src/**.ts",
|
110
|
+
"src/**.js",
|
112
111
|
"!**/*.spec.*",
|
113
112
|
"!**/*.json",
|
114
113
|
"CHANGELOG.md",
|
@@ -122,5 +121,8 @@
|
|
122
121
|
"*.{ts,md,json,conf*.*js}": [
|
123
122
|
"prettier --write"
|
124
123
|
]
|
124
|
+
},
|
125
|
+
"dependencies": {
|
126
|
+
"@waku/zerokit-rln-wasm": "^0.0.1"
|
125
127
|
}
|
126
128
|
}
|
package/src/rln.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import * as
|
2
|
-
|
3
|
-
import * as
|
1
|
+
import init, * as zerokitRLN from "@waku/zerokit-rln-wasm";
|
2
|
+
|
3
|
+
import * as resources from "./resources.js";
|
4
|
+
import * as wc from "./witness_calculator.js";
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Convert a base64 string into uint8Array
|
@@ -41,13 +42,14 @@ const VERIFICATION_KEY = base64ToUint8Array(resources.verification_key);
|
|
41
42
|
const ZKEY = base64ToUint8Array(resources.zkey);
|
42
43
|
const CIRCUIT = base64ToUint8Array(resources.circuit);
|
43
44
|
|
44
|
-
zerokitRLN.init_panic_hook();
|
45
|
-
|
46
45
|
/**
|
47
46
|
* Create an instance of RLN
|
48
47
|
* @returns RLNInstance
|
49
48
|
*/
|
50
49
|
export async function create(): Promise<RLNInstance> {
|
50
|
+
await init();
|
51
|
+
zerokitRLN.init_panic_hook();
|
52
|
+
|
51
53
|
const witnessCalculator = await wc.builder(CIRCUIT, false);
|
52
54
|
const zkRLN = zerokitRLN.newRLN(DEPTH, ZKEY, VERIFICATION_KEY);
|
53
55
|
return new RLNInstance(zkRLN, witnessCalculator);
|
@@ -0,0 +1,335 @@
|
|
1
|
+
// File generated with https://github.com/iden3/circom
|
2
|
+
// following the instructions from:
|
3
|
+
// https://github.com/vacp2p/zerokit/tree/master/rln#compiling-circuits
|
4
|
+
|
5
|
+
export async function builder(code, options) {
|
6
|
+
|
7
|
+
options = options || {};
|
8
|
+
|
9
|
+
let wasmModule;
|
10
|
+
try {
|
11
|
+
wasmModule = await WebAssembly.compile(code);
|
12
|
+
} catch (err) {
|
13
|
+
console.log(err);
|
14
|
+
console.log("\nTry to run circom --c in order to generate c++ code instead\n");
|
15
|
+
throw new Error(err);
|
16
|
+
}
|
17
|
+
|
18
|
+
let wc;
|
19
|
+
|
20
|
+
let errStr = "";
|
21
|
+
let msgStr = "";
|
22
|
+
|
23
|
+
const instance = await WebAssembly.instantiate(wasmModule, {
|
24
|
+
runtime: {
|
25
|
+
exceptionHandler : function(code) {
|
26
|
+
let err;
|
27
|
+
if (code == 1) {
|
28
|
+
err = "Signal not found.\n";
|
29
|
+
} else if (code == 2) {
|
30
|
+
err = "Too many signals set.\n";
|
31
|
+
} else if (code == 3) {
|
32
|
+
err = "Signal already set.\n";
|
33
|
+
} else if (code == 4) {
|
34
|
+
err = "Assert Failed.\n";
|
35
|
+
} else if (code == 5) {
|
36
|
+
err = "Not enough memory.\n";
|
37
|
+
} else if (code == 6) {
|
38
|
+
err = "Input signal array access exceeds the size.\n";
|
39
|
+
} else {
|
40
|
+
err = "Unknown error.\n";
|
41
|
+
}
|
42
|
+
throw new Error(err + errStr);
|
43
|
+
},
|
44
|
+
printErrorMessage : function() {
|
45
|
+
errStr += getMessage() + "\n";
|
46
|
+
// console.error(getMessage());
|
47
|
+
},
|
48
|
+
writeBufferMessage : function() {
|
49
|
+
const msg = getMessage();
|
50
|
+
// Any calls to `log()` will always end with a `\n`, so that's when we print and reset
|
51
|
+
if (msg === "\n") {
|
52
|
+
console.log(msgStr);
|
53
|
+
msgStr = "";
|
54
|
+
} else {
|
55
|
+
// If we've buffered other content, put a space in between the items
|
56
|
+
if (msgStr !== "") {
|
57
|
+
msgStr += " "
|
58
|
+
}
|
59
|
+
// Then append the message to the message we are creating
|
60
|
+
msgStr += msg;
|
61
|
+
}
|
62
|
+
},
|
63
|
+
showSharedRWMemory : function() {
|
64
|
+
printSharedRWMemory ();
|
65
|
+
}
|
66
|
+
|
67
|
+
}
|
68
|
+
});
|
69
|
+
|
70
|
+
const sanityCheck =
|
71
|
+
options
|
72
|
+
// options &&
|
73
|
+
// (
|
74
|
+
// options.sanityCheck ||
|
75
|
+
// options.logGetSignal ||
|
76
|
+
// options.logSetSignal ||
|
77
|
+
// options.logStartComponent ||
|
78
|
+
// options.logFinishComponent
|
79
|
+
// );
|
80
|
+
|
81
|
+
|
82
|
+
wc = new WitnessCalculator(instance, sanityCheck);
|
83
|
+
return wc;
|
84
|
+
|
85
|
+
function getMessage() {
|
86
|
+
var message = "";
|
87
|
+
var c = instance.exports.getMessageChar();
|
88
|
+
while ( c != 0 ) {
|
89
|
+
message += String.fromCharCode(c);
|
90
|
+
c = instance.exports.getMessageChar();
|
91
|
+
}
|
92
|
+
return message;
|
93
|
+
}
|
94
|
+
|
95
|
+
function printSharedRWMemory () {
|
96
|
+
const shared_rw_memory_size = instance.exports.getFieldNumLen32();
|
97
|
+
const arr = new Uint32Array(shared_rw_memory_size);
|
98
|
+
for (let j=0; j<shared_rw_memory_size; j++) {
|
99
|
+
arr[shared_rw_memory_size-1-j] = instance.exports.readSharedRWMemory(j);
|
100
|
+
}
|
101
|
+
|
102
|
+
// If we've buffered other content, put a space in between the items
|
103
|
+
if (msgStr !== "") {
|
104
|
+
msgStr += " "
|
105
|
+
}
|
106
|
+
// Then append the value to the message we are creating
|
107
|
+
msgStr += (fromArray32(arr).toString());
|
108
|
+
}
|
109
|
+
|
110
|
+
};
|
111
|
+
|
112
|
+
class WitnessCalculator {
|
113
|
+
constructor(instance, sanityCheck) {
|
114
|
+
this.instance = instance;
|
115
|
+
|
116
|
+
this.version = this.instance.exports.getVersion();
|
117
|
+
this.n32 = this.instance.exports.getFieldNumLen32();
|
118
|
+
|
119
|
+
this.instance.exports.getRawPrime();
|
120
|
+
const arr = new Uint32Array(this.n32);
|
121
|
+
for (let i=0; i<this.n32; i++) {
|
122
|
+
arr[this.n32-1-i] = this.instance.exports.readSharedRWMemory(i);
|
123
|
+
}
|
124
|
+
this.prime = fromArray32(arr);
|
125
|
+
|
126
|
+
this.witnessSize = this.instance.exports.getWitnessSize();
|
127
|
+
|
128
|
+
this.sanityCheck = sanityCheck;
|
129
|
+
}
|
130
|
+
|
131
|
+
circom_version() {
|
132
|
+
return this.instance.exports.getVersion();
|
133
|
+
}
|
134
|
+
|
135
|
+
async _doCalculateWitness(input, sanityCheck) {
|
136
|
+
//input is assumed to be a map from signals to arrays of bigints
|
137
|
+
this.instance.exports.init((this.sanityCheck || sanityCheck) ? 1 : 0);
|
138
|
+
const keys = Object.keys(input);
|
139
|
+
var input_counter = 0;
|
140
|
+
keys.forEach( (k) => {
|
141
|
+
const h = fnvHash(k);
|
142
|
+
const hMSB = parseInt(h.slice(0,8), 16);
|
143
|
+
const hLSB = parseInt(h.slice(8,16), 16);
|
144
|
+
const fArr = flatArray(input[k]);
|
145
|
+
let signalSize = this.instance.exports.getInputSignalSize(hMSB, hLSB);
|
146
|
+
if (signalSize < 0){
|
147
|
+
throw new Error(`Signal ${k} not found\n`);
|
148
|
+
}
|
149
|
+
if (fArr.length < signalSize) {
|
150
|
+
throw new Error(`Not enough values for input signal ${k}\n`);
|
151
|
+
}
|
152
|
+
if (fArr.length > signalSize) {
|
153
|
+
throw new Error(`Too many values for input signal ${k}\n`);
|
154
|
+
}
|
155
|
+
for (let i=0; i<fArr.length; i++) {
|
156
|
+
const arrFr = toArray32(BigInt(fArr[i])%this.prime,this.n32)
|
157
|
+
for (let j=0; j<this.n32; j++) {
|
158
|
+
this.instance.exports.writeSharedRWMemory(j,arrFr[this.n32-1-j]);
|
159
|
+
}
|
160
|
+
try {
|
161
|
+
this.instance.exports.setInputSignal(hMSB, hLSB,i);
|
162
|
+
input_counter++;
|
163
|
+
} catch (err) {
|
164
|
+
// console.log(`After adding signal ${i} of ${k}`)
|
165
|
+
throw new Error(err);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
});
|
170
|
+
if (input_counter < this.instance.exports.getInputSize()) {
|
171
|
+
throw new Error(`Not all inputs have been set. Only ${input_counter} out of ${this.instance.exports.getInputSize()}`);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
async calculateWitness(input, sanityCheck) {
|
176
|
+
|
177
|
+
const w = [];
|
178
|
+
|
179
|
+
await this._doCalculateWitness(input, sanityCheck);
|
180
|
+
|
181
|
+
for (let i=0; i<this.witnessSize; i++) {
|
182
|
+
this.instance.exports.getWitness(i);
|
183
|
+
const arr = new Uint32Array(this.n32);
|
184
|
+
for (let j=0; j<this.n32; j++) {
|
185
|
+
arr[this.n32-1-j] = this.instance.exports.readSharedRWMemory(j);
|
186
|
+
}
|
187
|
+
w.push(fromArray32(arr));
|
188
|
+
}
|
189
|
+
|
190
|
+
return w;
|
191
|
+
}
|
192
|
+
|
193
|
+
|
194
|
+
async calculateBinWitness(input, sanityCheck) {
|
195
|
+
|
196
|
+
const buff32 = new Uint32Array(this.witnessSize*this.n32);
|
197
|
+
const buff = new Uint8Array( buff32.buffer);
|
198
|
+
await this._doCalculateWitness(input, sanityCheck);
|
199
|
+
|
200
|
+
for (let i=0; i<this.witnessSize; i++) {
|
201
|
+
this.instance.exports.getWitness(i);
|
202
|
+
const pos = i*this.n32;
|
203
|
+
for (let j=0; j<this.n32; j++) {
|
204
|
+
buff32[pos+j] = this.instance.exports.readSharedRWMemory(j);
|
205
|
+
}
|
206
|
+
}
|
207
|
+
|
208
|
+
return buff;
|
209
|
+
}
|
210
|
+
|
211
|
+
|
212
|
+
async calculateWTNSBin(input, sanityCheck) {
|
213
|
+
|
214
|
+
const buff32 = new Uint32Array(this.witnessSize*this.n32+this.n32+11);
|
215
|
+
const buff = new Uint8Array( buff32.buffer);
|
216
|
+
await this._doCalculateWitness(input, sanityCheck);
|
217
|
+
|
218
|
+
//"wtns"
|
219
|
+
buff[0] = "w".charCodeAt(0)
|
220
|
+
buff[1] = "t".charCodeAt(0)
|
221
|
+
buff[2] = "n".charCodeAt(0)
|
222
|
+
buff[3] = "s".charCodeAt(0)
|
223
|
+
|
224
|
+
//version 2
|
225
|
+
buff32[1] = 2;
|
226
|
+
|
227
|
+
//number of sections: 2
|
228
|
+
buff32[2] = 2;
|
229
|
+
|
230
|
+
//id section 1
|
231
|
+
buff32[3] = 1;
|
232
|
+
|
233
|
+
const n8 = this.n32*4;
|
234
|
+
//id section 1 length in 64bytes
|
235
|
+
const idSection1length = 8 + n8;
|
236
|
+
const idSection1lengthHex = idSection1length.toString(16);
|
237
|
+
buff32[4] = parseInt(idSection1lengthHex.slice(0,8), 16);
|
238
|
+
buff32[5] = parseInt(idSection1lengthHex.slice(8,16), 16);
|
239
|
+
|
240
|
+
//this.n32
|
241
|
+
buff32[6] = n8;
|
242
|
+
|
243
|
+
//prime number
|
244
|
+
this.instance.exports.getRawPrime();
|
245
|
+
|
246
|
+
var pos = 7;
|
247
|
+
for (let j=0; j<this.n32; j++) {
|
248
|
+
buff32[pos+j] = this.instance.exports.readSharedRWMemory(j);
|
249
|
+
}
|
250
|
+
pos += this.n32;
|
251
|
+
|
252
|
+
// witness size
|
253
|
+
buff32[pos] = this.witnessSize;
|
254
|
+
pos++;
|
255
|
+
|
256
|
+
//id section 2
|
257
|
+
buff32[pos] = 2;
|
258
|
+
pos++;
|
259
|
+
|
260
|
+
// section 2 length
|
261
|
+
const idSection2length = n8*this.witnessSize;
|
262
|
+
const idSection2lengthHex = idSection2length.toString(16);
|
263
|
+
buff32[pos] = parseInt(idSection2lengthHex.slice(0,8), 16);
|
264
|
+
buff32[pos+1] = parseInt(idSection2lengthHex.slice(8,16), 16);
|
265
|
+
|
266
|
+
pos += 2;
|
267
|
+
for (let i=0; i<this.witnessSize; i++) {
|
268
|
+
this.instance.exports.getWitness(i);
|
269
|
+
for (let j=0; j<this.n32; j++) {
|
270
|
+
buff32[pos+j] = this.instance.exports.readSharedRWMemory(j);
|
271
|
+
}
|
272
|
+
pos += this.n32;
|
273
|
+
}
|
274
|
+
|
275
|
+
return buff;
|
276
|
+
}
|
277
|
+
|
278
|
+
}
|
279
|
+
|
280
|
+
|
281
|
+
function toArray32(rem,size) {
|
282
|
+
const res = []; //new Uint32Array(size); //has no unshift
|
283
|
+
const radix = BigInt(0x100000000);
|
284
|
+
while (rem) {
|
285
|
+
res.unshift( Number(rem % radix));
|
286
|
+
rem = rem / radix;
|
287
|
+
}
|
288
|
+
if (size) {
|
289
|
+
var i = size - res.length;
|
290
|
+
while (i>0) {
|
291
|
+
res.unshift(0);
|
292
|
+
i--;
|
293
|
+
}
|
294
|
+
}
|
295
|
+
return res;
|
296
|
+
}
|
297
|
+
|
298
|
+
function fromArray32(arr) { //returns a BigInt
|
299
|
+
var res = BigInt(0);
|
300
|
+
const radix = BigInt(0x100000000);
|
301
|
+
for (let i = 0; i<arr.length; i++) {
|
302
|
+
res = res*radix + BigInt(arr[i]);
|
303
|
+
}
|
304
|
+
return res;
|
305
|
+
}
|
306
|
+
|
307
|
+
function flatArray(a) {
|
308
|
+
var res = [];
|
309
|
+
fillArray(res, a);
|
310
|
+
return res;
|
311
|
+
|
312
|
+
function fillArray(res, a) {
|
313
|
+
if (Array.isArray(a)) {
|
314
|
+
for (let i=0; i<a.length; i++) {
|
315
|
+
fillArray(res, a[i]);
|
316
|
+
}
|
317
|
+
} else {
|
318
|
+
res.push(a);
|
319
|
+
}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
323
|
+
function fnvHash(str) {
|
324
|
+
const uint64_max = BigInt(2) ** BigInt(64);
|
325
|
+
let hash = BigInt("0xCBF29CE484222325");
|
326
|
+
for (var i = 0; i < str.length; i++) {
|
327
|
+
hash ^= BigInt(str[i].charCodeAt());
|
328
|
+
hash *= BigInt(0x100000001B3);
|
329
|
+
hash %= uint64_max;
|
330
|
+
}
|
331
|
+
let shash = hash.toString(16);
|
332
|
+
let n = 16 - shash.length;
|
333
|
+
shash = '0'.repeat(n).concat(shash);
|
334
|
+
return shash;
|
335
|
+
}
|
Binary file
|
Binary file
|