@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,660 @@
|
|
1
|
+
import { commonjsGlobal, getDefaultExportFromCjs } from '../../../../../../_virtual/_commonjsHelpers.js';
|
2
|
+
import { __module as sha3$1 } from '../../../../../../_virtual/sha3.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
6
|
+
*
|
7
|
+
* @version 0.8.0
|
8
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
9
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
10
|
+
* @license MIT
|
11
|
+
*/
|
12
|
+
|
13
|
+
(function (module) {
|
14
|
+
/*jslint bitwise: true */
|
15
|
+
(function () {
|
16
|
+
|
17
|
+
var INPUT_ERROR = 'input is invalid type';
|
18
|
+
var FINALIZE_ERROR = 'finalize already called';
|
19
|
+
var WINDOW = typeof window === 'object';
|
20
|
+
var root = WINDOW ? window : {};
|
21
|
+
if (root.JS_SHA3_NO_WINDOW) {
|
22
|
+
WINDOW = false;
|
23
|
+
}
|
24
|
+
var WEB_WORKER = !WINDOW && typeof self === 'object';
|
25
|
+
var NODE_JS = !root.JS_SHA3_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
|
26
|
+
if (NODE_JS) {
|
27
|
+
root = commonjsGlobal;
|
28
|
+
} else if (WEB_WORKER) {
|
29
|
+
root = self;
|
30
|
+
}
|
31
|
+
var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && 'object' === 'object' && module.exports;
|
32
|
+
var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
|
33
|
+
var HEX_CHARS = '0123456789abcdef'.split('');
|
34
|
+
var SHAKE_PADDING = [31, 7936, 2031616, 520093696];
|
35
|
+
var CSHAKE_PADDING = [4, 1024, 262144, 67108864];
|
36
|
+
var KECCAK_PADDING = [1, 256, 65536, 16777216];
|
37
|
+
var PADDING = [6, 1536, 393216, 100663296];
|
38
|
+
var SHIFT = [0, 8, 16, 24];
|
39
|
+
var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649,
|
40
|
+
0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0,
|
41
|
+
2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771,
|
42
|
+
2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648,
|
43
|
+
2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648];
|
44
|
+
var BITS = [224, 256, 384, 512];
|
45
|
+
var SHAKE_BITS = [128, 256];
|
46
|
+
var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest'];
|
47
|
+
var CSHAKE_BYTEPAD = {
|
48
|
+
'128': 168,
|
49
|
+
'256': 136
|
50
|
+
};
|
51
|
+
|
52
|
+
if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) {
|
53
|
+
Array.isArray = function (obj) {
|
54
|
+
return Object.prototype.toString.call(obj) === '[object Array]';
|
55
|
+
};
|
56
|
+
}
|
57
|
+
|
58
|
+
if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
|
59
|
+
ArrayBuffer.isView = function (obj) {
|
60
|
+
return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
|
61
|
+
};
|
62
|
+
}
|
63
|
+
|
64
|
+
var createOutputMethod = function (bits, padding, outputType) {
|
65
|
+
return function (message) {
|
66
|
+
return new Keccak(bits, padding, bits).update(message)[outputType]();
|
67
|
+
};
|
68
|
+
};
|
69
|
+
|
70
|
+
var createShakeOutputMethod = function (bits, padding, outputType) {
|
71
|
+
return function (message, outputBits) {
|
72
|
+
return new Keccak(bits, padding, outputBits).update(message)[outputType]();
|
73
|
+
};
|
74
|
+
};
|
75
|
+
|
76
|
+
var createCshakeOutputMethod = function (bits, padding, outputType) {
|
77
|
+
return function (message, outputBits, n, s) {
|
78
|
+
return methods['cshake' + bits].update(message, outputBits, n, s)[outputType]();
|
79
|
+
};
|
80
|
+
};
|
81
|
+
|
82
|
+
var createKmacOutputMethod = function (bits, padding, outputType) {
|
83
|
+
return function (key, message, outputBits, s) {
|
84
|
+
return methods['kmac' + bits].update(key, message, outputBits, s)[outputType]();
|
85
|
+
};
|
86
|
+
};
|
87
|
+
|
88
|
+
var createOutputMethods = function (method, createMethod, bits, padding) {
|
89
|
+
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
90
|
+
var type = OUTPUT_TYPES[i];
|
91
|
+
method[type] = createMethod(bits, padding, type);
|
92
|
+
}
|
93
|
+
return method;
|
94
|
+
};
|
95
|
+
|
96
|
+
var createMethod = function (bits, padding) {
|
97
|
+
var method = createOutputMethod(bits, padding, 'hex');
|
98
|
+
method.create = function () {
|
99
|
+
return new Keccak(bits, padding, bits);
|
100
|
+
};
|
101
|
+
method.update = function (message) {
|
102
|
+
return method.create().update(message);
|
103
|
+
};
|
104
|
+
return createOutputMethods(method, createOutputMethod, bits, padding);
|
105
|
+
};
|
106
|
+
|
107
|
+
var createShakeMethod = function (bits, padding) {
|
108
|
+
var method = createShakeOutputMethod(bits, padding, 'hex');
|
109
|
+
method.create = function (outputBits) {
|
110
|
+
return new Keccak(bits, padding, outputBits);
|
111
|
+
};
|
112
|
+
method.update = function (message, outputBits) {
|
113
|
+
return method.create(outputBits).update(message);
|
114
|
+
};
|
115
|
+
return createOutputMethods(method, createShakeOutputMethod, bits, padding);
|
116
|
+
};
|
117
|
+
|
118
|
+
var createCshakeMethod = function (bits, padding) {
|
119
|
+
var w = CSHAKE_BYTEPAD[bits];
|
120
|
+
var method = createCshakeOutputMethod(bits, padding, 'hex');
|
121
|
+
method.create = function (outputBits, n, s) {
|
122
|
+
if (!n && !s) {
|
123
|
+
return methods['shake' + bits].create(outputBits);
|
124
|
+
} else {
|
125
|
+
return new Keccak(bits, padding, outputBits).bytepad([n, s], w);
|
126
|
+
}
|
127
|
+
};
|
128
|
+
method.update = function (message, outputBits, n, s) {
|
129
|
+
return method.create(outputBits, n, s).update(message);
|
130
|
+
};
|
131
|
+
return createOutputMethods(method, createCshakeOutputMethod, bits, padding);
|
132
|
+
};
|
133
|
+
|
134
|
+
var createKmacMethod = function (bits, padding) {
|
135
|
+
var w = CSHAKE_BYTEPAD[bits];
|
136
|
+
var method = createKmacOutputMethod(bits, padding, 'hex');
|
137
|
+
method.create = function (key, outputBits, s) {
|
138
|
+
return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w);
|
139
|
+
};
|
140
|
+
method.update = function (key, message, outputBits, s) {
|
141
|
+
return method.create(key, outputBits, s).update(message);
|
142
|
+
};
|
143
|
+
return createOutputMethods(method, createKmacOutputMethod, bits, padding);
|
144
|
+
};
|
145
|
+
|
146
|
+
var algorithms = [
|
147
|
+
{ name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod },
|
148
|
+
{ name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod },
|
149
|
+
{ name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod },
|
150
|
+
{ name: 'cshake', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createCshakeMethod },
|
151
|
+
{ name: 'kmac', padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod }
|
152
|
+
];
|
153
|
+
|
154
|
+
var methods = {}, methodNames = [];
|
155
|
+
|
156
|
+
for (var i = 0; i < algorithms.length; ++i) {
|
157
|
+
var algorithm = algorithms[i];
|
158
|
+
var bits = algorithm.bits;
|
159
|
+
for (var j = 0; j < bits.length; ++j) {
|
160
|
+
var methodName = algorithm.name + '_' + bits[j];
|
161
|
+
methodNames.push(methodName);
|
162
|
+
methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding);
|
163
|
+
if (algorithm.name !== 'sha3') {
|
164
|
+
var newMethodName = algorithm.name + bits[j];
|
165
|
+
methodNames.push(newMethodName);
|
166
|
+
methods[newMethodName] = methods[methodName];
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
function Keccak(bits, padding, outputBits) {
|
172
|
+
this.blocks = [];
|
173
|
+
this.s = [];
|
174
|
+
this.padding = padding;
|
175
|
+
this.outputBits = outputBits;
|
176
|
+
this.reset = true;
|
177
|
+
this.finalized = false;
|
178
|
+
this.block = 0;
|
179
|
+
this.start = 0;
|
180
|
+
this.blockCount = (1600 - (bits << 1)) >> 5;
|
181
|
+
this.byteCount = this.blockCount << 2;
|
182
|
+
this.outputBlocks = outputBits >> 5;
|
183
|
+
this.extraBytes = (outputBits & 31) >> 3;
|
184
|
+
|
185
|
+
for (var i = 0; i < 50; ++i) {
|
186
|
+
this.s[i] = 0;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
Keccak.prototype.update = function (message) {
|
191
|
+
if (this.finalized) {
|
192
|
+
throw new Error(FINALIZE_ERROR);
|
193
|
+
}
|
194
|
+
var notString, type = typeof message;
|
195
|
+
if (type !== 'string') {
|
196
|
+
if (type === 'object') {
|
197
|
+
if (message === null) {
|
198
|
+
throw new Error(INPUT_ERROR);
|
199
|
+
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
200
|
+
message = new Uint8Array(message);
|
201
|
+
} else if (!Array.isArray(message)) {
|
202
|
+
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
|
203
|
+
throw new Error(INPUT_ERROR);
|
204
|
+
}
|
205
|
+
}
|
206
|
+
} else {
|
207
|
+
throw new Error(INPUT_ERROR);
|
208
|
+
}
|
209
|
+
notString = true;
|
210
|
+
}
|
211
|
+
var blocks = this.blocks, byteCount = this.byteCount, length = message.length,
|
212
|
+
blockCount = this.blockCount, index = 0, s = this.s, i, code;
|
213
|
+
|
214
|
+
while (index < length) {
|
215
|
+
if (this.reset) {
|
216
|
+
this.reset = false;
|
217
|
+
blocks[0] = this.block;
|
218
|
+
for (i = 1; i < blockCount + 1; ++i) {
|
219
|
+
blocks[i] = 0;
|
220
|
+
}
|
221
|
+
}
|
222
|
+
if (notString) {
|
223
|
+
for (i = this.start; index < length && i < byteCount; ++index) {
|
224
|
+
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
225
|
+
}
|
226
|
+
} else {
|
227
|
+
for (i = this.start; index < length && i < byteCount; ++index) {
|
228
|
+
code = message.charCodeAt(index);
|
229
|
+
if (code < 0x80) {
|
230
|
+
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
231
|
+
} else if (code < 0x800) {
|
232
|
+
blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
|
233
|
+
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
234
|
+
} else if (code < 0xd800 || code >= 0xe000) {
|
235
|
+
blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
|
236
|
+
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
|
237
|
+
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
238
|
+
} else {
|
239
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
|
240
|
+
blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
|
241
|
+
blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
|
242
|
+
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
|
243
|
+
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
244
|
+
}
|
245
|
+
}
|
246
|
+
}
|
247
|
+
this.lastByteIndex = i;
|
248
|
+
if (i >= byteCount) {
|
249
|
+
this.start = i - byteCount;
|
250
|
+
this.block = blocks[blockCount];
|
251
|
+
for (i = 0; i < blockCount; ++i) {
|
252
|
+
s[i] ^= blocks[i];
|
253
|
+
}
|
254
|
+
f(s);
|
255
|
+
this.reset = true;
|
256
|
+
} else {
|
257
|
+
this.start = i;
|
258
|
+
}
|
259
|
+
}
|
260
|
+
return this;
|
261
|
+
};
|
262
|
+
|
263
|
+
Keccak.prototype.encode = function (x, right) {
|
264
|
+
var o = x & 255, n = 1;
|
265
|
+
var bytes = [o];
|
266
|
+
x = x >> 8;
|
267
|
+
o = x & 255;
|
268
|
+
while (o > 0) {
|
269
|
+
bytes.unshift(o);
|
270
|
+
x = x >> 8;
|
271
|
+
o = x & 255;
|
272
|
+
++n;
|
273
|
+
}
|
274
|
+
if (right) {
|
275
|
+
bytes.push(n);
|
276
|
+
} else {
|
277
|
+
bytes.unshift(n);
|
278
|
+
}
|
279
|
+
this.update(bytes);
|
280
|
+
return bytes.length;
|
281
|
+
};
|
282
|
+
|
283
|
+
Keccak.prototype.encodeString = function (str) {
|
284
|
+
var notString, type = typeof str;
|
285
|
+
if (type !== 'string') {
|
286
|
+
if (type === 'object') {
|
287
|
+
if (str === null) {
|
288
|
+
throw new Error(INPUT_ERROR);
|
289
|
+
} else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) {
|
290
|
+
str = new Uint8Array(str);
|
291
|
+
} else if (!Array.isArray(str)) {
|
292
|
+
if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) {
|
293
|
+
throw new Error(INPUT_ERROR);
|
294
|
+
}
|
295
|
+
}
|
296
|
+
} else {
|
297
|
+
throw new Error(INPUT_ERROR);
|
298
|
+
}
|
299
|
+
notString = true;
|
300
|
+
}
|
301
|
+
var bytes = 0, length = str.length;
|
302
|
+
if (notString) {
|
303
|
+
bytes = length;
|
304
|
+
} else {
|
305
|
+
for (var i = 0; i < str.length; ++i) {
|
306
|
+
var code = str.charCodeAt(i);
|
307
|
+
if (code < 0x80) {
|
308
|
+
bytes += 1;
|
309
|
+
} else if (code < 0x800) {
|
310
|
+
bytes += 2;
|
311
|
+
} else if (code < 0xd800 || code >= 0xe000) {
|
312
|
+
bytes += 3;
|
313
|
+
} else {
|
314
|
+
code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(++i) & 0x3ff));
|
315
|
+
bytes += 4;
|
316
|
+
}
|
317
|
+
}
|
318
|
+
}
|
319
|
+
bytes += this.encode(bytes * 8);
|
320
|
+
this.update(str);
|
321
|
+
return bytes;
|
322
|
+
};
|
323
|
+
|
324
|
+
Keccak.prototype.bytepad = function (strs, w) {
|
325
|
+
var bytes = this.encode(w);
|
326
|
+
for (var i = 0; i < strs.length; ++i) {
|
327
|
+
bytes += this.encodeString(strs[i]);
|
328
|
+
}
|
329
|
+
var paddingBytes = w - bytes % w;
|
330
|
+
var zeros = [];
|
331
|
+
zeros.length = paddingBytes;
|
332
|
+
this.update(zeros);
|
333
|
+
return this;
|
334
|
+
};
|
335
|
+
|
336
|
+
Keccak.prototype.finalize = function () {
|
337
|
+
if (this.finalized) {
|
338
|
+
return;
|
339
|
+
}
|
340
|
+
this.finalized = true;
|
341
|
+
var blocks = this.blocks, i = this.lastByteIndex, blockCount = this.blockCount, s = this.s;
|
342
|
+
blocks[i >> 2] |= this.padding[i & 3];
|
343
|
+
if (this.lastByteIndex === this.byteCount) {
|
344
|
+
blocks[0] = blocks[blockCount];
|
345
|
+
for (i = 1; i < blockCount + 1; ++i) {
|
346
|
+
blocks[i] = 0;
|
347
|
+
}
|
348
|
+
}
|
349
|
+
blocks[blockCount - 1] |= 0x80000000;
|
350
|
+
for (i = 0; i < blockCount; ++i) {
|
351
|
+
s[i] ^= blocks[i];
|
352
|
+
}
|
353
|
+
f(s);
|
354
|
+
};
|
355
|
+
|
356
|
+
Keccak.prototype.toString = Keccak.prototype.hex = function () {
|
357
|
+
this.finalize();
|
358
|
+
|
359
|
+
var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
|
360
|
+
extraBytes = this.extraBytes, i = 0, j = 0;
|
361
|
+
var hex = '', block;
|
362
|
+
while (j < outputBlocks) {
|
363
|
+
for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
|
364
|
+
block = s[i];
|
365
|
+
hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F] +
|
366
|
+
HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F] +
|
367
|
+
HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F] +
|
368
|
+
HEX_CHARS[(block >> 28) & 0x0F] + HEX_CHARS[(block >> 24) & 0x0F];
|
369
|
+
}
|
370
|
+
if (j % blockCount === 0) {
|
371
|
+
f(s);
|
372
|
+
i = 0;
|
373
|
+
}
|
374
|
+
}
|
375
|
+
if (extraBytes) {
|
376
|
+
block = s[i];
|
377
|
+
hex += HEX_CHARS[(block >> 4) & 0x0F] + HEX_CHARS[block & 0x0F];
|
378
|
+
if (extraBytes > 1) {
|
379
|
+
hex += HEX_CHARS[(block >> 12) & 0x0F] + HEX_CHARS[(block >> 8) & 0x0F];
|
380
|
+
}
|
381
|
+
if (extraBytes > 2) {
|
382
|
+
hex += HEX_CHARS[(block >> 20) & 0x0F] + HEX_CHARS[(block >> 16) & 0x0F];
|
383
|
+
}
|
384
|
+
}
|
385
|
+
return hex;
|
386
|
+
};
|
387
|
+
|
388
|
+
Keccak.prototype.arrayBuffer = function () {
|
389
|
+
this.finalize();
|
390
|
+
|
391
|
+
var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
|
392
|
+
extraBytes = this.extraBytes, i = 0, j = 0;
|
393
|
+
var bytes = this.outputBits >> 3;
|
394
|
+
var buffer;
|
395
|
+
if (extraBytes) {
|
396
|
+
buffer = new ArrayBuffer((outputBlocks + 1) << 2);
|
397
|
+
} else {
|
398
|
+
buffer = new ArrayBuffer(bytes);
|
399
|
+
}
|
400
|
+
var array = new Uint32Array(buffer);
|
401
|
+
while (j < outputBlocks) {
|
402
|
+
for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
|
403
|
+
array[j] = s[i];
|
404
|
+
}
|
405
|
+
if (j % blockCount === 0) {
|
406
|
+
f(s);
|
407
|
+
}
|
408
|
+
}
|
409
|
+
if (extraBytes) {
|
410
|
+
array[i] = s[i];
|
411
|
+
buffer = buffer.slice(0, bytes);
|
412
|
+
}
|
413
|
+
return buffer;
|
414
|
+
};
|
415
|
+
|
416
|
+
Keccak.prototype.buffer = Keccak.prototype.arrayBuffer;
|
417
|
+
|
418
|
+
Keccak.prototype.digest = Keccak.prototype.array = function () {
|
419
|
+
this.finalize();
|
420
|
+
|
421
|
+
var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks,
|
422
|
+
extraBytes = this.extraBytes, i = 0, j = 0;
|
423
|
+
var array = [], offset, block;
|
424
|
+
while (j < outputBlocks) {
|
425
|
+
for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) {
|
426
|
+
offset = j << 2;
|
427
|
+
block = s[i];
|
428
|
+
array[offset] = block & 0xFF;
|
429
|
+
array[offset + 1] = (block >> 8) & 0xFF;
|
430
|
+
array[offset + 2] = (block >> 16) & 0xFF;
|
431
|
+
array[offset + 3] = (block >> 24) & 0xFF;
|
432
|
+
}
|
433
|
+
if (j % blockCount === 0) {
|
434
|
+
f(s);
|
435
|
+
}
|
436
|
+
}
|
437
|
+
if (extraBytes) {
|
438
|
+
offset = j << 2;
|
439
|
+
block = s[i];
|
440
|
+
array[offset] = block & 0xFF;
|
441
|
+
if (extraBytes > 1) {
|
442
|
+
array[offset + 1] = (block >> 8) & 0xFF;
|
443
|
+
}
|
444
|
+
if (extraBytes > 2) {
|
445
|
+
array[offset + 2] = (block >> 16) & 0xFF;
|
446
|
+
}
|
447
|
+
}
|
448
|
+
return array;
|
449
|
+
};
|
450
|
+
|
451
|
+
function Kmac(bits, padding, outputBits) {
|
452
|
+
Keccak.call(this, bits, padding, outputBits);
|
453
|
+
}
|
454
|
+
|
455
|
+
Kmac.prototype = new Keccak();
|
456
|
+
|
457
|
+
Kmac.prototype.finalize = function () {
|
458
|
+
this.encode(this.outputBits, true);
|
459
|
+
return Keccak.prototype.finalize.call(this);
|
460
|
+
};
|
461
|
+
|
462
|
+
var f = function (s) {
|
463
|
+
var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9,
|
464
|
+
b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17,
|
465
|
+
b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33,
|
466
|
+
b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49;
|
467
|
+
for (n = 0; n < 48; n += 2) {
|
468
|
+
c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40];
|
469
|
+
c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41];
|
470
|
+
c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42];
|
471
|
+
c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43];
|
472
|
+
c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44];
|
473
|
+
c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45];
|
474
|
+
c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46];
|
475
|
+
c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47];
|
476
|
+
c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48];
|
477
|
+
c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49];
|
478
|
+
|
479
|
+
h = c8 ^ ((c2 << 1) | (c3 >>> 31));
|
480
|
+
l = c9 ^ ((c3 << 1) | (c2 >>> 31));
|
481
|
+
s[0] ^= h;
|
482
|
+
s[1] ^= l;
|
483
|
+
s[10] ^= h;
|
484
|
+
s[11] ^= l;
|
485
|
+
s[20] ^= h;
|
486
|
+
s[21] ^= l;
|
487
|
+
s[30] ^= h;
|
488
|
+
s[31] ^= l;
|
489
|
+
s[40] ^= h;
|
490
|
+
s[41] ^= l;
|
491
|
+
h = c0 ^ ((c4 << 1) | (c5 >>> 31));
|
492
|
+
l = c1 ^ ((c5 << 1) | (c4 >>> 31));
|
493
|
+
s[2] ^= h;
|
494
|
+
s[3] ^= l;
|
495
|
+
s[12] ^= h;
|
496
|
+
s[13] ^= l;
|
497
|
+
s[22] ^= h;
|
498
|
+
s[23] ^= l;
|
499
|
+
s[32] ^= h;
|
500
|
+
s[33] ^= l;
|
501
|
+
s[42] ^= h;
|
502
|
+
s[43] ^= l;
|
503
|
+
h = c2 ^ ((c6 << 1) | (c7 >>> 31));
|
504
|
+
l = c3 ^ ((c7 << 1) | (c6 >>> 31));
|
505
|
+
s[4] ^= h;
|
506
|
+
s[5] ^= l;
|
507
|
+
s[14] ^= h;
|
508
|
+
s[15] ^= l;
|
509
|
+
s[24] ^= h;
|
510
|
+
s[25] ^= l;
|
511
|
+
s[34] ^= h;
|
512
|
+
s[35] ^= l;
|
513
|
+
s[44] ^= h;
|
514
|
+
s[45] ^= l;
|
515
|
+
h = c4 ^ ((c8 << 1) | (c9 >>> 31));
|
516
|
+
l = c5 ^ ((c9 << 1) | (c8 >>> 31));
|
517
|
+
s[6] ^= h;
|
518
|
+
s[7] ^= l;
|
519
|
+
s[16] ^= h;
|
520
|
+
s[17] ^= l;
|
521
|
+
s[26] ^= h;
|
522
|
+
s[27] ^= l;
|
523
|
+
s[36] ^= h;
|
524
|
+
s[37] ^= l;
|
525
|
+
s[46] ^= h;
|
526
|
+
s[47] ^= l;
|
527
|
+
h = c6 ^ ((c0 << 1) | (c1 >>> 31));
|
528
|
+
l = c7 ^ ((c1 << 1) | (c0 >>> 31));
|
529
|
+
s[8] ^= h;
|
530
|
+
s[9] ^= l;
|
531
|
+
s[18] ^= h;
|
532
|
+
s[19] ^= l;
|
533
|
+
s[28] ^= h;
|
534
|
+
s[29] ^= l;
|
535
|
+
s[38] ^= h;
|
536
|
+
s[39] ^= l;
|
537
|
+
s[48] ^= h;
|
538
|
+
s[49] ^= l;
|
539
|
+
|
540
|
+
b0 = s[0];
|
541
|
+
b1 = s[1];
|
542
|
+
b32 = (s[11] << 4) | (s[10] >>> 28);
|
543
|
+
b33 = (s[10] << 4) | (s[11] >>> 28);
|
544
|
+
b14 = (s[20] << 3) | (s[21] >>> 29);
|
545
|
+
b15 = (s[21] << 3) | (s[20] >>> 29);
|
546
|
+
b46 = (s[31] << 9) | (s[30] >>> 23);
|
547
|
+
b47 = (s[30] << 9) | (s[31] >>> 23);
|
548
|
+
b28 = (s[40] << 18) | (s[41] >>> 14);
|
549
|
+
b29 = (s[41] << 18) | (s[40] >>> 14);
|
550
|
+
b20 = (s[2] << 1) | (s[3] >>> 31);
|
551
|
+
b21 = (s[3] << 1) | (s[2] >>> 31);
|
552
|
+
b2 = (s[13] << 12) | (s[12] >>> 20);
|
553
|
+
b3 = (s[12] << 12) | (s[13] >>> 20);
|
554
|
+
b34 = (s[22] << 10) | (s[23] >>> 22);
|
555
|
+
b35 = (s[23] << 10) | (s[22] >>> 22);
|
556
|
+
b16 = (s[33] << 13) | (s[32] >>> 19);
|
557
|
+
b17 = (s[32] << 13) | (s[33] >>> 19);
|
558
|
+
b48 = (s[42] << 2) | (s[43] >>> 30);
|
559
|
+
b49 = (s[43] << 2) | (s[42] >>> 30);
|
560
|
+
b40 = (s[5] << 30) | (s[4] >>> 2);
|
561
|
+
b41 = (s[4] << 30) | (s[5] >>> 2);
|
562
|
+
b22 = (s[14] << 6) | (s[15] >>> 26);
|
563
|
+
b23 = (s[15] << 6) | (s[14] >>> 26);
|
564
|
+
b4 = (s[25] << 11) | (s[24] >>> 21);
|
565
|
+
b5 = (s[24] << 11) | (s[25] >>> 21);
|
566
|
+
b36 = (s[34] << 15) | (s[35] >>> 17);
|
567
|
+
b37 = (s[35] << 15) | (s[34] >>> 17);
|
568
|
+
b18 = (s[45] << 29) | (s[44] >>> 3);
|
569
|
+
b19 = (s[44] << 29) | (s[45] >>> 3);
|
570
|
+
b10 = (s[6] << 28) | (s[7] >>> 4);
|
571
|
+
b11 = (s[7] << 28) | (s[6] >>> 4);
|
572
|
+
b42 = (s[17] << 23) | (s[16] >>> 9);
|
573
|
+
b43 = (s[16] << 23) | (s[17] >>> 9);
|
574
|
+
b24 = (s[26] << 25) | (s[27] >>> 7);
|
575
|
+
b25 = (s[27] << 25) | (s[26] >>> 7);
|
576
|
+
b6 = (s[36] << 21) | (s[37] >>> 11);
|
577
|
+
b7 = (s[37] << 21) | (s[36] >>> 11);
|
578
|
+
b38 = (s[47] << 24) | (s[46] >>> 8);
|
579
|
+
b39 = (s[46] << 24) | (s[47] >>> 8);
|
580
|
+
b30 = (s[8] << 27) | (s[9] >>> 5);
|
581
|
+
b31 = (s[9] << 27) | (s[8] >>> 5);
|
582
|
+
b12 = (s[18] << 20) | (s[19] >>> 12);
|
583
|
+
b13 = (s[19] << 20) | (s[18] >>> 12);
|
584
|
+
b44 = (s[29] << 7) | (s[28] >>> 25);
|
585
|
+
b45 = (s[28] << 7) | (s[29] >>> 25);
|
586
|
+
b26 = (s[38] << 8) | (s[39] >>> 24);
|
587
|
+
b27 = (s[39] << 8) | (s[38] >>> 24);
|
588
|
+
b8 = (s[48] << 14) | (s[49] >>> 18);
|
589
|
+
b9 = (s[49] << 14) | (s[48] >>> 18);
|
590
|
+
|
591
|
+
s[0] = b0 ^ (~b2 & b4);
|
592
|
+
s[1] = b1 ^ (~b3 & b5);
|
593
|
+
s[10] = b10 ^ (~b12 & b14);
|
594
|
+
s[11] = b11 ^ (~b13 & b15);
|
595
|
+
s[20] = b20 ^ (~b22 & b24);
|
596
|
+
s[21] = b21 ^ (~b23 & b25);
|
597
|
+
s[30] = b30 ^ (~b32 & b34);
|
598
|
+
s[31] = b31 ^ (~b33 & b35);
|
599
|
+
s[40] = b40 ^ (~b42 & b44);
|
600
|
+
s[41] = b41 ^ (~b43 & b45);
|
601
|
+
s[2] = b2 ^ (~b4 & b6);
|
602
|
+
s[3] = b3 ^ (~b5 & b7);
|
603
|
+
s[12] = b12 ^ (~b14 & b16);
|
604
|
+
s[13] = b13 ^ (~b15 & b17);
|
605
|
+
s[22] = b22 ^ (~b24 & b26);
|
606
|
+
s[23] = b23 ^ (~b25 & b27);
|
607
|
+
s[32] = b32 ^ (~b34 & b36);
|
608
|
+
s[33] = b33 ^ (~b35 & b37);
|
609
|
+
s[42] = b42 ^ (~b44 & b46);
|
610
|
+
s[43] = b43 ^ (~b45 & b47);
|
611
|
+
s[4] = b4 ^ (~b6 & b8);
|
612
|
+
s[5] = b5 ^ (~b7 & b9);
|
613
|
+
s[14] = b14 ^ (~b16 & b18);
|
614
|
+
s[15] = b15 ^ (~b17 & b19);
|
615
|
+
s[24] = b24 ^ (~b26 & b28);
|
616
|
+
s[25] = b25 ^ (~b27 & b29);
|
617
|
+
s[34] = b34 ^ (~b36 & b38);
|
618
|
+
s[35] = b35 ^ (~b37 & b39);
|
619
|
+
s[44] = b44 ^ (~b46 & b48);
|
620
|
+
s[45] = b45 ^ (~b47 & b49);
|
621
|
+
s[6] = b6 ^ (~b8 & b0);
|
622
|
+
s[7] = b7 ^ (~b9 & b1);
|
623
|
+
s[16] = b16 ^ (~b18 & b10);
|
624
|
+
s[17] = b17 ^ (~b19 & b11);
|
625
|
+
s[26] = b26 ^ (~b28 & b20);
|
626
|
+
s[27] = b27 ^ (~b29 & b21);
|
627
|
+
s[36] = b36 ^ (~b38 & b30);
|
628
|
+
s[37] = b37 ^ (~b39 & b31);
|
629
|
+
s[46] = b46 ^ (~b48 & b40);
|
630
|
+
s[47] = b47 ^ (~b49 & b41);
|
631
|
+
s[8] = b8 ^ (~b0 & b2);
|
632
|
+
s[9] = b9 ^ (~b1 & b3);
|
633
|
+
s[18] = b18 ^ (~b10 & b12);
|
634
|
+
s[19] = b19 ^ (~b11 & b13);
|
635
|
+
s[28] = b28 ^ (~b20 & b22);
|
636
|
+
s[29] = b29 ^ (~b21 & b23);
|
637
|
+
s[38] = b38 ^ (~b30 & b32);
|
638
|
+
s[39] = b39 ^ (~b31 & b33);
|
639
|
+
s[48] = b48 ^ (~b40 & b42);
|
640
|
+
s[49] = b49 ^ (~b41 & b43);
|
641
|
+
|
642
|
+
s[0] ^= RC[n];
|
643
|
+
s[1] ^= RC[n + 1];
|
644
|
+
}
|
645
|
+
};
|
646
|
+
|
647
|
+
if (COMMON_JS) {
|
648
|
+
module.exports = methods;
|
649
|
+
} else {
|
650
|
+
for (i = 0; i < methodNames.length; ++i) {
|
651
|
+
root[methodNames[i]] = methods[methodNames[i]];
|
652
|
+
}
|
653
|
+
}
|
654
|
+
})();
|
655
|
+
} (sha3$1));
|
656
|
+
|
657
|
+
var sha3Exports = sha3$1.exports;
|
658
|
+
var sha3 = /*@__PURE__*/getDefaultExportFromCjs(sha3Exports);
|
659
|
+
|
660
|
+
export { sha3 as default };
|