@waku/rln 0.0.1 → 0.0.2-c41b319.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 +12 -108
- 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 -10
- 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/@iden3/js-crypto/dist/browser/esm/index.js +7 -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/@stablelib/binary/lib/binary.js +22 -0
- package/bundle/node_modules/@stablelib/chacha/lib/chacha.js +245 -0
- package/bundle/node_modules/@stablelib/wipe/lib/wipe.js +26 -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 +97 -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/rlnv2.js +394 -0
- package/bundle/packages/rln/dist/contract/constants.js +33 -0
- package/bundle/packages/rln/dist/contract/rln_contract.js +427 -0
- package/bundle/packages/rln/dist/create.js +9 -0
- package/bundle/packages/rln/dist/identity.js +54 -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 +204 -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 +122 -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/rln.wasm +0 -0
- package/bundle/resources/rln_final.zkey +0 -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 -1
- package/dist/codec.d.ts +39 -0
- package/dist/codec.js +77 -0
- package/dist/codec.js.map +1 -0
- package/dist/contract/abi/rlnv2.d.ts +42 -0
- package/dist/contract/abi/rlnv2.js +393 -0
- package/dist/contract/abi/rlnv2.js.map +1 -0
- package/dist/contract/constants.d.ts +68 -0
- package/dist/contract/constants.js +31 -0
- package/dist/contract/constants.js.map +1 -0
- package/dist/contract/index.d.ts +2 -0
- package/dist/contract/index.js +3 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/rln_contract.d.ts +119 -0
- package/dist/contract/rln_contract.js +421 -0
- package/dist/contract/rln_contract.js.map +1 -0
- package/dist/create.d.ts +2 -0
- package/dist/create.js +8 -0
- package/dist/create.js.map +1 -0
- package/dist/identity.d.ts +10 -0
- package/dist/identity.js +51 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/dist/keystore/cipher.d.ts +4 -0
- package/dist/keystore/cipher.js +28 -0
- package/dist/keystore/cipher.js.map +1 -0
- package/dist/keystore/credential_validation_generated.d.ts +8 -0
- package/dist/keystore/credential_validation_generated.js +121 -0
- package/dist/keystore/credential_validation_generated.js.map +1 -0
- package/dist/keystore/index.d.ts +4 -0
- package/dist/keystore/index.js +3 -0
- package/dist/keystore/index.js.map +1 -0
- package/dist/keystore/keystore.d.ts +50 -0
- package/dist/keystore/keystore.js +205 -0
- package/dist/keystore/keystore.js.map +1 -0
- package/dist/keystore/keystore_validation_generated.d.ts +8 -0
- package/dist/keystore/keystore_validation_generated.js +75 -0
- package/dist/keystore/keystore_validation_generated.js.map +1 -0
- package/dist/keystore/schema_validator.d.ts +2 -0
- package/dist/keystore/schema_validator.js +18 -0
- package/dist/keystore/schema_validator.js.map +1 -0
- package/dist/keystore/types.d.ts +29 -0
- package/dist/keystore/types.js +2 -0
- package/dist/keystore/types.js.map +1 -0
- package/dist/message.d.ts +18 -0
- package/dist/message.js +49 -0
- package/dist/message.js.map +1 -0
- package/dist/proof.d.ts +21 -0
- package/dist/proof.js +50 -0
- package/dist/proof.js.map +1 -0
- package/dist/resources/rln.wasm +0 -0
- package/dist/resources/rln_final.zkey +0 -0
- package/dist/resources/verification_key.d.ts +13 -0
- package/dist/resources/verification_key.js +112 -0
- package/dist/resources/witness_calculator.d.ts +11 -0
- package/dist/resources/witness_calculator.js +328 -0
- package/dist/rln.d.ts +59 -13
- package/dist/rln.js +164 -81
- package/dist/rln.js.map +1 -1
- package/dist/root_tracker.d.ts +10 -0
- package/dist/root_tracker.js +75 -0
- package/dist/root_tracker.js.map +1 -0
- package/dist/utils/bytes.d.ts +20 -0
- package/dist/utils/bytes.js +64 -0
- package/dist/utils/bytes.js.map +1 -0
- package/dist/utils/epoch.d.ts +3 -0
- package/dist/utils/epoch.js +23 -0
- package/dist/utils/epoch.js.map +1 -0
- package/dist/utils/hash.d.ts +2 -0
- package/dist/utils/hash.js +13 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/metamask.d.ts +2 -0
- package/dist/utils/metamask.js +12 -0
- package/dist/utils/metamask.js.map +1 -0
- package/dist/zerokit.d.ts +19 -0
- package/dist/zerokit.js +119 -0
- package/dist/zerokit.js.map +1 -0
- package/package.json +1 -126
- package/src/codec.ts +134 -0
- package/src/contract/abi/rlnv2.ts +392 -0
- package/src/contract/constants.ts +35 -0
- package/src/contract/index.ts +2 -0
- package/src/contract/rln_contract.ts +673 -0
- package/src/create.ts +9 -0
- package/src/identity.ts +73 -0
- package/src/index.ts +24 -10
- 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 +70 -0
- package/src/proof.ts +69 -0
- package/src/resources/verification_key.d.ts +13 -0
- package/src/resources/witness_calculator.d.ts +11 -0
- package/src/rln.ts +270 -106
- package/src/root_tracker.ts +92 -0
- 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 +214 -0
- package/bundle/02bce7e5f3bcf834.wasm +0 -0
- package/bundle/rln-f87f6dbe.js +0 -563
- package/dist/resources.d.ts +0 -4
- package/dist/resources.js +0 -5
- package/dist/resources.js.map +0 -1
- package/dist/witness_calculator.d.ts +0 -16
- package/dist/witness_calculator.js +0 -291
- package/dist/witness_calculator.js.map +0 -1
- package/dist/zerokit/rln_wasm.d.ts +0 -1
- package/dist/zerokit/rln_wasm.js +0 -2
- package/dist/zerokit/rln_wasm.js.map +0 -1
- package/dist/zerokit/rln_wasm_bg.d.ts +0 -108
- package/dist/zerokit/rln_wasm_bg.js +0 -592
- package/dist/zerokit/rln_wasm_bg.js.map +0 -1
- package/dist/zerokit/rln_wasm_bg.wasm +0 -0
- package/src/resources.ts +0 -10
- package/src/witness_calculator.d.ts +0 -4
@@ -0,0 +1,121 @@
|
|
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
|
+
"use strict";
|
7
|
+
export const Credential = validate11;
|
8
|
+
const schema12 = { "type": "object", "properties": { "crypto": { "type": "object", "properties": { "cipher": { "type": "string" }, "cipherparams": { "type": "object" }, "ciphertext": { "type": "string" }, "kdf": { "type": "string" }, "kdfparams": { "type": "object" }, "mac": { "type": "string" } }, "required": ["cipher", "cipherparams", "ciphertext", "kdf", "kdfparams", "mac"] } }, "required": ["crypto"] };
|
9
|
+
function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) {
|
10
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
11
|
+
let missing0;
|
12
|
+
if ((data.crypto === undefined) && (missing0 = "crypto")) {
|
13
|
+
validate11.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
else {
|
17
|
+
if (data.crypto !== undefined) {
|
18
|
+
let data0 = data.crypto;
|
19
|
+
const _errs1 = errors;
|
20
|
+
if (errors === _errs1) {
|
21
|
+
if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
|
22
|
+
let missing1;
|
23
|
+
if (((((((data0.cipher === undefined) && (missing1 = "cipher")) || ((data0.cipherparams === undefined) && (missing1 = "cipherparams"))) || ((data0.ciphertext === undefined) && (missing1 = "ciphertext"))) || ((data0.kdf === undefined) && (missing1 = "kdf"))) || ((data0.kdfparams === undefined) && (missing1 = "kdfparams"))) || ((data0.mac === undefined) && (missing1 = "mac"))) {
|
24
|
+
validate11.errors = [{ instancePath: instancePath + "/crypto", schemaPath: "#/properties/crypto/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
25
|
+
return false;
|
26
|
+
}
|
27
|
+
else {
|
28
|
+
if (data0.cipher !== undefined) {
|
29
|
+
const _errs3 = errors;
|
30
|
+
if (typeof data0.cipher !== "string") {
|
31
|
+
validate11.errors = [{ instancePath: instancePath + "/crypto/cipher", schemaPath: "#/properties/crypto/properties/cipher/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
32
|
+
return false;
|
33
|
+
}
|
34
|
+
var valid1 = _errs3 === errors;
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
var valid1 = true;
|
38
|
+
}
|
39
|
+
if (valid1) {
|
40
|
+
if (data0.cipherparams !== undefined) {
|
41
|
+
let data2 = data0.cipherparams;
|
42
|
+
const _errs5 = errors;
|
43
|
+
if (!(data2 && typeof data2 == "object" && !Array.isArray(data2))) {
|
44
|
+
validate11.errors = [{ instancePath: instancePath + "/crypto/cipherparams", schemaPath: "#/properties/crypto/properties/cipherparams/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
45
|
+
return false;
|
46
|
+
}
|
47
|
+
var valid1 = _errs5 === errors;
|
48
|
+
}
|
49
|
+
else {
|
50
|
+
var valid1 = true;
|
51
|
+
}
|
52
|
+
if (valid1) {
|
53
|
+
if (data0.ciphertext !== undefined) {
|
54
|
+
const _errs7 = errors;
|
55
|
+
if (typeof data0.ciphertext !== "string") {
|
56
|
+
validate11.errors = [{ instancePath: instancePath + "/crypto/ciphertext", schemaPath: "#/properties/crypto/properties/ciphertext/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
57
|
+
return false;
|
58
|
+
}
|
59
|
+
var valid1 = _errs7 === errors;
|
60
|
+
}
|
61
|
+
else {
|
62
|
+
var valid1 = true;
|
63
|
+
}
|
64
|
+
if (valid1) {
|
65
|
+
if (data0.kdf !== undefined) {
|
66
|
+
const _errs9 = errors;
|
67
|
+
if (typeof data0.kdf !== "string") {
|
68
|
+
validate11.errors = [{ instancePath: instancePath + "/crypto/kdf", schemaPath: "#/properties/crypto/properties/kdf/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
69
|
+
return false;
|
70
|
+
}
|
71
|
+
var valid1 = _errs9 === errors;
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
var valid1 = true;
|
75
|
+
}
|
76
|
+
if (valid1) {
|
77
|
+
if (data0.kdfparams !== undefined) {
|
78
|
+
let data5 = data0.kdfparams;
|
79
|
+
const _errs11 = errors;
|
80
|
+
if (!(data5 && typeof data5 == "object" && !Array.isArray(data5))) {
|
81
|
+
validate11.errors = [{ instancePath: instancePath + "/crypto/kdfparams", schemaPath: "#/properties/crypto/properties/kdfparams/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
82
|
+
return false;
|
83
|
+
}
|
84
|
+
var valid1 = _errs11 === errors;
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
var valid1 = true;
|
88
|
+
}
|
89
|
+
if (valid1) {
|
90
|
+
if (data0.mac !== undefined) {
|
91
|
+
const _errs13 = errors;
|
92
|
+
if (typeof data0.mac !== "string") {
|
93
|
+
validate11.errors = [{ instancePath: instancePath + "/crypto/mac", schemaPath: "#/properties/crypto/properties/mac/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
94
|
+
return false;
|
95
|
+
}
|
96
|
+
var valid1 = _errs13 === errors;
|
97
|
+
}
|
98
|
+
else {
|
99
|
+
var valid1 = true;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
else {
|
109
|
+
validate11.errors = [{ instancePath: instancePath + "/crypto", schemaPath: "#/properties/crypto/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
110
|
+
return false;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
else {
|
117
|
+
validate11.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
118
|
+
return false;
|
119
|
+
}
|
120
|
+
} validate11.errors = vErrors; return errors === 0; }
|
121
|
+
//# sourceMappingURL=credential_validation_generated.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"credential_validation_generated.js","sourceRoot":"","sources":["../../src/keystore/credential_validation_generated.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,mEAAmE;AACnE,mCAAmC;AAEnC,oBAAoB;AACpB,aAAa;AACb,YAAY,CAAC;AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AAAA,MAAM,QAAQ,GAAG,EAAC,MAAM,EAAC,QAAQ,EAAC,YAAY,EAAC,EAAC,QAAQ,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,YAAY,EAAC,EAAC,QAAQ,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,cAAc,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,YAAY,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,KAAK,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,WAAW,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,KAAK,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,EAAC,UAAU,EAAC,CAAC,QAAQ,EAAC,cAAc,EAAC,YAAY,EAAC,KAAK,EAAC,WAAW,EAAC,KAAK,CAAC,EAAC,EAAC,EAAC,UAAU,EAAC,CAAC,QAAQ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C,OAAO,EAAC,MAAM,EAAC,MAAM,EAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC,OAAO,EAAC,gBAAgB,EAAC,CAAC,CAAC;QAAA,OAAO,KAAK,CAAC;IAAA,CAAC;AAAA,CAAC,CAAA,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,CAAA,OAAO,MAAM,KAAK,CAAC,CAAC,CAAA,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keystore/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import type { ICipherModule, IPbkdf2KdfModule } from "@chainsafe/bls-keystore";
|
2
|
+
import type { KeystoreEntity, MembershipHash, Password, Sha256Hash } from "./types.js";
|
3
|
+
type NwakuCredential = {
|
4
|
+
crypto: {
|
5
|
+
cipher: ICipherModule["function"];
|
6
|
+
cipherparams: ICipherModule["params"];
|
7
|
+
ciphertext: ICipherModule["message"];
|
8
|
+
kdf: IPbkdf2KdfModule["function"];
|
9
|
+
kdfparams: IPbkdf2KdfModule["params"];
|
10
|
+
mac: Sha256Hash;
|
11
|
+
};
|
12
|
+
};
|
13
|
+
interface NwakuKeystore {
|
14
|
+
application: string;
|
15
|
+
version: string;
|
16
|
+
appIdentifier: string;
|
17
|
+
credentials: {
|
18
|
+
[key: MembershipHash]: NwakuCredential;
|
19
|
+
};
|
20
|
+
}
|
21
|
+
type KeystoreCreateOptions = {
|
22
|
+
application?: string;
|
23
|
+
version?: string;
|
24
|
+
appIdentifier?: string;
|
25
|
+
};
|
26
|
+
export declare class Keystore {
|
27
|
+
private data;
|
28
|
+
private constructor();
|
29
|
+
static create(options?: KeystoreCreateOptions): Keystore;
|
30
|
+
static fromString(str: string): undefined | Keystore;
|
31
|
+
static fromObject(obj: NwakuKeystore): Keystore;
|
32
|
+
addCredential(options: KeystoreEntity, password: Password): Promise<MembershipHash>;
|
33
|
+
readCredential(membershipHash: MembershipHash, password: Password): Promise<undefined | KeystoreEntity>;
|
34
|
+
removeCredential(hash: MembershipHash): void;
|
35
|
+
toString(): string;
|
36
|
+
toObject(): NwakuKeystore;
|
37
|
+
/**
|
38
|
+
* Read array of hashes of current credentials
|
39
|
+
* @returns array of keys of credentials in current Keystore
|
40
|
+
*/
|
41
|
+
keys(): string[];
|
42
|
+
private static isValidNwakuStore;
|
43
|
+
private static fromCredentialToEip;
|
44
|
+
private static fromEipToCredential;
|
45
|
+
private static fromBytesToIdentity;
|
46
|
+
private static fromArraylikeToBytes;
|
47
|
+
private static computeMembershipHash;
|
48
|
+
private static fromIdentityToBytes;
|
49
|
+
}
|
50
|
+
export {};
|
@@ -0,0 +1,205 @@
|
|
1
|
+
import { create as createEipKeystore } from "@chainsafe/bls-keystore";
|
2
|
+
import { Logger } from "@waku/utils";
|
3
|
+
import { sha256 } from "ethereum-cryptography/sha256";
|
4
|
+
import { bytesToHex, bytesToUtf8, utf8ToBytes } from "ethereum-cryptography/utils";
|
5
|
+
import _ from "lodash";
|
6
|
+
import { v4 as uuidV4 } from "uuid";
|
7
|
+
import { buildBigIntFromUint8Array } from "../utils/bytes.js";
|
8
|
+
import { decryptEipKeystore, keccak256Checksum } from "./cipher.js";
|
9
|
+
import { isCredentialValid, isKeystoreValid } from "./schema_validator.js";
|
10
|
+
const log = new Logger("waku:rln:keystore");
|
11
|
+
export class Keystore {
|
12
|
+
data;
|
13
|
+
constructor(options) {
|
14
|
+
this.data = Object.assign({
|
15
|
+
application: "waku-rln-relay",
|
16
|
+
appIdentifier: "01234567890abcdef",
|
17
|
+
version: "0.2",
|
18
|
+
credentials: {}
|
19
|
+
}, options);
|
20
|
+
}
|
21
|
+
static create(options = {}) {
|
22
|
+
return new Keystore(options);
|
23
|
+
}
|
24
|
+
// should be valid JSON string that contains Keystore file
|
25
|
+
// https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/keyfile.nim#L376
|
26
|
+
static fromString(str) {
|
27
|
+
try {
|
28
|
+
const obj = JSON.parse(str);
|
29
|
+
if (!Keystore.isValidNwakuStore(obj)) {
|
30
|
+
throw Error("Invalid string, does not match Nwaku Keystore format.");
|
31
|
+
}
|
32
|
+
return new Keystore(obj);
|
33
|
+
}
|
34
|
+
catch (err) {
|
35
|
+
log.error("Cannot create Keystore from string:", err);
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
static fromObject(obj) {
|
40
|
+
if (!Keystore.isValidNwakuStore(obj)) {
|
41
|
+
throw Error("Invalid object, does not match Nwaku Keystore format.");
|
42
|
+
}
|
43
|
+
return new Keystore(obj);
|
44
|
+
}
|
45
|
+
async addCredential(options, password) {
|
46
|
+
const membershipHash = Keystore.computeMembershipHash(options.membership);
|
47
|
+
if (this.data.credentials[membershipHash]) {
|
48
|
+
throw Error("Credential already exists in the store.");
|
49
|
+
}
|
50
|
+
// these are not important
|
51
|
+
const stubPath = "/stub/path";
|
52
|
+
const stubPubkey = new Uint8Array([0]);
|
53
|
+
const secret = Keystore.fromIdentityToBytes(options);
|
54
|
+
const eipKeystore = await createEipKeystore(password, secret, stubPubkey, stubPath);
|
55
|
+
// need to re-compute checksum since nwaku uses keccak256 instead of sha256
|
56
|
+
const checksum = await keccak256Checksum(password, eipKeystore);
|
57
|
+
const nwakuCredential = Keystore.fromEipToCredential(eipKeystore, checksum);
|
58
|
+
this.data.credentials[membershipHash] = nwakuCredential;
|
59
|
+
return membershipHash;
|
60
|
+
}
|
61
|
+
async readCredential(membershipHash, password) {
|
62
|
+
const nwakuCredential = this.data.credentials[membershipHash];
|
63
|
+
if (!nwakuCredential) {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
const eipKeystore = Keystore.fromCredentialToEip(nwakuCredential);
|
67
|
+
const bytes = await decryptEipKeystore(password, eipKeystore);
|
68
|
+
return Keystore.fromBytesToIdentity(bytes);
|
69
|
+
}
|
70
|
+
removeCredential(hash) {
|
71
|
+
if (!this.data.credentials[hash]) {
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
delete this.data.credentials[hash];
|
75
|
+
}
|
76
|
+
toString() {
|
77
|
+
return JSON.stringify(this.data);
|
78
|
+
}
|
79
|
+
toObject() {
|
80
|
+
return this.data;
|
81
|
+
}
|
82
|
+
/**
|
83
|
+
* Read array of hashes of current credentials
|
84
|
+
* @returns array of keys of credentials in current Keystore
|
85
|
+
*/
|
86
|
+
keys() {
|
87
|
+
return Object.keys(this.toObject().credentials || {});
|
88
|
+
}
|
89
|
+
static isValidNwakuStore(obj) {
|
90
|
+
if (!isKeystoreValid(obj)) {
|
91
|
+
return false;
|
92
|
+
}
|
93
|
+
const areCredentialsValid = Object.values(_.get(obj, "credentials", {}))
|
94
|
+
.map((c) => isCredentialValid(c))
|
95
|
+
.every((v) => v);
|
96
|
+
return areCredentialsValid;
|
97
|
+
}
|
98
|
+
static fromCredentialToEip(credential) {
|
99
|
+
const nwakuCrypto = credential.crypto;
|
100
|
+
const eipCrypto = {
|
101
|
+
kdf: {
|
102
|
+
function: nwakuCrypto.kdf,
|
103
|
+
params: nwakuCrypto.kdfparams,
|
104
|
+
message: ""
|
105
|
+
},
|
106
|
+
cipher: {
|
107
|
+
function: nwakuCrypto.cipher,
|
108
|
+
params: nwakuCrypto.cipherparams,
|
109
|
+
message: nwakuCrypto.ciphertext
|
110
|
+
},
|
111
|
+
checksum: {
|
112
|
+
// @chainsafe/bls-keystore supports only sha256
|
113
|
+
// but nwaku uses keccak256
|
114
|
+
// https://github.com/waku-org/nwaku/blob/25d6e52e3804d15f9b61bc4cc6dd448540c072a1/waku/waku_keystore/keyfile.nim#L367
|
115
|
+
function: "sha256",
|
116
|
+
params: {},
|
117
|
+
message: nwakuCrypto.mac
|
118
|
+
}
|
119
|
+
};
|
120
|
+
return {
|
121
|
+
version: 4,
|
122
|
+
uuid: uuidV4(),
|
123
|
+
description: undefined,
|
124
|
+
path: "safe to ignore, not important for decrypt",
|
125
|
+
pubkey: "safe to ignore, not important for decrypt",
|
126
|
+
crypto: eipCrypto
|
127
|
+
};
|
128
|
+
}
|
129
|
+
static fromEipToCredential(eipKeystore, checksum) {
|
130
|
+
const eipCrypto = eipKeystore.crypto;
|
131
|
+
const eipKdf = eipCrypto.kdf;
|
132
|
+
return {
|
133
|
+
crypto: {
|
134
|
+
cipher: eipCrypto.cipher.function,
|
135
|
+
cipherparams: eipCrypto.cipher.params,
|
136
|
+
ciphertext: eipCrypto.cipher.message,
|
137
|
+
kdf: eipKdf.function,
|
138
|
+
kdfparams: eipKdf.params,
|
139
|
+
// @chainsafe/bls-keystore generates only sha256
|
140
|
+
// but nwaku uses keccak256
|
141
|
+
// https://github.com/waku-org/nwaku/blob/25d6e52e3804d15f9b61bc4cc6dd448540c072a1/waku/waku_keystore/keyfile.nim#L367
|
142
|
+
mac: checksum
|
143
|
+
}
|
144
|
+
};
|
145
|
+
}
|
146
|
+
static fromBytesToIdentity(bytes) {
|
147
|
+
try {
|
148
|
+
const str = bytesToUtf8(bytes);
|
149
|
+
const obj = JSON.parse(str);
|
150
|
+
// TODO: add runtime validation of nwaku credentials
|
151
|
+
return {
|
152
|
+
identity: {
|
153
|
+
IDCommitment: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idCommitment", [])),
|
154
|
+
IDTrapdoor: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idTrapdoor", [])),
|
155
|
+
IDNullifier: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idNullifier", [])),
|
156
|
+
IDCommitmentBigInt: buildBigIntFromUint8Array(Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idCommitment", []))),
|
157
|
+
IDSecretHash: Keystore.fromArraylikeToBytes(_.get(obj, "identityCredential.idSecretHash", []))
|
158
|
+
},
|
159
|
+
membership: {
|
160
|
+
treeIndex: _.get(obj, "treeIndex"),
|
161
|
+
chainId: _.get(obj, "membershipContract.chainId"),
|
162
|
+
address: _.get(obj, "membershipContract.address")
|
163
|
+
}
|
164
|
+
};
|
165
|
+
}
|
166
|
+
catch (err) {
|
167
|
+
log.error("Cannot parse bytes to Nwaku Credentials:", err);
|
168
|
+
return;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
static fromArraylikeToBytes(obj) {
|
172
|
+
const bytes = [];
|
173
|
+
let index = 0;
|
174
|
+
let lastElement = obj[index];
|
175
|
+
while (lastElement !== undefined) {
|
176
|
+
bytes.push(lastElement);
|
177
|
+
index += 1;
|
178
|
+
lastElement = obj[index];
|
179
|
+
}
|
180
|
+
return new Uint8Array(bytes);
|
181
|
+
}
|
182
|
+
// follows nwaku implementation
|
183
|
+
// https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/protocol_types.nim#L111
|
184
|
+
static computeMembershipHash(info) {
|
185
|
+
return bytesToHex(sha256(utf8ToBytes(`${info.chainId}${info.address}${info.treeIndex}`))).toUpperCase();
|
186
|
+
}
|
187
|
+
// follows nwaku implementation
|
188
|
+
// https://github.com/waku-org/nwaku/blob/f05528d4be3d3c876a8b07f9bb7dfaae8aa8ec6e/waku/waku_keystore/protocol_types.nim#L98
|
189
|
+
static fromIdentityToBytes(options) {
|
190
|
+
return utf8ToBytes(JSON.stringify({
|
191
|
+
treeIndex: options.membership.treeIndex,
|
192
|
+
identityCredential: {
|
193
|
+
idCommitment: options.identity.IDCommitment,
|
194
|
+
idNullifier: options.identity.IDNullifier,
|
195
|
+
idSecretHash: options.identity.IDSecretHash,
|
196
|
+
idTrapdoor: options.identity.IDTrapdoor
|
197
|
+
},
|
198
|
+
membershipContract: {
|
199
|
+
chainId: options.membership.chainId,
|
200
|
+
address: options.membership.address
|
201
|
+
}
|
202
|
+
}));
|
203
|
+
}
|
204
|
+
}
|
205
|
+
//# sourceMappingURL=keystore.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version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B,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;gBACnC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO;aACpC;SACF,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare const Keystore: typeof validate11;
|
2
|
+
declare function validate11(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
|
3
|
+
instancePath?: string | undefined;
|
4
|
+
parentData: any;
|
5
|
+
parentDataProperty: any;
|
6
|
+
rootData?: any;
|
7
|
+
}): boolean;
|
8
|
+
export {};
|
@@ -0,0 +1,75 @@
|
|
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
|
+
"use strict";
|
7
|
+
export const Keystore = validate11;
|
8
|
+
const schema12 = { "type": "object", "properties": { "credentials": { "type": "object" }, "appIdentifier": { "type": "string" }, "version": { "type": "string" }, "application": { "type": "string" } }, "required": ["application", "appIdentifier", "credentials", "version"] };
|
9
|
+
function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (errors === 0) {
|
10
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
11
|
+
let missing0;
|
12
|
+
if (((((data.application === undefined) && (missing0 = "application")) || ((data.appIdentifier === undefined) && (missing0 = "appIdentifier"))) || ((data.credentials === undefined) && (missing0 = "credentials"))) || ((data.version === undefined) && (missing0 = "version"))) {
|
13
|
+
validate11.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
else {
|
17
|
+
if (data.credentials !== undefined) {
|
18
|
+
let data0 = data.credentials;
|
19
|
+
const _errs1 = errors;
|
20
|
+
if (!(data0 && typeof data0 == "object" && !Array.isArray(data0))) {
|
21
|
+
validate11.errors = [{ instancePath: instancePath + "/credentials", schemaPath: "#/properties/credentials/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
22
|
+
return false;
|
23
|
+
}
|
24
|
+
var valid0 = _errs1 === errors;
|
25
|
+
}
|
26
|
+
else {
|
27
|
+
var valid0 = true;
|
28
|
+
}
|
29
|
+
if (valid0) {
|
30
|
+
if (data.appIdentifier !== undefined) {
|
31
|
+
const _errs3 = errors;
|
32
|
+
if (typeof data.appIdentifier !== "string") {
|
33
|
+
validate11.errors = [{ instancePath: instancePath + "/appIdentifier", schemaPath: "#/properties/appIdentifier/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
34
|
+
return false;
|
35
|
+
}
|
36
|
+
var valid0 = _errs3 === errors;
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
var valid0 = true;
|
40
|
+
}
|
41
|
+
if (valid0) {
|
42
|
+
if (data.version !== undefined) {
|
43
|
+
const _errs5 = errors;
|
44
|
+
if (typeof data.version !== "string") {
|
45
|
+
validate11.errors = [{ instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
46
|
+
return false;
|
47
|
+
}
|
48
|
+
var valid0 = _errs5 === errors;
|
49
|
+
}
|
50
|
+
else {
|
51
|
+
var valid0 = true;
|
52
|
+
}
|
53
|
+
if (valid0) {
|
54
|
+
if (data.application !== undefined) {
|
55
|
+
const _errs7 = errors;
|
56
|
+
if (typeof data.application !== "string") {
|
57
|
+
validate11.errors = [{ instancePath: instancePath + "/application", schemaPath: "#/properties/application/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
58
|
+
return false;
|
59
|
+
}
|
60
|
+
var valid0 = _errs7 === errors;
|
61
|
+
}
|
62
|
+
else {
|
63
|
+
var valid0 = true;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
validate11.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
72
|
+
return false;
|
73
|
+
}
|
74
|
+
} validate11.errors = vErrors; return errors === 0; }
|
75
|
+
//# sourceMappingURL=keystore_validation_generated.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"keystore_validation_generated.js","sourceRoot":"","sources":["../../src/keystore/keystore_validation_generated.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,mEAAmE;AACnE,mCAAmC;AAEnC,oBAAoB;AACpB,aAAa;AACb,YAAY,CAAC;AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AAAA,MAAM,QAAQ,GAAG,EAAC,MAAM,EAAC,QAAQ,EAAC,YAAY,EAAC,EAAC,aAAa,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,eAAe,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,SAAS,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,aAAa,EAAC,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAC,EAAC,UAAU,EAAC,CAAC,aAAa,EAAC,eAAe,EAAC,aAAa,EAAC,SAAS,CAAC,EAAC,CAAC;AAAA,SAAS,UAAU,CAAC,IAAI,EAAE,EAAC,YAAY,GAAC,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,GAAC,IAAI,EAAC,GAAC,EAAE,IAAE,IAAI,OAAO,GAAG,IAAI,CAAC,CAAA,IAAI,MAAM,GAAG,CAAC,CAAC,CAAA,IAAG,MAAM,KAAK,CAAC,EAAC,CAAC;IAAA,IAAG,IAAI,IAAI,OAAO,IAAI,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAC,CAAC;QAAA,IAAI,QAAQ,CAAC;QAAA,IAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,IAAI,CAAC,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AAK,SAAS,EAAC,CAAC;4BAAA,MAAM,MAAM,GAAG,MAAM,CAAC;4BAAA,IAAG,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,EAAC,CAAC;gCAAA,UAAU,CAAC,MAAM,GAAG,CAAC,EAAC,YAAY,EAAC,YAAY,GAAC,cAAc,EAAC,UAAU,EAAC,+BAA+B,EAAC,OAAO,EAAC,MAAM,EAAC,MAAM,EAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC,OAAO,EAAC,gBAAgB,EAAC,CAAC,CAAC;gCAAA,OAAO,KAAK,CAAC;4BAAA,CAAC;4BAAA,IAAI,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;wBAAA,CAAC;6BAAK,CAAC;4BAAA,IAAI,MAAM,GAAG,IAAI,CAAC;wBAAA,CAAC;oBAAA,CAAC;gBAAA,CAAC;YAAA,CAAC;QAAA,CAAC;IAAA,CAAC;SAAK,CAAC;QAAA,UAAU,CAAC,MAAM,GAAG,CAAC,EAAC,YAAY,EAAC,UAAU,EAAC,QAAQ,EAAC,OAAO,EAAC,MAAM,EAAC,MAAM,EAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC,OAAO,EAAC,gBAAgB,EAAC,CAAC,CAAC;QAAA,OAAO,KAAK,CAAC;IAAA,CAAC;AAAA,CAAC,CAAA,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC,CAAA,OAAO,MAAM,KAAK,CAAC,CAAC,CAAA,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Credential as _validateCredentialGenerated } from "./credential_validation_generated.js";
|
2
|
+
import { Keystore as _validateKeystoreGenerated } from "./keystore_validation_generated.js";
|
3
|
+
const _validateKeystore = _validateKeystoreGenerated;
|
4
|
+
const _validateCredential = _validateCredentialGenerated;
|
5
|
+
function schemaValidationErrors(validator, data) {
|
6
|
+
const validated = validator(data);
|
7
|
+
if (validated) {
|
8
|
+
return null;
|
9
|
+
}
|
10
|
+
return validator.errors;
|
11
|
+
}
|
12
|
+
export function isKeystoreValid(keystore) {
|
13
|
+
return !schemaValidationErrors(_validateKeystore, keystore);
|
14
|
+
}
|
15
|
+
export function isCredentialValid(credential) {
|
16
|
+
return !schemaValidationErrors(_validateCredential, credential);
|
17
|
+
}
|
18
|
+
//# sourceMappingURL=schema_validator.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"schema_validator.js","sourceRoot":"","sources":["../../src/keystore/schema_validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAClG,OAAO,EAAE,QAAQ,IAAI,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAY5F,MAAM,iBAAiB,GAAG,0BAAyC,CAAC;AACpE,MAAM,mBAAmB,GAAG,4BAA2C,CAAC;AAExE,SAAS,sBAAsB,CAC7B,SAAsB,EACtB,IAAa;IAEb,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAiB;IAC/C,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,UAAmB;IACnD,OAAO,CAAC,sBAAsB,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;AAClE,CAAC"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import type { IdentityCredential } from "../identity.js";
|
2
|
+
export type MembershipHash = string;
|
3
|
+
export type Sha256Hash = string;
|
4
|
+
export type Keccak256Hash = string;
|
5
|
+
export type Password = string | Uint8Array;
|
6
|
+
export type MembershipInfo = {
|
7
|
+
chainId: number;
|
8
|
+
address: string;
|
9
|
+
treeIndex: number;
|
10
|
+
};
|
11
|
+
export type KeystoreEntity = {
|
12
|
+
identity: IdentityCredential;
|
13
|
+
membership: MembershipInfo;
|
14
|
+
};
|
15
|
+
export type DecryptedCredentials = KeystoreEntity;
|
16
|
+
export type EncryptedCredentials = {
|
17
|
+
/**
|
18
|
+
* Valid JSON string that contains Keystore
|
19
|
+
*/
|
20
|
+
keystore: string;
|
21
|
+
/**
|
22
|
+
* ID of credentials from provided Keystore to use
|
23
|
+
*/
|
24
|
+
id: string;
|
25
|
+
/**
|
26
|
+
* Password to decrypt credentials provided
|
27
|
+
*/
|
28
|
+
password: Password;
|
29
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/keystore/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import type { IDecodedMessage, IMessage, IRateLimitProof } from "@waku/interfaces";
|
2
|
+
import { RLNInstance } from "./rln.js";
|
3
|
+
export declare function toRLNSignal(contentTopic: string, msg: IMessage): Uint8Array;
|
4
|
+
export declare class RlnMessage<T extends IDecodedMessage> implements IDecodedMessage {
|
5
|
+
rlnInstance: RLNInstance;
|
6
|
+
msg: T;
|
7
|
+
rateLimitProof: IRateLimitProof | undefined;
|
8
|
+
pubsubTopic: string;
|
9
|
+
constructor(rlnInstance: RLNInstance, msg: T, rateLimitProof: IRateLimitProof | undefined);
|
10
|
+
verify(roots: Uint8Array[]): boolean | undefined;
|
11
|
+
verifyNoRoot(): boolean | undefined;
|
12
|
+
get payload(): Uint8Array;
|
13
|
+
get contentTopic(): string;
|
14
|
+
get timestamp(): Date | undefined;
|
15
|
+
get ephemeral(): boolean | undefined;
|
16
|
+
get meta(): Uint8Array | undefined;
|
17
|
+
get epoch(): number | undefined;
|
18
|
+
}
|