@pezkuwi/util-crypto 14.0.10 → 14.0.12
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/address/addressToEvm.d.ts +5 -0
- package/address/addressToEvm.js +8 -0
- package/address/check.d.ts +8 -0
- package/address/check.js +26 -0
- package/address/checksum.d.ts +1 -0
- package/address/checksum.js +16 -0
- package/address/decode.d.ts +2 -0
- package/address/decode.js +29 -0
- package/address/defaults.d.ts +6 -0
- package/address/defaults.js +8 -0
- package/address/derive.d.ts +8 -0
- package/address/derive.js +24 -0
- package/address/encode.d.ts +2 -0
- package/address/encode.js +23 -0
- package/address/encodeDerived.d.ts +9 -0
- package/address/encodeDerived.js +12 -0
- package/address/encodeMulti.d.ts +9 -0
- package/address/encodeMulti.js +11 -0
- package/address/eq.d.ts +15 -0
- package/address/eq.js +19 -0
- package/address/evmToAddress.d.ts +7 -0
- package/address/evmToAddress.js +14 -0
- package/address/index.d.ts +16 -0
- package/address/index.js +16 -0
- package/address/is.d.ts +2 -0
- package/address/is.js +9 -0
- package/address/keyDerived.d.ts +2 -0
- package/address/keyDerived.js +8 -0
- package/address/keyMulti.d.ts +2 -0
- package/address/keyMulti.js +8 -0
- package/address/setSS58Format.d.ts +6 -0
- package/address/setSS58Format.js +11 -0
- package/address/sort.d.ts +2 -0
- package/address/sort.js +7 -0
- package/address/sshash.d.ts +1 -0
- package/address/sshash.js +6 -0
- package/address/types.d.ts +1 -0
- package/address/types.js +1 -0
- package/address/util.d.ts +1 -0
- package/address/util.js +4 -0
- package/address/validate.d.ts +2 -0
- package/address/validate.js +4 -0
- package/base32/bs32.d.ts +26 -0
- package/base32/bs32.js +40 -0
- package/base32/helpers.d.ts +25 -0
- package/base32/helpers.js +61 -0
- package/base32/index.d.ts +4 -0
- package/base32/index.js +4 -0
- package/base58/bs58.d.ts +26 -0
- package/base58/bs58.js +34 -0
- package/base58/index.d.ts +4 -0
- package/base58/index.js +4 -0
- package/base64/bs64.d.ts +26 -0
- package/base64/bs64.js +34 -0
- package/base64/index.d.ts +6 -0
- package/base64/index.js +6 -0
- package/base64/pad.d.ts +5 -0
- package/base64/pad.js +7 -0
- package/base64/trim.d.ts +5 -0
- package/base64/trim.js +10 -0
- package/blake2/asU8a.d.ts +20 -0
- package/blake2/asU8a.js +32 -0
- package/blake2/index.d.ts +4 -0
- package/blake2/index.js +4 -0
- package/bn.d.ts +30 -0
- package/bn.js +8 -0
- package/build/blake2/asU8a.d.ts +1 -1
- package/build/bundle-pezkuwi-util-crypto.js +8749 -8246
- package/build/cjs/blake2/asU8a.d.ts +1 -1
- package/build/cjs/keccak/asU8a.d.ts +1 -1
- package/build/cjs/packageInfo.js +1 -1
- package/build/cjs/scrypt/encode.d.ts +1 -1
- package/build/cjs/xxhash/asU8a.d.ts +1 -1
- package/build/keccak/asU8a.d.ts +1 -1
- package/build/package.json +9 -9
- package/build/packageInfo.js +1 -1
- package/build/scrypt/encode.d.ts +1 -1
- package/build/xxhash/asU8a.d.ts +1 -1
- package/build-deno/packageInfo.ts +1 -1
- package/build-tsc/blake2/asU8a.d.ts +1 -1
- package/build-tsc/keccak/asU8a.d.ts +1 -1
- package/build-tsc/scrypt/encode.d.ts +1 -1
- package/build-tsc/xxhash/asU8a.d.ts +1 -1
- package/build-tsc-cjs/packageInfo.js +1 -1
- package/build-tsc-esm/packageInfo.js +1 -1
- package/bundle-pezkuwi-util-crypto.js +8251 -0
- package/bundle.d.ts +26 -0
- package/bundle.js +26 -0
- package/bundleInit.d.ts +1 -0
- package/bundleInit.js +5 -0
- package/cjs/address/addressToEvm.d.ts +5 -0
- package/cjs/address/addressToEvm.js +11 -0
- package/cjs/address/check.d.ts +8 -0
- package/cjs/address/check.js +29 -0
- package/cjs/address/checksum.d.ts +1 -0
- package/cjs/address/checksum.js +19 -0
- package/cjs/address/decode.d.ts +2 -0
- package/cjs/address/decode.js +32 -0
- package/cjs/address/defaults.d.ts +6 -0
- package/cjs/address/defaults.js +11 -0
- package/cjs/address/derive.d.ts +8 -0
- package/cjs/address/derive.js +27 -0
- package/cjs/address/encode.d.ts +2 -0
- package/cjs/address/encode.js +26 -0
- package/cjs/address/encodeDerived.d.ts +9 -0
- package/cjs/address/encodeDerived.js +15 -0
- package/cjs/address/encodeMulti.d.ts +9 -0
- package/cjs/address/encodeMulti.js +14 -0
- package/cjs/address/eq.d.ts +15 -0
- package/cjs/address/eq.js +22 -0
- package/cjs/address/evmToAddress.d.ts +7 -0
- package/cjs/address/evmToAddress.js +17 -0
- package/cjs/address/index.d.ts +16 -0
- package/cjs/address/index.js +35 -0
- package/cjs/address/is.d.ts +2 -0
- package/cjs/address/is.js +12 -0
- package/cjs/address/keyDerived.d.ts +2 -0
- package/cjs/address/keyDerived.js +11 -0
- package/cjs/address/keyMulti.d.ts +2 -0
- package/cjs/address/keyMulti.js +11 -0
- package/cjs/address/setSS58Format.d.ts +6 -0
- package/cjs/address/setSS58Format.js +14 -0
- package/cjs/address/sort.d.ts +2 -0
- package/cjs/address/sort.js +10 -0
- package/cjs/address/sshash.d.ts +1 -0
- package/cjs/address/sshash.js +9 -0
- package/cjs/address/types.d.ts +1 -0
- package/cjs/address/types.js +2 -0
- package/cjs/address/util.d.ts +1 -0
- package/cjs/address/util.js +7 -0
- package/cjs/address/validate.d.ts +2 -0
- package/cjs/address/validate.js +7 -0
- package/cjs/base32/bs32.d.ts +26 -0
- package/cjs/base32/bs32.js +43 -0
- package/cjs/base32/helpers.d.ts +25 -0
- package/cjs/base32/helpers.js +67 -0
- package/cjs/base32/index.d.ts +4 -0
- package/cjs/base32/index.js +11 -0
- package/cjs/base58/bs58.d.ts +26 -0
- package/cjs/base58/bs58.js +37 -0
- package/cjs/base58/index.d.ts +4 -0
- package/cjs/base58/index.js +11 -0
- package/cjs/base64/bs64.d.ts +26 -0
- package/cjs/base64/bs64.js +37 -0
- package/cjs/base64/index.d.ts +6 -0
- package/cjs/base64/index.js +15 -0
- package/cjs/base64/pad.d.ts +5 -0
- package/cjs/base64/pad.js +10 -0
- package/cjs/base64/trim.d.ts +5 -0
- package/cjs/base64/trim.js +13 -0
- package/cjs/blake2/asU8a.d.ts +20 -0
- package/cjs/blake2/asU8a.js +36 -0
- package/cjs/blake2/index.d.ts +4 -0
- package/cjs/blake2/index.js +9 -0
- package/cjs/bn.d.ts +30 -0
- package/cjs/bn.js +11 -0
- package/cjs/bundle.d.ts +26 -0
- package/cjs/bundle.js +31 -0
- package/cjs/bundleInit.d.ts +1 -0
- package/cjs/bundleInit.js +7 -0
- package/cjs/crypto.d.ts +3 -0
- package/cjs/crypto.js +16 -0
- package/cjs/ed25519/deriveHard.d.ts +1 -0
- package/cjs/ed25519/deriveHard.js +12 -0
- package/cjs/ed25519/index.d.ts +10 -0
- package/cjs/ed25519/index.js +20 -0
- package/cjs/ed25519/pair/fromRandom.d.ts +16 -0
- package/cjs/ed25519/pair/fromRandom.js +22 -0
- package/cjs/ed25519/pair/fromSecret.d.ts +16 -0
- package/cjs/ed25519/pair/fromSecret.js +26 -0
- package/cjs/ed25519/pair/fromSeed.d.ts +16 -0
- package/cjs/ed25519/pair/fromSeed.js +34 -0
- package/cjs/ed25519/pair/fromString.d.ts +16 -0
- package/cjs/ed25519/pair/fromString.js +23 -0
- package/cjs/ed25519/sign.d.ts +16 -0
- package/cjs/ed25519/sign.js +33 -0
- package/cjs/ed25519/verify.d.ts +15 -0
- package/cjs/ed25519/verify.js +39 -0
- package/cjs/ethereum/encode.d.ts +2 -0
- package/cjs/ethereum/encode.js +28 -0
- package/cjs/ethereum/index.d.ts +3 -0
- package/cjs/ethereum/index.js +9 -0
- package/cjs/ethereum/isAddress.d.ts +1 -0
- package/cjs/ethereum/isAddress.js +14 -0
- package/cjs/ethereum/isChecksum.d.ts +1 -0
- package/cjs/ethereum/isChecksum.js +20 -0
- package/cjs/hd/ethereum/index.d.ts +2 -0
- package/cjs/hd/ethereum/index.js +47 -0
- package/cjs/hd/index.d.ts +3 -0
- package/cjs/hd/index.js +9 -0
- package/cjs/hd/ledger/derivePrivate.d.ts +1 -0
- package/cjs/hd/ledger/derivePrivate.js +15 -0
- package/cjs/hd/ledger/index.d.ts +2 -0
- package/cjs/hd/ledger/index.js +33 -0
- package/cjs/hd/ledger/master.d.ts +1 -0
- package/cjs/hd/ledger/master.js +19 -0
- package/cjs/hd/validatePath.d.ts +2 -0
- package/cjs/hd/validatePath.js +20 -0
- package/cjs/helpers.d.ts +12 -0
- package/cjs/helpers.js +24 -0
- package/cjs/hmac/index.d.ts +1 -0
- package/cjs/hmac/index.js +7 -0
- package/cjs/hmac/shaAsU8a.d.ts +15 -0
- package/cjs/hmac/shaAsU8a.js +40 -0
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +5 -0
- package/cjs/json/constants.d.ts +6 -0
- package/cjs/json/constants.js +8 -0
- package/cjs/json/decrypt.d.ts +2 -0
- package/cjs/json/decrypt.js +16 -0
- package/cjs/json/decryptData.d.ts +2 -0
- package/cjs/json/decryptData.js +32 -0
- package/cjs/json/encrypt.d.ts +2 -0
- package/cjs/json/encrypt.js +18 -0
- package/cjs/json/encryptFormat.d.ts +2 -0
- package/cjs/json/encryptFormat.js +17 -0
- package/cjs/json/index.d.ts +4 -0
- package/cjs/json/index.js +11 -0
- package/cjs/json/types.d.ts +16 -0
- package/cjs/json/types.js +2 -0
- package/cjs/keccak/asU8a.d.ts +30 -0
- package/cjs/keccak/asU8a.js +36 -0
- package/cjs/keccak/index.d.ts +4 -0
- package/cjs/keccak/index.js +11 -0
- package/cjs/key/DeriveJunction.d.ts +12 -0
- package/cjs/key/DeriveJunction.js +62 -0
- package/cjs/key/extractPath.d.ts +9 -0
- package/cjs/key/extractPath.js +26 -0
- package/cjs/key/extractSuri.d.ts +11 -0
- package/cjs/key/extractSuri.js +25 -0
- package/cjs/key/fromPath.d.ts +3 -0
- package/cjs/key/fromPath.js +21 -0
- package/cjs/key/hdkdDerive.d.ts +3 -0
- package/cjs/key/hdkdDerive.js +11 -0
- package/cjs/key/hdkdEcdsa.d.ts +1 -0
- package/cjs/key/hdkdEcdsa.js +7 -0
- package/cjs/key/hdkdEd25519.d.ts +1 -0
- package/cjs/key/hdkdEd25519.js +6 -0
- package/cjs/key/hdkdSr25519.d.ts +3 -0
- package/cjs/key/hdkdSr25519.js +10 -0
- package/cjs/key/index.d.ts +9 -0
- package/cjs/key/index.js +18 -0
- package/cjs/mnemonic/bip39.d.ts +5 -0
- package/cjs/mnemonic/bip39.js +90 -0
- package/cjs/mnemonic/generate.d.ts +13 -0
- package/cjs/mnemonic/generate.js +23 -0
- package/cjs/mnemonic/index.d.ts +8 -0
- package/cjs/mnemonic/index.js +16 -0
- package/cjs/mnemonic/toEntropy.d.ts +1 -0
- package/cjs/mnemonic/toEntropy.js +11 -0
- package/cjs/mnemonic/toLegacySeed.d.ts +18 -0
- package/cjs/mnemonic/toLegacySeed.js +37 -0
- package/cjs/mnemonic/toMiniSecret.d.ts +1 -0
- package/cjs/mnemonic/toMiniSecret.js +20 -0
- package/cjs/mnemonic/validate.d.ts +14 -0
- package/cjs/mnemonic/validate.js +24 -0
- package/cjs/mnemonic/wordlists/en.d.ts +2 -0
- package/cjs/mnemonic/wordlists/en.js +3 -0
- package/cjs/mnemonic/wordlists/es.d.ts +2 -0
- package/cjs/mnemonic/wordlists/es.js +3 -0
- package/cjs/mnemonic/wordlists/fr.d.ts +2 -0
- package/cjs/mnemonic/wordlists/fr.js +3 -0
- package/cjs/mnemonic/wordlists/index.d.ts +8 -0
- package/cjs/mnemonic/wordlists/index.js +20 -0
- package/cjs/mnemonic/wordlists/it.d.ts +2 -0
- package/cjs/mnemonic/wordlists/it.js +3 -0
- package/cjs/mnemonic/wordlists/jp.d.ts +2 -0
- package/cjs/mnemonic/wordlists/jp.js +3 -0
- package/cjs/mnemonic/wordlists/ko.d.ts +2 -0
- package/cjs/mnemonic/wordlists/ko.js +3 -0
- package/cjs/mnemonic/wordlists/zh-s.d.ts +2 -0
- package/cjs/mnemonic/wordlists/zh-s.js +3 -0
- package/cjs/mnemonic/wordlists/zh-t.d.ts +2 -0
- package/cjs/mnemonic/wordlists/zh-t.js +3 -0
- package/cjs/nacl/decrypt.d.ts +15 -0
- package/cjs/nacl/decrypt.js +21 -0
- package/cjs/nacl/encrypt.d.ts +20 -0
- package/cjs/nacl/encrypt.js +25 -0
- package/cjs/nacl/index.d.ts +5 -0
- package/cjs/nacl/index.js +10 -0
- package/cjs/nacl/tweetnacl.d.ts +2 -0
- package/cjs/nacl/tweetnacl.js +238 -0
- package/cjs/networks.d.ts +1 -0
- package/cjs/networks.js +7 -0
- package/cjs/package.json +3 -0
- package/cjs/packageDetect.d.ts +1 -0
- package/cjs/packageDetect.js +8 -0
- package/cjs/packageInfo.d.ts +6 -0
- package/cjs/packageInfo.js +4 -0
- package/cjs/pbkdf2/encode.d.ts +7 -0
- package/cjs/pbkdf2/encode.js +19 -0
- package/cjs/pbkdf2/index.d.ts +1 -0
- package/cjs/pbkdf2/index.js +5 -0
- package/cjs/random/asNumber.d.ts +15 -0
- package/cjs/random/asNumber.js +23 -0
- package/cjs/random/asU8a.d.ts +20 -0
- package/cjs/random/asU8a.js +28 -0
- package/cjs/random/index.d.ts +5 -0
- package/cjs/random/index.js +11 -0
- package/cjs/scrypt/defaults.d.ts +3 -0
- package/cjs/scrypt/defaults.js +16 -0
- package/cjs/scrypt/encode.d.ts +8 -0
- package/cjs/scrypt/encode.js +18 -0
- package/cjs/scrypt/fromU8a.d.ts +7 -0
- package/cjs/scrypt/fromU8a.js +27 -0
- package/cjs/scrypt/index.d.ts +3 -0
- package/cjs/scrypt/index.js +9 -0
- package/cjs/scrypt/toU8a.d.ts +2 -0
- package/cjs/scrypt/toU8a.js +8 -0
- package/cjs/scrypt/types.d.ts +6 -0
- package/cjs/scrypt/types.js +2 -0
- package/cjs/secp256k1/compress.d.ts +1 -0
- package/cjs/secp256k1/compress.js +17 -0
- package/cjs/secp256k1/deriveHard.d.ts +1 -0
- package/cjs/secp256k1/deriveHard.js +13 -0
- package/cjs/secp256k1/expand.d.ts +1 -0
- package/cjs/secp256k1/expand.js +20 -0
- package/cjs/secp256k1/hasher.d.ts +2 -0
- package/cjs/secp256k1/hasher.js +10 -0
- package/cjs/secp256k1/index.d.ts +7 -0
- package/cjs/secp256k1/index.js +17 -0
- package/cjs/secp256k1/pair/fromSeed.d.ts +6 -0
- package/cjs/secp256k1/pair/fromSeed.js +34 -0
- package/cjs/secp256k1/recover.d.ts +6 -0
- package/cjs/secp256k1/recover.js +29 -0
- package/cjs/secp256k1/sign.d.ts +7 -0
- package/cjs/secp256k1/sign.js +23 -0
- package/cjs/secp256k1/tweakAdd.d.ts +1 -0
- package/cjs/secp256k1/tweakAdd.js +48 -0
- package/cjs/secp256k1/types.d.ts +1 -0
- package/cjs/secp256k1/types.js +2 -0
- package/cjs/secp256k1/verify.d.ts +6 -0
- package/cjs/secp256k1/verify.js +23 -0
- package/cjs/sha/asU8a.d.ts +15 -0
- package/cjs/sha/asU8a.js +22 -0
- package/cjs/sha/index.d.ts +4 -0
- package/cjs/sha/index.js +10 -0
- package/cjs/signature/index.d.ts +4 -0
- package/cjs/signature/index.js +8 -0
- package/cjs/signature/verify.d.ts +2 -0
- package/cjs/signature/verify.js +81 -0
- package/cjs/sr25519/agreement.d.ts +5 -0
- package/cjs/sr25519/agreement.js +20 -0
- package/cjs/sr25519/derive.d.ts +2 -0
- package/cjs/sr25519/derive.js +16 -0
- package/cjs/sr25519/deriveHard.d.ts +1 -0
- package/cjs/sr25519/deriveHard.js +7 -0
- package/cjs/sr25519/derivePublic.d.ts +1 -0
- package/cjs/sr25519/derivePublic.js +16 -0
- package/cjs/sr25519/deriveSoft.d.ts +1 -0
- package/cjs/sr25519/deriveSoft.js +7 -0
- package/cjs/sr25519/index.d.ts +9 -0
- package/cjs/sr25519/index.js +21 -0
- package/cjs/sr25519/pair/fromSeed.d.ts +6 -0
- package/cjs/sr25519/pair/fromSeed.js +22 -0
- package/cjs/sr25519/pair/fromU8a.d.ts +2 -0
- package/cjs/sr25519/pair/fromU8a.js +17 -0
- package/cjs/sr25519/pair/toU8a.d.ts +2 -0
- package/cjs/sr25519/pair/toU8a.js +7 -0
- package/cjs/sr25519/sign.d.ts +6 -0
- package/cjs/sr25519/sign.js +19 -0
- package/cjs/sr25519/verify.d.ts +5 -0
- package/cjs/sr25519/verify.js +21 -0
- package/cjs/sr25519/vrfSign.d.ts +6 -0
- package/cjs/sr25519/vrfSign.js +19 -0
- package/cjs/sr25519/vrfVerify.d.ts +5 -0
- package/cjs/sr25519/vrfVerify.js +22 -0
- package/cjs/types.d.ts +26 -0
- package/cjs/types.js +5 -0
- package/cjs/xxhash/asU8a.d.ts +20 -0
- package/cjs/xxhash/asU8a.js +39 -0
- package/cjs/xxhash/index.d.ts +4 -0
- package/cjs/xxhash/index.js +9 -0
- package/cjs/xxhash/xxhash64.d.ts +1 -0
- package/cjs/xxhash/xxhash64.js +103 -0
- package/crypto.d.ts +3 -0
- package/crypto.js +12 -0
- package/ed25519/deriveHard.d.ts +1 -0
- package/ed25519/deriveHard.js +9 -0
- package/ed25519/index.d.ts +10 -0
- package/ed25519/index.js +10 -0
- package/ed25519/pair/fromRandom.d.ts +16 -0
- package/ed25519/pair/fromRandom.js +19 -0
- package/ed25519/pair/fromSecret.d.ts +16 -0
- package/ed25519/pair/fromSecret.js +23 -0
- package/ed25519/pair/fromSeed.d.ts +16 -0
- package/ed25519/pair/fromSeed.js +31 -0
- package/ed25519/pair/fromString.d.ts +16 -0
- package/ed25519/pair/fromString.js +20 -0
- package/ed25519/sign.d.ts +16 -0
- package/ed25519/sign.js +30 -0
- package/ed25519/verify.d.ts +15 -0
- package/ed25519/verify.js +36 -0
- package/ethereum/encode.d.ts +2 -0
- package/ethereum/encode.js +25 -0
- package/ethereum/index.d.ts +3 -0
- package/ethereum/index.js +3 -0
- package/ethereum/isAddress.d.ts +1 -0
- package/ethereum/isAddress.js +11 -0
- package/ethereum/isChecksum.d.ts +1 -0
- package/ethereum/isChecksum.js +17 -0
- package/hd/ethereum/index.d.ts +2 -0
- package/hd/ethereum/index.js +44 -0
- package/hd/index.d.ts +3 -0
- package/hd/index.js +3 -0
- package/hd/ledger/derivePrivate.d.ts +1 -0
- package/hd/ledger/derivePrivate.js +12 -0
- package/hd/ledger/index.d.ts +2 -0
- package/hd/ledger/index.js +30 -0
- package/hd/ledger/master.d.ts +1 -0
- package/hd/ledger/master.js +16 -0
- package/hd/validatePath.d.ts +2 -0
- package/hd/validatePath.js +16 -0
- package/helpers.d.ts +12 -0
- package/helpers.js +19 -0
- package/hmac/index.d.ts +1 -0
- package/hmac/index.js +1 -0
- package/hmac/shaAsU8a.d.ts +15 -0
- package/hmac/shaAsU8a.js +36 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/json/constants.d.ts +6 -0
- package/json/constants.js +5 -0
- package/json/decrypt.d.ts +2 -0
- package/json/decrypt.js +13 -0
- package/json/decryptData.d.ts +2 -0
- package/json/decryptData.js +29 -0
- package/json/encrypt.d.ts +2 -0
- package/json/encrypt.js +15 -0
- package/json/encryptFormat.d.ts +2 -0
- package/json/encryptFormat.js +14 -0
- package/json/index.d.ts +4 -0
- package/json/index.js +4 -0
- package/json/types.d.ts +16 -0
- package/json/types.js +1 -0
- package/keccak/asU8a.d.ts +30 -0
- package/keccak/asU8a.js +33 -0
- package/keccak/index.d.ts +4 -0
- package/keccak/index.js +4 -0
- package/key/DeriveJunction.d.ts +12 -0
- package/key/DeriveJunction.js +58 -0
- package/key/extractPath.d.ts +9 -0
- package/key/extractPath.js +23 -0
- package/key/extractSuri.d.ts +11 -0
- package/key/extractSuri.js +22 -0
- package/key/fromPath.d.ts +3 -0
- package/key/fromPath.js +18 -0
- package/key/hdkdDerive.d.ts +3 -0
- package/key/hdkdDerive.js +8 -0
- package/key/hdkdEcdsa.d.ts +1 -0
- package/key/hdkdEcdsa.js +4 -0
- package/key/hdkdEd25519.d.ts +1 -0
- package/key/hdkdEd25519.js +3 -0
- package/key/hdkdSr25519.d.ts +3 -0
- package/key/hdkdSr25519.js +7 -0
- package/key/index.d.ts +9 -0
- package/key/index.js +9 -0
- package/mnemonic/bip39.d.ts +5 -0
- package/mnemonic/bip39.js +82 -0
- package/mnemonic/generate.d.ts +13 -0
- package/mnemonic/generate.js +20 -0
- package/mnemonic/index.d.ts +8 -0
- package/mnemonic/index.js +8 -0
- package/mnemonic/toEntropy.d.ts +1 -0
- package/mnemonic/toEntropy.js +8 -0
- package/mnemonic/toLegacySeed.d.ts +18 -0
- package/mnemonic/toLegacySeed.js +34 -0
- package/mnemonic/toMiniSecret.d.ts +1 -0
- package/mnemonic/toMiniSecret.js +17 -0
- package/mnemonic/validate.d.ts +14 -0
- package/mnemonic/validate.js +21 -0
- package/mnemonic/wordlists/en.d.ts +2 -0
- package/mnemonic/wordlists/en.js +1 -0
- package/mnemonic/wordlists/es.d.ts +2 -0
- package/mnemonic/wordlists/es.js +1 -0
- package/mnemonic/wordlists/fr.d.ts +2 -0
- package/mnemonic/wordlists/fr.js +1 -0
- package/mnemonic/wordlists/index.d.ts +8 -0
- package/mnemonic/wordlists/index.js +8 -0
- package/mnemonic/wordlists/it.d.ts +2 -0
- package/mnemonic/wordlists/it.js +1 -0
- package/mnemonic/wordlists/jp.d.ts +2 -0
- package/mnemonic/wordlists/jp.js +1 -0
- package/mnemonic/wordlists/ko.d.ts +2 -0
- package/mnemonic/wordlists/ko.js +1 -0
- package/mnemonic/wordlists/zh-s.d.ts +2 -0
- package/mnemonic/wordlists/zh-s.js +1 -0
- package/mnemonic/wordlists/zh-t.d.ts +2 -0
- package/mnemonic/wordlists/zh-t.js +1 -0
- package/nacl/decrypt.d.ts +15 -0
- package/nacl/decrypt.js +18 -0
- package/nacl/encrypt.d.ts +20 -0
- package/nacl/encrypt.js +22 -0
- package/nacl/index.d.ts +5 -0
- package/nacl/index.js +5 -0
- package/nacl/tweetnacl.d.ts +2 -0
- package/nacl/tweetnacl.js +234 -0
- package/networks.d.ts +1 -0
- package/networks.js +1 -0
- package/package.json +2023 -11
- package/packageDetect.d.ts +1 -0
- package/packageDetect.js +6 -0
- package/packageInfo.d.ts +6 -0
- package/packageInfo.js +1 -0
- package/pbkdf2/encode.d.ts +7 -0
- package/pbkdf2/encode.js +16 -0
- package/pbkdf2/index.d.ts +1 -0
- package/pbkdf2/index.js +1 -0
- package/random/asNumber.d.ts +15 -0
- package/random/asNumber.js +20 -0
- package/random/asU8a.d.ts +20 -0
- package/random/asU8a.js +24 -0
- package/random/index.d.ts +5 -0
- package/random/index.js +5 -0
- package/scrypt/defaults.d.ts +3 -0
- package/scrypt/defaults.js +13 -0
- package/scrypt/encode.d.ts +8 -0
- package/scrypt/encode.js +15 -0
- package/scrypt/fromU8a.d.ts +7 -0
- package/scrypt/fromU8a.js +24 -0
- package/scrypt/index.d.ts +3 -0
- package/scrypt/index.js +3 -0
- package/scrypt/toU8a.d.ts +2 -0
- package/scrypt/toU8a.js +5 -0
- package/scrypt/types.d.ts +6 -0
- package/scrypt/types.js +1 -0
- package/secp256k1/compress.d.ts +1 -0
- package/secp256k1/compress.js +14 -0
- package/secp256k1/deriveHard.d.ts +1 -0
- package/secp256k1/deriveHard.js +10 -0
- package/secp256k1/expand.d.ts +1 -0
- package/secp256k1/expand.js +17 -0
- package/secp256k1/hasher.d.ts +2 -0
- package/secp256k1/hasher.js +7 -0
- package/secp256k1/index.d.ts +7 -0
- package/secp256k1/index.js +7 -0
- package/secp256k1/pair/fromSeed.d.ts +6 -0
- package/secp256k1/pair/fromSeed.js +31 -0
- package/secp256k1/recover.d.ts +6 -0
- package/secp256k1/recover.js +26 -0
- package/secp256k1/sign.d.ts +7 -0
- package/secp256k1/sign.js +20 -0
- package/secp256k1/tweakAdd.d.ts +1 -0
- package/secp256k1/tweakAdd.js +45 -0
- package/secp256k1/types.d.ts +1 -0
- package/secp256k1/types.js +1 -0
- package/secp256k1/verify.d.ts +6 -0
- package/secp256k1/verify.js +20 -0
- package/sha/asU8a.d.ts +15 -0
- package/sha/asU8a.js +19 -0
- package/sha/index.d.ts +4 -0
- package/sha/index.js +4 -0
- package/signature/index.d.ts +4 -0
- package/signature/index.js +4 -0
- package/signature/verify.d.ts +2 -0
- package/signature/verify.js +78 -0
- package/sr25519/agreement.d.ts +5 -0
- package/sr25519/agreement.js +17 -0
- package/sr25519/derive.d.ts +2 -0
- package/sr25519/derive.js +12 -0
- package/sr25519/deriveHard.d.ts +1 -0
- package/sr25519/deriveHard.js +3 -0
- package/sr25519/derivePublic.d.ts +1 -0
- package/sr25519/derivePublic.js +12 -0
- package/sr25519/deriveSoft.d.ts +1 -0
- package/sr25519/deriveSoft.js +3 -0
- package/sr25519/index.d.ts +9 -0
- package/sr25519/index.js +9 -0
- package/sr25519/pair/fromSeed.d.ts +6 -0
- package/sr25519/pair/fromSeed.js +18 -0
- package/sr25519/pair/fromU8a.d.ts +2 -0
- package/sr25519/pair/fromU8a.js +14 -0
- package/sr25519/pair/toU8a.d.ts +2 -0
- package/sr25519/pair/toU8a.js +4 -0
- package/sr25519/sign.d.ts +6 -0
- package/sr25519/sign.js +15 -0
- package/sr25519/verify.d.ts +5 -0
- package/sr25519/verify.js +17 -0
- package/sr25519/vrfSign.d.ts +6 -0
- package/sr25519/vrfSign.js +15 -0
- package/sr25519/vrfVerify.d.ts +5 -0
- package/sr25519/vrfVerify.js +18 -0
- package/src/packageInfo.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.spec.tsbuildinfo +1 -1
- package/types.d.ts +26 -0
- package/types.js +2 -0
- package/xxhash/asU8a.d.ts +20 -0
- package/xxhash/asU8a.js +35 -0
- package/xxhash/index.d.ts +4 -0
- package/xxhash/index.js +4 -0
- package/xxhash/xxhash64.d.ts +1 -0
- package/xxhash/xxhash64.js +100 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.base32Encode = exports.base32Decode = exports.isBase32 = exports.base32Validate = void 0;
|
|
4
|
+
const base_1 = require("@scure/base");
|
|
5
|
+
const helpers_js_1 = require("./helpers.js");
|
|
6
|
+
const chars = 'abcdefghijklmnopqrstuvwxyz234567';
|
|
7
|
+
const config = {
|
|
8
|
+
chars,
|
|
9
|
+
coder: base_1.utils.chain(
|
|
10
|
+
// We define our own chain, the default base32 has padding
|
|
11
|
+
base_1.utils.radix2(5), base_1.utils.alphabet(chars), {
|
|
12
|
+
decode: (input) => input.split(''),
|
|
13
|
+
encode: (input) => input.join('')
|
|
14
|
+
}),
|
|
15
|
+
ipfs: 'b',
|
|
16
|
+
type: 'base32'
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @name base32Validate
|
|
20
|
+
* @summary Validates a base32 value.
|
|
21
|
+
* @description
|
|
22
|
+
* Validates that the supplied value is valid base32, throwing exceptions if not
|
|
23
|
+
*/
|
|
24
|
+
exports.base32Validate = (0, helpers_js_1.createValidate)(config);
|
|
25
|
+
/**
|
|
26
|
+
* @name isBase32
|
|
27
|
+
* @description Checks if the input is in base32, returning true/false
|
|
28
|
+
*/
|
|
29
|
+
exports.isBase32 = (0, helpers_js_1.createIs)(exports.base32Validate);
|
|
30
|
+
/**
|
|
31
|
+
* @name base32Decode
|
|
32
|
+
* @summary Delookup a base32 value.
|
|
33
|
+
* @description
|
|
34
|
+
* From the provided input, decode the base32 and return the result as an `Uint8Array`.
|
|
35
|
+
*/
|
|
36
|
+
exports.base32Decode = (0, helpers_js_1.createDecode)(config, exports.base32Validate);
|
|
37
|
+
/**
|
|
38
|
+
* @name base32Encode
|
|
39
|
+
* @summary Creates a base32 value.
|
|
40
|
+
* @description
|
|
41
|
+
* From the provided input, create the base32 and return the result as a string.
|
|
42
|
+
*/
|
|
43
|
+
exports.base32Encode = (0, helpers_js_1.createEncode)(config);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { U8aLike } from '@pezkuwi/util/types';
|
|
2
|
+
export type { U8aLike } from '@pezkuwi/util/types';
|
|
3
|
+
interface Coder {
|
|
4
|
+
decode: (value: string) => Uint8Array;
|
|
5
|
+
encode: (value: Uint8Array) => string;
|
|
6
|
+
}
|
|
7
|
+
interface Config {
|
|
8
|
+
chars: string;
|
|
9
|
+
coder: Coder;
|
|
10
|
+
ipfs?: string;
|
|
11
|
+
regex?: RegExp;
|
|
12
|
+
type: string;
|
|
13
|
+
withPadding?: boolean;
|
|
14
|
+
}
|
|
15
|
+
type DecodeFn = (value: string, ipfsCompat?: boolean) => Uint8Array;
|
|
16
|
+
type EncodeFn = (value: U8aLike, ipfsCompat?: boolean) => string;
|
|
17
|
+
type ValidateFn = (value?: unknown, ipfsCompat?: boolean) => value is string;
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare function createDecode({ coder, ipfs }: Config, validate: ValidateFn): DecodeFn;
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare function createEncode({ coder, ipfs }: Config): EncodeFn;
|
|
22
|
+
/** @internal */
|
|
23
|
+
export declare function createIs(validate: ValidateFn): ValidateFn;
|
|
24
|
+
/** @internal */
|
|
25
|
+
export declare function createValidate({ chars, ipfs, type, withPadding }: Config): ValidateFn;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDecode = createDecode;
|
|
4
|
+
exports.createEncode = createEncode;
|
|
5
|
+
exports.createIs = createIs;
|
|
6
|
+
exports.createValidate = createValidate;
|
|
7
|
+
const util_1 = require("@pezkuwi/util");
|
|
8
|
+
/** @internal */
|
|
9
|
+
function createDecode({ coder, ipfs }, validate) {
|
|
10
|
+
return (value, ipfsCompat) => {
|
|
11
|
+
validate(value, ipfsCompat);
|
|
12
|
+
return coder.decode(ipfs && ipfsCompat
|
|
13
|
+
? value.substring(1)
|
|
14
|
+
: value);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** @internal */
|
|
18
|
+
function createEncode({ coder, ipfs }) {
|
|
19
|
+
return (value, ipfsCompat) => {
|
|
20
|
+
const out = coder.encode((0, util_1.u8aToU8a)(value));
|
|
21
|
+
return ipfs && ipfsCompat
|
|
22
|
+
? `${ipfs}${out}`
|
|
23
|
+
: out;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
function createIs(validate) {
|
|
28
|
+
return (value, ipfsCompat) => {
|
|
29
|
+
try {
|
|
30
|
+
return validate(value, ipfsCompat);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** @internal */
|
|
38
|
+
function createValidate({ chars, ipfs, type, withPadding }) {
|
|
39
|
+
return (value, ipfsCompat) => {
|
|
40
|
+
if (typeof value !== 'string') {
|
|
41
|
+
throw new Error(`Expected ${type} string input`);
|
|
42
|
+
}
|
|
43
|
+
else if (ipfs && ipfsCompat && !value.startsWith(ipfs)) {
|
|
44
|
+
throw new Error(`Expected ipfs-compatible ${type} to start with '${ipfs}'`);
|
|
45
|
+
}
|
|
46
|
+
for (let i = (ipfsCompat ? 1 : 0), count = value.length; i < count; i++) {
|
|
47
|
+
if (chars.includes(value[i])) {
|
|
48
|
+
// all ok, character found
|
|
49
|
+
}
|
|
50
|
+
else if (withPadding && value[i] === '=') {
|
|
51
|
+
if (i === count - 1) {
|
|
52
|
+
// last character, everything ok
|
|
53
|
+
}
|
|
54
|
+
else if (value[i + 1] === '=') {
|
|
55
|
+
// next one is also padding, sequence ok
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw new Error(`Invalid ${type} padding sequence "${value[i]}${value[i + 1]}" at index ${i}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
throw new Error(`Invalid ${type} character "${value[i]}" (0x${value.charCodeAt(i).toString(16)}) at index ${i}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBase32 = exports.base32Validate = exports.base32Encode = exports.base32Decode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @summary Encode and decode base32 values
|
|
6
|
+
*/
|
|
7
|
+
var bs32_js_1 = require("./bs32.js");
|
|
8
|
+
Object.defineProperty(exports, "base32Decode", { enumerable: true, get: function () { return bs32_js_1.base32Decode; } });
|
|
9
|
+
Object.defineProperty(exports, "base32Encode", { enumerable: true, get: function () { return bs32_js_1.base32Encode; } });
|
|
10
|
+
Object.defineProperty(exports, "base32Validate", { enumerable: true, get: function () { return bs32_js_1.base32Validate; } });
|
|
11
|
+
Object.defineProperty(exports, "isBase32", { enumerable: true, get: function () { return bs32_js_1.isBase32; } });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name base58Validate
|
|
3
|
+
* @summary Validates a base58 value.
|
|
4
|
+
* @description
|
|
5
|
+
* Validates that the supplied value is valid base58, throwing exceptions if not
|
|
6
|
+
*/
|
|
7
|
+
export declare const base58Validate: (value?: unknown, ipfsCompat?: boolean) => value is string;
|
|
8
|
+
/**
|
|
9
|
+
* @name base58Decode
|
|
10
|
+
* @summary Decodes a base58 value.
|
|
11
|
+
* @description
|
|
12
|
+
* From the provided input, decode the base58 and return the result as an `Uint8Array`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const base58Decode: (value: string, ipfsCompat?: boolean) => Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* @name base58Encode
|
|
17
|
+
* @summary Creates a base58 value.
|
|
18
|
+
* @description
|
|
19
|
+
* From the provided input, create the base58 and return the result as a string.
|
|
20
|
+
*/
|
|
21
|
+
export declare const base58Encode: (value: import("@pezkuwi/util/types").U8aLike, ipfsCompat?: boolean) => string;
|
|
22
|
+
/**
|
|
23
|
+
* @name isBase58
|
|
24
|
+
* @description Checks if the input is in base58, returning true/false
|
|
25
|
+
*/
|
|
26
|
+
export declare const isBase58: (value?: unknown, ipfsCompat?: boolean) => value is string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBase58 = exports.base58Encode = exports.base58Decode = exports.base58Validate = void 0;
|
|
4
|
+
const base_1 = require("@scure/base");
|
|
5
|
+
const helpers_js_1 = require("../base32/helpers.js");
|
|
6
|
+
const config = {
|
|
7
|
+
chars: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz',
|
|
8
|
+
coder: base_1.base58,
|
|
9
|
+
ipfs: 'z',
|
|
10
|
+
type: 'base58'
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @name base58Validate
|
|
14
|
+
* @summary Validates a base58 value.
|
|
15
|
+
* @description
|
|
16
|
+
* Validates that the supplied value is valid base58, throwing exceptions if not
|
|
17
|
+
*/
|
|
18
|
+
exports.base58Validate = (0, helpers_js_1.createValidate)(config);
|
|
19
|
+
/**
|
|
20
|
+
* @name base58Decode
|
|
21
|
+
* @summary Decodes a base58 value.
|
|
22
|
+
* @description
|
|
23
|
+
* From the provided input, decode the base58 and return the result as an `Uint8Array`.
|
|
24
|
+
*/
|
|
25
|
+
exports.base58Decode = (0, helpers_js_1.createDecode)(config, exports.base58Validate);
|
|
26
|
+
/**
|
|
27
|
+
* @name base58Encode
|
|
28
|
+
* @summary Creates a base58 value.
|
|
29
|
+
* @description
|
|
30
|
+
* From the provided input, create the base58 and return the result as a string.
|
|
31
|
+
*/
|
|
32
|
+
exports.base58Encode = (0, helpers_js_1.createEncode)(config);
|
|
33
|
+
/**
|
|
34
|
+
* @name isBase58
|
|
35
|
+
* @description Checks if the input is in base58, returning true/false
|
|
36
|
+
*/
|
|
37
|
+
exports.isBase58 = (0, helpers_js_1.createIs)(exports.base58Validate);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBase58 = exports.base58Validate = exports.base58Encode = exports.base58Decode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @summary Encode and decode base58 values
|
|
6
|
+
*/
|
|
7
|
+
var bs58_js_1 = require("./bs58.js");
|
|
8
|
+
Object.defineProperty(exports, "base58Decode", { enumerable: true, get: function () { return bs58_js_1.base58Decode; } });
|
|
9
|
+
Object.defineProperty(exports, "base58Encode", { enumerable: true, get: function () { return bs58_js_1.base58Encode; } });
|
|
10
|
+
Object.defineProperty(exports, "base58Validate", { enumerable: true, get: function () { return bs58_js_1.base58Validate; } });
|
|
11
|
+
Object.defineProperty(exports, "isBase58", { enumerable: true, get: function () { return bs58_js_1.isBase58; } });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name base64Validate
|
|
3
|
+
* @summary Validates a base64 value.
|
|
4
|
+
* @description
|
|
5
|
+
* Validates that the supplied value is valid base64
|
|
6
|
+
*/
|
|
7
|
+
export declare const base64Validate: (value?: unknown, ipfsCompat?: boolean) => value is string;
|
|
8
|
+
/**
|
|
9
|
+
* @name isBase64
|
|
10
|
+
* @description Checks if the input is in base64, returning true/false
|
|
11
|
+
*/
|
|
12
|
+
export declare const isBase64: (value?: unknown, ipfsCompat?: boolean) => value is string;
|
|
13
|
+
/**
|
|
14
|
+
* @name base64Decode
|
|
15
|
+
* @summary Decodes a base64 value.
|
|
16
|
+
* @description
|
|
17
|
+
* From the provided input, decode the base64 and return the result as an `Uint8Array`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const base64Decode: (value: string, ipfsCompat?: boolean) => Uint8Array;
|
|
20
|
+
/**
|
|
21
|
+
* @name base64Encode
|
|
22
|
+
* @summary Creates a base64 value.
|
|
23
|
+
* @description
|
|
24
|
+
* From the provided input, create the base64 and return the result as a string.
|
|
25
|
+
*/
|
|
26
|
+
export declare const base64Encode: (value: import("@pezkuwi/util/types").U8aLike, ipfsCompat?: boolean) => string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.base64Encode = exports.base64Decode = exports.isBase64 = exports.base64Validate = void 0;
|
|
4
|
+
const base_1 = require("@scure/base");
|
|
5
|
+
const helpers_js_1 = require("../base32/helpers.js");
|
|
6
|
+
const config = {
|
|
7
|
+
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
|
|
8
|
+
coder: base_1.base64,
|
|
9
|
+
type: 'base64',
|
|
10
|
+
withPadding: true
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @name base64Validate
|
|
14
|
+
* @summary Validates a base64 value.
|
|
15
|
+
* @description
|
|
16
|
+
* Validates that the supplied value is valid base64
|
|
17
|
+
*/
|
|
18
|
+
exports.base64Validate = (0, helpers_js_1.createValidate)(config);
|
|
19
|
+
/**
|
|
20
|
+
* @name isBase64
|
|
21
|
+
* @description Checks if the input is in base64, returning true/false
|
|
22
|
+
*/
|
|
23
|
+
exports.isBase64 = (0, helpers_js_1.createIs)(exports.base64Validate);
|
|
24
|
+
/**
|
|
25
|
+
* @name base64Decode
|
|
26
|
+
* @summary Decodes a base64 value.
|
|
27
|
+
* @description
|
|
28
|
+
* From the provided input, decode the base64 and return the result as an `Uint8Array`.
|
|
29
|
+
*/
|
|
30
|
+
exports.base64Decode = (0, helpers_js_1.createDecode)(config, exports.base64Validate);
|
|
31
|
+
/**
|
|
32
|
+
* @name base64Encode
|
|
33
|
+
* @summary Creates a base64 value.
|
|
34
|
+
* @description
|
|
35
|
+
* From the provided input, create the base64 and return the result as a string.
|
|
36
|
+
*/
|
|
37
|
+
exports.base64Encode = (0, helpers_js_1.createEncode)(config);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.base64Trim = exports.base64Pad = exports.isBase64 = exports.base64Validate = exports.base64Encode = exports.base64Decode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @summary Encode and decode base64 values
|
|
6
|
+
*/
|
|
7
|
+
var bs64_js_1 = require("./bs64.js");
|
|
8
|
+
Object.defineProperty(exports, "base64Decode", { enumerable: true, get: function () { return bs64_js_1.base64Decode; } });
|
|
9
|
+
Object.defineProperty(exports, "base64Encode", { enumerable: true, get: function () { return bs64_js_1.base64Encode; } });
|
|
10
|
+
Object.defineProperty(exports, "base64Validate", { enumerable: true, get: function () { return bs64_js_1.base64Validate; } });
|
|
11
|
+
Object.defineProperty(exports, "isBase64", { enumerable: true, get: function () { return bs64_js_1.isBase64; } });
|
|
12
|
+
var pad_js_1 = require("./pad.js");
|
|
13
|
+
Object.defineProperty(exports, "base64Pad", { enumerable: true, get: function () { return pad_js_1.base64Pad; } });
|
|
14
|
+
var trim_js_1 = require("./trim.js");
|
|
15
|
+
Object.defineProperty(exports, "base64Trim", { enumerable: true, get: function () { return trim_js_1.base64Trim; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.base64Pad = base64Pad;
|
|
4
|
+
/**
|
|
5
|
+
* @name base64Pad
|
|
6
|
+
* @description Adds padding characters for correct length
|
|
7
|
+
*/
|
|
8
|
+
function base64Pad(value) {
|
|
9
|
+
return value.padEnd(value.length + (value.length % 4), '=');
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.base64Trim = base64Trim;
|
|
4
|
+
/**
|
|
5
|
+
* @name base64Trim
|
|
6
|
+
* @description Trims padding characters
|
|
7
|
+
*/
|
|
8
|
+
function base64Trim(value) {
|
|
9
|
+
while (value.length && value.endsWith('=')) {
|
|
10
|
+
value = value.slice(0, -1);
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name blake2AsU8a
|
|
3
|
+
* @summary Creates a blake2b u8a from the input.
|
|
4
|
+
* @description
|
|
5
|
+
* From a `Uint8Array` input, create the blake2b and return the result as a u8a with the specified `bitLength`.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { blake2AsU8a } from '@pezkuwi/util-crypto';
|
|
11
|
+
*
|
|
12
|
+
* blake2AsU8a('abc'); // => [0xba, 0x80, 0xa5, 0x3f, 0x98, 0x1c, 0x4d, 0x0d]
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function blake2AsU8a(data: string | Uint8Array, bitLength?: 64 | 128 | 256 | 384 | 512, key?: Uint8Array | null, onlyJs?: boolean): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* @name blake2AsHex
|
|
18
|
+
* @description Creates a blake2b hex from the input.
|
|
19
|
+
*/
|
|
20
|
+
export declare const blake2AsHex: (data: string | Uint8Array, bitLength?: 256 | 512 | 64 | 128 | 384 | undefined, key?: Uint8Array | null | undefined, onlyJs?: boolean | undefined) => import("@pezkuwi/util/types").HexString;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.blake2AsHex = void 0;
|
|
4
|
+
exports.blake2AsU8a = blake2AsU8a;
|
|
5
|
+
const blake2b_1 = require("@noble/hashes/blake2b");
|
|
6
|
+
const util_1 = require("@pezkuwi/util");
|
|
7
|
+
const wasm_crypto_1 = require("@pezkuwi/wasm-crypto");
|
|
8
|
+
const helpers_js_1 = require("../helpers.js");
|
|
9
|
+
/**
|
|
10
|
+
* @name blake2AsU8a
|
|
11
|
+
* @summary Creates a blake2b u8a from the input.
|
|
12
|
+
* @description
|
|
13
|
+
* From a `Uint8Array` input, create the blake2b and return the result as a u8a with the specified `bitLength`.
|
|
14
|
+
* @example
|
|
15
|
+
* <BR>
|
|
16
|
+
*
|
|
17
|
+
* ```javascript
|
|
18
|
+
* import { blake2AsU8a } from '@pezkuwi/util-crypto';
|
|
19
|
+
*
|
|
20
|
+
* blake2AsU8a('abc'); // => [0xba, 0x80, 0xa5, 0x3f, 0x98, 0x1c, 0x4d, 0x0d]
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function blake2AsU8a(data, bitLength = 256, key, onlyJs) {
|
|
24
|
+
const byteLength = Math.ceil(bitLength / 8);
|
|
25
|
+
const u8a = (0, util_1.u8aToU8a)(data);
|
|
26
|
+
return !util_1.hasBigInt || (!onlyJs && (0, wasm_crypto_1.isReady)())
|
|
27
|
+
? (0, wasm_crypto_1.blake2b)(u8a, (0, util_1.u8aToU8a)(key), byteLength)
|
|
28
|
+
: key
|
|
29
|
+
? (0, blake2b_1.blake2b)(u8a, { dkLen: byteLength, key })
|
|
30
|
+
: (0, blake2b_1.blake2b)(u8a, { dkLen: byteLength });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @name blake2AsHex
|
|
34
|
+
* @description Creates a blake2b hex from the input.
|
|
35
|
+
*/
|
|
36
|
+
exports.blake2AsHex = (0, helpers_js_1.createAsHex)(blake2AsU8a);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.blake2AsU8a = exports.blake2AsHex = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @summary Create blake2b values with specified bitlengths
|
|
6
|
+
*/
|
|
7
|
+
var asU8a_js_1 = require("./asU8a.js");
|
|
8
|
+
Object.defineProperty(exports, "blake2AsHex", { enumerable: true, get: function () { return asU8a_js_1.blake2AsHex; } });
|
|
9
|
+
Object.defineProperty(exports, "blake2AsU8a", { enumerable: true, get: function () { return asU8a_js_1.blake2AsU8a; } });
|
package/cjs/bn.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const BN_BE_OPTS: {
|
|
2
|
+
isLe: boolean;
|
|
3
|
+
};
|
|
4
|
+
export declare const BN_LE_OPTS: {
|
|
5
|
+
isLe: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const BN_LE_16_OPTS: {
|
|
8
|
+
bitLength: number;
|
|
9
|
+
isLe: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const BN_BE_32_OPTS: {
|
|
12
|
+
bitLength: number;
|
|
13
|
+
isLe: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const BN_LE_32_OPTS: {
|
|
16
|
+
bitLength: number;
|
|
17
|
+
isLe: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare const BN_BE_256_OPTS: {
|
|
20
|
+
bitLength: number;
|
|
21
|
+
isLe: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const BN_LE_256_OPTS: {
|
|
24
|
+
bitLength: number;
|
|
25
|
+
isLe: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare const BN_LE_512_OPTS: {
|
|
28
|
+
bitLength: number;
|
|
29
|
+
isLe: boolean;
|
|
30
|
+
};
|
package/cjs/bn.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BN_LE_512_OPTS = exports.BN_LE_256_OPTS = exports.BN_BE_256_OPTS = exports.BN_LE_32_OPTS = exports.BN_BE_32_OPTS = exports.BN_LE_16_OPTS = exports.BN_LE_OPTS = exports.BN_BE_OPTS = void 0;
|
|
4
|
+
exports.BN_BE_OPTS = { isLe: false };
|
|
5
|
+
exports.BN_LE_OPTS = { isLe: true };
|
|
6
|
+
exports.BN_LE_16_OPTS = { bitLength: 16, isLe: true };
|
|
7
|
+
exports.BN_BE_32_OPTS = { bitLength: 32, isLe: false };
|
|
8
|
+
exports.BN_LE_32_OPTS = { bitLength: 32, isLe: true };
|
|
9
|
+
exports.BN_BE_256_OPTS = { bitLength: 256, isLe: false };
|
|
10
|
+
exports.BN_LE_256_OPTS = { bitLength: 256, isLe: true };
|
|
11
|
+
exports.BN_LE_512_OPTS = { bitLength: 512, isLe: true };
|
package/cjs/bundle.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import './bundleInit.js';
|
|
2
|
+
export { packageInfo } from './packageInfo.js';
|
|
3
|
+
export * from './address/index.js';
|
|
4
|
+
export * from './base32/index.js';
|
|
5
|
+
export * from './base58/index.js';
|
|
6
|
+
export * from './base64/index.js';
|
|
7
|
+
export * from './blake2/index.js';
|
|
8
|
+
export * from './crypto.js';
|
|
9
|
+
export * from './ed25519/index.js';
|
|
10
|
+
export * from './ethereum/index.js';
|
|
11
|
+
export * from './hd/index.js';
|
|
12
|
+
export * from './hmac/index.js';
|
|
13
|
+
export * from './json/index.js';
|
|
14
|
+
export * from './keccak/index.js';
|
|
15
|
+
export * from './key/index.js';
|
|
16
|
+
export * from './mnemonic/index.js';
|
|
17
|
+
export * from './nacl/index.js';
|
|
18
|
+
export * from './networks.js';
|
|
19
|
+
export * from './pbkdf2/index.js';
|
|
20
|
+
export * from './random/index.js';
|
|
21
|
+
export * from './scrypt/index.js';
|
|
22
|
+
export * from './secp256k1/index.js';
|
|
23
|
+
export * from './sha/index.js';
|
|
24
|
+
export * from './signature/index.js';
|
|
25
|
+
export * from './sr25519/index.js';
|
|
26
|
+
export * from './xxhash/index.js';
|
package/cjs/bundle.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.packageInfo = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
require("./bundleInit.js");
|
|
6
|
+
var packageInfo_js_1 = require("./packageInfo.js");
|
|
7
|
+
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
|
8
|
+
tslib_1.__exportStar(require("./address/index.js"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./base32/index.js"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./base58/index.js"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./base64/index.js"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./blake2/index.js"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./crypto.js"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./ed25519/index.js"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./ethereum/index.js"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./hd/index.js"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./hmac/index.js"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./json/index.js"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./keccak/index.js"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./key/index.js"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./mnemonic/index.js"), exports);
|
|
22
|
+
tslib_1.__exportStar(require("./nacl/index.js"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./networks.js"), exports);
|
|
24
|
+
tslib_1.__exportStar(require("./pbkdf2/index.js"), exports);
|
|
25
|
+
tslib_1.__exportStar(require("./random/index.js"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./scrypt/index.js"), exports);
|
|
27
|
+
tslib_1.__exportStar(require("./secp256k1/index.js"), exports);
|
|
28
|
+
tslib_1.__exportStar(require("./sha/index.js"), exports);
|
|
29
|
+
tslib_1.__exportStar(require("./signature/index.js"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./sr25519/index.js"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./xxhash/index.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@pezkuwi/x-bigint/shim';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("@pezkuwi/x-bigint/shim");
|
|
4
|
+
const crypto_js_1 = require("./crypto.js");
|
|
5
|
+
(0, crypto_js_1.cryptoWaitReady)().catch(() => {
|
|
6
|
+
// shouldn't happen, logged and caught inside cryptoWaitReady
|
|
7
|
+
});
|
package/cjs/crypto.d.ts
ADDED
package/cjs/crypto.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cryptoIsReady = void 0;
|
|
4
|
+
exports.cryptoWaitReady = cryptoWaitReady;
|
|
5
|
+
const wasm_crypto_1 = require("@pezkuwi/wasm-crypto");
|
|
6
|
+
exports.cryptoIsReady = wasm_crypto_1.isReady;
|
|
7
|
+
function cryptoWaitReady() {
|
|
8
|
+
return (0, wasm_crypto_1.waitReady)()
|
|
9
|
+
.then(() => {
|
|
10
|
+
if (!(0, wasm_crypto_1.isReady)()) {
|
|
11
|
+
throw new Error('Unable to initialize @pezkuwi/util-crypto');
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
})
|
|
15
|
+
.catch(() => false);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ed25519DeriveHard(seed: Uint8Array, chainCode: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ed25519DeriveHard = ed25519DeriveHard;
|
|
4
|
+
const util_1 = require("@pezkuwi/util");
|
|
5
|
+
const asU8a_js_1 = require("../blake2/asU8a.js");
|
|
6
|
+
const HDKD = (0, util_1.compactAddLength)((0, util_1.stringToU8a)('Ed25519HDKD'));
|
|
7
|
+
function ed25519DeriveHard(seed, chainCode) {
|
|
8
|
+
if (!(0, util_1.isU8a)(chainCode) || chainCode.length !== 32) {
|
|
9
|
+
throw new Error('Invalid chainCode passed to derive');
|
|
10
|
+
}
|
|
11
|
+
return (0, asU8a_js_1.blake2AsU8a)((0, util_1.u8aConcat)(HDKD, seed, chainCode));
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary Implements ed25519 operations
|
|
3
|
+
*/
|
|
4
|
+
export { ed25519DeriveHard } from './deriveHard.js';
|
|
5
|
+
export { ed25519PairFromRandom } from './pair/fromRandom.js';
|
|
6
|
+
export { ed25519PairFromSecret } from './pair/fromSecret.js';
|
|
7
|
+
export { ed25519PairFromSeed } from './pair/fromSeed.js';
|
|
8
|
+
export { ed25519PairFromString } from './pair/fromString.js';
|
|
9
|
+
export { ed25519Sign } from './sign.js';
|
|
10
|
+
export { ed25519Verify } from './verify.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ed25519Verify = exports.ed25519Sign = exports.ed25519PairFromString = exports.ed25519PairFromSeed = exports.ed25519PairFromSecret = exports.ed25519PairFromRandom = exports.ed25519DeriveHard = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @summary Implements ed25519 operations
|
|
6
|
+
*/
|
|
7
|
+
var deriveHard_js_1 = require("./deriveHard.js");
|
|
8
|
+
Object.defineProperty(exports, "ed25519DeriveHard", { enumerable: true, get: function () { return deriveHard_js_1.ed25519DeriveHard; } });
|
|
9
|
+
var fromRandom_js_1 = require("./pair/fromRandom.js");
|
|
10
|
+
Object.defineProperty(exports, "ed25519PairFromRandom", { enumerable: true, get: function () { return fromRandom_js_1.ed25519PairFromRandom; } });
|
|
11
|
+
var fromSecret_js_1 = require("./pair/fromSecret.js");
|
|
12
|
+
Object.defineProperty(exports, "ed25519PairFromSecret", { enumerable: true, get: function () { return fromSecret_js_1.ed25519PairFromSecret; } });
|
|
13
|
+
var fromSeed_js_1 = require("./pair/fromSeed.js");
|
|
14
|
+
Object.defineProperty(exports, "ed25519PairFromSeed", { enumerable: true, get: function () { return fromSeed_js_1.ed25519PairFromSeed; } });
|
|
15
|
+
var fromString_js_1 = require("./pair/fromString.js");
|
|
16
|
+
Object.defineProperty(exports, "ed25519PairFromString", { enumerable: true, get: function () { return fromString_js_1.ed25519PairFromString; } });
|
|
17
|
+
var sign_js_1 = require("./sign.js");
|
|
18
|
+
Object.defineProperty(exports, "ed25519Sign", { enumerable: true, get: function () { return sign_js_1.ed25519Sign; } });
|
|
19
|
+
var verify_js_1 = require("./verify.js");
|
|
20
|
+
Object.defineProperty(exports, "ed25519Verify", { enumerable: true, get: function () { return verify_js_1.ed25519Verify; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Keypair } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @name ed25519PairFromRandom
|
|
4
|
+
* @summary Creates a new public/secret keypair.
|
|
5
|
+
* @description
|
|
6
|
+
* Returns a new generate object containing a `publicKey` & `secretKey`.
|
|
7
|
+
* @example
|
|
8
|
+
* <BR>
|
|
9
|
+
*
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import { ed25519PairFromRandom } from '@pezkuwi/util-crypto';
|
|
12
|
+
*
|
|
13
|
+
* ed25519PairFromRandom(); // => { secretKey: [...], publicKey: [...] }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function ed25519PairFromRandom(): Keypair;
|