@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,170 @@
1
+ /* eslint-disable */
2
+ // base-x encoding / decoding
3
+ // Copyright (c) 2018 base-x contributors
4
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
5
+ // Distributed under the MIT software license, see the accompanying
6
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
7
+ /**
8
+ * @param {string} ALPHABET
9
+ * @param {any} name
10
+ */
11
+ function base(ALPHABET, name) {
12
+ if (ALPHABET.length >= 255) {
13
+ throw new TypeError('Alphabet too long');
14
+ }
15
+ var BASE_MAP = new Uint8Array(256);
16
+ for (var j = 0; j < BASE_MAP.length; j++) {
17
+ BASE_MAP[j] = 255;
18
+ }
19
+ for (var i = 0; i < ALPHABET.length; i++) {
20
+ var x = ALPHABET.charAt(i);
21
+ var xc = x.charCodeAt(0);
22
+ if (BASE_MAP[xc] !== 255) {
23
+ throw new TypeError(x + ' is ambiguous');
24
+ }
25
+ BASE_MAP[xc] = i;
26
+ }
27
+ var BASE = ALPHABET.length;
28
+ var LEADER = ALPHABET.charAt(0);
29
+ var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
30
+ var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
31
+ /**
32
+ * @param {any[] | Iterable<number>} source
33
+ */
34
+ function encode(source) {
35
+ // @ts-ignore
36
+ if (source instanceof Uint8Array)
37
+ ;
38
+ else if (ArrayBuffer.isView(source)) {
39
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
40
+ }
41
+ else if (Array.isArray(source)) {
42
+ source = Uint8Array.from(source);
43
+ }
44
+ if (!(source instanceof Uint8Array)) {
45
+ throw new TypeError('Expected Uint8Array');
46
+ }
47
+ if (source.length === 0) {
48
+ return '';
49
+ }
50
+ // Skip & count leading zeroes.
51
+ var zeroes = 0;
52
+ var length = 0;
53
+ var pbegin = 0;
54
+ var pend = source.length;
55
+ while (pbegin !== pend && source[pbegin] === 0) {
56
+ pbegin++;
57
+ zeroes++;
58
+ }
59
+ // Allocate enough space in big-endian base58 representation.
60
+ var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
61
+ var b58 = new Uint8Array(size);
62
+ // Process the bytes.
63
+ while (pbegin !== pend) {
64
+ var carry = source[pbegin];
65
+ // Apply "b58 = b58 * 256 + ch".
66
+ var i = 0;
67
+ for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
68
+ carry += (256 * b58[it1]) >>> 0;
69
+ b58[it1] = (carry % BASE) >>> 0;
70
+ carry = (carry / BASE) >>> 0;
71
+ }
72
+ if (carry !== 0) {
73
+ throw new Error('Non-zero carry');
74
+ }
75
+ length = i;
76
+ pbegin++;
77
+ }
78
+ // Skip leading zeroes in base58 result.
79
+ var it2 = size - length;
80
+ while (it2 !== size && b58[it2] === 0) {
81
+ it2++;
82
+ }
83
+ // Translate the result into a string.
84
+ var str = LEADER.repeat(zeroes);
85
+ for (; it2 < size; ++it2) {
86
+ str += ALPHABET.charAt(b58[it2]);
87
+ }
88
+ return str;
89
+ }
90
+ /**
91
+ * @param {string | string[]} source
92
+ */
93
+ function decodeUnsafe(source) {
94
+ if (typeof source !== 'string') {
95
+ throw new TypeError('Expected String');
96
+ }
97
+ if (source.length === 0) {
98
+ return new Uint8Array();
99
+ }
100
+ var psz = 0;
101
+ // Skip leading spaces.
102
+ if (source[psz] === ' ') {
103
+ return;
104
+ }
105
+ // Skip and count leading '1's.
106
+ var zeroes = 0;
107
+ var length = 0;
108
+ while (source[psz] === LEADER) {
109
+ zeroes++;
110
+ psz++;
111
+ }
112
+ // Allocate enough space in big-endian base256 representation.
113
+ var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
114
+ var b256 = new Uint8Array(size);
115
+ // Process the characters.
116
+ while (source[psz]) {
117
+ // Decode character
118
+ var carry = BASE_MAP[source.charCodeAt(psz)];
119
+ // Invalid character
120
+ if (carry === 255) {
121
+ return;
122
+ }
123
+ var i = 0;
124
+ for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
125
+ carry += (BASE * b256[it3]) >>> 0;
126
+ b256[it3] = (carry % 256) >>> 0;
127
+ carry = (carry / 256) >>> 0;
128
+ }
129
+ if (carry !== 0) {
130
+ throw new Error('Non-zero carry');
131
+ }
132
+ length = i;
133
+ psz++;
134
+ }
135
+ // Skip trailing spaces.
136
+ if (source[psz] === ' ') {
137
+ return;
138
+ }
139
+ // Skip leading zeroes in b256.
140
+ var it4 = size - length;
141
+ while (it4 !== size && b256[it4] === 0) {
142
+ it4++;
143
+ }
144
+ var vch = new Uint8Array(zeroes + (size - it4));
145
+ var j = zeroes;
146
+ while (it4 !== size) {
147
+ vch[j++] = b256[it4++];
148
+ }
149
+ return vch;
150
+ }
151
+ /**
152
+ * @param {string | string[]} string
153
+ */
154
+ function decode(string) {
155
+ var buffer = decodeUnsafe(string);
156
+ if (buffer) {
157
+ return buffer;
158
+ }
159
+ throw new Error(`Non-${name} character`);
160
+ }
161
+ return {
162
+ encode: encode,
163
+ decodeUnsafe: decodeUnsafe,
164
+ decode: decode
165
+ };
166
+ }
167
+ var src = base;
168
+ var _brrp__multiformats_scope_baseX = src;
169
+
170
+ export { _brrp__multiformats_scope_baseX as default };
@@ -0,0 +1,20 @@
1
+ // https://developers.google.com/protocol-buffers/docs/encoding#structure
2
+ var CODEC_TYPES;
3
+ (function (CODEC_TYPES) {
4
+ CODEC_TYPES[CODEC_TYPES["VARINT"] = 0] = "VARINT";
5
+ CODEC_TYPES[CODEC_TYPES["BIT64"] = 1] = "BIT64";
6
+ CODEC_TYPES[CODEC_TYPES["LENGTH_DELIMITED"] = 2] = "LENGTH_DELIMITED";
7
+ CODEC_TYPES[CODEC_TYPES["START_GROUP"] = 3] = "START_GROUP";
8
+ CODEC_TYPES[CODEC_TYPES["END_GROUP"] = 4] = "END_GROUP";
9
+ CODEC_TYPES[CODEC_TYPES["BIT32"] = 5] = "BIT32";
10
+ })(CODEC_TYPES || (CODEC_TYPES = {}));
11
+ function createCodec(name, type, encode, decode) {
12
+ return {
13
+ name,
14
+ type,
15
+ encode,
16
+ decode
17
+ };
18
+ }
19
+
20
+ export { CODEC_TYPES, createCodec };
@@ -0,0 +1,24 @@
1
+ import { createCodec, CODEC_TYPES } from '../codec.js';
2
+
3
+ function enumeration(v) {
4
+ function findValue(val) {
5
+ // Use the reverse mapping to look up the enum key for the stored value
6
+ // https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings
7
+ if (v[val.toString()] == null) {
8
+ throw new Error('Invalid enum value');
9
+ }
10
+ return v[val];
11
+ }
12
+ const encode = function enumEncode(val, writer) {
13
+ const enumValue = findValue(val);
14
+ writer.int32(enumValue);
15
+ };
16
+ const decode = function enumDecode(reader) {
17
+ const val = reader.int32();
18
+ return findValue(val);
19
+ };
20
+ // @ts-expect-error yeah yeah
21
+ return createCodec('enum', CODEC_TYPES.VARINT, encode, decode);
22
+ }
23
+
24
+ export { enumeration };
@@ -0,0 +1,7 @@
1
+ import { createCodec, CODEC_TYPES } from '../codec.js';
2
+
3
+ function message(encode, decode) {
4
+ return createCodec('message', CODEC_TYPES.LENGTH_DELIMITED, encode, decode);
5
+ }
6
+
7
+ export { message };
@@ -0,0 +1,8 @@
1
+ import { createReader } from './utils/reader.js';
2
+
3
+ function decodeMessage(buf, codec, opts) {
4
+ const reader = createReader(buf);
5
+ return codec.decode(reader, undefined, opts);
6
+ }
7
+
8
+ export { decodeMessage };
@@ -0,0 +1,11 @@
1
+ import { createWriter } from './utils/writer.js';
2
+
3
+ function encodeMessage(message, codec) {
4
+ const w = createWriter();
5
+ codec.encode(message, w, {
6
+ lengthDelimited: false
7
+ });
8
+ return w.finish();
9
+ }
10
+
11
+ export { encodeMessage };
@@ -0,0 +1,30 @@
1
+ import './utils/float.js';
2
+ import './utils/longbits.js';
3
+ export { createWriter as writer } from './utils/writer.js';
4
+ import './codec.js';
5
+
6
+ /**
7
+ * @packageDocumentation
8
+ *
9
+ * This module contains serialization/deserialization code used when encoding/decoding protobufs.
10
+ *
11
+ * It should be declared as a dependency of your project:
12
+ *
13
+ * ```console
14
+ * npm i protons-runtime
15
+ * ```
16
+ */
17
+ /**
18
+ * Thrown when a repeated field has too many elements
19
+ */
20
+ class MaxLengthError extends Error {
21
+ /**
22
+ * This will be removed in a future release
23
+ *
24
+ * @deprecated use the `.name` property instead
25
+ */
26
+ code = 'ERR_MAX_LENGTH';
27
+ name = 'MaxLengthError';
28
+ }
29
+
30
+ export { MaxLengthError };
@@ -0,0 +1,54 @@
1
+ const f32 = new Float32Array([-0]);
2
+ const f8b = new Uint8Array(f32.buffer);
3
+ /**
4
+ * Writes a 32 bit float to a buffer using little endian byte order
5
+ */
6
+ function writeFloatLE(val, buf, pos) {
7
+ f32[0] = val;
8
+ buf[pos] = f8b[0];
9
+ buf[pos + 1] = f8b[1];
10
+ buf[pos + 2] = f8b[2];
11
+ buf[pos + 3] = f8b[3];
12
+ }
13
+ /**
14
+ * Reads a 32 bit float from a buffer using little endian byte order
15
+ */
16
+ function readFloatLE(buf, pos) {
17
+ f8b[0] = buf[pos];
18
+ f8b[1] = buf[pos + 1];
19
+ f8b[2] = buf[pos + 2];
20
+ f8b[3] = buf[pos + 3];
21
+ return f32[0];
22
+ }
23
+ const f64 = new Float64Array([-0]);
24
+ const d8b = new Uint8Array(f64.buffer);
25
+ /**
26
+ * Writes a 64 bit double to a buffer using little endian byte order
27
+ */
28
+ function writeDoubleLE(val, buf, pos) {
29
+ f64[0] = val;
30
+ buf[pos] = d8b[0];
31
+ buf[pos + 1] = d8b[1];
32
+ buf[pos + 2] = d8b[2];
33
+ buf[pos + 3] = d8b[3];
34
+ buf[pos + 4] = d8b[4];
35
+ buf[pos + 5] = d8b[5];
36
+ buf[pos + 6] = d8b[6];
37
+ buf[pos + 7] = d8b[7];
38
+ }
39
+ /**
40
+ * Reads a 64 bit double from a buffer using little endian byte order
41
+ */
42
+ function readDoubleLE(buf, pos) {
43
+ d8b[0] = buf[pos];
44
+ d8b[1] = buf[pos + 1];
45
+ d8b[2] = buf[pos + 2];
46
+ d8b[3] = buf[pos + 3];
47
+ d8b[4] = buf[pos + 4];
48
+ d8b[5] = buf[pos + 5];
49
+ d8b[6] = buf[pos + 6];
50
+ d8b[7] = buf[pos + 7];
51
+ return f64[0];
52
+ }
53
+
54
+ export { readDoubleLE, readFloatLE, writeDoubleLE, writeFloatLE };
@@ -0,0 +1,175 @@
1
+ // the largest BigInt we can safely downcast to a Number
2
+ const MAX_SAFE_NUMBER_INTEGER = BigInt(Number.MAX_SAFE_INTEGER);
3
+ const MIN_SAFE_NUMBER_INTEGER = BigInt(Number.MIN_SAFE_INTEGER);
4
+ /**
5
+ * Constructs new long bits.
6
+ *
7
+ * @classdesc Helper class for working with the low and high bits of a 64 bit value.
8
+ * @memberof util
9
+ * @function Object() { [native code] }
10
+ * @param {number} lo - Low 32 bits, unsigned
11
+ * @param {number} hi - High 32 bits, unsigned
12
+ */
13
+ class LongBits {
14
+ lo;
15
+ hi;
16
+ constructor(lo, hi) {
17
+ // note that the casts below are theoretically unnecessary as of today, but older statically
18
+ // generated converter code might still call the ctor with signed 32bits. kept for compat.
19
+ /**
20
+ * Low bits
21
+ */
22
+ this.lo = lo | 0;
23
+ /**
24
+ * High bits
25
+ */
26
+ this.hi = hi | 0;
27
+ }
28
+ /**
29
+ * Converts this long bits to a possibly unsafe JavaScript number
30
+ */
31
+ toNumber(unsigned = false) {
32
+ if (!unsigned && (this.hi >>> 31) > 0) {
33
+ const lo = ~this.lo + 1 >>> 0;
34
+ let hi = ~this.hi >>> 0;
35
+ if (lo === 0) {
36
+ hi = hi + 1 >>> 0;
37
+ }
38
+ return -(lo + hi * 4294967296);
39
+ }
40
+ return this.lo + this.hi * 4294967296;
41
+ }
42
+ /**
43
+ * Converts this long bits to a bigint
44
+ */
45
+ toBigInt(unsigned = false) {
46
+ if (unsigned) {
47
+ return BigInt(this.lo >>> 0) + (BigInt(this.hi >>> 0) << 32n);
48
+ }
49
+ if ((this.hi >>> 31) !== 0) {
50
+ const lo = ~this.lo + 1 >>> 0;
51
+ let hi = ~this.hi >>> 0;
52
+ if (lo === 0) {
53
+ hi = hi + 1 >>> 0;
54
+ }
55
+ return -(BigInt(lo) + (BigInt(hi) << 32n));
56
+ }
57
+ return BigInt(this.lo >>> 0) + (BigInt(this.hi >>> 0) << 32n);
58
+ }
59
+ /**
60
+ * Converts this long bits to a string
61
+ */
62
+ toString(unsigned = false) {
63
+ return this.toBigInt(unsigned).toString();
64
+ }
65
+ /**
66
+ * Zig-zag encodes this long bits
67
+ */
68
+ zzEncode() {
69
+ const mask = this.hi >> 31;
70
+ this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
71
+ this.lo = (this.lo << 1 ^ mask) >>> 0;
72
+ return this;
73
+ }
74
+ /**
75
+ * Zig-zag decodes this long bits
76
+ */
77
+ zzDecode() {
78
+ const mask = -(this.lo & 1);
79
+ this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
80
+ this.hi = (this.hi >>> 1 ^ mask) >>> 0;
81
+ return this;
82
+ }
83
+ /**
84
+ * Calculates the length of this longbits when encoded as a varint.
85
+ */
86
+ length() {
87
+ const part0 = this.lo;
88
+ const part1 = (this.lo >>> 28 | this.hi << 4) >>> 0;
89
+ const part2 = this.hi >>> 24;
90
+ return part2 === 0
91
+ ? part1 === 0
92
+ ? part0 < 16384
93
+ ? part0 < 128 ? 1 : 2
94
+ : part0 < 2097152 ? 3 : 4
95
+ : part1 < 16384
96
+ ? part1 < 128 ? 5 : 6
97
+ : part1 < 2097152 ? 7 : 8
98
+ : part2 < 128 ? 9 : 10;
99
+ }
100
+ /**
101
+ * Constructs new long bits from the specified number
102
+ */
103
+ static fromBigInt(value) {
104
+ if (value === 0n) {
105
+ return zero;
106
+ }
107
+ if (value < MAX_SAFE_NUMBER_INTEGER && value > MIN_SAFE_NUMBER_INTEGER) {
108
+ return this.fromNumber(Number(value));
109
+ }
110
+ const negative = value < 0n;
111
+ if (negative) {
112
+ value = -value;
113
+ }
114
+ let hi = value >> 32n;
115
+ let lo = value - (hi << 32n);
116
+ if (negative) {
117
+ hi = ~hi | 0n;
118
+ lo = ~lo | 0n;
119
+ if (++lo > TWO_32) {
120
+ lo = 0n;
121
+ if (++hi > TWO_32) {
122
+ hi = 0n;
123
+ }
124
+ }
125
+ }
126
+ return new LongBits(Number(lo), Number(hi));
127
+ }
128
+ /**
129
+ * Constructs new long bits from the specified number
130
+ */
131
+ static fromNumber(value) {
132
+ if (value === 0) {
133
+ return zero;
134
+ }
135
+ const sign = value < 0;
136
+ if (sign) {
137
+ value = -value;
138
+ }
139
+ let lo = value >>> 0;
140
+ let hi = (value - lo) / 4294967296 >>> 0;
141
+ if (sign) {
142
+ hi = ~hi >>> 0;
143
+ lo = ~lo >>> 0;
144
+ if (++lo > 4294967295) {
145
+ lo = 0;
146
+ if (++hi > 4294967295) {
147
+ hi = 0;
148
+ }
149
+ }
150
+ }
151
+ return new LongBits(lo, hi);
152
+ }
153
+ /**
154
+ * Constructs new long bits from a number, long or string
155
+ */
156
+ static from(value) {
157
+ if (typeof value === 'number') {
158
+ return LongBits.fromNumber(value);
159
+ }
160
+ if (typeof value === 'bigint') {
161
+ return LongBits.fromBigInt(value);
162
+ }
163
+ if (typeof value === 'string') {
164
+ return LongBits.fromBigInt(BigInt(value));
165
+ }
166
+ return value.low != null || value.high != null ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
167
+ }
168
+ }
169
+ const zero = new LongBits(0, 0);
170
+ zero.toBigInt = function () { return 0n; };
171
+ zero.zzEncode = zero.zzDecode = function () { return this; };
172
+ zero.length = function () { return 1; };
173
+ const TWO_32 = 4294967296n;
174
+
175
+ export { LongBits };
@@ -0,0 +1,28 @@
1
+ import { allocUnsafe } from '../../../../uint8arrays/dist/src/alloc.js';
2
+
3
+ /**
4
+ * A general purpose buffer pool
5
+ */
6
+ function pool(size) {
7
+ const SIZE = 8192;
8
+ const MAX = SIZE >>> 1;
9
+ let slab;
10
+ let offset = SIZE;
11
+ return function poolAlloc(size) {
12
+ if (size < 1 || size > MAX) {
13
+ return allocUnsafe(size);
14
+ }
15
+ if (offset + size > SIZE) {
16
+ slab = allocUnsafe(SIZE);
17
+ offset = 0;
18
+ }
19
+ const buf = slab.subarray(offset, offset += size);
20
+ if ((offset & 7) !== 0) {
21
+ // align to 32 bit
22
+ offset = (offset | 7) + 1;
23
+ }
24
+ return buf;
25
+ };
26
+ }
27
+
28
+ export { pool as default };