@waku/rln 0.1.3-f6d5deb → 0.1.4-d27db21.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.
- package/README.md +10 -186
- package/bundle/_virtual/__node-resolve_empty.js +6 -0
- package/bundle/_virtual/_assert.js +3 -0
- package/bundle/_virtual/_commonjs-dynamic-modules.js +5 -0
- package/bundle/_virtual/_commonjsHelpers.js +32 -0
- package/bundle/_virtual/_node-resolve_empty.js +3 -0
- package/bundle/_virtual/_sha2.js +3 -0
- package/bundle/_virtual/_u64.js +3 -0
- package/bundle/_virtual/aes.js +3 -0
- package/bundle/_virtual/bn.js +3 -0
- package/bundle/_virtual/browser.js +3 -0
- package/bundle/_virtual/checksum.js +3 -0
- package/bundle/_virtual/cipher.js +3 -0
- package/bundle/_virtual/class.js +3 -0
- package/bundle/_virtual/common.js +3 -0
- package/bundle/_virtual/common2.js +3 -0
- package/bundle/_virtual/cryptoBrowser.js +3 -0
- package/bundle/_virtual/functional.js +3 -0
- package/bundle/_virtual/hash.js +3 -0
- package/bundle/_virtual/hmac.js +3 -0
- package/bundle/_virtual/index.js +3 -0
- package/bundle/_virtual/index2.js +6 -0
- package/bundle/_virtual/inherits_browser.js +3 -0
- package/bundle/_virtual/kdf.js +3 -0
- package/bundle/_virtual/lodash.js +3 -0
- package/bundle/_virtual/password.js +3 -0
- package/bundle/_virtual/pbkdf2.js +3 -0
- package/bundle/_virtual/pbkdf22.js +3 -0
- package/bundle/_virtual/random.js +3 -0
- package/bundle/_virtual/ripemd.js +3 -0
- package/bundle/_virtual/schema-validation-generated.js +3 -0
- package/bundle/_virtual/schema-validation.js +3 -0
- package/bundle/_virtual/scrypt.js +3 -0
- package/bundle/_virtual/scrypt2.js +3 -0
- package/bundle/_virtual/sha.js +3 -0
- package/bundle/_virtual/sha256.js +3 -0
- package/bundle/_virtual/sha2562.js +3 -0
- package/bundle/_virtual/sha3.js +3 -0
- package/bundle/_virtual/sha512.js +3 -0
- package/bundle/_virtual/types.js +3 -0
- package/bundle/_virtual/utils.js +3 -0
- package/bundle/_virtual/utils2.js +3 -0
- package/bundle/_virtual/utils3.js +3 -0
- package/bundle/index.js +12 -74804
- package/bundle/node_modules/@ethersproject/abi/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/abi-coder.js +96 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +148 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/address.js +26 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js +20 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/array.js +210 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/boolean.js +18 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/bytes.js +30 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js +26 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/null.js +22 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/number.js +43 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/string.js +19 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/tuple.js +58 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/fragments.js +854 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/interface.js +609 -0
- package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/index.js +66 -0
- package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/index.js +302 -0
- package/bundle/node_modules/@ethersproject/address/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/address/lib.esm/index.js +110 -0
- package/bundle/node_modules/@ethersproject/base64/lib.esm/base64.js +20 -0
- package/bundle/node_modules/@ethersproject/basex/lib.esm/index.js +120 -0
- package/bundle/node_modules/@ethersproject/bignumber/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js +287 -0
- package/bundle/node_modules/@ethersproject/bytes/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/bytes/lib.esm/index.js +402 -0
- package/bundle/node_modules/@ethersproject/constants/lib.esm/addresses.js +3 -0
- package/bundle/node_modules/@ethersproject/constants/lib.esm/bignumbers.js +8 -0
- package/bundle/node_modules/@ethersproject/constants/lib.esm/hashes.js +3 -0
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +893 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/decoder.js +256 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/include.js +36 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +135 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/id.js +8 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/namehash.js +64 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/typed-data.js +443 -0
- package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +8 -0
- package/bundle/node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +660 -0
- package/bundle/node_modules/@ethersproject/logger/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/logger/lib.esm/index.js +352 -0
- package/bundle/node_modules/@ethersproject/networks/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/networks/lib.esm/index.js +248 -0
- package/bundle/node_modules/@ethersproject/properties/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/properties/lib.esm/index.js +127 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/base-provider.js +2007 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/formatter.js +422 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +674 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/web3-provider.js +132 -0
- package/bundle/node_modules/@ethersproject/rlp/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/rlp/lib.esm/index.js +120 -0
- package/bundle/node_modules/@ethersproject/sha2/lib.esm/sha2.js +8 -0
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +2430 -0
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/index.js +76 -0
- package/bundle/node_modules/@ethersproject/strings/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/strings/lib.esm/utf8.js +219 -0
- package/bundle/node_modules/@ethersproject/transactions/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/transactions/lib.esm/index.js +279 -0
- package/bundle/node_modules/@ethersproject/web/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/web/lib.esm/geturl.js +69 -0
- package/bundle/node_modules/@ethersproject/web/lib.esm/index.js +404 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/convert.js +15 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/multiaddr.js +20 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/protocols-table.js +92 -0
- package/bundle/node_modules/@noble/hashes/esm/_assert.js +37 -0
- package/bundle/node_modules/@noble/hashes/esm/_md.js +132 -0
- package/bundle/node_modules/@noble/hashes/esm/_u64.js +29 -0
- package/bundle/node_modules/@noble/hashes/esm/sha256.js +113 -0
- package/bundle/node_modules/@noble/hashes/esm/sha3.js +210 -0
- package/bundle/node_modules/@noble/hashes/esm/utils.js +144 -0
- package/bundle/node_modules/@waku/zerokit-rln-wasm/rln_wasm.js +756 -0
- package/bundle/node_modules/bech32/index.js +187 -0
- package/bundle/node_modules/bn.js/lib/bn.js +3361 -0
- package/bundle/node_modules/debug/src/browser.js +283 -0
- package/bundle/node_modules/debug/src/common.js +295 -0
- package/bundle/node_modules/ethereum-cryptography/esm/keccak.js +10 -0
- package/bundle/node_modules/ethereum-cryptography/esm/sha256.js +6 -0
- package/bundle/node_modules/ethereum-cryptography/esm/utils.js +24 -0
- package/bundle/node_modules/hash.js/lib/hash/common.js +97 -0
- package/bundle/node_modules/hash.js/lib/hash/hmac.js +51 -0
- package/bundle/node_modules/hash.js/lib/hash/ripemd.js +152 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/1.js +81 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/224.js +33 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/256.js +113 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/384.js +39 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/512.js +336 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/common.js +53 -0
- package/bundle/node_modules/hash.js/lib/hash/sha.js +14 -0
- package/bundle/node_modules/hash.js/lib/hash/utils.js +282 -0
- package/bundle/node_modules/hash.js/lib/hash.js +33 -0
- package/bundle/node_modules/inherits/inherits_browser.js +33 -0
- package/bundle/node_modules/it-length-prefixed/dist/src/decode.js +6 -0
- package/bundle/node_modules/lodash/lodash.js +17207 -0
- package/bundle/node_modules/minimalistic-assert/index.js +13 -0
- package/bundle/node_modules/ms/index.js +172 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base.js +205 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base10.js +9 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base16.js +16 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base2.js +10 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base256emoji.js +41 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base32.js +58 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base36.js +14 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base58.js +14 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base64.js +28 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base8.js +10 -0
- package/bundle/node_modules/multiformats/dist/src/bases/identity.js +11 -0
- package/bundle/node_modules/multiformats/dist/src/basics.js +15 -0
- package/bundle/node_modules/multiformats/dist/src/bytes.js +18 -0
- package/bundle/node_modules/multiformats/dist/src/codecs/json.js +2 -0
- package/bundle/node_modules/multiformats/dist/src/vendor/base-x.js +170 -0
- package/bundle/node_modules/protons-runtime/dist/src/codec.js +20 -0
- package/bundle/node_modules/protons-runtime/dist/src/codecs/enum.js +24 -0
- package/bundle/node_modules/protons-runtime/dist/src/codecs/message.js +7 -0
- package/bundle/node_modules/protons-runtime/dist/src/decode.js +8 -0
- package/bundle/node_modules/protons-runtime/dist/src/encode.js +11 -0
- package/bundle/node_modules/protons-runtime/dist/src/index.js +30 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/float.js +54 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/longbits.js +175 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/pool.js +28 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/reader.js +367 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/utf8.js +99 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/writer.js +438 -0
- package/bundle/node_modules/uint8-varint/dist/src/index.js +124 -0
- package/bundle/node_modules/uint8arrays/dist/src/alloc.js +17 -0
- package/bundle/node_modules/uint8arrays/dist/src/from-string.js +19 -0
- package/bundle/node_modules/uint8arrays/dist/src/util/bases.js +49 -0
- package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +21 -0
- package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +18 -0
- package/bundle/packages/core/dist/lib/filter/filter.js +27 -0
- package/bundle/packages/core/dist/lib/light_push/light_push.js +27 -0
- package/bundle/packages/core/dist/lib/message/version_0.js +154 -0
- package/bundle/packages/core/dist/lib/metadata/metadata.js +27 -0
- package/bundle/packages/core/dist/lib/store/store.js +27 -0
- package/bundle/packages/interfaces/dist/connection_manager.js +19 -0
- package/bundle/packages/interfaces/dist/constants.js +6 -0
- package/bundle/packages/interfaces/dist/health_indicator.js +12 -0
- package/bundle/packages/interfaces/dist/protocols.js +92 -0
- package/bundle/packages/proto/dist/generated/filter.js +445 -0
- package/bundle/packages/proto/dist/generated/filter_v2.js +424 -0
- package/bundle/packages/proto/dist/generated/light_push.js +389 -0
- package/bundle/packages/proto/dist/generated/message.js +213 -0
- package/bundle/packages/proto/dist/generated/metadata.js +130 -0
- package/bundle/packages/proto/dist/generated/peer_exchange.js +209 -0
- package/bundle/packages/proto/dist/generated/sds_message.js +105 -0
- package/bundle/packages/proto/dist/generated/store_v3.js +490 -0
- package/bundle/packages/proto/dist/generated/topic_only_message.js +61 -0
- package/bundle/packages/rln/dist/codec.js +93 -0
- package/bundle/packages/rln/dist/contract/abi.js +394 -0
- package/bundle/packages/rln/dist/contract/constants.js +27 -0
- package/bundle/packages/rln/dist/contract/rln_contract.js +438 -0
- package/bundle/packages/rln/dist/create.js +9 -0
- package/bundle/packages/rln/dist/identity.js +30 -0
- package/bundle/packages/rln/dist/keystore/cipher.js +31 -0
- package/bundle/packages/rln/dist/keystore/credential_validation_generated.js +119 -0
- package/bundle/packages/rln/dist/keystore/keystore.js +223 -0
- package/bundle/packages/rln/dist/keystore/keystore_validation_generated.js +74 -0
- package/bundle/packages/rln/dist/keystore/schema_validator.js +20 -0
- package/bundle/packages/rln/dist/message.js +51 -0
- package/bundle/packages/rln/dist/proof.js +54 -0
- package/bundle/packages/rln/dist/resources/verification_key.js +112 -0
- package/bundle/packages/rln/dist/resources/witness_calculator.js +330 -0
- package/bundle/packages/rln/dist/rln.js +220 -0
- package/bundle/packages/rln/dist/root_tracker.js +76 -0
- package/bundle/packages/rln/dist/utils/bytes.js +65 -0
- package/bundle/packages/rln/dist/utils/epoch.js +39 -0
- package/bundle/packages/rln/dist/utils/hash.js +10 -0
- package/bundle/packages/rln/dist/utils/metamask.js +14 -0
- package/bundle/packages/rln/dist/zerokit.js +128 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/checksum.js +52 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/cipher.js +65 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/class.js +99 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/functional.js +103 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/index.js +28 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/kdf.js +78 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/password.js +17 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1253 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation.js +40 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/types.js +5 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +103 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +41 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +17 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +23 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +12 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +77 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js +9 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/md5.js +215 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/nil.js +3 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/parse.js +35 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/regex.js +3 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/rng.js +21 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/stringify.js +31 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v1.js +96 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v3.js +6 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v35.js +66 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v4.js +24 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v5.js +6 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/validate.js +7 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/version.js +11 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/_assert.js +52 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +124 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/_u64.js +71 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/cryptoBrowser.js +10 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +88 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +99 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +233 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +133 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +243 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +167 -0
- package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/native.js +4 -0
- package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/rng.js +13 -0
- package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/stringify.js +28 -0
- package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/v4.js +19 -0
- package/bundle/packages/utils/dist/bytes/index.js +44 -0
- package/bundle/packages/utils/dist/common/sharding/index.js +91 -0
- package/bundle/packages/utils/dist/logger/index.js +31 -0
- package/bundle/resources/verification_key.d.ts +13 -0
- package/bundle/resources/verification_key.js +112 -0
- package/bundle/resources/witness_calculator.d.ts +11 -0
- package/bundle/resources/witness_calculator.js +328 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/codec.d.ts +5 -5
- package/dist/codec.js +6 -6
- package/dist/codec.js.map +1 -1
- package/dist/contract/abi.d.ts +42 -0
- package/dist/contract/abi.js +393 -0
- package/dist/contract/abi.js.map +1 -0
- package/dist/contract/constants.d.ts +59 -3
- package/dist/contract/constants.js +21 -63
- package/dist/contract/constants.js.map +1 -1
- package/dist/contract/rln_contract.d.ts +98 -17
- package/dist/contract/rln_contract.js +292 -71
- package/dist/contract/rln_contract.js.map +1 -1
- package/dist/identity.js +5 -2
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/keystore/cipher.js +3 -3
- package/dist/keystore/cipher.js.map +1 -1
- package/dist/keystore/credential_validation_generated.js.map +1 -1
- package/dist/keystore/keystore.js +4 -4
- package/dist/keystore/keystore.js.map +1 -1
- package/dist/keystore/keystore_validation_generated.js.map +1 -1
- package/dist/message.js +3 -3
- package/dist/message.js.map +1 -1
- package/dist/proof.js +3 -2
- package/dist/proof.js.map +1 -1
- package/dist/resources/verification_key.d.ts +12 -11
- package/dist/resources/verification_key.js +103 -103
- package/dist/resources/witness_calculator.d.ts +10 -15
- package/dist/resources/witness_calculator.js +302 -265
- package/dist/rln.d.ts +5 -1
- package/dist/rln.js +56 -28
- package/dist/rln.js.map +1 -1
- package/dist/root_tracker.js.map +1 -1
- package/dist/utils/epoch.js +5 -5
- package/dist/utils/epoch.js.map +1 -1
- package/dist/zerokit.d.ts +13 -9
- package/dist/zerokit.js +40 -20
- package/dist/zerokit.js.map +1 -1
- package/package.json +1 -146
- package/src/codec.ts +26 -22
- package/src/contract/abi.ts +392 -0
- package/src/contract/constants.ts +28 -0
- package/src/contract/index.ts +2 -0
- package/src/contract/rln_contract.ts +686 -0
- package/src/identity.ts +8 -4
- package/src/index.ts +4 -9
- package/src/keystore/cipher.ts +54 -0
- package/src/keystore/credential_validation_generated.ts +7 -0
- package/src/keystore/index.ts +5 -0
- package/src/keystore/keystore.ts +330 -0
- package/src/keystore/keystore_validation_generated.ts +7 -0
- package/src/keystore/schema_validator.ts +34 -0
- package/src/keystore/types.ts +36 -0
- package/src/message.ts +10 -10
- package/src/proof.ts +13 -11
- package/src/resources/verification_key.d.ts +13 -0
- package/src/resources/witness_calculator.d.ts +11 -0
- package/src/rln.ts +76 -31
- package/src/root_tracker.ts +7 -6
- package/src/utils/bytes.ts +84 -0
- package/src/utils/epoch.ts +30 -0
- package/src/utils/hash.ts +15 -0
- package/src/utils/index.ts +9 -0
- package/src/utils/metamask.ts +17 -0
- package/src/zerokit.ts +95 -33
- package/bundle/assets/rln_wasm_bg-a503e304.wasm +0 -0
- package/dist/resources/verification_key.js.map +0 -1
- package/dist/resources/witness_calculator.js.map +0 -1
- /package/bundle/{assets/rln-6ded2896.wasm → resources/rln.wasm} +0 -0
- /package/bundle/{assets/rln_final-8b299152.zkey → resources/rln_final.zkey} +0 -0
@@ -0,0 +1,223 @@
|
|
1
|
+
import '../../node_modules/@chainsafe/bls-keystore/lib/index.js';
|
2
|
+
import '../../../interfaces/dist/protocols.js';
|
3
|
+
import '../../../interfaces/dist/connection_manager.js';
|
4
|
+
import '../../../interfaces/dist/health_indicator.js';
|
5
|
+
import '../../../../node_modules/multiformats/dist/src/bases/base10.js';
|
6
|
+
import '../../../../node_modules/multiformats/dist/src/bases/base16.js';
|
7
|
+
import '../../../../node_modules/multiformats/dist/src/bases/base2.js';
|
8
|
+
import '../../../../node_modules/multiformats/dist/src/bases/base256emoji.js';
|
9
|
+
import '../../../../node_modules/multiformats/dist/src/bases/base32.js';
|
10
|
+
import '../../../../node_modules/multiformats/dist/src/bases/base36.js';
|
11
|
+
import '../../../../node_modules/multiformats/dist/src/bases/base58.js';
|
12
|
+
import '../../../../node_modules/multiformats/dist/src/bases/base64.js';
|
13
|
+
import '../../../../node_modules/multiformats/dist/src/bases/base8.js';
|
14
|
+
import '../../../../node_modules/multiformats/dist/src/bases/identity.js';
|
15
|
+
import '../../../../node_modules/multiformats/dist/src/codecs/json.js';
|
16
|
+
import { Logger } from '../../../utils/dist/logger/index.js';
|
17
|
+
import { sha256 } from '../../../../node_modules/ethereum-cryptography/esm/sha256.js';
|
18
|
+
import { bytesToUtf8 } from '../../../../node_modules/ethereum-cryptography/esm/utils.js';
|
19
|
+
import _ from '../../../../node_modules/lodash/lodash.js';
|
20
|
+
import { buildBigIntFromUint8Array } from '../utils/bytes.js';
|
21
|
+
import { keccak256Checksum, decryptEipKeystore } from './cipher.js';
|
22
|
+
import { isKeystoreValid, isCredentialValid } from './schema_validator.js';
|
23
|
+
import { __exports as lib } from '../../../../_virtual/index.js';
|
24
|
+
import v4 from '../../node_modules/uuid/dist/esm-browser/v4.js';
|
25
|
+
import { bytesToHex, utf8ToBytes } from '../../../../node_modules/@noble/hashes/esm/utils.js';
|
26
|
+
|
27
|
+
const log = new Logger("waku:rln:keystore");
|
28
|
+
class Keystore {
|
29
|
+
data;
|
30
|
+
constructor(options) {
|
31
|
+
this.data = Object.assign({
|
32
|
+
application: "waku-rln-relay",
|
33
|
+
appIdentifier: "01234567890abcdef",
|
34
|
+
version: "0.2",
|
35
|
+
credentials: {}
|
36
|
+
}, options);
|
37
|
+
}
|
38
|
+
static create(options = {}) {
|
39
|
+
return new Keystore(options);
|
40
|
+
}
|
41
|
+
// should be valid JSON string that contains Keystore file
|
42
|
+
// https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/keyfile.nim#L376
|
43
|
+
static fromString(str) {
|
44
|
+
try {
|
45
|
+
const obj = JSON.parse(str);
|
46
|
+
if (!Keystore.isValidNwakuStore(obj)) {
|
47
|
+
throw Error("Invalid string, does not match Nwaku Keystore format.");
|
48
|
+
}
|
49
|
+
return new Keystore(obj);
|
50
|
+
}
|
51
|
+
catch (err) {
|
52
|
+
log.error("Cannot create Keystore from string:", err);
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
static fromObject(obj) {
|
57
|
+
if (!Keystore.isValidNwakuStore(obj)) {
|
58
|
+
throw Error("Invalid object, does not match Nwaku Keystore format.");
|
59
|
+
}
|
60
|
+
return new Keystore(obj);
|
61
|
+
}
|
62
|
+
async addCredential(options, password) {
|
63
|
+
const membershipHash = Keystore.computeMembershipHash(options.membership);
|
64
|
+
if (this.data.credentials[membershipHash]) {
|
65
|
+
throw Error("Credential already exists in the store.");
|
66
|
+
}
|
67
|
+
// these are not important
|
68
|
+
const stubPath = "/stub/path";
|
69
|
+
const stubPubkey = new Uint8Array([0]);
|
70
|
+
const secret = Keystore.fromIdentityToBytes(options);
|
71
|
+
const eipKeystore = await lib.create(password, secret, stubPubkey, stubPath);
|
72
|
+
// need to re-compute checksum since nwaku uses keccak256 instead of sha256
|
73
|
+
const checksum = await keccak256Checksum(password, eipKeystore);
|
74
|
+
const nwakuCredential = Keystore.fromEipToCredential(eipKeystore, checksum);
|
75
|
+
this.data.credentials[membershipHash] = nwakuCredential;
|
76
|
+
return membershipHash;
|
77
|
+
}
|
78
|
+
async readCredential(membershipHash, password) {
|
79
|
+
const nwakuCredential = this.data.credentials[membershipHash];
|
80
|
+
if (!nwakuCredential) {
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
const eipKeystore = Keystore.fromCredentialToEip(nwakuCredential);
|
84
|
+
const bytes = await decryptEipKeystore(password, eipKeystore);
|
85
|
+
return Keystore.fromBytesToIdentity(bytes);
|
86
|
+
}
|
87
|
+
removeCredential(hash) {
|
88
|
+
if (!this.data.credentials[hash]) {
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
delete this.data.credentials[hash];
|
92
|
+
}
|
93
|
+
toString() {
|
94
|
+
return JSON.stringify(this.data);
|
95
|
+
}
|
96
|
+
toObject() {
|
97
|
+
return this.data;
|
98
|
+
}
|
99
|
+
/**
|
100
|
+
* Read array of hashes of current credentials
|
101
|
+
* @returns array of keys of credentials in current Keystore
|
102
|
+
*/
|
103
|
+
keys() {
|
104
|
+
return Object.keys(this.toObject().credentials || {});
|
105
|
+
}
|
106
|
+
static isValidNwakuStore(obj) {
|
107
|
+
if (!isKeystoreValid(obj)) {
|
108
|
+
return false;
|
109
|
+
}
|
110
|
+
const areCredentialsValid = Object.values(_.get(obj, "credentials", {}))
|
111
|
+
.map((c) => isCredentialValid(c))
|
112
|
+
.every((v) => v);
|
113
|
+
return areCredentialsValid;
|
114
|
+
}
|
115
|
+
static fromCredentialToEip(credential) {
|
116
|
+
const nwakuCrypto = credential.crypto;
|
117
|
+
const eipCrypto = {
|
118
|
+
kdf: {
|
119
|
+
function: nwakuCrypto.kdf,
|
120
|
+
params: nwakuCrypto.kdfparams,
|
121
|
+
message: ""
|
122
|
+
},
|
123
|
+
cipher: {
|
124
|
+
function: nwakuCrypto.cipher,
|
125
|
+
params: nwakuCrypto.cipherparams,
|
126
|
+
message: nwakuCrypto.ciphertext
|
127
|
+
},
|
128
|
+
checksum: {
|
129
|
+
// @chainsafe/bls-keystore supports only sha256
|
130
|
+
// but nwaku uses keccak256
|
131
|
+
// https://github.com/waku-org/nwaku/blob/25d6e52e3804d15f9b61bc4cc6dd448540c072a1/waku/waku_keystore/keyfile.nim#L367
|
132
|
+
function: "sha256",
|
133
|
+
params: {},
|
134
|
+
message: nwakuCrypto.mac
|
135
|
+
}
|
136
|
+
};
|
137
|
+
return {
|
138
|
+
version: 4,
|
139
|
+
uuid: v4(),
|
140
|
+
description: undefined,
|
141
|
+
path: "safe to ignore, not important for decrypt",
|
142
|
+
pubkey: "safe to ignore, not important for decrypt",
|
143
|
+
crypto: eipCrypto
|
144
|
+
};
|
145
|
+
}
|
146
|
+
static fromEipToCredential(eipKeystore, checksum) {
|
147
|
+
const eipCrypto = eipKeystore.crypto;
|
148
|
+
const eipKdf = eipCrypto.kdf;
|
149
|
+
return {
|
150
|
+
crypto: {
|
151
|
+
cipher: eipCrypto.cipher.function,
|
152
|
+
cipherparams: eipCrypto.cipher.params,
|
153
|
+
ciphertext: eipCrypto.cipher.message,
|
154
|
+
kdf: eipKdf.function,
|
155
|
+
kdfparams: eipKdf.params,
|
156
|
+
// @chainsafe/bls-keystore generates only sha256
|
157
|
+
// but nwaku uses keccak256
|
158
|
+
// https://github.com/waku-org/nwaku/blob/25d6e52e3804d15f9b61bc4cc6dd448540c072a1/waku/waku_keystore/keyfile.nim#L367
|
159
|
+
mac: checksum
|
160
|
+
}
|
161
|
+
};
|
162
|
+
}
|
163
|
+
static fromBytesToIdentity(bytes) {
|
164
|
+
try {
|
165
|
+
const str = bytesToUtf8(bytes);
|
166
|
+
const obj = JSON.parse(str);
|
167
|
+
// TODO: add runtime validation of nwaku credentials
|
168
|
+
return {
|
169
|
+
identity: {
|
170
|
+
IDCommitment: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idCommitment", [])),
|
171
|
+
IDTrapdoor: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idTrapdoor", [])),
|
172
|
+
IDNullifier: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idNullifier", [])),
|
173
|
+
IDCommitmentBigInt: buildBigIntFromUint8Array(Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idCommitment", []))),
|
174
|
+
IDSecretHash: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idSecretHash", []))
|
175
|
+
},
|
176
|
+
membership: {
|
177
|
+
treeIndex: _.get(obj, "treeIndex"),
|
178
|
+
chainId: _.get(obj, "membershipContract.chainId"),
|
179
|
+
address: _.get(obj, "membershipContract.address")
|
180
|
+
}
|
181
|
+
};
|
182
|
+
}
|
183
|
+
catch (err) {
|
184
|
+
log.error("Cannot parse bytes to Nwaku Credentials:", err);
|
185
|
+
return;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
static fromArraylikeToBytes(obj) {
|
189
|
+
const bytes = [];
|
190
|
+
let index = 0;
|
191
|
+
let lastElement = obj[index];
|
192
|
+
while (lastElement !== undefined) {
|
193
|
+
bytes.push(lastElement);
|
194
|
+
index += 1;
|
195
|
+
lastElement = obj[index];
|
196
|
+
}
|
197
|
+
return new Uint8Array(bytes);
|
198
|
+
}
|
199
|
+
// follows nwaku implementation
|
200
|
+
// https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/protocol_types.nim#L111
|
201
|
+
static computeMembershipHash(info) {
|
202
|
+
return bytesToHex(sha256(utf8ToBytes(`${info.chainId}${info.address}${info.treeIndex}`))).toUpperCase();
|
203
|
+
}
|
204
|
+
// follows nwaku implementation
|
205
|
+
// https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/protocol_types.nim#L98
|
206
|
+
static fromIdentityToBytes(options) {
|
207
|
+
return utf8ToBytes(JSON.stringify({
|
208
|
+
treeIndex: options.membership.treeIndex,
|
209
|
+
identityCredential: {
|
210
|
+
idCommitment: options.identity.IDCommitment,
|
211
|
+
idNullifier: options.identity.IDNullifier,
|
212
|
+
idSecretHash: options.identity.IDSecretHash,
|
213
|
+
idTrapdoor: options.identity.IDTrapdoor
|
214
|
+
},
|
215
|
+
membershipContract: {
|
216
|
+
chainId: options.membership.chainId,
|
217
|
+
address: options.membership.address
|
218
|
+
}
|
219
|
+
}));
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
export { Keystore };
|
@@ -0,0 +1,74 @@
|
|
1
|
+
/* eslint eslint-comments/no-unlimited-disable: "off" */
|
2
|
+
// This file was generated by /scripts/schema-validation-codegen.ts
|
3
|
+
// Do not modify this file by hand.
|
4
|
+
/* eslint-disable */
|
5
|
+
// @ts-ignore
|
6
|
+
const Keystore = validate11;
|
7
|
+
function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; {
|
8
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
9
|
+
let missing0;
|
10
|
+
if (((((data.application === undefined) && (missing0 = "application")) || ((data.appIdentifier === undefined) && (missing0 = "appIdentifier"))) || ((data.credentials === undefined) && (missing0 = "credentials"))) || ((data.version === undefined) && (missing0 = "version"))) {
|
11
|
+
validate11.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
12
|
+
return false;
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
if (data.credentials !== undefined) {
|
16
|
+
let data0 = data.credentials;
|
17
|
+
const _errs1 = errors;
|
18
|
+
if (!(data0 && typeof data0 == "object" && !Array.isArray(data0))) {
|
19
|
+
validate11.errors = [{ instancePath: instancePath + "/credentials", schemaPath: "#/properties/credentials/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
20
|
+
return false;
|
21
|
+
}
|
22
|
+
var valid0 = _errs1 === errors;
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
var valid0 = true;
|
26
|
+
}
|
27
|
+
if (valid0) {
|
28
|
+
if (data.appIdentifier !== undefined) {
|
29
|
+
const _errs3 = errors;
|
30
|
+
if (typeof data.appIdentifier !== "string") {
|
31
|
+
validate11.errors = [{ instancePath: instancePath + "/appIdentifier", schemaPath: "#/properties/appIdentifier/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
var valid0 = _errs3 === errors;
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
var valid0 = true;
|
38
|
+
}
|
39
|
+
if (valid0) {
|
40
|
+
if (data.version !== undefined) {
|
41
|
+
const _errs5 = errors;
|
42
|
+
if (typeof data.version !== "string") {
|
43
|
+
validate11.errors = [{ instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
44
|
+
return false;
|
45
|
+
}
|
46
|
+
var valid0 = _errs5 === errors;
|
47
|
+
}
|
48
|
+
else {
|
49
|
+
var valid0 = true;
|
50
|
+
}
|
51
|
+
if (valid0) {
|
52
|
+
if (data.application !== undefined) {
|
53
|
+
const _errs7 = errors;
|
54
|
+
if (typeof data.application !== "string") {
|
55
|
+
validate11.errors = [{ instancePath: instancePath + "/application", schemaPath: "#/properties/application/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
56
|
+
return false;
|
57
|
+
}
|
58
|
+
var valid0 = _errs7 === errors;
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
var valid0 = true;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
else {
|
69
|
+
validate11.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
70
|
+
return false;
|
71
|
+
}
|
72
|
+
} validate11.errors = vErrors; return errors === 0; }
|
73
|
+
|
74
|
+
export { Keystore };
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { Credential } from './credential_validation_generated.js';
|
2
|
+
import { Keystore } from './keystore_validation_generated.js';
|
3
|
+
|
4
|
+
const _validateKeystore = Keystore;
|
5
|
+
const _validateCredential = Credential;
|
6
|
+
function schemaValidationErrors(validator, data) {
|
7
|
+
const validated = validator(data);
|
8
|
+
if (validated) {
|
9
|
+
return null;
|
10
|
+
}
|
11
|
+
return validator.errors;
|
12
|
+
}
|
13
|
+
function isKeystoreValid(keystore) {
|
14
|
+
return !schemaValidationErrors(_validateKeystore, keystore);
|
15
|
+
}
|
16
|
+
function isCredentialValid(credential) {
|
17
|
+
return !schemaValidationErrors(_validateCredential, credential);
|
18
|
+
}
|
19
|
+
|
20
|
+
export { isCredentialValid, isKeystoreValid };
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { utf8ToBytes } from '../../utils/dist/bytes/index.js';
|
2
|
+
import { epochBytesToInt } from './utils/epoch.js';
|
3
|
+
|
4
|
+
function toRLNSignal(contentTopic, msg) {
|
5
|
+
const contentTopicBytes = utf8ToBytes(contentTopic ?? "");
|
6
|
+
return new Uint8Array([...(msg.payload ?? []), ...contentTopicBytes]);
|
7
|
+
}
|
8
|
+
class RlnMessage {
|
9
|
+
rlnInstance;
|
10
|
+
msg;
|
11
|
+
rateLimitProof;
|
12
|
+
pubsubTopic = "";
|
13
|
+
constructor(rlnInstance, msg, rateLimitProof) {
|
14
|
+
this.rlnInstance = rlnInstance;
|
15
|
+
this.msg = msg;
|
16
|
+
this.rateLimitProof = rateLimitProof;
|
17
|
+
}
|
18
|
+
verify(roots) {
|
19
|
+
return this.rateLimitProof
|
20
|
+
? this.rlnInstance.zerokit.verifyWithRoots(this.rateLimitProof, toRLNSignal(this.msg.contentTopic, this.msg), roots) // this.rlnInstance.verifyRLNProof once issue status-im/nwaku#1248 is fixed
|
21
|
+
: undefined;
|
22
|
+
}
|
23
|
+
verifyNoRoot() {
|
24
|
+
return this.rateLimitProof
|
25
|
+
? this.rlnInstance.zerokit.verifyWithNoRoot(this.rateLimitProof, toRLNSignal(this.msg.contentTopic, this.msg)) // this.rlnInstance.verifyRLNProof once issue status-im/nwaku#1248 is fixed
|
26
|
+
: undefined;
|
27
|
+
}
|
28
|
+
get payload() {
|
29
|
+
return this.msg.payload;
|
30
|
+
}
|
31
|
+
get contentTopic() {
|
32
|
+
return this.msg.contentTopic;
|
33
|
+
}
|
34
|
+
get timestamp() {
|
35
|
+
return this.msg.timestamp;
|
36
|
+
}
|
37
|
+
get ephemeral() {
|
38
|
+
return this.msg.ephemeral;
|
39
|
+
}
|
40
|
+
get meta() {
|
41
|
+
return this.msg.meta;
|
42
|
+
}
|
43
|
+
get epoch() {
|
44
|
+
const bytes = this.rateLimitProof?.epoch;
|
45
|
+
if (!bytes)
|
46
|
+
return undefined;
|
47
|
+
return epochBytesToInt(bytes);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
export { RlnMessage, toRLNSignal };
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import { concatenate } from './utils/bytes.js';
|
2
|
+
import { poseidonHash } from './utils/hash.js';
|
3
|
+
import './utils/epoch.js';
|
4
|
+
|
5
|
+
const proofOffset = 128;
|
6
|
+
const rootOffset = proofOffset + 32;
|
7
|
+
const epochOffset = rootOffset + 32;
|
8
|
+
const shareXOffset = epochOffset + 32;
|
9
|
+
const shareYOffset = shareXOffset + 32;
|
10
|
+
const nullifierOffset = shareYOffset + 32;
|
11
|
+
const rlnIdentifierOffset = nullifierOffset + 32;
|
12
|
+
class ProofMetadata {
|
13
|
+
nullifier;
|
14
|
+
shareX;
|
15
|
+
shareY;
|
16
|
+
externalNullifier;
|
17
|
+
constructor(nullifier, shareX, shareY, externalNullifier) {
|
18
|
+
this.nullifier = nullifier;
|
19
|
+
this.shareX = shareX;
|
20
|
+
this.shareY = shareY;
|
21
|
+
this.externalNullifier = externalNullifier;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
class Proof {
|
25
|
+
proof;
|
26
|
+
merkleRoot;
|
27
|
+
epoch;
|
28
|
+
shareX;
|
29
|
+
shareY;
|
30
|
+
nullifier;
|
31
|
+
rlnIdentifier;
|
32
|
+
constructor(proofBytes) {
|
33
|
+
if (proofBytes.length < rlnIdentifierOffset) {
|
34
|
+
throw new Error("invalid proof");
|
35
|
+
}
|
36
|
+
// parse the proof as proof<128> | share_y<32> | nullifier<32> | root<32> | epoch<32> | share_x<32> | rln_identifier<32>
|
37
|
+
this.proof = proofBytes.subarray(0, proofOffset);
|
38
|
+
this.merkleRoot = proofBytes.subarray(proofOffset, rootOffset);
|
39
|
+
this.epoch = proofBytes.subarray(rootOffset, epochOffset);
|
40
|
+
this.shareX = proofBytes.subarray(epochOffset, shareXOffset);
|
41
|
+
this.shareY = proofBytes.subarray(shareXOffset, shareYOffset);
|
42
|
+
this.nullifier = proofBytes.subarray(shareYOffset, nullifierOffset);
|
43
|
+
this.rlnIdentifier = proofBytes.subarray(nullifierOffset, rlnIdentifierOffset);
|
44
|
+
}
|
45
|
+
extractMetadata() {
|
46
|
+
const externalNullifier = poseidonHash(this.epoch, this.rlnIdentifier);
|
47
|
+
return new ProofMetadata(this.nullifier, this.shareX, this.shareY, externalNullifier);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
function proofToBytes(p) {
|
51
|
+
return concatenate(p.proof, p.merkleRoot, p.epoch, p.shareX, p.shareY, p.nullifier, p.rlnIdentifier);
|
52
|
+
}
|
53
|
+
|
54
|
+
export { Proof, proofToBytes };
|
@@ -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 { verificationKey as default };
|