@waku/rln 0.1.3-f6d5deb → 0.1.4-d27db21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -186
- package/bundle/_virtual/__node-resolve_empty.js +6 -0
- package/bundle/_virtual/_assert.js +3 -0
- package/bundle/_virtual/_commonjs-dynamic-modules.js +5 -0
- package/bundle/_virtual/_commonjsHelpers.js +32 -0
- package/bundle/_virtual/_node-resolve_empty.js +3 -0
- package/bundle/_virtual/_sha2.js +3 -0
- package/bundle/_virtual/_u64.js +3 -0
- package/bundle/_virtual/aes.js +3 -0
- package/bundle/_virtual/bn.js +3 -0
- package/bundle/_virtual/browser.js +3 -0
- package/bundle/_virtual/checksum.js +3 -0
- package/bundle/_virtual/cipher.js +3 -0
- package/bundle/_virtual/class.js +3 -0
- package/bundle/_virtual/common.js +3 -0
- package/bundle/_virtual/common2.js +3 -0
- package/bundle/_virtual/cryptoBrowser.js +3 -0
- package/bundle/_virtual/functional.js +3 -0
- package/bundle/_virtual/hash.js +3 -0
- package/bundle/_virtual/hmac.js +3 -0
- package/bundle/_virtual/index.js +3 -0
- package/bundle/_virtual/index2.js +6 -0
- package/bundle/_virtual/inherits_browser.js +3 -0
- package/bundle/_virtual/kdf.js +3 -0
- package/bundle/_virtual/lodash.js +3 -0
- package/bundle/_virtual/password.js +3 -0
- package/bundle/_virtual/pbkdf2.js +3 -0
- package/bundle/_virtual/pbkdf22.js +3 -0
- package/bundle/_virtual/random.js +3 -0
- package/bundle/_virtual/ripemd.js +3 -0
- package/bundle/_virtual/schema-validation-generated.js +3 -0
- package/bundle/_virtual/schema-validation.js +3 -0
- package/bundle/_virtual/scrypt.js +3 -0
- package/bundle/_virtual/scrypt2.js +3 -0
- package/bundle/_virtual/sha.js +3 -0
- package/bundle/_virtual/sha256.js +3 -0
- package/bundle/_virtual/sha2562.js +3 -0
- package/bundle/_virtual/sha3.js +3 -0
- package/bundle/_virtual/sha512.js +3 -0
- package/bundle/_virtual/types.js +3 -0
- package/bundle/_virtual/utils.js +3 -0
- package/bundle/_virtual/utils2.js +3 -0
- package/bundle/_virtual/utils3.js +3 -0
- package/bundle/index.js +12 -74804
- package/bundle/node_modules/@ethersproject/abi/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/abi-coder.js +96 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +148 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/address.js +26 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js +20 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/array.js +210 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/boolean.js +18 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/bytes.js +30 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js +26 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/null.js +22 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/number.js +43 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/string.js +19 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/tuple.js +58 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/fragments.js +854 -0
- package/bundle/node_modules/@ethersproject/abi/lib.esm/interface.js +609 -0
- package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/index.js +66 -0
- package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/index.js +302 -0
- package/bundle/node_modules/@ethersproject/address/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/address/lib.esm/index.js +110 -0
- package/bundle/node_modules/@ethersproject/base64/lib.esm/base64.js +20 -0
- package/bundle/node_modules/@ethersproject/basex/lib.esm/index.js +120 -0
- package/bundle/node_modules/@ethersproject/bignumber/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/bignumber/lib.esm/bignumber.js +287 -0
- package/bundle/node_modules/@ethersproject/bytes/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/bytes/lib.esm/index.js +402 -0
- package/bundle/node_modules/@ethersproject/constants/lib.esm/addresses.js +3 -0
- package/bundle/node_modules/@ethersproject/constants/lib.esm/bignumbers.js +8 -0
- package/bundle/node_modules/@ethersproject/constants/lib.esm/hashes.js +3 -0
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +893 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/decoder.js +256 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/include.js +36 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +135 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/id.js +8 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/namehash.js +64 -0
- package/bundle/node_modules/@ethersproject/hash/lib.esm/typed-data.js +443 -0
- package/bundle/node_modules/@ethersproject/keccak256/lib.esm/index.js +8 -0
- package/bundle/node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +660 -0
- package/bundle/node_modules/@ethersproject/logger/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/logger/lib.esm/index.js +352 -0
- package/bundle/node_modules/@ethersproject/networks/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/networks/lib.esm/index.js +248 -0
- package/bundle/node_modules/@ethersproject/properties/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/properties/lib.esm/index.js +127 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/base-provider.js +2007 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/formatter.js +422 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +674 -0
- package/bundle/node_modules/@ethersproject/providers/lib.esm/web3-provider.js +132 -0
- package/bundle/node_modules/@ethersproject/rlp/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/rlp/lib.esm/index.js +120 -0
- package/bundle/node_modules/@ethersproject/sha2/lib.esm/sha2.js +8 -0
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/elliptic.js +2430 -0
- package/bundle/node_modules/@ethersproject/signing-key/lib.esm/index.js +76 -0
- package/bundle/node_modules/@ethersproject/strings/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/strings/lib.esm/utf8.js +219 -0
- package/bundle/node_modules/@ethersproject/transactions/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/transactions/lib.esm/index.js +279 -0
- package/bundle/node_modules/@ethersproject/web/lib.esm/_version.js +3 -0
- package/bundle/node_modules/@ethersproject/web/lib.esm/geturl.js +69 -0
- package/bundle/node_modules/@ethersproject/web/lib.esm/index.js +404 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/convert.js +15 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/multiaddr.js +20 -0
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/protocols-table.js +92 -0
- package/bundle/node_modules/@noble/hashes/esm/_assert.js +37 -0
- package/bundle/node_modules/@noble/hashes/esm/_md.js +132 -0
- package/bundle/node_modules/@noble/hashes/esm/_u64.js +29 -0
- package/bundle/node_modules/@noble/hashes/esm/sha256.js +113 -0
- package/bundle/node_modules/@noble/hashes/esm/sha3.js +210 -0
- package/bundle/node_modules/@noble/hashes/esm/utils.js +144 -0
- package/bundle/node_modules/@waku/zerokit-rln-wasm/rln_wasm.js +756 -0
- package/bundle/node_modules/bech32/index.js +187 -0
- package/bundle/node_modules/bn.js/lib/bn.js +3361 -0
- package/bundle/node_modules/debug/src/browser.js +283 -0
- package/bundle/node_modules/debug/src/common.js +295 -0
- package/bundle/node_modules/ethereum-cryptography/esm/keccak.js +10 -0
- package/bundle/node_modules/ethereum-cryptography/esm/sha256.js +6 -0
- package/bundle/node_modules/ethereum-cryptography/esm/utils.js +24 -0
- package/bundle/node_modules/hash.js/lib/hash/common.js +97 -0
- package/bundle/node_modules/hash.js/lib/hash/hmac.js +51 -0
- package/bundle/node_modules/hash.js/lib/hash/ripemd.js +152 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/1.js +81 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/224.js +33 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/256.js +113 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/384.js +39 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/512.js +336 -0
- package/bundle/node_modules/hash.js/lib/hash/sha/common.js +53 -0
- package/bundle/node_modules/hash.js/lib/hash/sha.js +14 -0
- package/bundle/node_modules/hash.js/lib/hash/utils.js +282 -0
- package/bundle/node_modules/hash.js/lib/hash.js +33 -0
- package/bundle/node_modules/inherits/inherits_browser.js +33 -0
- package/bundle/node_modules/it-length-prefixed/dist/src/decode.js +6 -0
- package/bundle/node_modules/lodash/lodash.js +17207 -0
- package/bundle/node_modules/minimalistic-assert/index.js +13 -0
- package/bundle/node_modules/ms/index.js +172 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base.js +205 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base10.js +9 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base16.js +16 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base2.js +10 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base256emoji.js +41 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base32.js +58 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base36.js +14 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base58.js +14 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base64.js +28 -0
- package/bundle/node_modules/multiformats/dist/src/bases/base8.js +10 -0
- package/bundle/node_modules/multiformats/dist/src/bases/identity.js +11 -0
- package/bundle/node_modules/multiformats/dist/src/basics.js +15 -0
- package/bundle/node_modules/multiformats/dist/src/bytes.js +18 -0
- package/bundle/node_modules/multiformats/dist/src/codecs/json.js +2 -0
- package/bundle/node_modules/multiformats/dist/src/vendor/base-x.js +170 -0
- package/bundle/node_modules/protons-runtime/dist/src/codec.js +20 -0
- package/bundle/node_modules/protons-runtime/dist/src/codecs/enum.js +24 -0
- package/bundle/node_modules/protons-runtime/dist/src/codecs/message.js +7 -0
- package/bundle/node_modules/protons-runtime/dist/src/decode.js +8 -0
- package/bundle/node_modules/protons-runtime/dist/src/encode.js +11 -0
- package/bundle/node_modules/protons-runtime/dist/src/index.js +30 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/float.js +54 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/longbits.js +175 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/pool.js +28 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/reader.js +367 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/utf8.js +99 -0
- package/bundle/node_modules/protons-runtime/dist/src/utils/writer.js +438 -0
- package/bundle/node_modules/uint8-varint/dist/src/index.js +124 -0
- package/bundle/node_modules/uint8arrays/dist/src/alloc.js +17 -0
- package/bundle/node_modules/uint8arrays/dist/src/from-string.js +19 -0
- package/bundle/node_modules/uint8arrays/dist/src/util/bases.js +49 -0
- package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +21 -0
- package/bundle/packages/core/dist/lib/connection_manager/keep_alive_manager.js +18 -0
- package/bundle/packages/core/dist/lib/filter/filter.js +27 -0
- package/bundle/packages/core/dist/lib/light_push/light_push.js +27 -0
- package/bundle/packages/core/dist/lib/message/version_0.js +154 -0
- package/bundle/packages/core/dist/lib/metadata/metadata.js +27 -0
- package/bundle/packages/core/dist/lib/store/store.js +27 -0
- package/bundle/packages/interfaces/dist/connection_manager.js +19 -0
- package/bundle/packages/interfaces/dist/constants.js +6 -0
- package/bundle/packages/interfaces/dist/health_indicator.js +12 -0
- package/bundle/packages/interfaces/dist/protocols.js +92 -0
- package/bundle/packages/proto/dist/generated/filter.js +445 -0
- package/bundle/packages/proto/dist/generated/filter_v2.js +424 -0
- package/bundle/packages/proto/dist/generated/light_push.js +389 -0
- package/bundle/packages/proto/dist/generated/message.js +213 -0
- package/bundle/packages/proto/dist/generated/metadata.js +130 -0
- package/bundle/packages/proto/dist/generated/peer_exchange.js +209 -0
- package/bundle/packages/proto/dist/generated/sds_message.js +105 -0
- package/bundle/packages/proto/dist/generated/store_v3.js +490 -0
- package/bundle/packages/proto/dist/generated/topic_only_message.js +61 -0
- package/bundle/packages/rln/dist/codec.js +93 -0
- package/bundle/packages/rln/dist/contract/abi.js +394 -0
- package/bundle/packages/rln/dist/contract/constants.js +27 -0
- package/bundle/packages/rln/dist/contract/rln_contract.js +438 -0
- package/bundle/packages/rln/dist/create.js +9 -0
- package/bundle/packages/rln/dist/identity.js +30 -0
- package/bundle/packages/rln/dist/keystore/cipher.js +31 -0
- package/bundle/packages/rln/dist/keystore/credential_validation_generated.js +119 -0
- package/bundle/packages/rln/dist/keystore/keystore.js +223 -0
- package/bundle/packages/rln/dist/keystore/keystore_validation_generated.js +74 -0
- package/bundle/packages/rln/dist/keystore/schema_validator.js +20 -0
- package/bundle/packages/rln/dist/message.js +51 -0
- package/bundle/packages/rln/dist/proof.js +54 -0
- package/bundle/packages/rln/dist/resources/verification_key.js +112 -0
- package/bundle/packages/rln/dist/resources/witness_calculator.js +330 -0
- package/bundle/packages/rln/dist/rln.js +220 -0
- package/bundle/packages/rln/dist/root_tracker.js +76 -0
- package/bundle/packages/rln/dist/utils/bytes.js +65 -0
- package/bundle/packages/rln/dist/utils/epoch.js +39 -0
- package/bundle/packages/rln/dist/utils/hash.js +10 -0
- package/bundle/packages/rln/dist/utils/metamask.js +14 -0
- package/bundle/packages/rln/dist/zerokit.js +128 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/checksum.js +52 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/cipher.js +65 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/class.js +99 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/functional.js +103 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/index.js +28 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/kdf.js +78 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/password.js +17 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1253 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation.js +40 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/types.js +5 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +103 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +41 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +17 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +23 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +12 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +77 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/index.js +9 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/md5.js +215 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/nil.js +3 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/parse.js +35 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/regex.js +3 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/rng.js +21 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/stringify.js +31 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v1.js +96 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v3.js +6 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v35.js +66 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v4.js +24 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/v5.js +6 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/validate.js +7 -0
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/uuid/dist/esm-browser/version.js +11 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/_assert.js +52 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +124 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/_u64.js +71 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/cryptoBrowser.js +10 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +88 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +99 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +233 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +133 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +243 -0
- package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +167 -0
- package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/native.js +4 -0
- package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/rng.js +13 -0
- package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/stringify.js +28 -0
- package/bundle/packages/rln/node_modules/uuid/dist/esm-browser/v4.js +19 -0
- package/bundle/packages/utils/dist/bytes/index.js +44 -0
- package/bundle/packages/utils/dist/common/sharding/index.js +91 -0
- package/bundle/packages/utils/dist/logger/index.js +31 -0
- package/bundle/resources/verification_key.d.ts +13 -0
- package/bundle/resources/verification_key.js +112 -0
- package/bundle/resources/witness_calculator.d.ts +11 -0
- package/bundle/resources/witness_calculator.js +328 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/codec.d.ts +5 -5
- package/dist/codec.js +6 -6
- package/dist/codec.js.map +1 -1
- package/dist/contract/abi.d.ts +42 -0
- package/dist/contract/abi.js +393 -0
- package/dist/contract/abi.js.map +1 -0
- package/dist/contract/constants.d.ts +59 -3
- package/dist/contract/constants.js +21 -63
- package/dist/contract/constants.js.map +1 -1
- package/dist/contract/rln_contract.d.ts +98 -17
- package/dist/contract/rln_contract.js +292 -71
- package/dist/contract/rln_contract.js.map +1 -1
- package/dist/identity.js +5 -2
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/keystore/cipher.js +3 -3
- package/dist/keystore/cipher.js.map +1 -1
- package/dist/keystore/credential_validation_generated.js.map +1 -1
- package/dist/keystore/keystore.js +4 -4
- package/dist/keystore/keystore.js.map +1 -1
- package/dist/keystore/keystore_validation_generated.js.map +1 -1
- package/dist/message.js +3 -3
- package/dist/message.js.map +1 -1
- package/dist/proof.js +3 -2
- package/dist/proof.js.map +1 -1
- package/dist/resources/verification_key.d.ts +12 -11
- package/dist/resources/verification_key.js +103 -103
- package/dist/resources/witness_calculator.d.ts +10 -15
- package/dist/resources/witness_calculator.js +302 -265
- package/dist/rln.d.ts +5 -1
- package/dist/rln.js +56 -28
- package/dist/rln.js.map +1 -1
- package/dist/root_tracker.js.map +1 -1
- package/dist/utils/epoch.js +5 -5
- package/dist/utils/epoch.js.map +1 -1
- package/dist/zerokit.d.ts +13 -9
- package/dist/zerokit.js +40 -20
- package/dist/zerokit.js.map +1 -1
- package/package.json +1 -146
- package/src/codec.ts +26 -22
- package/src/contract/abi.ts +392 -0
- package/src/contract/constants.ts +28 -0
- package/src/contract/index.ts +2 -0
- package/src/contract/rln_contract.ts +686 -0
- package/src/identity.ts +8 -4
- package/src/index.ts +4 -9
- package/src/keystore/cipher.ts +54 -0
- package/src/keystore/credential_validation_generated.ts +7 -0
- package/src/keystore/index.ts +5 -0
- package/src/keystore/keystore.ts +330 -0
- package/src/keystore/keystore_validation_generated.ts +7 -0
- package/src/keystore/schema_validator.ts +34 -0
- package/src/keystore/types.ts +36 -0
- package/src/message.ts +10 -10
- package/src/proof.ts +13 -11
- package/src/resources/verification_key.d.ts +13 -0
- package/src/resources/witness_calculator.d.ts +11 -0
- package/src/rln.ts +76 -31
- package/src/root_tracker.ts +7 -6
- package/src/utils/bytes.ts +84 -0
- package/src/utils/epoch.ts +30 -0
- package/src/utils/hash.ts +15 -0
- package/src/utils/index.ts +9 -0
- package/src/utils/metamask.ts +17 -0
- package/src/zerokit.ts +95 -33
- package/bundle/assets/rln_wasm_bg-a503e304.wasm +0 -0
- package/dist/resources/verification_key.js.map +0 -1
- package/dist/resources/witness_calculator.js.map +0 -1
- /package/bundle/{assets/rln-6ded2896.wasm → resources/rln.wasm} +0 -0
- /package/bundle/{assets/rln_final-8b299152.zkey → resources/rln_final.zkey} +0 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
var minimalisticAssert = assert;
|
2
|
+
|
3
|
+
function assert(val, msg) {
|
4
|
+
if (!val)
|
5
|
+
throw new Error(msg || 'Assertion failed');
|
6
|
+
}
|
7
|
+
|
8
|
+
assert.equal = function assertEqual(l, r, msg) {
|
9
|
+
if (l != r)
|
10
|
+
throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
|
11
|
+
};
|
12
|
+
|
13
|
+
export { minimalisticAssert as m };
|
@@ -0,0 +1,172 @@
|
|
1
|
+
/**
|
2
|
+
* Helpers.
|
3
|
+
*/
|
4
|
+
|
5
|
+
var ms;
|
6
|
+
var hasRequiredMs;
|
7
|
+
|
8
|
+
function requireMs () {
|
9
|
+
if (hasRequiredMs) return ms;
|
10
|
+
hasRequiredMs = 1;
|
11
|
+
var s = 1000;
|
12
|
+
var m = s * 60;
|
13
|
+
var h = m * 60;
|
14
|
+
var d = h * 24;
|
15
|
+
var w = d * 7;
|
16
|
+
var y = d * 365.25;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Parse or format the given `val`.
|
20
|
+
*
|
21
|
+
* Options:
|
22
|
+
*
|
23
|
+
* - `long` verbose formatting [false]
|
24
|
+
*
|
25
|
+
* @param {String|Number} val
|
26
|
+
* @param {Object} [options]
|
27
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
28
|
+
* @return {String|Number}
|
29
|
+
* @api public
|
30
|
+
*/
|
31
|
+
|
32
|
+
ms = function (val, options) {
|
33
|
+
options = options || {};
|
34
|
+
var type = typeof val;
|
35
|
+
if (type === 'string' && val.length > 0) {
|
36
|
+
return parse(val);
|
37
|
+
} else if (type === 'number' && isFinite(val)) {
|
38
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
39
|
+
}
|
40
|
+
throw new Error(
|
41
|
+
'val is not a non-empty string or a valid number. val=' +
|
42
|
+
JSON.stringify(val)
|
43
|
+
);
|
44
|
+
};
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Parse the given `str` and return milliseconds.
|
48
|
+
*
|
49
|
+
* @param {String} str
|
50
|
+
* @return {Number}
|
51
|
+
* @api private
|
52
|
+
*/
|
53
|
+
|
54
|
+
function parse(str) {
|
55
|
+
str = String(str);
|
56
|
+
if (str.length > 100) {
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
60
|
+
str
|
61
|
+
);
|
62
|
+
if (!match) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
var n = parseFloat(match[1]);
|
66
|
+
var type = (match[2] || 'ms').toLowerCase();
|
67
|
+
switch (type) {
|
68
|
+
case 'years':
|
69
|
+
case 'year':
|
70
|
+
case 'yrs':
|
71
|
+
case 'yr':
|
72
|
+
case 'y':
|
73
|
+
return n * y;
|
74
|
+
case 'weeks':
|
75
|
+
case 'week':
|
76
|
+
case 'w':
|
77
|
+
return n * w;
|
78
|
+
case 'days':
|
79
|
+
case 'day':
|
80
|
+
case 'd':
|
81
|
+
return n * d;
|
82
|
+
case 'hours':
|
83
|
+
case 'hour':
|
84
|
+
case 'hrs':
|
85
|
+
case 'hr':
|
86
|
+
case 'h':
|
87
|
+
return n * h;
|
88
|
+
case 'minutes':
|
89
|
+
case 'minute':
|
90
|
+
case 'mins':
|
91
|
+
case 'min':
|
92
|
+
case 'm':
|
93
|
+
return n * m;
|
94
|
+
case 'seconds':
|
95
|
+
case 'second':
|
96
|
+
case 'secs':
|
97
|
+
case 'sec':
|
98
|
+
case 's':
|
99
|
+
return n * s;
|
100
|
+
case 'milliseconds':
|
101
|
+
case 'millisecond':
|
102
|
+
case 'msecs':
|
103
|
+
case 'msec':
|
104
|
+
case 'ms':
|
105
|
+
return n;
|
106
|
+
default:
|
107
|
+
return undefined;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Short format for `ms`.
|
113
|
+
*
|
114
|
+
* @param {Number} ms
|
115
|
+
* @return {String}
|
116
|
+
* @api private
|
117
|
+
*/
|
118
|
+
|
119
|
+
function fmtShort(ms) {
|
120
|
+
var msAbs = Math.abs(ms);
|
121
|
+
if (msAbs >= d) {
|
122
|
+
return Math.round(ms / d) + 'd';
|
123
|
+
}
|
124
|
+
if (msAbs >= h) {
|
125
|
+
return Math.round(ms / h) + 'h';
|
126
|
+
}
|
127
|
+
if (msAbs >= m) {
|
128
|
+
return Math.round(ms / m) + 'm';
|
129
|
+
}
|
130
|
+
if (msAbs >= s) {
|
131
|
+
return Math.round(ms / s) + 's';
|
132
|
+
}
|
133
|
+
return ms + 'ms';
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Long format for `ms`.
|
138
|
+
*
|
139
|
+
* @param {Number} ms
|
140
|
+
* @return {String}
|
141
|
+
* @api private
|
142
|
+
*/
|
143
|
+
|
144
|
+
function fmtLong(ms) {
|
145
|
+
var msAbs = Math.abs(ms);
|
146
|
+
if (msAbs >= d) {
|
147
|
+
return plural(ms, msAbs, d, 'day');
|
148
|
+
}
|
149
|
+
if (msAbs >= h) {
|
150
|
+
return plural(ms, msAbs, h, 'hour');
|
151
|
+
}
|
152
|
+
if (msAbs >= m) {
|
153
|
+
return plural(ms, msAbs, m, 'minute');
|
154
|
+
}
|
155
|
+
if (msAbs >= s) {
|
156
|
+
return plural(ms, msAbs, s, 'second');
|
157
|
+
}
|
158
|
+
return ms + ' ms';
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Pluralization helper.
|
163
|
+
*/
|
164
|
+
|
165
|
+
function plural(ms, msAbs, n, name) {
|
166
|
+
var isPlural = msAbs >= n * 1.5;
|
167
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
168
|
+
}
|
169
|
+
return ms;
|
170
|
+
}
|
171
|
+
|
172
|
+
export { requireMs as __require };
|
@@ -0,0 +1,205 @@
|
|
1
|
+
import { coerce } from '../bytes.js';
|
2
|
+
import _brrp__multiformats_scope_baseX from '../vendor/base-x.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Class represents both BaseEncoder and MultibaseEncoder meaning it
|
6
|
+
* can be used to encode to multibase or base encode without multibase
|
7
|
+
* prefix.
|
8
|
+
*/
|
9
|
+
class Encoder {
|
10
|
+
name;
|
11
|
+
prefix;
|
12
|
+
baseEncode;
|
13
|
+
constructor(name, prefix, baseEncode) {
|
14
|
+
this.name = name;
|
15
|
+
this.prefix = prefix;
|
16
|
+
this.baseEncode = baseEncode;
|
17
|
+
}
|
18
|
+
encode(bytes) {
|
19
|
+
if (bytes instanceof Uint8Array) {
|
20
|
+
return `${this.prefix}${this.baseEncode(bytes)}`;
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
throw Error('Unknown type, must be binary type');
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Class represents both BaseDecoder and MultibaseDecoder so it could be used
|
29
|
+
* to decode multibases (with matching prefix) or just base decode strings
|
30
|
+
* with corresponding base encoding.
|
31
|
+
*/
|
32
|
+
class Decoder {
|
33
|
+
name;
|
34
|
+
prefix;
|
35
|
+
baseDecode;
|
36
|
+
prefixCodePoint;
|
37
|
+
constructor(name, prefix, baseDecode) {
|
38
|
+
this.name = name;
|
39
|
+
this.prefix = prefix;
|
40
|
+
const prefixCodePoint = prefix.codePointAt(0);
|
41
|
+
/* c8 ignore next 3 */
|
42
|
+
if (prefixCodePoint === undefined) {
|
43
|
+
throw new Error('Invalid prefix character');
|
44
|
+
}
|
45
|
+
this.prefixCodePoint = prefixCodePoint;
|
46
|
+
this.baseDecode = baseDecode;
|
47
|
+
}
|
48
|
+
decode(text) {
|
49
|
+
if (typeof text === 'string') {
|
50
|
+
if (text.codePointAt(0) !== this.prefixCodePoint) {
|
51
|
+
throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);
|
52
|
+
}
|
53
|
+
return this.baseDecode(text.slice(this.prefix.length));
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
throw Error('Can only multibase decode strings');
|
57
|
+
}
|
58
|
+
}
|
59
|
+
or(decoder) {
|
60
|
+
return or(this, decoder);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
class ComposedDecoder {
|
64
|
+
decoders;
|
65
|
+
constructor(decoders) {
|
66
|
+
this.decoders = decoders;
|
67
|
+
}
|
68
|
+
or(decoder) {
|
69
|
+
return or(this, decoder);
|
70
|
+
}
|
71
|
+
decode(input) {
|
72
|
+
const prefix = input[0];
|
73
|
+
const decoder = this.decoders[prefix];
|
74
|
+
if (decoder != null) {
|
75
|
+
return decoder.decode(input);
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
function or(left, right) {
|
83
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
84
|
+
return new ComposedDecoder({
|
85
|
+
...(left.decoders ?? { [left.prefix]: left }),
|
86
|
+
...(right.decoders ?? { [right.prefix]: right })
|
87
|
+
});
|
88
|
+
}
|
89
|
+
class Codec {
|
90
|
+
name;
|
91
|
+
prefix;
|
92
|
+
baseEncode;
|
93
|
+
baseDecode;
|
94
|
+
encoder;
|
95
|
+
decoder;
|
96
|
+
constructor(name, prefix, baseEncode, baseDecode) {
|
97
|
+
this.name = name;
|
98
|
+
this.prefix = prefix;
|
99
|
+
this.baseEncode = baseEncode;
|
100
|
+
this.baseDecode = baseDecode;
|
101
|
+
this.encoder = new Encoder(name, prefix, baseEncode);
|
102
|
+
this.decoder = new Decoder(name, prefix, baseDecode);
|
103
|
+
}
|
104
|
+
encode(input) {
|
105
|
+
return this.encoder.encode(input);
|
106
|
+
}
|
107
|
+
decode(input) {
|
108
|
+
return this.decoder.decode(input);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
function from({ name, prefix, encode, decode }) {
|
112
|
+
return new Codec(name, prefix, encode, decode);
|
113
|
+
}
|
114
|
+
function baseX({ name, prefix, alphabet }) {
|
115
|
+
const { encode, decode } = _brrp__multiformats_scope_baseX(alphabet, name);
|
116
|
+
return from({
|
117
|
+
prefix,
|
118
|
+
name,
|
119
|
+
encode,
|
120
|
+
decode: (text) => coerce(decode(text))
|
121
|
+
});
|
122
|
+
}
|
123
|
+
function decode(string, alphabet, bitsPerChar, name) {
|
124
|
+
// Build the character lookup table:
|
125
|
+
const codes = {};
|
126
|
+
for (let i = 0; i < alphabet.length; ++i) {
|
127
|
+
codes[alphabet[i]] = i;
|
128
|
+
}
|
129
|
+
// Count the padding bytes:
|
130
|
+
let end = string.length;
|
131
|
+
while (string[end - 1] === '=') {
|
132
|
+
--end;
|
133
|
+
}
|
134
|
+
// Allocate the output:
|
135
|
+
const out = new Uint8Array((end * bitsPerChar / 8) | 0);
|
136
|
+
// Parse the data:
|
137
|
+
let bits = 0; // Number of bits currently in the buffer
|
138
|
+
let buffer = 0; // Bits waiting to be written out, MSB first
|
139
|
+
let written = 0; // Next byte to write
|
140
|
+
for (let i = 0; i < end; ++i) {
|
141
|
+
// Read one character from the string:
|
142
|
+
const value = codes[string[i]];
|
143
|
+
if (value === undefined) {
|
144
|
+
throw new SyntaxError(`Non-${name} character`);
|
145
|
+
}
|
146
|
+
// Append the bits to the buffer:
|
147
|
+
buffer = (buffer << bitsPerChar) | value;
|
148
|
+
bits += bitsPerChar;
|
149
|
+
// Write out some bits if the buffer has a byte's worth:
|
150
|
+
if (bits >= 8) {
|
151
|
+
bits -= 8;
|
152
|
+
out[written++] = 0xff & (buffer >> bits);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
// Verify that we have received just enough bits:
|
156
|
+
if (bits >= bitsPerChar || (0xff & (buffer << (8 - bits))) !== 0) {
|
157
|
+
throw new SyntaxError('Unexpected end of data');
|
158
|
+
}
|
159
|
+
return out;
|
160
|
+
}
|
161
|
+
function encode(data, alphabet, bitsPerChar) {
|
162
|
+
const pad = alphabet[alphabet.length - 1] === '=';
|
163
|
+
const mask = (1 << bitsPerChar) - 1;
|
164
|
+
let out = '';
|
165
|
+
let bits = 0; // Number of bits currently in the buffer
|
166
|
+
let buffer = 0; // Bits waiting to be written out, MSB first
|
167
|
+
for (let i = 0; i < data.length; ++i) {
|
168
|
+
// Slurp data into the buffer:
|
169
|
+
buffer = (buffer << 8) | data[i];
|
170
|
+
bits += 8;
|
171
|
+
// Write out as much as we can:
|
172
|
+
while (bits > bitsPerChar) {
|
173
|
+
bits -= bitsPerChar;
|
174
|
+
out += alphabet[mask & (buffer >> bits)];
|
175
|
+
}
|
176
|
+
}
|
177
|
+
// Partial character:
|
178
|
+
if (bits !== 0) {
|
179
|
+
out += alphabet[mask & (buffer << (bitsPerChar - bits))];
|
180
|
+
}
|
181
|
+
// Add padding characters until we hit a byte boundary:
|
182
|
+
if (pad) {
|
183
|
+
while (((out.length * bitsPerChar) & 7) !== 0) {
|
184
|
+
out += '=';
|
185
|
+
}
|
186
|
+
}
|
187
|
+
return out;
|
188
|
+
}
|
189
|
+
/**
|
190
|
+
* RFC4648 Factory
|
191
|
+
*/
|
192
|
+
function rfc4648({ name, prefix, bitsPerChar, alphabet }) {
|
193
|
+
return from({
|
194
|
+
prefix,
|
195
|
+
name,
|
196
|
+
encode(input) {
|
197
|
+
return encode(input, alphabet, bitsPerChar);
|
198
|
+
},
|
199
|
+
decode(input) {
|
200
|
+
return decode(input, alphabet, bitsPerChar, name);
|
201
|
+
}
|
202
|
+
});
|
203
|
+
}
|
204
|
+
|
205
|
+
export { Codec, baseX, from, or, rfc4648 };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { rfc4648 } from './base.js';
|
2
|
+
|
3
|
+
const base16 = rfc4648({
|
4
|
+
prefix: 'f',
|
5
|
+
name: 'base16',
|
6
|
+
alphabet: '0123456789abcdef',
|
7
|
+
bitsPerChar: 4
|
8
|
+
});
|
9
|
+
const base16upper = rfc4648({
|
10
|
+
prefix: 'F',
|
11
|
+
name: 'base16upper',
|
12
|
+
alphabet: '0123456789ABCDEF',
|
13
|
+
bitsPerChar: 4
|
14
|
+
});
|
15
|
+
|
16
|
+
export { base16, base16upper };
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { from } from './base.js';
|
2
|
+
|
3
|
+
const alphabet = Array.from('🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂');
|
4
|
+
const alphabetBytesToChars = (alphabet.reduce((p, c, i) => { p[i] = c; return p; }, ([])));
|
5
|
+
const alphabetCharsToBytes = (alphabet.reduce((p, c, i) => {
|
6
|
+
const codePoint = c.codePointAt(0);
|
7
|
+
if (codePoint == null) {
|
8
|
+
throw new Error(`Invalid character: ${c}`);
|
9
|
+
}
|
10
|
+
p[codePoint] = i;
|
11
|
+
return p;
|
12
|
+
}, ([])));
|
13
|
+
function encode(data) {
|
14
|
+
return data.reduce((p, c) => {
|
15
|
+
p += alphabetBytesToChars[c];
|
16
|
+
return p;
|
17
|
+
}, '');
|
18
|
+
}
|
19
|
+
function decode(str) {
|
20
|
+
const byts = [];
|
21
|
+
for (const char of str) {
|
22
|
+
const codePoint = char.codePointAt(0);
|
23
|
+
if (codePoint == null) {
|
24
|
+
throw new Error(`Invalid character: ${char}`);
|
25
|
+
}
|
26
|
+
const byt = alphabetCharsToBytes[codePoint];
|
27
|
+
if (byt == null) {
|
28
|
+
throw new Error(`Non-base256emoji character: ${char}`);
|
29
|
+
}
|
30
|
+
byts.push(byt);
|
31
|
+
}
|
32
|
+
return new Uint8Array(byts);
|
33
|
+
}
|
34
|
+
const base256emoji = from({
|
35
|
+
prefix: '🚀',
|
36
|
+
name: 'base256emoji',
|
37
|
+
encode,
|
38
|
+
decode
|
39
|
+
});
|
40
|
+
|
41
|
+
export { base256emoji };
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { rfc4648 } from './base.js';
|
2
|
+
|
3
|
+
const base32 = rfc4648({
|
4
|
+
prefix: 'b',
|
5
|
+
name: 'base32',
|
6
|
+
alphabet: 'abcdefghijklmnopqrstuvwxyz234567',
|
7
|
+
bitsPerChar: 5
|
8
|
+
});
|
9
|
+
const base32upper = rfc4648({
|
10
|
+
prefix: 'B',
|
11
|
+
name: 'base32upper',
|
12
|
+
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
|
13
|
+
bitsPerChar: 5
|
14
|
+
});
|
15
|
+
const base32pad = rfc4648({
|
16
|
+
prefix: 'c',
|
17
|
+
name: 'base32pad',
|
18
|
+
alphabet: 'abcdefghijklmnopqrstuvwxyz234567=',
|
19
|
+
bitsPerChar: 5
|
20
|
+
});
|
21
|
+
const base32padupper = rfc4648({
|
22
|
+
prefix: 'C',
|
23
|
+
name: 'base32padupper',
|
24
|
+
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=',
|
25
|
+
bitsPerChar: 5
|
26
|
+
});
|
27
|
+
const base32hex = rfc4648({
|
28
|
+
prefix: 'v',
|
29
|
+
name: 'base32hex',
|
30
|
+
alphabet: '0123456789abcdefghijklmnopqrstuv',
|
31
|
+
bitsPerChar: 5
|
32
|
+
});
|
33
|
+
const base32hexupper = rfc4648({
|
34
|
+
prefix: 'V',
|
35
|
+
name: 'base32hexupper',
|
36
|
+
alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV',
|
37
|
+
bitsPerChar: 5
|
38
|
+
});
|
39
|
+
const base32hexpad = rfc4648({
|
40
|
+
prefix: 't',
|
41
|
+
name: 'base32hexpad',
|
42
|
+
alphabet: '0123456789abcdefghijklmnopqrstuv=',
|
43
|
+
bitsPerChar: 5
|
44
|
+
});
|
45
|
+
const base32hexpadupper = rfc4648({
|
46
|
+
prefix: 'T',
|
47
|
+
name: 'base32hexpadupper',
|
48
|
+
alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUV=',
|
49
|
+
bitsPerChar: 5
|
50
|
+
});
|
51
|
+
const base32z = rfc4648({
|
52
|
+
prefix: 'h',
|
53
|
+
name: 'base32z',
|
54
|
+
alphabet: 'ybndrfg8ejkmcpqxot1uwisza345h769',
|
55
|
+
bitsPerChar: 5
|
56
|
+
});
|
57
|
+
|
58
|
+
export { base32, base32hex, base32hexpad, base32hexpadupper, base32hexupper, base32pad, base32padupper, base32upper, base32z };
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { baseX } from './base.js';
|
2
|
+
|
3
|
+
const base36 = baseX({
|
4
|
+
prefix: 'k',
|
5
|
+
name: 'base36',
|
6
|
+
alphabet: '0123456789abcdefghijklmnopqrstuvwxyz'
|
7
|
+
});
|
8
|
+
const base36upper = baseX({
|
9
|
+
prefix: 'K',
|
10
|
+
name: 'base36upper',
|
11
|
+
alphabet: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
12
|
+
});
|
13
|
+
|
14
|
+
export { base36, base36upper };
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { baseX } from './base.js';
|
2
|
+
|
3
|
+
const base58btc = baseX({
|
4
|
+
name: 'base58btc',
|
5
|
+
prefix: 'z',
|
6
|
+
alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
7
|
+
});
|
8
|
+
const base58flickr = baseX({
|
9
|
+
name: 'base58flickr',
|
10
|
+
prefix: 'Z',
|
11
|
+
alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
|
12
|
+
});
|
13
|
+
|
14
|
+
export { base58btc, base58flickr };
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { rfc4648 } from './base.js';
|
2
|
+
|
3
|
+
const base64 = rfc4648({
|
4
|
+
prefix: 'm',
|
5
|
+
name: 'base64',
|
6
|
+
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
|
7
|
+
bitsPerChar: 6
|
8
|
+
});
|
9
|
+
const base64pad = rfc4648({
|
10
|
+
prefix: 'M',
|
11
|
+
name: 'base64pad',
|
12
|
+
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
13
|
+
bitsPerChar: 6
|
14
|
+
});
|
15
|
+
const base64url = rfc4648({
|
16
|
+
prefix: 'u',
|
17
|
+
name: 'base64url',
|
18
|
+
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
|
19
|
+
bitsPerChar: 6
|
20
|
+
});
|
21
|
+
const base64urlpad = rfc4648({
|
22
|
+
prefix: 'U',
|
23
|
+
name: 'base64urlpad',
|
24
|
+
alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=',
|
25
|
+
bitsPerChar: 6
|
26
|
+
});
|
27
|
+
|
28
|
+
export { base64, base64pad, base64url, base64urlpad };
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import * as base10 from './bases/base10.js';
|
2
|
+
import * as base16 from './bases/base16.js';
|
3
|
+
import * as base2 from './bases/base2.js';
|
4
|
+
import * as base256emoji from './bases/base256emoji.js';
|
5
|
+
import * as base32 from './bases/base32.js';
|
6
|
+
import * as base36 from './bases/base36.js';
|
7
|
+
import * as base58 from './bases/base58.js';
|
8
|
+
import * as base64 from './bases/base64.js';
|
9
|
+
import * as base8 from './bases/base8.js';
|
10
|
+
import * as identity from './bases/identity.js';
|
11
|
+
import './codecs/json.js';
|
12
|
+
|
13
|
+
const bases = { ...identity, ...base2, ...base8, ...base10, ...base16, ...base32, ...base36, ...base58, ...base64, ...base256emoji };
|
14
|
+
|
15
|
+
export { bases };
|
@@ -0,0 +1,18 @@
|
|
1
|
+
function coerce(o) {
|
2
|
+
if (o instanceof Uint8Array && o.constructor.name === 'Uint8Array')
|
3
|
+
return o;
|
4
|
+
if (o instanceof ArrayBuffer)
|
5
|
+
return new Uint8Array(o);
|
6
|
+
if (ArrayBuffer.isView(o)) {
|
7
|
+
return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
|
8
|
+
}
|
9
|
+
throw new Error('Unknown type, must be binary type');
|
10
|
+
}
|
11
|
+
function fromString(str) {
|
12
|
+
return new TextEncoder().encode(str);
|
13
|
+
}
|
14
|
+
function toString(b) {
|
15
|
+
return new TextDecoder().decode(b);
|
16
|
+
}
|
17
|
+
|
18
|
+
export { coerce, fromString, toString };
|