@waku/rln 0.1.3-f6d5deb → 0.1.4-29a4c3f.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,367 @@
|
|
1
|
+
import { decodeUint8Array, encodingLength } from '../../../../uint8-varint/dist/src/index.js';
|
2
|
+
import { readFloatLE, readDoubleLE } from './float.js';
|
3
|
+
import { LongBits } from './longbits.js';
|
4
|
+
import { read } from './utf8.js';
|
5
|
+
|
6
|
+
/* istanbul ignore next */
|
7
|
+
function indexOutOfRange(reader, writeLength) {
|
8
|
+
return RangeError(`index out of range: ${reader.pos} + ${writeLength ?? 1} > ${reader.len}`);
|
9
|
+
}
|
10
|
+
function readFixed32End(buf, end) {
|
11
|
+
return (buf[end - 4] |
|
12
|
+
buf[end - 3] << 8 |
|
13
|
+
buf[end - 2] << 16 |
|
14
|
+
buf[end - 1] << 24) >>> 0;
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* Constructs a new reader instance using the specified buffer.
|
18
|
+
*/
|
19
|
+
class Uint8ArrayReader {
|
20
|
+
buf;
|
21
|
+
pos;
|
22
|
+
len;
|
23
|
+
_slice = Uint8Array.prototype.subarray;
|
24
|
+
constructor(buffer) {
|
25
|
+
/**
|
26
|
+
* Read buffer
|
27
|
+
*/
|
28
|
+
this.buf = buffer;
|
29
|
+
/**
|
30
|
+
* Read buffer position
|
31
|
+
*/
|
32
|
+
this.pos = 0;
|
33
|
+
/**
|
34
|
+
* Read buffer length
|
35
|
+
*/
|
36
|
+
this.len = buffer.length;
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* Reads a varint as an unsigned 32 bit value
|
40
|
+
*/
|
41
|
+
uint32() {
|
42
|
+
let value = 4294967295;
|
43
|
+
value = (this.buf[this.pos] & 127) >>> 0;
|
44
|
+
if (this.buf[this.pos++] < 128)
|
45
|
+
return value;
|
46
|
+
value = (value | (this.buf[this.pos] & 127) << 7) >>> 0;
|
47
|
+
if (this.buf[this.pos++] < 128)
|
48
|
+
return value;
|
49
|
+
value = (value | (this.buf[this.pos] & 127) << 14) >>> 0;
|
50
|
+
if (this.buf[this.pos++] < 128)
|
51
|
+
return value;
|
52
|
+
value = (value | (this.buf[this.pos] & 127) << 21) >>> 0;
|
53
|
+
if (this.buf[this.pos++] < 128)
|
54
|
+
return value;
|
55
|
+
value = (value | (this.buf[this.pos] & 15) << 28) >>> 0;
|
56
|
+
if (this.buf[this.pos++] < 128)
|
57
|
+
return value;
|
58
|
+
if ((this.pos += 5) > this.len) {
|
59
|
+
this.pos = this.len;
|
60
|
+
throw indexOutOfRange(this, 10);
|
61
|
+
}
|
62
|
+
return value;
|
63
|
+
}
|
64
|
+
/**
|
65
|
+
* Reads a varint as a signed 32 bit value
|
66
|
+
*/
|
67
|
+
int32() {
|
68
|
+
return this.uint32() | 0;
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* Reads a zig-zag encoded varint as a signed 32 bit value
|
72
|
+
*/
|
73
|
+
sint32() {
|
74
|
+
const value = this.uint32();
|
75
|
+
return value >>> 1 ^ -(value & 1) | 0;
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* Reads a varint as a boolean
|
79
|
+
*/
|
80
|
+
bool() {
|
81
|
+
return this.uint32() !== 0;
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* Reads fixed 32 bits as an unsigned 32 bit integer
|
85
|
+
*/
|
86
|
+
fixed32() {
|
87
|
+
if (this.pos + 4 > this.len) {
|
88
|
+
throw indexOutOfRange(this, 4);
|
89
|
+
}
|
90
|
+
const res = readFixed32End(this.buf, this.pos += 4);
|
91
|
+
return res;
|
92
|
+
}
|
93
|
+
/**
|
94
|
+
* Reads fixed 32 bits as a signed 32 bit integer
|
95
|
+
*/
|
96
|
+
sfixed32() {
|
97
|
+
if (this.pos + 4 > this.len) {
|
98
|
+
throw indexOutOfRange(this, 4);
|
99
|
+
}
|
100
|
+
const res = readFixed32End(this.buf, this.pos += 4) | 0;
|
101
|
+
return res;
|
102
|
+
}
|
103
|
+
/**
|
104
|
+
* Reads a float (32 bit) as a number
|
105
|
+
*/
|
106
|
+
float() {
|
107
|
+
if (this.pos + 4 > this.len) {
|
108
|
+
throw indexOutOfRange(this, 4);
|
109
|
+
}
|
110
|
+
const value = readFloatLE(this.buf, this.pos);
|
111
|
+
this.pos += 4;
|
112
|
+
return value;
|
113
|
+
}
|
114
|
+
/**
|
115
|
+
* Reads a double (64 bit float) as a number
|
116
|
+
*/
|
117
|
+
double() {
|
118
|
+
/* istanbul ignore if */
|
119
|
+
if (this.pos + 8 > this.len) {
|
120
|
+
throw indexOutOfRange(this, 4);
|
121
|
+
}
|
122
|
+
const value = readDoubleLE(this.buf, this.pos);
|
123
|
+
this.pos += 8;
|
124
|
+
return value;
|
125
|
+
}
|
126
|
+
/**
|
127
|
+
* Reads a sequence of bytes preceded by its length as a varint
|
128
|
+
*/
|
129
|
+
bytes() {
|
130
|
+
const length = this.uint32();
|
131
|
+
const start = this.pos;
|
132
|
+
const end = this.pos + length;
|
133
|
+
/* istanbul ignore if */
|
134
|
+
if (end > this.len) {
|
135
|
+
throw indexOutOfRange(this, length);
|
136
|
+
}
|
137
|
+
this.pos += length;
|
138
|
+
return start === end // fix for IE 10/Win8 and others' subarray returning array of size 1
|
139
|
+
? new Uint8Array(0)
|
140
|
+
: this.buf.subarray(start, end);
|
141
|
+
}
|
142
|
+
/**
|
143
|
+
* Reads a string preceded by its byte length as a varint
|
144
|
+
*/
|
145
|
+
string() {
|
146
|
+
const bytes = this.bytes();
|
147
|
+
return read(bytes, 0, bytes.length);
|
148
|
+
}
|
149
|
+
/**
|
150
|
+
* Skips the specified number of bytes if specified, otherwise skips a varint
|
151
|
+
*/
|
152
|
+
skip(length) {
|
153
|
+
if (typeof length === 'number') {
|
154
|
+
/* istanbul ignore if */
|
155
|
+
if (this.pos + length > this.len) {
|
156
|
+
throw indexOutOfRange(this, length);
|
157
|
+
}
|
158
|
+
this.pos += length;
|
159
|
+
}
|
160
|
+
else {
|
161
|
+
do {
|
162
|
+
/* istanbul ignore if */
|
163
|
+
if (this.pos >= this.len) {
|
164
|
+
throw indexOutOfRange(this);
|
165
|
+
}
|
166
|
+
} while ((this.buf[this.pos++] & 128) !== 0);
|
167
|
+
}
|
168
|
+
return this;
|
169
|
+
}
|
170
|
+
/**
|
171
|
+
* Skips the next element of the specified wire type
|
172
|
+
*/
|
173
|
+
skipType(wireType) {
|
174
|
+
switch (wireType) {
|
175
|
+
case 0:
|
176
|
+
this.skip();
|
177
|
+
break;
|
178
|
+
case 1:
|
179
|
+
this.skip(8);
|
180
|
+
break;
|
181
|
+
case 2:
|
182
|
+
this.skip(this.uint32());
|
183
|
+
break;
|
184
|
+
case 3:
|
185
|
+
while ((wireType = this.uint32() & 7) !== 4) {
|
186
|
+
this.skipType(wireType);
|
187
|
+
}
|
188
|
+
break;
|
189
|
+
case 5:
|
190
|
+
this.skip(4);
|
191
|
+
break;
|
192
|
+
/* istanbul ignore next */
|
193
|
+
default:
|
194
|
+
throw Error(`invalid wire type ${wireType} at offset ${this.pos}`);
|
195
|
+
}
|
196
|
+
return this;
|
197
|
+
}
|
198
|
+
readLongVarint() {
|
199
|
+
// tends to deopt with local vars for octet etc.
|
200
|
+
const bits = new LongBits(0, 0);
|
201
|
+
let i = 0;
|
202
|
+
if (this.len - this.pos > 4) { // fast route (lo)
|
203
|
+
for (; i < 4; ++i) {
|
204
|
+
// 1st..4th
|
205
|
+
bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
|
206
|
+
if (this.buf[this.pos++] < 128) {
|
207
|
+
return bits;
|
208
|
+
}
|
209
|
+
}
|
210
|
+
// 5th
|
211
|
+
bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;
|
212
|
+
bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;
|
213
|
+
if (this.buf[this.pos++] < 128) {
|
214
|
+
return bits;
|
215
|
+
}
|
216
|
+
i = 0;
|
217
|
+
}
|
218
|
+
else {
|
219
|
+
for (; i < 3; ++i) {
|
220
|
+
/* istanbul ignore if */
|
221
|
+
if (this.pos >= this.len) {
|
222
|
+
throw indexOutOfRange(this);
|
223
|
+
}
|
224
|
+
// 1st..3th
|
225
|
+
bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0;
|
226
|
+
if (this.buf[this.pos++] < 128) {
|
227
|
+
return bits;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
// 4th
|
231
|
+
bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0;
|
232
|
+
return bits;
|
233
|
+
}
|
234
|
+
if (this.len - this.pos > 4) { // fast route (hi)
|
235
|
+
for (; i < 5; ++i) {
|
236
|
+
// 6th..10th
|
237
|
+
bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
|
238
|
+
if (this.buf[this.pos++] < 128) {
|
239
|
+
return bits;
|
240
|
+
}
|
241
|
+
}
|
242
|
+
}
|
243
|
+
else {
|
244
|
+
for (; i < 5; ++i) {
|
245
|
+
if (this.pos >= this.len) {
|
246
|
+
throw indexOutOfRange(this);
|
247
|
+
}
|
248
|
+
// 6th..10th
|
249
|
+
bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0;
|
250
|
+
if (this.buf[this.pos++] < 128) {
|
251
|
+
return bits;
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
255
|
+
throw Error('invalid varint encoding');
|
256
|
+
}
|
257
|
+
readFixed64() {
|
258
|
+
if (this.pos + 8 > this.len) {
|
259
|
+
throw indexOutOfRange(this, 8);
|
260
|
+
}
|
261
|
+
const lo = readFixed32End(this.buf, this.pos += 4);
|
262
|
+
const hi = readFixed32End(this.buf, this.pos += 4);
|
263
|
+
return new LongBits(lo, hi);
|
264
|
+
}
|
265
|
+
/**
|
266
|
+
* Reads a varint as a signed 64 bit value
|
267
|
+
*/
|
268
|
+
int64() {
|
269
|
+
return this.readLongVarint().toBigInt();
|
270
|
+
}
|
271
|
+
/**
|
272
|
+
* Reads a varint as a signed 64 bit value returned as a possibly unsafe
|
273
|
+
* JavaScript number
|
274
|
+
*/
|
275
|
+
int64Number() {
|
276
|
+
return this.readLongVarint().toNumber();
|
277
|
+
}
|
278
|
+
/**
|
279
|
+
* Reads a varint as a signed 64 bit value returned as a string
|
280
|
+
*/
|
281
|
+
int64String() {
|
282
|
+
return this.readLongVarint().toString();
|
283
|
+
}
|
284
|
+
/**
|
285
|
+
* Reads a varint as an unsigned 64 bit value
|
286
|
+
*/
|
287
|
+
uint64() {
|
288
|
+
return this.readLongVarint().toBigInt(true);
|
289
|
+
}
|
290
|
+
/**
|
291
|
+
* Reads a varint as an unsigned 64 bit value returned as a possibly unsafe
|
292
|
+
* JavaScript number
|
293
|
+
*/
|
294
|
+
uint64Number() {
|
295
|
+
const value = decodeUint8Array(this.buf, this.pos);
|
296
|
+
this.pos += encodingLength(value);
|
297
|
+
return value;
|
298
|
+
}
|
299
|
+
/**
|
300
|
+
* Reads a varint as an unsigned 64 bit value returned as a string
|
301
|
+
*/
|
302
|
+
uint64String() {
|
303
|
+
return this.readLongVarint().toString(true);
|
304
|
+
}
|
305
|
+
/**
|
306
|
+
* Reads a zig-zag encoded varint as a signed 64 bit value
|
307
|
+
*/
|
308
|
+
sint64() {
|
309
|
+
return this.readLongVarint().zzDecode().toBigInt();
|
310
|
+
}
|
311
|
+
/**
|
312
|
+
* Reads a zig-zag encoded varint as a signed 64 bit value returned as a
|
313
|
+
* possibly unsafe JavaScript number
|
314
|
+
*/
|
315
|
+
sint64Number() {
|
316
|
+
return this.readLongVarint().zzDecode().toNumber();
|
317
|
+
}
|
318
|
+
/**
|
319
|
+
* Reads a zig-zag encoded varint as a signed 64 bit value returned as a
|
320
|
+
* string
|
321
|
+
*/
|
322
|
+
sint64String() {
|
323
|
+
return this.readLongVarint().zzDecode().toString();
|
324
|
+
}
|
325
|
+
/**
|
326
|
+
* Reads fixed 64 bits
|
327
|
+
*/
|
328
|
+
fixed64() {
|
329
|
+
return this.readFixed64().toBigInt();
|
330
|
+
}
|
331
|
+
/**
|
332
|
+
* Reads fixed 64 bits returned as a possibly unsafe JavaScript number
|
333
|
+
*/
|
334
|
+
fixed64Number() {
|
335
|
+
return this.readFixed64().toNumber();
|
336
|
+
}
|
337
|
+
/**
|
338
|
+
* Reads fixed 64 bits returned as a string
|
339
|
+
*/
|
340
|
+
fixed64String() {
|
341
|
+
return this.readFixed64().toString();
|
342
|
+
}
|
343
|
+
/**
|
344
|
+
* Reads zig-zag encoded fixed 64 bits
|
345
|
+
*/
|
346
|
+
sfixed64() {
|
347
|
+
return this.readFixed64().toBigInt();
|
348
|
+
}
|
349
|
+
/**
|
350
|
+
* Reads zig-zag encoded fixed 64 bits returned as a possibly unsafe
|
351
|
+
* JavaScript number
|
352
|
+
*/
|
353
|
+
sfixed64Number() {
|
354
|
+
return this.readFixed64().toNumber();
|
355
|
+
}
|
356
|
+
/**
|
357
|
+
* Reads zig-zag encoded fixed 64 bits returned as a string
|
358
|
+
*/
|
359
|
+
sfixed64String() {
|
360
|
+
return this.readFixed64().toString();
|
361
|
+
}
|
362
|
+
}
|
363
|
+
function createReader(buf) {
|
364
|
+
return new Uint8ArrayReader(buf instanceof Uint8Array ? buf : buf.subarray());
|
365
|
+
}
|
366
|
+
|
367
|
+
export { Uint8ArrayReader, createReader };
|
@@ -0,0 +1,99 @@
|
|
1
|
+
/**
|
2
|
+
* Calculates the UTF8 byte length of a string
|
3
|
+
*/
|
4
|
+
function length(string) {
|
5
|
+
let len = 0;
|
6
|
+
let c = 0;
|
7
|
+
for (let i = 0; i < string.length; ++i) {
|
8
|
+
c = string.charCodeAt(i);
|
9
|
+
if (c < 128) {
|
10
|
+
len += 1;
|
11
|
+
}
|
12
|
+
else if (c < 2048) {
|
13
|
+
len += 2;
|
14
|
+
}
|
15
|
+
else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) {
|
16
|
+
++i;
|
17
|
+
len += 4;
|
18
|
+
}
|
19
|
+
else {
|
20
|
+
len += 3;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
return len;
|
24
|
+
}
|
25
|
+
/**
|
26
|
+
* Reads UTF8 bytes as a string
|
27
|
+
*/
|
28
|
+
function read(buffer, start, end) {
|
29
|
+
const len = end - start;
|
30
|
+
if (len < 1) {
|
31
|
+
return '';
|
32
|
+
}
|
33
|
+
let parts;
|
34
|
+
const chunk = [];
|
35
|
+
let i = 0; // char offset
|
36
|
+
let t; // temporary
|
37
|
+
while (start < end) {
|
38
|
+
t = buffer[start++];
|
39
|
+
if (t < 128) {
|
40
|
+
chunk[i++] = t;
|
41
|
+
}
|
42
|
+
else if (t > 191 && t < 224) {
|
43
|
+
chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;
|
44
|
+
}
|
45
|
+
else if (t > 239 && t < 365) {
|
46
|
+
t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;
|
47
|
+
chunk[i++] = 0xD800 + (t >> 10);
|
48
|
+
chunk[i++] = 0xDC00 + (t & 1023);
|
49
|
+
}
|
50
|
+
else {
|
51
|
+
chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
|
52
|
+
}
|
53
|
+
if (i > 8191) {
|
54
|
+
(parts ?? (parts = [])).push(String.fromCharCode.apply(String, chunk));
|
55
|
+
i = 0;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
if (parts != null) {
|
59
|
+
if (i > 0) {
|
60
|
+
parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
|
61
|
+
}
|
62
|
+
return parts.join('');
|
63
|
+
}
|
64
|
+
return String.fromCharCode.apply(String, chunk.slice(0, i));
|
65
|
+
}
|
66
|
+
/**
|
67
|
+
* Writes a string as UTF8 bytes
|
68
|
+
*/
|
69
|
+
function write(string, buffer, offset) {
|
70
|
+
const start = offset;
|
71
|
+
let c1; // character 1
|
72
|
+
let c2; // character 2
|
73
|
+
for (let i = 0; i < string.length; ++i) {
|
74
|
+
c1 = string.charCodeAt(i);
|
75
|
+
if (c1 < 128) {
|
76
|
+
buffer[offset++] = c1;
|
77
|
+
}
|
78
|
+
else if (c1 < 2048) {
|
79
|
+
buffer[offset++] = c1 >> 6 | 192;
|
80
|
+
buffer[offset++] = c1 & 63 | 128;
|
81
|
+
}
|
82
|
+
else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) {
|
83
|
+
c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF);
|
84
|
+
++i;
|
85
|
+
buffer[offset++] = c1 >> 18 | 240;
|
86
|
+
buffer[offset++] = c1 >> 12 & 63 | 128;
|
87
|
+
buffer[offset++] = c1 >> 6 & 63 | 128;
|
88
|
+
buffer[offset++] = c1 & 63 | 128;
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
buffer[offset++] = c1 >> 12 | 224;
|
92
|
+
buffer[offset++] = c1 >> 6 & 63 | 128;
|
93
|
+
buffer[offset++] = c1 & 63 | 128;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
return offset - start;
|
97
|
+
}
|
98
|
+
|
99
|
+
export { length, read, write };
|