@pezkuwi/util-crypto 14.0.1 → 14.0.3
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/LICENSE +201 -0
- package/README.md +4 -4
- 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/{src/address/eq.ts → address/eq.js} +2 -7
- package/address/evmToAddress.d.ts +7 -0
- package/address/evmToAddress.js +14 -0
- package/{src/address/index.ts → address/index.d.ts} +0 -5
- 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/{src/base32/bs32.ts → base32/bs32.js} +8 -21
- package/base32/helpers.d.ts +25 -0
- package/base32/helpers.js +61 -0
- package/{src/base32/index.ts → base32/index.d.ts} +0 -4
- package/base32/index.js +4 -0
- package/base58/bs58.d.ts +26 -0
- package/{src/base58/bs58.ts → base58/bs58.js} +4 -13
- package/{src/base58/index.ts → base58/index.d.ts} +0 -4
- package/base58/index.js +4 -0
- package/base64/bs64.d.ts +26 -0
- package/{src/base64/bs64.ts → base64/bs64.js} +4 -13
- package/{src/base64/index.ts → base64/index.d.ts} +0 -4
- 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/{src/blake2/asU8a.ts → blake2/asU8a.js} +8 -16
- package/{src/blake2/index.ts → blake2/index.d.ts} +0 -4
- package/blake2/index.js +4 -0
- package/bn.d.ts +30 -0
- package/{src/bn.ts → bn.js} +0 -7
- package/bundle-polkadot-util-crypto.js +11813 -0
- package/{src/bundle.ts → bundle.d.ts} +0 -7
- 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/{src/ed25519/index.ts → cjs/ed25519/index.d.ts} +0 -3
- 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/{src/ed25519/pair/fromSecret.ts → cjs/ed25519/pair/fromSecret.js} +11 -14
- 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/{src/ethereum/index.ts → cjs/ethereum/index.d.ts} +0 -3
- 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/{src/hd/index.ts → cjs/hd/index.d.ts} +0 -3
- 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/{src/json/index.ts → cjs/json/index.d.ts} +0 -3
- 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/{src/keccak/index.ts → cjs/keccak/index.d.ts} +0 -4
- 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/{src/key/index.ts → cjs/key/index.d.ts} +0 -3
- 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/{src/mnemonic/index.ts → cjs/mnemonic/index.d.ts} +0 -3
- 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/{src/mnemonic/wordlists/index.ts → cjs/mnemonic/wordlists/index.d.ts} +0 -3
- 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/{src/nacl/index.ts → cjs/nacl/index.d.ts} +0 -3
- 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/{src/random/index.ts → cjs/random/index.d.ts} +0 -4
- 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/{src/scrypt/index.ts → cjs/scrypt/index.d.ts} +0 -3
- 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/{src/secp256k1/index.ts → cjs/secp256k1/index.d.ts} +0 -3
- 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/{src/sha/index.ts → cjs/sha/index.d.ts} +0 -4
- 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/{src/sr25519/index.ts → cjs/sr25519/index.d.ts} +0 -3
- 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/{src/xxhash/index.ts → cjs/xxhash/index.d.ts} +0 -4
- 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/{src/ed25519/pair/fromRandom.ts → ed25519/pair/fromRandom.js} +2 -8
- package/ed25519/pair/fromSecret.d.ts +16 -0
- package/ed25519/pair/fromSecret.js +23 -0
- package/ed25519/pair/fromSeed.d.ts +16 -0
- package/{src/ed25519/pair/fromSeed.ts → ed25519/pair/fromSeed.js} +11 -21
- package/ed25519/pair/fromString.d.ts +16 -0
- package/{src/ed25519/pair/fromString.ts → ed25519/pair/fromString.js} +2 -13
- 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/{src/hmac/shaAsU8a.ts → hmac/shaAsU8a.js} +11 -23
- 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/{src/keccak/asU8a.ts → keccak/asU8a.js} +1 -13
- 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/{src/key/hdkdEcdsa.ts → key/hdkdEcdsa.js} +0 -4
- package/key/hdkdEd25519.d.ts +1 -0
- package/{src/key/hdkdEd25519.ts → key/hdkdEd25519.js} +0 -4
- 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/{src/mnemonic/generate.ts → mnemonic/generate.js} +4 -9
- 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/{src/mnemonic/toLegacySeed.ts → mnemonic/toLegacySeed.js} +12 -17
- package/mnemonic/toMiniSecret.d.ts +1 -0
- package/mnemonic/toMiniSecret.js +17 -0
- package/mnemonic/validate.d.ts +14 -0
- package/{src/mnemonic/validate.ts → mnemonic/validate.js} +4 -9
- package/mnemonic/wordlists/en.d.ts +2 -0
- package/{src/mnemonic/wordlists/en.ts → mnemonic/wordlists/en.js} +0 -6
- package/mnemonic/wordlists/es.d.ts +2 -0
- package/{src/mnemonic/wordlists/es.ts → mnemonic/wordlists/es.js} +0 -6
- package/mnemonic/wordlists/fr.d.ts +2 -0
- package/{src/mnemonic/wordlists/fr.ts → mnemonic/wordlists/fr.js} +0 -6
- package/mnemonic/wordlists/index.d.ts +8 -0
- package/mnemonic/wordlists/index.js +8 -0
- package/mnemonic/wordlists/it.d.ts +2 -0
- package/{src/mnemonic/wordlists/it.ts → mnemonic/wordlists/it.js} +0 -6
- package/mnemonic/wordlists/jp.d.ts +2 -0
- package/{src/mnemonic/wordlists/jp.ts → mnemonic/wordlists/jp.js} +0 -6
- package/mnemonic/wordlists/ko.d.ts +2 -0
- package/{src/mnemonic/wordlists/ko.ts → mnemonic/wordlists/ko.js} +0 -6
- package/mnemonic/wordlists/zh-s.d.ts +2 -0
- package/{src/mnemonic/wordlists/zh-s.ts → mnemonic/wordlists/zh-s.js} +0 -6
- package/mnemonic/wordlists/zh-t.d.ts +2 -0
- package/{src/mnemonic/wordlists/zh-t.ts → mnemonic/wordlists/zh-t.js} +0 -6
- package/nacl/decrypt.d.ts +15 -0
- package/{src/nacl/decrypt.ts → nacl/decrypt.js} +2 -6
- package/nacl/encrypt.d.ts +20 -0
- package/{src/nacl/encrypt.ts → nacl/encrypt.js} +5 -14
- 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 +2020 -8
- package/packageDetect.d.ts +1 -0
- package/{src/packageDetect.ts → packageDetect.js} +0 -8
- 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/{src/random/asNumber.ts → random/asNumber.js} +2 -10
- package/random/asU8a.d.ts +20 -0
- package/{src/random/asU8a.ts → random/asU8a.js} +2 -8
- 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/{src/sha/asU8a.ts → sha/asU8a.js} +1 -12
- 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/{src/sr25519/deriveHard.ts → sr25519/deriveHard.js} +0 -6
- package/sr25519/derivePublic.d.ts +1 -0
- package/sr25519/derivePublic.js +12 -0
- package/sr25519/deriveSoft.d.ts +1 -0
- package/{src/sr25519/deriveSoft.ts → sr25519/deriveSoft.js} +0 -6
- 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/types.d.ts +26 -0
- package/types.js +2 -0
- package/xxhash/asU8a.d.ts +20 -0
- package/{src/xxhash/asU8a.ts → xxhash/asU8a.js} +11 -21
- 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
- package/src/address/addressToEvm.spec.ts +0 -16
- package/src/address/addressToEvm.ts +0 -12
- package/src/address/check.spec.ts +0 -44
- package/src/address/check.ts +0 -34
- package/src/address/checksum.spec.ts +0 -45
- package/src/address/checksum.ts +0 -25
- package/src/address/decode.spec.ts +0 -138
- package/src/address/decode.ts +0 -41
- package/src/address/defaults.ts +0 -12
- package/src/address/derive.spec.ts +0 -26
- package/src/address/derive.ts +0 -36
- package/src/address/encode.spec.ts +0 -177
- package/src/address/encode.ts +0 -43
- package/src/address/encodeDerived.spec.ts +0 -14
- package/src/address/encodeDerived.ts +0 -19
- package/src/address/encodeMulti.spec.ts +0 -18
- package/src/address/encodeMulti.ts +0 -18
- package/src/address/eq.spec.ts +0 -45
- package/src/address/evmToAddress.spec.ts +0 -20
- package/src/address/evmToAddress.ts +0 -24
- package/src/address/is.spec.ts +0 -113
- package/src/address/is.ts +0 -14
- package/src/address/keyDerived.spec.ts +0 -24
- package/src/address/keyDerived.ts +0 -22
- package/src/address/keyMulti.spec.ts +0 -20
- package/src/address/keyMulti.ts +0 -23
- package/src/address/setSS58Format.spec.ts +0 -21
- package/src/address/setSS58Format.ts +0 -20
- package/src/address/sort.spec.ts +0 -22
- package/src/address/sort.ts +0 -17
- package/src/address/sshash.ts +0 -12
- package/src/address/types.ts +0 -6
- package/src/address/util.ts +0 -8
- package/src/address/validate.spec.ts +0 -113
- package/src/address/validate.ts +0 -10
- package/src/base32/decode.spec.ts +0 -34
- package/src/base32/encode.spec.ts +0 -30
- package/src/base32/helpers.ts +0 -93
- package/src/base32/is.spec.ts +0 -32
- package/src/base32/validate.spec.ts +0 -44
- package/src/base58/decode.spec.ts +0 -31
- package/src/base58/encode.spec.ts +0 -26
- package/src/base58/validate.spec.ts +0 -20
- package/src/base64/decode.spec.ts +0 -42
- package/src/base64/encode.spec.ts +0 -14
- package/src/base64/pad.spec.ts +0 -14
- package/src/base64/pad.ts +0 -10
- package/src/base64/trim.spec.ts +0 -14
- package/src/base64/trim.ts +0 -14
- package/src/base64/validate.spec.ts +0 -32
- package/src/blake2/asHex.spec.ts +0 -57
- package/src/blake2/asU8a.spec.ts +0 -74
- package/src/bundleInit.ts +0 -11
- package/src/crypto.spec.ts +0 -18
- package/src/crypto.ts +0 -18
- package/src/ed25519/deriveHard.ts +0 -18
- package/src/ed25519/pair/fromRandom.spec.ts +0 -28
- package/src/ed25519/pair/fromSecret.spec.ts +0 -33
- package/src/ed25519/pair/fromSeed.spec.ts +0 -42
- package/src/ed25519/pair/fromString.spec.ts +0 -17
- package/src/ed25519/sign.spec.ts +0 -40
- package/src/ed25519/sign.ts +0 -38
- package/src/ed25519/verify.spec.ts +0 -84
- package/src/ed25519/verify.ts +0 -41
- package/src/ethereum/encode.spec.ts +0 -59
- package/src/ethereum/encode.ts +0 -39
- package/src/ethereum/isAddress.spec.ts +0 -34
- package/src/ethereum/isAddress.ts +0 -16
- package/src/ethereum/isChecksum.ts +0 -27
- package/src/ethereum/isCheksum.spec.ts +0 -30
- package/src/hd/ethereum/index.spec.ts +0 -54
- package/src/hd/ethereum/index.ts +0 -69
- package/src/hd/ledger/derivePrivate.ts +0 -34
- package/src/hd/ledger/index.spec.ts +0 -64
- package/src/hd/ledger/index.ts +0 -42
- package/src/hd/ledger/master.spec.ts +0 -19
- package/src/hd/ledger/master.ts +0 -26
- package/src/hd/validatePath.spec.ts +0 -30
- package/src/hd/validatePath.ts +0 -24
- package/src/helpers.ts +0 -38
- package/src/hmac/index.ts +0 -4
- package/src/hmac/shaAsU8a.spec.ts +0 -45
- package/src/index.ts +0 -6
- package/src/json/constants.ts +0 -11
- package/src/json/decrypt.ts +0 -25
- package/src/json/decryptData.ts +0 -45
- package/src/json/encrypt.ts +0 -25
- package/src/json/encryptFormat.ts +0 -20
- package/src/json/types.ts +0 -22
- package/src/keccak/asHex.spec.ts +0 -30
- package/src/keccak/asU8a.spec.ts +0 -56
- package/src/key/DeriveJunction.ts +0 -79
- package/src/key/extractPath.spec.ts +0 -51
- package/src/key/extractPath.ts +0 -37
- package/src/key/extractSuri.spec.ts +0 -147
- package/src/key/extractSuri.ts +0 -40
- package/src/key/fromPath.ts +0 -28
- package/src/key/hdkdDerive.ts +0 -17
- package/src/key/hdkdSr25519.ts +0 -14
- package/src/mnemonic/bip39.spec.ts +0 -80
- package/src/mnemonic/bip39.ts +0 -127
- package/src/mnemonic/generate.spec.ts +0 -58
- package/src/mnemonic/toEntropy.spec.ts +0 -36
- package/src/mnemonic/toEntropy.ts +0 -13
- package/src/mnemonic/toLegacySeed.spec.ts +0 -52
- package/src/mnemonic/toMiniSecret.spec.ts +0 -67
- package/src/mnemonic/toMiniSecret.ts +0 -23
- package/src/mnemonic/toMiniSecretCmp.spec.ts +0 -64
- package/src/mnemonic/validate.spec.ts +0 -39
- package/src/mod.ts +0 -4
- package/src/nacl/decrypt.spec.ts +0 -26
- package/src/nacl/encrypt.spec.ts +0 -20
- package/src/nacl/tweetnacl-secretbox-data.spec.ts +0 -4629
- package/src/nacl/tweetnacl-secretbox.spec.ts +0 -161
- package/src/nacl/tweetnacl.ts +0 -1159
- package/src/networks.ts +0 -5
- package/src/packageInfo.ts +0 -6
- package/src/pbkdf2/encode.spec.ts +0 -54
- package/src/pbkdf2/encode.ts +0 -29
- package/src/pbkdf2/index.ts +0 -4
- package/src/random/asHex.spec.ts +0 -38
- package/src/random/asNumber.spec.ts +0 -16
- package/src/random/asU8a.spec.ts +0 -36
- package/src/scrypt/defaults.ts +0 -19
- package/src/scrypt/encode.spec.ts +0 -43
- package/src/scrypt/encode.ts +0 -30
- package/src/scrypt/fromU8a.ts +0 -44
- package/src/scrypt/toU8a.ts +0 -17
- package/src/scrypt/types.ts +0 -9
- package/src/secp256k1/compress.spec.ts +0 -47
- package/src/secp256k1/compress.ts +0 -21
- package/src/secp256k1/deriveHard.ts +0 -17
- package/src/secp256k1/expand.spec.ts +0 -47
- package/src/secp256k1/expand.ts +0 -30
- package/src/secp256k1/hasher.spec.ts +0 -24
- package/src/secp256k1/hasher.ts +0 -13
- package/src/secp256k1/pair/fromSeed.spec.ts +0 -75
- package/src/secp256k1/pair/fromSeed.ts +0 -42
- package/src/secp256k1/recover.spec.ts +0 -35
- package/src/secp256k1/recover.ts +0 -36
- package/src/secp256k1/sign.spec.ts +0 -39
- package/src/secp256k1/sign.ts +0 -37
- package/src/secp256k1/signVerify.spec.ts +0 -94
- package/src/secp256k1/tweakAdd.spec.ts +0 -35
- package/src/secp256k1/tweakAdd.ts +0 -65
- package/src/secp256k1/types.ts +0 -4
- package/src/secp256k1/verify.spec.ts +0 -81
- package/src/secp256k1/verify.ts +0 -32
- package/src/sha/asU8a256.spec.ts +0 -55
- package/src/sha/asU8a512.spec.ts +0 -33
- package/src/signature/index.ts +0 -8
- package/src/signature/verify.spec.ts +0 -230
- package/src/signature/verify.ts +0 -114
- package/src/sr25519/agreement.spec.ts +0 -31
- package/src/sr25519/agreement.ts +0 -23
- package/src/sr25519/derive.ts +0 -21
- package/src/sr25519/derivePublic.ts +0 -18
- package/src/sr25519/pair/fromSeed.spec.ts +0 -35
- package/src/sr25519/pair/fromSeed.ts +0 -28
- package/src/sr25519/pair/fromU8a.ts +0 -23
- package/src/sr25519/pair/testing.spec.ts +0 -161
- package/src/sr25519/pair/toU8a.ts +0 -10
- package/src/sr25519/sign.spec.ts +0 -28
- package/src/sr25519/sign.ts +0 -22
- package/src/sr25519/verify.spec.ts +0 -42
- package/src/sr25519/verify.ts +0 -23
- package/src/sr25519/vrfSign.ts +0 -24
- package/src/sr25519/vrfSignVerify.spec.ts +0 -73
- package/src/sr25519/vrfVerify.ts +0 -25
- package/src/test/index.ts +0 -8
- package/src/test/performance.ts +0 -17
- package/src/types.ts +0 -33
- package/src/xxhash/asHex.spec.ts +0 -36
- package/src/xxhash/asU8a.spec.ts +0 -48
- package/src/xxhash/xxhash64.ts +0 -155
- package/tsconfig.build.json +0 -18
- package/tsconfig.spec.json +0 -20
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hmacSha512AsU8a = exports.hmacSha256AsU8a = void 0;
|
|
4
|
+
exports.hmacShaAsU8a = hmacShaAsU8a;
|
|
5
|
+
const hmac_1 = require("@noble/hashes/hmac");
|
|
6
|
+
const sha256_1 = require("@noble/hashes/sha256");
|
|
7
|
+
const sha512_1 = require("@noble/hashes/sha512");
|
|
8
|
+
const util_1 = require("@pezkuwi/util");
|
|
9
|
+
const wasm_crypto_1 = require("@pezkuwi/wasm-crypto");
|
|
10
|
+
const JS_HASH = {
|
|
11
|
+
256: sha256_1.sha256,
|
|
12
|
+
512: sha512_1.sha512
|
|
13
|
+
};
|
|
14
|
+
const WA_MHAC = {
|
|
15
|
+
256: wasm_crypto_1.hmacSha256,
|
|
16
|
+
512: wasm_crypto_1.hmacSha512
|
|
17
|
+
};
|
|
18
|
+
function createSha(bitLength) {
|
|
19
|
+
return (key, data, onlyJs) => hmacShaAsU8a(key, data, bitLength, onlyJs);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @name hmacShaAsU8a
|
|
23
|
+
* @description creates a Hmac Sha (256/512) Uint8Array from the key & data
|
|
24
|
+
*/
|
|
25
|
+
function hmacShaAsU8a(key, data, bitLength = 256, onlyJs) {
|
|
26
|
+
const u8aKey = (0, util_1.u8aToU8a)(key);
|
|
27
|
+
return !util_1.hasBigInt || (!onlyJs && (0, wasm_crypto_1.isReady)())
|
|
28
|
+
? WA_MHAC[bitLength](u8aKey, data)
|
|
29
|
+
: (0, hmac_1.hmac)(JS_HASH[bitLength], u8aKey, data);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @name hmacSha256AsU8a
|
|
33
|
+
* @description creates a Hmac Sha256 Uint8Array from the key & data
|
|
34
|
+
*/
|
|
35
|
+
exports.hmacSha256AsU8a = createSha(256);
|
|
36
|
+
/**
|
|
37
|
+
* @name hmacSha512AsU8a
|
|
38
|
+
* @description creates a Hmac Sha512 Uint8Array from the key & data
|
|
39
|
+
*/
|
|
40
|
+
exports.hmacSha512AsU8a = createSha(512);
|
package/cjs/index.d.ts
ADDED
package/cjs/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EncryptedJsonEncoding, EncryptedJsonVersion } from './types.js';
|
|
2
|
+
export declare const ENCODING: EncryptedJsonEncoding[];
|
|
3
|
+
export declare const ENCODING_NONE: EncryptedJsonEncoding[];
|
|
4
|
+
export declare const ENCODING_VERSION: EncryptedJsonVersion;
|
|
5
|
+
export declare const NONCE_LENGTH = 24;
|
|
6
|
+
export declare const SCRYPT_LENGTH: number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SCRYPT_LENGTH = exports.NONCE_LENGTH = exports.ENCODING_VERSION = exports.ENCODING_NONE = exports.ENCODING = void 0;
|
|
4
|
+
exports.ENCODING = ['scrypt', 'xsalsa20-poly1305'];
|
|
5
|
+
exports.ENCODING_NONE = ['none'];
|
|
6
|
+
exports.ENCODING_VERSION = '3';
|
|
7
|
+
exports.NONCE_LENGTH = 24;
|
|
8
|
+
exports.SCRYPT_LENGTH = 32 + (3 * 4);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonDecrypt = jsonDecrypt;
|
|
4
|
+
const util_1 = require("@pezkuwi/util");
|
|
5
|
+
const index_js_1 = require("../base64/index.js");
|
|
6
|
+
const decryptData_js_1 = require("./decryptData.js");
|
|
7
|
+
function jsonDecrypt({ encoded, encoding }, passphrase) {
|
|
8
|
+
if (!encoded) {
|
|
9
|
+
throw new Error('No encrypted data available to decode');
|
|
10
|
+
}
|
|
11
|
+
return (0, decryptData_js_1.jsonDecryptData)((0, util_1.isHex)(encoded)
|
|
12
|
+
? (0, util_1.hexToU8a)(encoded)
|
|
13
|
+
: (0, index_js_1.base64Decode)(encoded), passphrase, Array.isArray(encoding.type)
|
|
14
|
+
? encoding.type
|
|
15
|
+
: [encoding.type]);
|
|
16
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonDecryptData = jsonDecryptData;
|
|
4
|
+
const util_1 = require("@pezkuwi/util");
|
|
5
|
+
const index_js_1 = require("../nacl/index.js");
|
|
6
|
+
const index_js_2 = require("../scrypt/index.js");
|
|
7
|
+
const constants_js_1 = require("./constants.js");
|
|
8
|
+
function jsonDecryptData(encrypted, passphrase, encType = constants_js_1.ENCODING) {
|
|
9
|
+
if (!encrypted) {
|
|
10
|
+
throw new Error('No encrypted data available to decode');
|
|
11
|
+
}
|
|
12
|
+
else if (encType.includes('xsalsa20-poly1305') && !passphrase) {
|
|
13
|
+
throw new Error('Password required to decode encrypted data');
|
|
14
|
+
}
|
|
15
|
+
let encoded = encrypted;
|
|
16
|
+
if (passphrase) {
|
|
17
|
+
let password;
|
|
18
|
+
if (encType.includes('scrypt')) {
|
|
19
|
+
const { params, salt } = (0, index_js_2.scryptFromU8a)(encrypted);
|
|
20
|
+
password = (0, index_js_2.scryptEncode)(passphrase, salt, params).password;
|
|
21
|
+
encrypted = encrypted.subarray(constants_js_1.SCRYPT_LENGTH);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
password = (0, util_1.stringToU8a)(passphrase);
|
|
25
|
+
}
|
|
26
|
+
encoded = (0, index_js_1.naclDecrypt)(encrypted.subarray(constants_js_1.NONCE_LENGTH), encrypted.subarray(0, constants_js_1.NONCE_LENGTH), (0, util_1.u8aFixLength)(password, 256, true));
|
|
27
|
+
}
|
|
28
|
+
if (!encoded) {
|
|
29
|
+
throw new Error('Unable to decode using the supplied passphrase');
|
|
30
|
+
}
|
|
31
|
+
return encoded;
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonEncrypt = jsonEncrypt;
|
|
4
|
+
const util_1 = require("@pezkuwi/util");
|
|
5
|
+
const index_js_1 = require("../nacl/index.js");
|
|
6
|
+
const index_js_2 = require("../scrypt/index.js");
|
|
7
|
+
const encryptFormat_js_1 = require("./encryptFormat.js");
|
|
8
|
+
function jsonEncrypt(data, contentType, passphrase) {
|
|
9
|
+
let isEncrypted = false;
|
|
10
|
+
let encoded = data;
|
|
11
|
+
if (passphrase) {
|
|
12
|
+
const { params, password, salt } = (0, index_js_2.scryptEncode)(passphrase);
|
|
13
|
+
const { encrypted, nonce } = (0, index_js_1.naclEncrypt)(encoded, password.subarray(0, 32));
|
|
14
|
+
isEncrypted = true;
|
|
15
|
+
encoded = (0, util_1.u8aConcat)((0, index_js_2.scryptToU8a)(salt, params), nonce, encrypted);
|
|
16
|
+
}
|
|
17
|
+
return (0, encryptFormat_js_1.jsonEncryptFormat)(encoded, contentType, isEncrypted);
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonEncryptFormat = jsonEncryptFormat;
|
|
4
|
+
const index_js_1 = require("../base64/index.js");
|
|
5
|
+
const constants_js_1 = require("./constants.js");
|
|
6
|
+
function jsonEncryptFormat(encoded, contentType, isEncrypted) {
|
|
7
|
+
return {
|
|
8
|
+
encoded: (0, index_js_1.base64Encode)(encoded),
|
|
9
|
+
encoding: {
|
|
10
|
+
content: contentType,
|
|
11
|
+
type: isEncrypted
|
|
12
|
+
? constants_js_1.ENCODING
|
|
13
|
+
: constants_js_1.ENCODING_NONE,
|
|
14
|
+
version: constants_js_1.ENCODING_VERSION
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonEncryptFormat = exports.jsonEncrypt = exports.jsonDecryptData = exports.jsonDecrypt = void 0;
|
|
4
|
+
var decrypt_js_1 = require("./decrypt.js");
|
|
5
|
+
Object.defineProperty(exports, "jsonDecrypt", { enumerable: true, get: function () { return decrypt_js_1.jsonDecrypt; } });
|
|
6
|
+
var decryptData_js_1 = require("./decryptData.js");
|
|
7
|
+
Object.defineProperty(exports, "jsonDecryptData", { enumerable: true, get: function () { return decryptData_js_1.jsonDecryptData; } });
|
|
8
|
+
var encrypt_js_1 = require("./encrypt.js");
|
|
9
|
+
Object.defineProperty(exports, "jsonEncrypt", { enumerable: true, get: function () { return encrypt_js_1.jsonEncrypt; } });
|
|
10
|
+
var encryptFormat_js_1 = require("./encryptFormat.js");
|
|
11
|
+
Object.defineProperty(exports, "jsonEncryptFormat", { enumerable: true, get: function () { return encryptFormat_js_1.jsonEncryptFormat; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type EncryptedJsonVersion = '0' | '1' | '2' | '3';
|
|
2
|
+
export type EncryptedJsonEncoding = 'none' | 'scrypt' | 'xsalsa20-poly1305';
|
|
3
|
+
export interface EncryptedJsonDescriptor {
|
|
4
|
+
/** Descriptor for the content */
|
|
5
|
+
content: string[];
|
|
6
|
+
/** The encoding (in current/latest versions this is always an array) */
|
|
7
|
+
type: EncryptedJsonEncoding | EncryptedJsonEncoding[];
|
|
8
|
+
/** The version of encoding applied */
|
|
9
|
+
version: EncryptedJsonVersion;
|
|
10
|
+
}
|
|
11
|
+
export interface EncryptedJson {
|
|
12
|
+
/** The encoded string */
|
|
13
|
+
encoded: string;
|
|
14
|
+
/** The encoding used */
|
|
15
|
+
encoding: EncryptedJsonDescriptor;
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name keccakAsU8a
|
|
3
|
+
* @summary Creates a keccak Uint8Array from the input.
|
|
4
|
+
* @description
|
|
5
|
+
* From either a `string` or a `Buffer` input, create the keccak and return the result as a `Uint8Array`.
|
|
6
|
+
* @example
|
|
7
|
+
* <BR>
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { keccakAsU8a } from '@polkadot/util-crypto';
|
|
11
|
+
*
|
|
12
|
+
* keccakAsU8a('123'); // => Uint8Array
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const keccakAsU8a: (value: string | Uint8Array, bitLength?: 256 | 512, onlyJs?: boolean) => Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* @name keccak256AsU8a
|
|
18
|
+
* @description Creates a keccak256 Uint8Array from the input.
|
|
19
|
+
*/
|
|
20
|
+
export declare const keccak256AsU8a: (data: string | Uint8Array, onlyJs?: boolean) => Uint8Array;
|
|
21
|
+
/**
|
|
22
|
+
* @name keccak512AsU8a
|
|
23
|
+
* @description Creates a keccak512 Uint8Array from the input.
|
|
24
|
+
*/
|
|
25
|
+
export declare const keccak512AsU8a: (data: string | Uint8Array, onlyJs?: boolean) => Uint8Array;
|
|
26
|
+
/**
|
|
27
|
+
* @name keccakAsHex
|
|
28
|
+
* @description Creates a keccak hex string from the input.
|
|
29
|
+
*/
|
|
30
|
+
export declare const keccakAsHex: (value: string | Uint8Array, bitLength?: 256 | 512 | undefined, onlyJs?: boolean | undefined) => import("@polkadot/util/types").HexString;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keccakAsHex = exports.keccak512AsU8a = exports.keccak256AsU8a = exports.keccakAsU8a = void 0;
|
|
4
|
+
const sha3_1 = require("@noble/hashes/sha3");
|
|
5
|
+
const wasm_crypto_1 = require("@pezkuwi/wasm-crypto");
|
|
6
|
+
const helpers_js_1 = require("../helpers.js");
|
|
7
|
+
/**
|
|
8
|
+
* @name keccakAsU8a
|
|
9
|
+
* @summary Creates a keccak Uint8Array from the input.
|
|
10
|
+
* @description
|
|
11
|
+
* From either a `string` or a `Buffer` input, create the keccak and return the result as a `Uint8Array`.
|
|
12
|
+
* @example
|
|
13
|
+
* <BR>
|
|
14
|
+
*
|
|
15
|
+
* ```javascript
|
|
16
|
+
* import { keccakAsU8a } from '@pezkuwi/util-crypto';
|
|
17
|
+
*
|
|
18
|
+
* keccakAsU8a('123'); // => Uint8Array
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
exports.keccakAsU8a = (0, helpers_js_1.createDualHasher)({ 256: wasm_crypto_1.keccak256, 512: wasm_crypto_1.keccak512 }, { 256: sha3_1.keccak_256, 512: sha3_1.keccak_512 });
|
|
22
|
+
/**
|
|
23
|
+
* @name keccak256AsU8a
|
|
24
|
+
* @description Creates a keccak256 Uint8Array from the input.
|
|
25
|
+
*/
|
|
26
|
+
exports.keccak256AsU8a = (0, helpers_js_1.createBitHasher)(256, exports.keccakAsU8a);
|
|
27
|
+
/**
|
|
28
|
+
* @name keccak512AsU8a
|
|
29
|
+
* @description Creates a keccak512 Uint8Array from the input.
|
|
30
|
+
*/
|
|
31
|
+
exports.keccak512AsU8a = (0, helpers_js_1.createBitHasher)(512, exports.keccakAsU8a);
|
|
32
|
+
/**
|
|
33
|
+
* @name keccakAsHex
|
|
34
|
+
* @description Creates a keccak hex string from the input.
|
|
35
|
+
*/
|
|
36
|
+
exports.keccakAsHex = (0, helpers_js_1.createAsHex)(exports.keccakAsU8a);
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
// Copyright 2017-2025 @polkadot/util-crypto authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* @summary Create Keccak256/512 values as hex & Uint8Array output
|
|
6
3
|
*/
|
|
7
|
-
|
|
8
4
|
export { keccak256AsU8a, keccak512AsU8a, keccakAsHex, keccakAsU8a } from './asU8a.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keccakAsU8a = exports.keccakAsHex = exports.keccak512AsU8a = exports.keccak256AsU8a = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @summary Create Keccak256/512 values as hex & Uint8Array output
|
|
6
|
+
*/
|
|
7
|
+
var asU8a_js_1 = require("./asU8a.js");
|
|
8
|
+
Object.defineProperty(exports, "keccak256AsU8a", { enumerable: true, get: function () { return asU8a_js_1.keccak256AsU8a; } });
|
|
9
|
+
Object.defineProperty(exports, "keccak512AsU8a", { enumerable: true, get: function () { return asU8a_js_1.keccak512AsU8a; } });
|
|
10
|
+
Object.defineProperty(exports, "keccakAsHex", { enumerable: true, get: function () { return asU8a_js_1.keccakAsHex; } });
|
|
11
|
+
Object.defineProperty(exports, "keccakAsU8a", { enumerable: true, get: function () { return asU8a_js_1.keccakAsU8a; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BN } from '@polkadot/util';
|
|
2
|
+
export declare class DeriveJunction {
|
|
3
|
+
#private;
|
|
4
|
+
static from(value: string): DeriveJunction;
|
|
5
|
+
get chainCode(): Uint8Array;
|
|
6
|
+
get isHard(): boolean;
|
|
7
|
+
get isSoft(): boolean;
|
|
8
|
+
hard(value: number | string | bigint | BN | Uint8Array): DeriveJunction;
|
|
9
|
+
harden(): DeriveJunction;
|
|
10
|
+
soft(value: number | string | bigint | BN | Uint8Array): DeriveJunction;
|
|
11
|
+
soften(): DeriveJunction;
|
|
12
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeriveJunction = void 0;
|
|
4
|
+
const util_1 = require("@pezkuwi/util");
|
|
5
|
+
const asU8a_js_1 = require("../blake2/asU8a.js");
|
|
6
|
+
const bn_js_1 = require("../bn.js");
|
|
7
|
+
const RE_NUMBER = /^\d+$/;
|
|
8
|
+
const JUNCTION_ID_LEN = 32;
|
|
9
|
+
class DeriveJunction {
|
|
10
|
+
#chainCode = new Uint8Array(32);
|
|
11
|
+
#isHard = false;
|
|
12
|
+
static from(value) {
|
|
13
|
+
const result = new DeriveJunction();
|
|
14
|
+
const [code, isHard] = value.startsWith('/')
|
|
15
|
+
? [value.substring(1), true]
|
|
16
|
+
: [value, false];
|
|
17
|
+
result.soft(RE_NUMBER.test(code)
|
|
18
|
+
? new util_1.BN(code, 10)
|
|
19
|
+
: code);
|
|
20
|
+
return isHard
|
|
21
|
+
? result.harden()
|
|
22
|
+
: result;
|
|
23
|
+
}
|
|
24
|
+
get chainCode() {
|
|
25
|
+
return this.#chainCode;
|
|
26
|
+
}
|
|
27
|
+
get isHard() {
|
|
28
|
+
return this.#isHard;
|
|
29
|
+
}
|
|
30
|
+
get isSoft() {
|
|
31
|
+
return !this.#isHard;
|
|
32
|
+
}
|
|
33
|
+
hard(value) {
|
|
34
|
+
return this.soft(value).harden();
|
|
35
|
+
}
|
|
36
|
+
harden() {
|
|
37
|
+
this.#isHard = true;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
soft(value) {
|
|
41
|
+
if ((0, util_1.isNumber)(value) || (0, util_1.isBn)(value) || (0, util_1.isBigInt)(value)) {
|
|
42
|
+
return this.soft((0, util_1.bnToU8a)(value, bn_js_1.BN_LE_256_OPTS));
|
|
43
|
+
}
|
|
44
|
+
else if ((0, util_1.isHex)(value)) {
|
|
45
|
+
return this.soft((0, util_1.hexToU8a)(value));
|
|
46
|
+
}
|
|
47
|
+
else if ((0, util_1.isString)(value)) {
|
|
48
|
+
return this.soft((0, util_1.compactAddLength)((0, util_1.stringToU8a)(value)));
|
|
49
|
+
}
|
|
50
|
+
else if (value.length > JUNCTION_ID_LEN) {
|
|
51
|
+
return this.soft((0, asU8a_js_1.blake2AsU8a)(value));
|
|
52
|
+
}
|
|
53
|
+
this.#chainCode.fill(0);
|
|
54
|
+
this.#chainCode.set(value, 0);
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
soften() {
|
|
58
|
+
this.#isHard = false;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.DeriveJunction = DeriveJunction;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeriveJunction } from './DeriveJunction.js';
|
|
2
|
+
export interface ExtractResult {
|
|
3
|
+
parts: string[] | null;
|
|
4
|
+
path: DeriveJunction[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @description Extract derivation junctions from the supplied path
|
|
8
|
+
*/
|
|
9
|
+
export declare function keyExtractPath(derivePath: string): ExtractResult;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyExtractPath = keyExtractPath;
|
|
4
|
+
const DeriveJunction_js_1 = require("./DeriveJunction.js");
|
|
5
|
+
const RE_JUNCTION = /\/(\/?)([^/]+)/g;
|
|
6
|
+
/**
|
|
7
|
+
* @description Extract derivation junctions from the supplied path
|
|
8
|
+
*/
|
|
9
|
+
function keyExtractPath(derivePath) {
|
|
10
|
+
const parts = derivePath.match(RE_JUNCTION);
|
|
11
|
+
const path = [];
|
|
12
|
+
let constructed = '';
|
|
13
|
+
if (parts) {
|
|
14
|
+
constructed = parts.join('');
|
|
15
|
+
for (const p of parts) {
|
|
16
|
+
path.push(DeriveJunction_js_1.DeriveJunction.from(p.substring(1)));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (constructed !== derivePath) {
|
|
20
|
+
throw new Error(`Re-constructed path "${constructed}" does not match input`);
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
parts,
|
|
24
|
+
path
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DeriveJunction } from './DeriveJunction.js';
|
|
2
|
+
export interface ExtractResult {
|
|
3
|
+
derivePath: string;
|
|
4
|
+
password?: string;
|
|
5
|
+
path: DeriveJunction[];
|
|
6
|
+
phrase: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @description Extracts the phrase, path and password from a SURI format for specifying secret keys `<secret>/<soft-key>//<hard-key>///<password>` (the `///password` may be omitted, and `/<soft-key>` and `//<hard-key>` maybe repeated and mixed).
|
|
10
|
+
*/
|
|
11
|
+
export declare function keyExtractSuri(suri: string): ExtractResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyExtractSuri = keyExtractSuri;
|
|
4
|
+
const extractPath_js_1 = require("./extractPath.js");
|
|
5
|
+
const RE_CAPTURE = /^((0x[a-fA-F0-9]+|[\p{L}\d]+(?: [\p{L}\d]+)*))((\/\/?[^/]+)*)(\/\/\/(.*))?$/u;
|
|
6
|
+
/**
|
|
7
|
+
* @description Extracts the phrase, path and password from a SURI format for specifying secret keys `<secret>/<soft-key>//<hard-key>///<password>` (the `///password` may be omitted, and `/<soft-key>` and `//<hard-key>` maybe repeated and mixed).
|
|
8
|
+
*/
|
|
9
|
+
function keyExtractSuri(suri) {
|
|
10
|
+
// Normalize Unicode to NFC to avoid accent-related mismatches
|
|
11
|
+
const normalizedSuri = suri.normalize('NFC');
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
|
|
13
|
+
const matches = normalizedSuri.match(RE_CAPTURE);
|
|
14
|
+
if (matches === null) {
|
|
15
|
+
throw new Error('Unable to match provided value to a secret URI');
|
|
16
|
+
}
|
|
17
|
+
const [, phrase, , derivePath, , , password] = matches;
|
|
18
|
+
const { path } = (0, extractPath_js_1.keyExtractPath)(derivePath);
|
|
19
|
+
return {
|
|
20
|
+
derivePath,
|
|
21
|
+
password,
|
|
22
|
+
path,
|
|
23
|
+
phrase
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyFromPath = keyFromPath;
|
|
4
|
+
const hdkdEcdsa_js_1 = require("./hdkdEcdsa.js");
|
|
5
|
+
const hdkdEd25519_js_1 = require("./hdkdEd25519.js");
|
|
6
|
+
const hdkdSr25519_js_1 = require("./hdkdSr25519.js");
|
|
7
|
+
const generators = {
|
|
8
|
+
ecdsa: hdkdEcdsa_js_1.keyHdkdEcdsa,
|
|
9
|
+
ed25519: hdkdEd25519_js_1.keyHdkdEd25519,
|
|
10
|
+
// FIXME This is Substrate-compatible, not Ethereum-compatible
|
|
11
|
+
ethereum: hdkdEcdsa_js_1.keyHdkdEcdsa,
|
|
12
|
+
sr25519: hdkdSr25519_js_1.keyHdkdSr25519
|
|
13
|
+
};
|
|
14
|
+
function keyFromPath(pair, path, type) {
|
|
15
|
+
const keyHdkd = generators[type];
|
|
16
|
+
let result = pair;
|
|
17
|
+
for (const junction of path) {
|
|
18
|
+
result = keyHdkd(result, junction);
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Keypair } from '../types.js';
|
|
2
|
+
import type { DeriveJunction } from './DeriveJunction.js';
|
|
3
|
+
export declare function createSeedDeriveFn(fromSeed: (seed: Uint8Array) => Keypair, derive: (seed: Uint8Array, chainCode: Uint8Array) => Uint8Array): (keypair: Keypair, junction: DeriveJunction) => Keypair;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSeedDeriveFn = createSeedDeriveFn;
|
|
4
|
+
function createSeedDeriveFn(fromSeed, derive) {
|
|
5
|
+
return (keypair, { chainCode, isHard }) => {
|
|
6
|
+
if (!isHard) {
|
|
7
|
+
throw new Error('A soft key was found in the path and is not supported');
|
|
8
|
+
}
|
|
9
|
+
return fromSeed(derive(keypair.secretKey.subarray(0, 32), chainCode));
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const keyHdkdEcdsa: (keypair: import("../types.js").Keypair, junction: import("./DeriveJunction.js").DeriveJunction) => import("../types.js").Keypair;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyHdkdEcdsa = void 0;
|
|
4
|
+
const deriveHard_js_1 = require("../secp256k1/deriveHard.js");
|
|
5
|
+
const fromSeed_js_1 = require("../secp256k1/pair/fromSeed.js");
|
|
6
|
+
const hdkdDerive_js_1 = require("./hdkdDerive.js");
|
|
7
|
+
exports.keyHdkdEcdsa = (0, hdkdDerive_js_1.createSeedDeriveFn)(fromSeed_js_1.secp256k1PairFromSeed, deriveHard_js_1.secp256k1DeriveHard);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const keyHdkdEd25519: (keypair: import("../types.js").Keypair, junction: import("./DeriveJunction.js").DeriveJunction) => import("../types.js").Keypair;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyHdkdEd25519 = void 0;
|
|
4
|
+
const index_js_1 = require("../ed25519/index.js");
|
|
5
|
+
const hdkdDerive_js_1 = require("./hdkdDerive.js");
|
|
6
|
+
exports.keyHdkdEd25519 = (0, hdkdDerive_js_1.createSeedDeriveFn)(index_js_1.ed25519PairFromSeed, index_js_1.ed25519DeriveHard);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyHdkdSr25519 = keyHdkdSr25519;
|
|
4
|
+
const deriveHard_js_1 = require("../sr25519/deriveHard.js");
|
|
5
|
+
const deriveSoft_js_1 = require("../sr25519/deriveSoft.js");
|
|
6
|
+
function keyHdkdSr25519(keypair, { chainCode, isSoft }) {
|
|
7
|
+
return isSoft
|
|
8
|
+
? (0, deriveSoft_js_1.sr25519DeriveSoft)(keypair, chainCode)
|
|
9
|
+
: (0, deriveHard_js_1.sr25519DeriveHard)(keypair, chainCode);
|
|
10
|
+
}
|
package/cjs/key/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keyHdkdSr25519 = exports.keyHdkdEd25519 = exports.keyHdkdEcdsa = exports.keyFromPath = exports.keyExtractSuri = exports.keyExtractPath = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @summary Create keys from paths, seeds and password
|
|
6
|
+
*/
|
|
7
|
+
var extractPath_js_1 = require("./extractPath.js");
|
|
8
|
+
Object.defineProperty(exports, "keyExtractPath", { enumerable: true, get: function () { return extractPath_js_1.keyExtractPath; } });
|
|
9
|
+
var extractSuri_js_1 = require("./extractSuri.js");
|
|
10
|
+
Object.defineProperty(exports, "keyExtractSuri", { enumerable: true, get: function () { return extractSuri_js_1.keyExtractSuri; } });
|
|
11
|
+
var fromPath_js_1 = require("./fromPath.js");
|
|
12
|
+
Object.defineProperty(exports, "keyFromPath", { enumerable: true, get: function () { return fromPath_js_1.keyFromPath; } });
|
|
13
|
+
var hdkdEcdsa_js_1 = require("./hdkdEcdsa.js");
|
|
14
|
+
Object.defineProperty(exports, "keyHdkdEcdsa", { enumerable: true, get: function () { return hdkdEcdsa_js_1.keyHdkdEcdsa; } });
|
|
15
|
+
var hdkdEd25519_js_1 = require("./hdkdEd25519.js");
|
|
16
|
+
Object.defineProperty(exports, "keyHdkdEd25519", { enumerable: true, get: function () { return hdkdEd25519_js_1.keyHdkdEd25519; } });
|
|
17
|
+
var hdkdSr25519_js_1 = require("./hdkdSr25519.js");
|
|
18
|
+
Object.defineProperty(exports, "keyHdkdSr25519", { enumerable: true, get: function () { return hdkdSr25519_js_1.keyHdkdSr25519; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function mnemonicToSeedSync(mnemonic: string, password?: string): Uint8Array;
|
|
2
|
+
export declare function mnemonicToEntropy(mnemonic: string, wordlist?: string[]): Uint8Array;
|
|
3
|
+
export declare function entropyToMnemonic(entropy: Uint8Array, wordlist?: string[]): string;
|
|
4
|
+
export declare function generateMnemonic(numWords: 12 | 15 | 18 | 21 | 24, wordlist?: string[]): string;
|
|
5
|
+
export declare function validateMnemonic(mnemonic: string, wordlist?: string[]): boolean;
|