@waku/rln 0.1.3-f6d5deb → 0.1.4-2a94244.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.
Files changed (341) hide show
  1. package/README.md +10 -186
  2. package/bundle/_virtual/__node-resolve_empty.js +6 -0
  3. package/bundle/_virtual/_assert.js +3 -0
  4. package/bundle/_virtual/_commonjs-dynamic-modules.js +5 -0
  5. package/bundle/_virtual/_commonjsHelpers.js +32 -0
  6. package/bundle/_virtual/_node-resolve_empty.js +3 -0
  7. package/bundle/_virtual/_sha2.js +3 -0
  8. package/bundle/_virtual/_u64.js +3 -0
  9. package/bundle/_virtual/aes.js +3 -0
  10. package/bundle/_virtual/bn.js +3 -0
  11. package/bundle/_virtual/browser.js +3 -0
  12. package/bundle/_virtual/checksum.js +3 -0
  13. package/bundle/_virtual/cipher.js +3 -0
  14. package/bundle/_virtual/class.js +3 -0
  15. package/bundle/_virtual/common.js +3 -0
  16. package/bundle/_virtual/common2.js +3 -0
  17. package/bundle/_virtual/cryptoBrowser.js +3 -0
  18. package/bundle/_virtual/functional.js +3 -0
  19. package/bundle/_virtual/hash.js +3 -0
  20. package/bundle/_virtual/hmac.js +3 -0
  21. package/bundle/_virtual/index.js +3 -0
  22. package/bundle/_virtual/index2.js +6 -0
  23. package/bundle/_virtual/inherits_browser.js +3 -0
  24. package/bundle/_virtual/kdf.js +3 -0
  25. package/bundle/_virtual/lodash.js +3 -0
  26. package/bundle/_virtual/password.js +3 -0
  27. package/bundle/_virtual/pbkdf2.js +3 -0
  28. package/bundle/_virtual/pbkdf22.js +3 -0
  29. package/bundle/_virtual/random.js +3 -0
  30. package/bundle/_virtual/ripemd.js +3 -0
  31. package/bundle/_virtual/schema-validation-generated.js +3 -0
  32. package/bundle/_virtual/schema-validation.js +3 -0
  33. package/bundle/_virtual/scrypt.js +3 -0
  34. package/bundle/_virtual/scrypt2.js +3 -0
  35. package/bundle/_virtual/sha.js +3 -0
  36. package/bundle/_virtual/sha256.js +3 -0
  37. package/bundle/_virtual/sha2562.js +3 -0
  38. package/bundle/_virtual/sha3.js +3 -0
  39. package/bundle/_virtual/sha512.js +3 -0
  40. package/bundle/_virtual/types.js +3 -0
  41. package/bundle/_virtual/utils.js +3 -0
  42. package/bundle/_virtual/utils2.js +3 -0
  43. package/bundle/_virtual/utils3.js +3 -0
  44. package/bundle/index.js +12 -74804
  45. package/bundle/node_modules/@ethersproject/abi/lib.esm/_version.js +3 -0
  46. package/bundle/node_modules/@ethersproject/abi/lib.esm/abi-coder.js +96 -0
  47. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +148 -0
  48. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/address.js +26 -0
  49. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js +20 -0
  50. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/array.js +210 -0
  51. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/boolean.js +18 -0
  52. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/bytes.js +30 -0
  53. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js +26 -0
  54. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/null.js +22 -0
  55. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/number.js +43 -0
  56. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/string.js +19 -0
  57. package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/tuple.js +58 -0
  58. package/bundle/node_modules/@ethersproject/abi/lib.esm/fragments.js +854 -0
  59. package/bundle/node_modules/@ethersproject/abi/lib.esm/interface.js +609 -0
  60. package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +3 -0
  61. package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/index.js +66 -0
  62. package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +3 -0
  63. package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/index.js +302 -0
  64. package/bundle/node_modules/@ethersproject/address/lib.esm/_version.js +3 -0
  65. package/bundle/node_modules/@ethersproject/address/lib.esm/index.js +110 -0
  66. package/bundle/node_modules/@ethersproject/base64/lib.esm/base64.js +20 -0
  67. package/bundle/node_modules/@ethersproject/basex/lib.esm/index.js +120 -0
  68. package/bundle/node_modules/@ethersproject/bignumber/lib.esm/_version.js +3 -0
  69. package/bundle/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js +287 -0
  70. package/bundle/node_modules/@ethersproject/bytes/lib.esm/_version.js +3 -0
  71. package/bundle/node_modules/@ethersproject/bytes/lib.esm/index.js +402 -0
  72. package/bundle/node_modules/@ethersproject/constants/lib.esm/addresses.js +3 -0
  73. package/bundle/node_modules/@ethersproject/constants/lib.esm/bignumbers.js +8 -0
  74. package/bundle/node_modules/@ethersproject/constants/lib.esm/hashes.js +3 -0
  75. package/bundle/node_modules/@ethersproject/contracts/lib.esm/_version.js +3 -0
  76. package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +893 -0
  77. package/bundle/node_modules/@ethersproject/hash/lib.esm/_version.js +3 -0
  78. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/decoder.js +256 -0
  79. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/include.js +36 -0
  80. package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +135 -0
  81. package/bundle/node_modules/@ethersproject/hash/lib.esm/id.js +8 -0
  82. package/bundle/node_modules/@ethersproject/hash/lib.esm/namehash.js +64 -0
  83. package/bundle/node_modules/@ethersproject/hash/lib.esm/typed-data.js +443 -0
  84. package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +8 -0
  85. package/bundle/node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +660 -0
  86. package/bundle/node_modules/@ethersproject/logger/lib.esm/_version.js +3 -0
  87. package/bundle/node_modules/@ethersproject/logger/lib.esm/index.js +352 -0
  88. package/bundle/node_modules/@ethersproject/networks/lib.esm/_version.js +3 -0
  89. package/bundle/node_modules/@ethersproject/networks/lib.esm/index.js +248 -0
  90. package/bundle/node_modules/@ethersproject/properties/lib.esm/_version.js +3 -0
  91. package/bundle/node_modules/@ethersproject/properties/lib.esm/index.js +127 -0
  92. package/bundle/node_modules/@ethersproject/providers/lib.esm/_version.js +3 -0
  93. package/bundle/node_modules/@ethersproject/providers/lib.esm/base-provider.js +2007 -0
  94. package/bundle/node_modules/@ethersproject/providers/lib.esm/formatter.js +422 -0
  95. package/bundle/node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +674 -0
  96. package/bundle/node_modules/@ethersproject/providers/lib.esm/web3-provider.js +132 -0
  97. package/bundle/node_modules/@ethersproject/rlp/lib.esm/_version.js +3 -0
  98. package/bundle/node_modules/@ethersproject/rlp/lib.esm/index.js +120 -0
  99. package/bundle/node_modules/@ethersproject/sha2/lib.esm/sha2.js +8 -0
  100. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/_version.js +3 -0
  101. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +2430 -0
  102. package/bundle/node_modules/@ethersproject/signing-key/lib.esm/index.js +76 -0
  103. package/bundle/node_modules/@ethersproject/strings/lib.esm/_version.js +3 -0
  104. package/bundle/node_modules/@ethersproject/strings/lib.esm/utf8.js +219 -0
  105. package/bundle/node_modules/@ethersproject/transactions/lib.esm/_version.js +3 -0
  106. package/bundle/node_modules/@ethersproject/transactions/lib.esm/index.js +279 -0
  107. package/bundle/node_modules/@ethersproject/web/lib.esm/_version.js +3 -0
  108. package/bundle/node_modules/@ethersproject/web/lib.esm/geturl.js +69 -0
  109. package/bundle/node_modules/@ethersproject/web/lib.esm/index.js +404 -0
  110. package/bundle/node_modules/@multiformats/multiaddr/dist/src/convert.js +15 -0
  111. package/bundle/node_modules/@multiformats/multiaddr/dist/src/multiaddr.js +20 -0
  112. package/bundle/node_modules/@multiformats/multiaddr/dist/src/protocols-table.js +92 -0
  113. package/bundle/node_modules/@noble/hashes/esm/_assert.js +37 -0
  114. package/bundle/node_modules/@noble/hashes/esm/_md.js +132 -0
  115. package/bundle/node_modules/@noble/hashes/esm/_u64.js +29 -0
  116. package/bundle/node_modules/@noble/hashes/esm/sha256.js +113 -0
  117. package/bundle/node_modules/@noble/hashes/esm/sha3.js +210 -0
  118. package/bundle/node_modules/@noble/hashes/esm/utils.js +144 -0
  119. package/bundle/node_modules/@waku/zerokit-rln-wasm/rln_wasm.js +756 -0
  120. package/bundle/node_modules/bech32/index.js +187 -0
  121. package/bundle/node_modules/bn.js/lib/bn.js +3361 -0
  122. package/bundle/node_modules/debug/src/browser.js +283 -0
  123. package/bundle/node_modules/debug/src/common.js +295 -0
  124. package/bundle/node_modules/ethereum-cryptography/esm/keccak.js +10 -0
  125. package/bundle/node_modules/ethereum-cryptography/esm/sha256.js +6 -0
  126. package/bundle/node_modules/ethereum-cryptography/esm/utils.js +24 -0
  127. package/bundle/node_modules/hash.js/lib/hash/common.js +97 -0
  128. package/bundle/node_modules/hash.js/lib/hash/hmac.js +51 -0
  129. package/bundle/node_modules/hash.js/lib/hash/ripemd.js +152 -0
  130. package/bundle/node_modules/hash.js/lib/hash/sha/1.js +81 -0
  131. package/bundle/node_modules/hash.js/lib/hash/sha/224.js +33 -0
  132. package/bundle/node_modules/hash.js/lib/hash/sha/256.js +113 -0
  133. package/bundle/node_modules/hash.js/lib/hash/sha/384.js +39 -0
  134. package/bundle/node_modules/hash.js/lib/hash/sha/512.js +336 -0
  135. package/bundle/node_modules/hash.js/lib/hash/sha/common.js +53 -0
  136. package/bundle/node_modules/hash.js/lib/hash/sha.js +14 -0
  137. package/bundle/node_modules/hash.js/lib/hash/utils.js +282 -0
  138. package/bundle/node_modules/hash.js/lib/hash.js +33 -0
  139. package/bundle/node_modules/inherits/inherits_browser.js +33 -0
  140. package/bundle/node_modules/it-length-prefixed/dist/src/decode.js +6 -0
  141. package/bundle/node_modules/lodash/lodash.js +17207 -0
  142. package/bundle/node_modules/minimalistic-assert/index.js +13 -0
  143. package/bundle/node_modules/ms/index.js +172 -0
  144. package/bundle/node_modules/multiformats/dist/src/bases/base.js +205 -0
  145. package/bundle/node_modules/multiformats/dist/src/bases/base10.js +9 -0
  146. package/bundle/node_modules/multiformats/dist/src/bases/base16.js +16 -0
  147. package/bundle/node_modules/multiformats/dist/src/bases/base2.js +10 -0
  148. package/bundle/node_modules/multiformats/dist/src/bases/base256emoji.js +41 -0
  149. package/bundle/node_modules/multiformats/dist/src/bases/base32.js +58 -0
  150. package/bundle/node_modules/multiformats/dist/src/bases/base36.js +14 -0
  151. package/bundle/node_modules/multiformats/dist/src/bases/base58.js +14 -0
  152. package/bundle/node_modules/multiformats/dist/src/bases/base64.js +28 -0
  153. package/bundle/node_modules/multiformats/dist/src/bases/base8.js +10 -0
  154. package/bundle/node_modules/multiformats/dist/src/bases/identity.js +11 -0
  155. package/bundle/node_modules/multiformats/dist/src/basics.js +15 -0
  156. package/bundle/node_modules/multiformats/dist/src/bytes.js +18 -0
  157. package/bundle/node_modules/multiformats/dist/src/codecs/json.js +2 -0
  158. package/bundle/node_modules/multiformats/dist/src/vendor/base-x.js +170 -0
  159. package/bundle/node_modules/protons-runtime/dist/src/codec.js +20 -0
  160. package/bundle/node_modules/protons-runtime/dist/src/codecs/enum.js +24 -0
  161. package/bundle/node_modules/protons-runtime/dist/src/codecs/message.js +7 -0
  162. package/bundle/node_modules/protons-runtime/dist/src/decode.js +8 -0
  163. package/bundle/node_modules/protons-runtime/dist/src/encode.js +11 -0
  164. package/bundle/node_modules/protons-runtime/dist/src/index.js +30 -0
  165. package/bundle/node_modules/protons-runtime/dist/src/utils/float.js +54 -0
  166. package/bundle/node_modules/protons-runtime/dist/src/utils/longbits.js +175 -0
  167. package/bundle/node_modules/protons-runtime/dist/src/utils/pool.js +28 -0
  168. package/bundle/node_modules/protons-runtime/dist/src/utils/reader.js +367 -0
  169. package/bundle/node_modules/protons-runtime/dist/src/utils/utf8.js +99 -0
  170. package/bundle/node_modules/protons-runtime/dist/src/utils/writer.js +438 -0
  171. package/bundle/node_modules/uint8-varint/dist/src/index.js +124 -0
  172. package/bundle/node_modules/uint8arrays/dist/src/alloc.js +17 -0
  173. package/bundle/node_modules/uint8arrays/dist/src/from-string.js +19 -0
  174. package/bundle/node_modules/uint8arrays/dist/src/util/bases.js +49 -0
  175. package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +21 -0
  176. package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +18 -0
  177. package/bundle/packages/core/dist/lib/filter/filter.js +27 -0
  178. package/bundle/packages/core/dist/lib/light_push/light_push.js +27 -0
  179. package/bundle/packages/core/dist/lib/message/version_0.js +154 -0
  180. package/bundle/packages/core/dist/lib/metadata/metadata.js +27 -0
  181. package/bundle/packages/core/dist/lib/store/store.js +27 -0
  182. package/bundle/packages/interfaces/dist/connection_manager.js +19 -0
  183. package/bundle/packages/interfaces/dist/constants.js +6 -0
  184. package/bundle/packages/interfaces/dist/health_indicator.js +12 -0
  185. package/bundle/packages/interfaces/dist/protocols.js +92 -0
  186. package/bundle/packages/proto/dist/generated/filter.js +445 -0
  187. package/bundle/packages/proto/dist/generated/filter_v2.js +424 -0
  188. package/bundle/packages/proto/dist/generated/light_push.js +389 -0
  189. package/bundle/packages/proto/dist/generated/message.js +213 -0
  190. package/bundle/packages/proto/dist/generated/metadata.js +130 -0
  191. package/bundle/packages/proto/dist/generated/peer_exchange.js +209 -0
  192. package/bundle/packages/proto/dist/generated/sds_message.js +105 -0
  193. package/bundle/packages/proto/dist/generated/store_v3.js +490 -0
  194. package/bundle/packages/proto/dist/generated/topic_only_message.js +61 -0
  195. package/bundle/packages/rln/dist/codec.js +93 -0
  196. package/bundle/packages/rln/dist/contract/abi.js +394 -0
  197. package/bundle/packages/rln/dist/contract/constants.js +27 -0
  198. package/bundle/packages/rln/dist/contract/rln_contract.js +438 -0
  199. package/bundle/packages/rln/dist/create.js +9 -0
  200. package/bundle/packages/rln/dist/identity.js +30 -0
  201. package/bundle/packages/rln/dist/keystore/cipher.js +31 -0
  202. package/bundle/packages/rln/dist/keystore/credential_validation_generated.js +119 -0
  203. package/bundle/packages/rln/dist/keystore/keystore.js +223 -0
  204. package/bundle/packages/rln/dist/keystore/keystore_validation_generated.js +74 -0
  205. package/bundle/packages/rln/dist/keystore/schema_validator.js +20 -0
  206. package/bundle/packages/rln/dist/message.js +51 -0
  207. package/bundle/packages/rln/dist/proof.js +54 -0
  208. package/bundle/packages/rln/dist/resources/verification_key.js +112 -0
  209. package/bundle/packages/rln/dist/resources/witness_calculator.js +330 -0
  210. package/bundle/packages/rln/dist/rln.js +220 -0
  211. package/bundle/packages/rln/dist/root_tracker.js +76 -0
  212. package/bundle/packages/rln/dist/utils/bytes.js +65 -0
  213. package/bundle/packages/rln/dist/utils/epoch.js +39 -0
  214. package/bundle/packages/rln/dist/utils/hash.js +10 -0
  215. package/bundle/packages/rln/dist/utils/metamask.js +14 -0
  216. package/bundle/packages/rln/dist/zerokit.js +128 -0
  217. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/checksum.js +52 -0
  218. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/cipher.js +65 -0
  219. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/class.js +99 -0
  220. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/functional.js +103 -0
  221. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/index.js +28 -0
  222. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/kdf.js +78 -0
  223. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/password.js +17 -0
  224. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1253 -0
  225. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation.js +40 -0
  226. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/types.js +5 -0
  227. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +103 -0
  228. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +41 -0
  229. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +17 -0
  230. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +23 -0
  231. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +12 -0
  232. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +77 -0
  233. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js +9 -0
  234. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/md5.js +215 -0
  235. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/nil.js +3 -0
  236. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/parse.js +35 -0
  237. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/regex.js +3 -0
  238. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/rng.js +21 -0
  239. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
  240. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/stringify.js +31 -0
  241. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v1.js +96 -0
  242. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v3.js +6 -0
  243. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v35.js +66 -0
  244. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v4.js +24 -0
  245. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v5.js +6 -0
  246. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/validate.js +7 -0
  247. package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/version.js +11 -0
  248. package/bundle/packages/rln/node_modules/@noble/hashes/_assert.js +52 -0
  249. package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +124 -0
  250. package/bundle/packages/rln/node_modules/@noble/hashes/_u64.js +71 -0
  251. package/bundle/packages/rln/node_modules/@noble/hashes/cryptoBrowser.js +10 -0
  252. package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +88 -0
  253. package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +99 -0
  254. package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +233 -0
  255. package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +133 -0
  256. package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +243 -0
  257. package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +167 -0
  258. package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/native.js +4 -0
  259. package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/rng.js +13 -0
  260. package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/stringify.js +28 -0
  261. package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/v4.js +19 -0
  262. package/bundle/packages/utils/dist/bytes/index.js +44 -0
  263. package/bundle/packages/utils/dist/common/sharding/index.js +91 -0
  264. package/bundle/packages/utils/dist/logger/index.js +31 -0
  265. package/bundle/resources/verification_key.d.ts +13 -0
  266. package/bundle/resources/verification_key.js +112 -0
  267. package/bundle/resources/witness_calculator.d.ts +11 -0
  268. package/bundle/resources/witness_calculator.js +328 -0
  269. package/dist/.tsbuildinfo +1 -0
  270. package/dist/codec.d.ts +5 -5
  271. package/dist/codec.js +6 -6
  272. package/dist/codec.js.map +1 -1
  273. package/dist/contract/abi.d.ts +42 -0
  274. package/dist/contract/abi.js +393 -0
  275. package/dist/contract/abi.js.map +1 -0
  276. package/dist/contract/constants.d.ts +59 -3
  277. package/dist/contract/constants.js +21 -63
  278. package/dist/contract/constants.js.map +1 -1
  279. package/dist/contract/rln_contract.d.ts +98 -17
  280. package/dist/contract/rln_contract.js +292 -71
  281. package/dist/contract/rln_contract.js.map +1 -1
  282. package/dist/identity.js +5 -2
  283. package/dist/identity.js.map +1 -1
  284. package/dist/index.d.ts +3 -3
  285. package/dist/index.js +3 -3
  286. package/dist/index.js.map +1 -1
  287. package/dist/keystore/cipher.js +3 -3
  288. package/dist/keystore/cipher.js.map +1 -1
  289. package/dist/keystore/credential_validation_generated.js.map +1 -1
  290. package/dist/keystore/keystore.js +4 -4
  291. package/dist/keystore/keystore.js.map +1 -1
  292. package/dist/keystore/keystore_validation_generated.js.map +1 -1
  293. package/dist/message.js +3 -3
  294. package/dist/message.js.map +1 -1
  295. package/dist/proof.js +3 -2
  296. package/dist/proof.js.map +1 -1
  297. package/dist/resources/verification_key.d.ts +12 -11
  298. package/dist/resources/verification_key.js +103 -103
  299. package/dist/resources/witness_calculator.d.ts +10 -15
  300. package/dist/resources/witness_calculator.js +302 -265
  301. package/dist/rln.d.ts +5 -1
  302. package/dist/rln.js +56 -28
  303. package/dist/rln.js.map +1 -1
  304. package/dist/root_tracker.js.map +1 -1
  305. package/dist/utils/epoch.js +5 -5
  306. package/dist/utils/epoch.js.map +1 -1
  307. package/dist/zerokit.d.ts +13 -9
  308. package/dist/zerokit.js +40 -20
  309. package/dist/zerokit.js.map +1 -1
  310. package/package.json +1 -146
  311. package/src/codec.ts +26 -22
  312. package/src/contract/abi.ts +392 -0
  313. package/src/contract/constants.ts +28 -0
  314. package/src/contract/index.ts +2 -0
  315. package/src/contract/rln_contract.ts +686 -0
  316. package/src/identity.ts +8 -4
  317. package/src/index.ts +4 -9
  318. package/src/keystore/cipher.ts +54 -0
  319. package/src/keystore/credential_validation_generated.ts +7 -0
  320. package/src/keystore/index.ts +5 -0
  321. package/src/keystore/keystore.ts +330 -0
  322. package/src/keystore/keystore_validation_generated.ts +7 -0
  323. package/src/keystore/schema_validator.ts +34 -0
  324. package/src/keystore/types.ts +36 -0
  325. package/src/message.ts +10 -10
  326. package/src/proof.ts +13 -11
  327. package/src/resources/verification_key.d.ts +13 -0
  328. package/src/resources/witness_calculator.d.ts +11 -0
  329. package/src/rln.ts +76 -31
  330. package/src/root_tracker.ts +7 -6
  331. package/src/utils/bytes.ts +84 -0
  332. package/src/utils/epoch.ts +30 -0
  333. package/src/utils/hash.ts +15 -0
  334. package/src/utils/index.ts +9 -0
  335. package/src/utils/metamask.ts +17 -0
  336. package/src/zerokit.ts +95 -33
  337. package/bundle/assets/rln_wasm_bg-a503e304.wasm +0 -0
  338. package/dist/resources/verification_key.js.map +0 -1
  339. package/dist/resources/witness_calculator.js.map +0 -1
  340. /package/bundle/{assets/rln-6ded2896.wasm → resources/rln.wasm} +0 -0
  341. /package/bundle/{assets/rln_final-8b299152.zkey → resources/rln_final.zkey} +0 -0
@@ -0,0 +1,112 @@
1
+ const verificationKey = {
2
+ protocol: "groth16",
3
+ curve: "bn128",
4
+ nPublic: 6,
5
+ vk_alpha_1: [
6
+ "20124996762962216725442980738609010303800849578410091356605067053491763969391",
7
+ "9118593021526896828671519912099489027245924097793322973632351264852174143923",
8
+ "1"
9
+ ],
10
+ vk_beta_2: [
11
+ [
12
+ "4693952934005375501364248788849686435240706020501681709396105298107971354382",
13
+ "14346958885444710485362620645446987998958218205939139994511461437152241966681"
14
+ ],
15
+ [
16
+ "16851772916911573982706166384196538392731905827088356034885868448550849804972",
17
+ "823612331030938060799959717749043047845343400798220427319188951998582076532"
18
+ ],
19
+ ["1", "0"]
20
+ ],
21
+ vk_gamma_2: [
22
+ [
23
+ "10857046999023057135944570762232829481370756359578518086990519993285655852781",
24
+ "11559732032986387107991004021392285783925812861821192530917403151452391805634"
25
+ ],
26
+ [
27
+ "8495653923123431417604973247489272438418190587263600148770280649306958101930",
28
+ "4082367875863433681332203403145435568316851327593401208105741076214120093531"
29
+ ],
30
+ ["1", "0"]
31
+ ],
32
+ vk_delta_2: [
33
+ [
34
+ "8353516066399360694538747105302262515182301251524941126222712285088022964076",
35
+ "9329524012539638256356482961742014315122377605267454801030953882967973561832"
36
+ ],
37
+ [
38
+ "16805391589556134376869247619848130874761233086443465978238468412168162326401",
39
+ "10111259694977636294287802909665108497237922060047080343914303287629927847739"
40
+ ],
41
+ ["1", "0"]
42
+ ],
43
+ vk_alphabeta_12: [
44
+ [
45
+ [
46
+ "12608968655665301215455851857466367636344427685631271961542642719683786103711",
47
+ "9849575605876329747382930567422916152871921500826003490242628251047652318086"
48
+ ],
49
+ [
50
+ "6322029441245076030714726551623552073612922718416871603535535085523083939021",
51
+ "8700115492541474338049149013125102281865518624059015445617546140629435818912"
52
+ ],
53
+ [
54
+ "10674973475340072635573101639867487770811074181475255667220644196793546640210",
55
+ "2926286967251299230490668407790788696102889214647256022788211245826267484824"
56
+ ]
57
+ ],
58
+ [
59
+ [
60
+ "9660441540778523475944706619139394922744328902833875392144658911530830074820",
61
+ "19548113127774514328631808547691096362144426239827206966690021428110281506546"
62
+ ],
63
+ [
64
+ "1870837942477655969123169532603615788122896469891695773961478956740992497097",
65
+ "12536105729661705698805725105036536744930776470051238187456307227425796690780"
66
+ ],
67
+ [
68
+ "21811903352654147452884857281720047789720483752548991551595462057142824037334",
69
+ "19021616763967199151052893283384285352200445499680068407023236283004353578353"
70
+ ]
71
+ ]
72
+ ],
73
+ IC: [
74
+ [
75
+ "11992897507809711711025355300535923222599547639134311050809253678876341466909",
76
+ "17181525095924075896332561978747020491074338784673526378866503154966799128110",
77
+ "1"
78
+ ],
79
+ [
80
+ "17018665030246167677911144513385572506766200776123272044534328594850561667818",
81
+ "18601114175490465275436712413925513066546725461375425769709566180981674884464",
82
+ "1"
83
+ ],
84
+ [
85
+ "18799470100699658367834559797874857804183288553462108031963980039244731716542",
86
+ "13064227487174191981628537974951887429496059857753101852163607049188825592007",
87
+ "1"
88
+ ],
89
+ [
90
+ "17432501889058124609368103715904104425610382063762621017593209214189134571156",
91
+ "13406815149699834788256141097399354592751313348962590382887503595131085938635",
92
+ "1"
93
+ ],
94
+ [
95
+ "10320964835612716439094703312987075811498239445882526576970512041988148264481",
96
+ "9024164961646353611176283204118089412001502110138072989569118393359029324867",
97
+ "1"
98
+ ],
99
+ [
100
+ "718355081067365548229685160476620267257521491773976402837645005858953849298",
101
+ "14635482993933988261008156660773180150752190597753512086153001683711587601974",
102
+ "1"
103
+ ],
104
+ [
105
+ "11777720285956632126519898515392071627539405001940313098390150593689568177535",
106
+ "8483603647274280691250972408211651407952870456587066148445913156086740744515",
107
+ "1"
108
+ ]
109
+ ]
110
+ };
111
+
112
+ export default verificationKey;
@@ -0,0 +1,11 @@
1
+ export async function builder(
2
+ code: Uint8Array,
3
+ sanityCheck: boolean
4
+ ): Promise<WitnessCalculator>;
5
+
6
+ export class WitnessCalculator {
7
+ public calculateWitness(
8
+ input: unknown,
9
+ sanityCheck: boolean
10
+ ): Promise<Array<bigint>>;
11
+ }
@@ -0,0 +1,328 @@
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
+ options = options || {};
7
+
8
+ let wasmModule;
9
+ try {
10
+ wasmModule = await WebAssembly.compile(code);
11
+ } catch (err) {
12
+ console.log(err);
13
+ console.log(
14
+ "\nTry to run circom --c in order to generate c++ code instead\n"
15
+ );
16
+ throw new Error(err);
17
+ }
18
+
19
+ let wc;
20
+
21
+ let errStr = "";
22
+ let msgStr = "";
23
+
24
+ const instance = await WebAssembly.instantiate(wasmModule, {
25
+ runtime: {
26
+ exceptionHandler: function (code) {
27
+ let err;
28
+ if (code == 1) {
29
+ err = "Signal not found.\n";
30
+ } else if (code == 2) {
31
+ err = "Too many signals set.\n";
32
+ } else if (code == 3) {
33
+ err = "Signal already set.\n";
34
+ } else if (code == 4) {
35
+ err = "Assert Failed.\n";
36
+ } else if (code == 5) {
37
+ err = "Not enough memory.\n";
38
+ } else if (code == 6) {
39
+ err = "Input signal array access exceeds the size.\n";
40
+ } else {
41
+ err = "Unknown error.\n";
42
+ }
43
+ throw new Error(err + errStr);
44
+ },
45
+ printErrorMessage: function () {
46
+ errStr += getMessage() + "\n";
47
+ // console.error(getMessage());
48
+ },
49
+ writeBufferMessage: function () {
50
+ const msg = getMessage();
51
+ // Any calls to `log()` will always end with a `\n`, so that's when we print and reset
52
+ if (msg === "\n") {
53
+ console.log(msgStr);
54
+ msgStr = "";
55
+ } else {
56
+ // If we've buffered other content, put a space in between the items
57
+ if (msgStr !== "") {
58
+ msgStr += " ";
59
+ }
60
+ // Then append the message to the message we are creating
61
+ msgStr += msg;
62
+ }
63
+ },
64
+ showSharedRWMemory: function () {
65
+ printSharedRWMemory();
66
+ }
67
+ }
68
+ });
69
+
70
+ const sanityCheck = options;
71
+ // options &&
72
+ // (
73
+ // options.sanityCheck ||
74
+ // options.logGetSignal ||
75
+ // options.logSetSignal ||
76
+ // options.logStartComponent ||
77
+ // options.logFinishComponent
78
+ // );
79
+
80
+ wc = new WitnessCalculator(instance, sanityCheck);
81
+ return wc;
82
+
83
+ function getMessage() {
84
+ var message = "";
85
+ var c = instance.exports.getMessageChar();
86
+ while (c != 0) {
87
+ message += String.fromCharCode(c);
88
+ c = instance.exports.getMessageChar();
89
+ }
90
+ return message;
91
+ }
92
+
93
+ function printSharedRWMemory() {
94
+ const shared_rw_memory_size = instance.exports.getFieldNumLen32();
95
+ const arr = new Uint32Array(shared_rw_memory_size);
96
+ for (let j = 0; j < shared_rw_memory_size; j++) {
97
+ arr[shared_rw_memory_size - 1 - j] =
98
+ instance.exports.readSharedRWMemory(j);
99
+ }
100
+
101
+ // If we've buffered other content, put a space in between the items
102
+ if (msgStr !== "") {
103
+ msgStr += " ";
104
+ }
105
+ // Then append the value to the message we are creating
106
+ msgStr += fromArray32(arr).toString();
107
+ }
108
+ }
109
+
110
+ class WitnessCalculator {
111
+ constructor(instance, sanityCheck) {
112
+ this.instance = instance;
113
+
114
+ this.version = this.instance.exports.getVersion();
115
+ this.n32 = this.instance.exports.getFieldNumLen32();
116
+
117
+ this.instance.exports.getRawPrime();
118
+ const arr = new Uint32Array(this.n32);
119
+ for (let i = 0; i < this.n32; i++) {
120
+ arr[this.n32 - 1 - i] = this.instance.exports.readSharedRWMemory(i);
121
+ }
122
+ this.prime = fromArray32(arr);
123
+
124
+ this.witnessSize = this.instance.exports.getWitnessSize();
125
+
126
+ this.sanityCheck = sanityCheck;
127
+ }
128
+
129
+ circom_version() {
130
+ return this.instance.exports.getVersion();
131
+ }
132
+
133
+ async _doCalculateWitness(input, sanityCheck) {
134
+ //input is assumed to be a map from signals to arrays of bigints
135
+ this.instance.exports.init(this.sanityCheck || sanityCheck ? 1 : 0);
136
+ const keys = Object.keys(input);
137
+ var input_counter = 0;
138
+ keys.forEach((k) => {
139
+ const h = fnvHash(k);
140
+ const hMSB = parseInt(h.slice(0, 8), 16);
141
+ const hLSB = parseInt(h.slice(8, 16), 16);
142
+ const fArr = flatArray(input[k]);
143
+ let signalSize = this.instance.exports.getInputSignalSize(hMSB, hLSB);
144
+ if (signalSize < 0) {
145
+ throw new Error(`Signal ${k} not found\n`);
146
+ }
147
+ if (fArr.length < signalSize) {
148
+ throw new Error(`Not enough values for input signal ${k}\n`);
149
+ }
150
+ if (fArr.length > signalSize) {
151
+ throw new Error(`Too many values for input signal ${k}\n`);
152
+ }
153
+ for (let i = 0; i < fArr.length; i++) {
154
+ const arrFr = toArray32(BigInt(fArr[i]) % this.prime, this.n32);
155
+ for (let j = 0; j < this.n32; j++) {
156
+ this.instance.exports.writeSharedRWMemory(j, arrFr[this.n32 - 1 - j]);
157
+ }
158
+ try {
159
+ this.instance.exports.setInputSignal(hMSB, hLSB, i);
160
+ input_counter++;
161
+ } catch (err) {
162
+ // console.log(`After adding signal ${i} of ${k}`)
163
+ throw new Error(err);
164
+ }
165
+ }
166
+ });
167
+ if (input_counter < this.instance.exports.getInputSize()) {
168
+ throw new Error(
169
+ `Not all inputs have been set. Only ${input_counter} out of ${this.instance.exports.getInputSize()}`
170
+ );
171
+ }
172
+ }
173
+
174
+ async calculateWitness(input, sanityCheck) {
175
+ const w = [];
176
+
177
+ await this._doCalculateWitness(input, sanityCheck);
178
+
179
+ for (let i = 0; i < this.witnessSize; i++) {
180
+ this.instance.exports.getWitness(i);
181
+ const arr = new Uint32Array(this.n32);
182
+ for (let j = 0; j < this.n32; j++) {
183
+ arr[this.n32 - 1 - j] = this.instance.exports.readSharedRWMemory(j);
184
+ }
185
+ w.push(fromArray32(arr));
186
+ }
187
+
188
+ return w;
189
+ }
190
+
191
+ async calculateBinWitness(input, sanityCheck) {
192
+ const buff32 = new Uint32Array(this.witnessSize * this.n32);
193
+ const buff = new Uint8Array(buff32.buffer);
194
+ await this._doCalculateWitness(input, sanityCheck);
195
+
196
+ for (let i = 0; i < this.witnessSize; i++) {
197
+ this.instance.exports.getWitness(i);
198
+ const pos = i * this.n32;
199
+ for (let j = 0; j < this.n32; j++) {
200
+ buff32[pos + j] = this.instance.exports.readSharedRWMemory(j);
201
+ }
202
+ }
203
+
204
+ return buff;
205
+ }
206
+
207
+ async calculateWTNSBin(input, sanityCheck) {
208
+ const buff32 = new Uint32Array(this.witnessSize * this.n32 + this.n32 + 11);
209
+ const buff = new Uint8Array(buff32.buffer);
210
+ await this._doCalculateWitness(input, sanityCheck);
211
+
212
+ //"wtns"
213
+ buff[0] = "w".charCodeAt(0);
214
+ buff[1] = "t".charCodeAt(0);
215
+ buff[2] = "n".charCodeAt(0);
216
+ buff[3] = "s".charCodeAt(0);
217
+
218
+ //version 2
219
+ buff32[1] = 2;
220
+
221
+ //number of sections: 2
222
+ buff32[2] = 2;
223
+
224
+ //id section 1
225
+ buff32[3] = 1;
226
+
227
+ const n8 = this.n32 * 4;
228
+ //id section 1 length in 64bytes
229
+ const idSection1length = 8 + n8;
230
+ const idSection1lengthHex = idSection1length.toString(16);
231
+ buff32[4] = parseInt(idSection1lengthHex.slice(0, 8), 16);
232
+ buff32[5] = parseInt(idSection1lengthHex.slice(8, 16), 16);
233
+
234
+ //this.n32
235
+ buff32[6] = n8;
236
+
237
+ //prime number
238
+ this.instance.exports.getRawPrime();
239
+
240
+ var pos = 7;
241
+ for (let j = 0; j < this.n32; j++) {
242
+ buff32[pos + j] = this.instance.exports.readSharedRWMemory(j);
243
+ }
244
+ pos += this.n32;
245
+
246
+ // witness size
247
+ buff32[pos] = this.witnessSize;
248
+ pos++;
249
+
250
+ //id section 2
251
+ buff32[pos] = 2;
252
+ pos++;
253
+
254
+ // section 2 length
255
+ const idSection2length = n8 * this.witnessSize;
256
+ const idSection2lengthHex = idSection2length.toString(16);
257
+ buff32[pos] = parseInt(idSection2lengthHex.slice(0, 8), 16);
258
+ buff32[pos + 1] = parseInt(idSection2lengthHex.slice(8, 16), 16);
259
+
260
+ pos += 2;
261
+ for (let i = 0; i < this.witnessSize; i++) {
262
+ this.instance.exports.getWitness(i);
263
+ for (let j = 0; j < this.n32; j++) {
264
+ buff32[pos + j] = this.instance.exports.readSharedRWMemory(j);
265
+ }
266
+ pos += this.n32;
267
+ }
268
+
269
+ return buff;
270
+ }
271
+ }
272
+
273
+ function toArray32(rem, size) {
274
+ const res = []; //new Uint32Array(size); //has no unshift
275
+ const radix = BigInt(0x100000000);
276
+ while (rem) {
277
+ res.unshift(Number(rem % radix));
278
+ rem = rem / radix;
279
+ }
280
+ if (size) {
281
+ var i = size - res.length;
282
+ while (i > 0) {
283
+ res.unshift(0);
284
+ i--;
285
+ }
286
+ }
287
+ return res;
288
+ }
289
+
290
+ function fromArray32(arr) {
291
+ //returns a BigInt
292
+ var res = BigInt(0);
293
+ const radix = BigInt(0x100000000);
294
+ for (let i = 0; i < arr.length; i++) {
295
+ res = res * radix + BigInt(arr[i]);
296
+ }
297
+ return res;
298
+ }
299
+
300
+ function flatArray(a) {
301
+ var res = [];
302
+ fillArray(res, a);
303
+ return res;
304
+
305
+ function fillArray(res, a) {
306
+ if (Array.isArray(a)) {
307
+ for (let i = 0; i < a.length; i++) {
308
+ fillArray(res, a[i]);
309
+ }
310
+ } else {
311
+ res.push(a);
312
+ }
313
+ }
314
+ }
315
+
316
+ function fnvHash(str) {
317
+ const uint64_max = BigInt(2) ** BigInt(64);
318
+ let hash = BigInt("0xCBF29CE484222325");
319
+ for (var i = 0; i < str.length; i++) {
320
+ hash ^= BigInt(str[i].charCodeAt());
321
+ hash *= BigInt(0x100000001b3);
322
+ hash %= uint64_max;
323
+ }
324
+ let shash = hash.toString(16);
325
+ let n = 16 - shash.length;
326
+ shash = "0".repeat(n).concat(shash);
327
+ return shash;
328
+ }