Global

Members

(constant) ADDRESS_FORMATS :Object

Description:
  • Supported address format types

Source:

Supported address format types

Type:
  • Object

(constant) ADDRESS_TYPE_PURPOSE :Object

Description:
  • Address type mapping to BIP purpose

Source:

Address type mapping to BIP purpose

Type:
  • Object

(constant) ADDRESS_TYPE_PURPOSE :Object

Description:
  • Address type mapping to BIP purpose

Source:

Address type mapping to BIP purpose

Type:
  • Object

(constant) BECH32_PREFIXES :Object.<string, string>

Description:
  • Bech32 human-readable part prefixes by network

Source:

Bech32 human-readable part prefixes by network

Type:
  • Object.<string, string>

(constant) BIP322_CONSTANTS :Object

Description:
  • BIP322 message signing constants

Source:

BIP322 message signing constants

Type:
  • Object

(constant) BIP32_CONSTANTS :Object

Description:
  • BIP32 HD wallet constants

Source:

BIP32 HD wallet constants

Type:
  • Object

(constant) BIP340_CONSTANTS :Object

Description:
  • BIP340 Schnorr signature constants

Source:

BIP340 Schnorr signature constants

Type:
  • Object

(constant) BIP39_CONSTANTS :Object

Description:
  • BIP39 implementation constants

Source:

BIP39 implementation constants

Type:
  • Object

(constant) BIP39_CONSTANTS :Object

Description:
  • BIP39 mnemonic constants

Source:

BIP39 mnemonic constants

Type:
  • Object

(constant) BIP44_CONSTANTS :Object

Description:
  • BIP44 derivation path constants

Source:

BIP44 derivation path constants

Type:
  • Object

(constant) BIP49_CONSTANTS :Object

Description:
  • BIP49 Derivation Path Constants

Source:

BIP49 Derivation Path Constants

Type:
  • Object

(constant) BIP_COMPLIANCE

Description:
  • BIP compliance matrix

Source:

BIP compliance matrix

(constant) BIP_PURPOSES :Object

Description:
  • BIP purpose values for different address types

Source:

BIP purpose values for different address types

Type:
  • Object

(constant) CRYPTO_CONSTANTS :Object

Description:
  • Cryptographic constants for secp256k1 curve and key lengths

Source:

Cryptographic constants for secp256k1 curve and key lengths

Type:
  • Object

(constant) CURVE_ORDER

Description:
  • secp256k1 curve order n

Source:

secp256k1 curve order n

(constant) ENCODING_CONSTANTS :Object

Description:
  • Encoding alphabet constants

Source:

Encoding alphabet constants

Type:
  • Object

(constant) FEATURES

Description:
  • Library feature support matrix

Source:

Library feature support matrix

(constant) G

Description:
  • secp256k1 generator point G

Source:

secp256k1 generator point G

(constant) G

Description:
  • secp256k1 generator point G

Source:

secp256k1 generator point G

(constant) G

Description:
  • secp256k1 generator point G

Source:

secp256k1 generator point G

(constant) HARDENED_OFFSET :number

Description:
  • Offset for hardened key derivation (2^31)

Source:

Offset for hardened key derivation (2^31)

Type:
  • number

(constant) LIBRARY_INFO

Description:
  • Library metadata

Source:

Library metadata

(constant) NETWORKS

Description:
  • Supported Bitcoin networks

Source:

Supported Bitcoin networks

(constant) NETWORK_VERSIONS :Object

Description:
  • Network version bytes for mainnet and testnet

Source:

Network version bytes for mainnet and testnet

Type:
  • Object

(constant) OPCODES :Object

Description:
  • Bitcoin opcodes

Source:

Bitcoin opcodes

Type:
  • Object

(constant) SECURITY_CONSTANTS :Object

Description:
  • Security constants for RIPEMD160 implementation

Source:

Security constants for RIPEMD160 implementation

Type:
  • Object

(constant) SIGHASH :Object

Description:
  • Sighash types

Source:

Sighash types

Type:
  • Object

(constant) TAPROOT_CONSTANTS :Object

Description:
  • Taproot signature constants

Source:

Taproot signature constants

Type:
  • Object

(constant) THRESHOLD_CONSTANTS :Object

Description:
  • Threshold signature scheme constants

Source:

Threshold signature scheme constants

Type:
  • Object

(constant) TRANSACTION_CONSTANTS :Object

Description:
  • Bitcoin transaction constants

Source:

Bitcoin transaction constants

Type:
  • Object

(constant) TX_CONSTANTS :Object

Description:
  • Transaction building constants

Source:

Transaction building constants

Type:
  • Object

Methods

ADDSS(aShares, bShares, threshold) → {BN}

Description:
  • Section 2.2: Addition of Shared Secrets (ADDSS)

    Given shares of two secrets a and b, computes a + b. Each participant calculates ν_i = a_i + b_i, then interpolates.

Source:
Parameters:
Name Type Description
aShares Array.<{x: BN, y: BN}>

Shares of secret a

bShares Array.<{x: BN, y: BN}>

Shares of secret b

threshold number

Required threshold (t+1)

Returns:

The sum a + b

Type
BN

INVSS(aShares, bShares, t) → {Object}

Description:
  • Section 2.4: Inverse of a Shared Secret (INVSS)

    Computes shares of a^-1 using a blinding value b.

    Process:

    1. Calculate μ = a * b using PROSS
    2. Calculate μ^-1 = (a * b)^-1 (this is known to all)
    3. Each participant calculates a_i^-1 = μ^-1 * b_i

    The inverse shares can then be used in further calculations. Interpolating over them would give a^-1, but we typically use them in products like k^-1 * (e + a*r).

Source:
Parameters:
Name Type Description
aShares Array.<{x: BN, y: BN}>

Shares of secret a

bShares Array.<{x: BN, y: BN}>

Shares of blinding value b

t number

Threshold degree (polynomials are order t)

Returns:

INVSS result

Type
Object

PROSS(aShares, bShares, productThreshold) → {BN}

Description:
  • Section 2.3: Product of Shared Secrets (PROSS)

    Given shares of two secrets a and b, computes a * b. Each participant calculates μ_i = a_i * b_i, then interpolates.

    NOTE: The product polynomial has order 2t, so 2t+1 shares are needed!

Source:
Parameters:
Name Type Description
aShares Array.<{x: BN, y: BN}>

Shares of secret a (order t polynomial)

bShares Array.<{x: BN, y: BN}>

Shares of secret b (order t polynomial)

productThreshold number

Required threshold for product (2t+1)

Returns:

The product a * b

Type
BN

b58decode(encoded) → {Buffer}

Description:
  • Decode Base58Check string (with checksum verification)

Source:
Parameters:
Name Type Description
encoded string

Base58Check string

Throws:

If checksum verification fails

Type
Error
Returns:

Decoded data (without checksum)

Type
Buffer

b58encode(buffer) → {string}

Description:
  • Encode buffer with Base58Check (with checksum)

Source:
Parameters:
Name Type Description
buffer Buffer

Data to encode

Throws:

If input invalid or checksum fails

Type
Error
Returns:

Base58Check-encoded string

Type
string

computeAdditiveShares(aShares, bShares) → {Array.<{x: BN, y: BN}>}

Description:
  • Calculate additive shares without interpolation Returns shares that can be used for further MPC operations

Source:
Parameters:
Name Type Description
aShares Array.<{x: BN, y: BN}>

Shares of secret a

bShares Array.<{x: BN, y: BN}>

Shares of secret b

Returns:

Additive shares ν_i = a_i + b_i

Type
Array.<{x: BN, y: BN}>

computeMultiplicativeShares(aShares, bShares) → {Array.<{x: BN, y: BN}>}

Description:
  • Calculate multiplicative shares without interpolation

Source:
Parameters:
Name Type Description
aShares Array.<{x: BN, y: BN}>

Shares of secret a

bShares Array.<{x: BN, y: BN}>

Shares of secret b

Returns:

Multiplicative shares μ_i = a_i * b_i

Type
Array.<{x: BN, y: BN}>

convertBits(data, fromBits, toBits, padopt) → {Array.<number>}

Description:
  • Convert between bit groupings

Source:
Parameters:
Name Type Attributes Default Description
data Array.<number>

Input values

fromBits number

Source bits per value

toBits number

Target bits per value

pad boolean <optional>
true

Add padding if needed

Returns:

Converted values

Type
Array.<number>

createP2WPKHScriptCode(pubkeyHash) → {Buffer}

Description:
  • Create scriptCode for P2WPKH sighash

Source:
Parameters:
Name Type Description
pubkeyHash Buffer

20-byte public key hash

Returns:

scriptCode

Type
Buffer

createThresholdScheme(n, t, ephemeralKeyCount) → {ThresholdSignatureScheme}

Description:
  • Create and initialize a threshold signature scheme Convenience function for quick setup

Source:
Parameters:
Name Type Default Description
n number

Total participants

t number

Threshold degree

ephemeralKeyCount number 5

Number of ephemeral keys to pre-generate

Returns:

Initialized scheme

Type
ThresholdSignatureScheme

decode(str) → {Object}

Description:
  • Decode a Bech32/Bech32m string

Source:
Parameters:
Name Type Description
str string

Bech32 string to decode

Throws:

If string invalid or checksum fails

Type
Error
Returns:

Decoded {hrp, data, spec}

Type
Object

decode(str) → {Buffer}

Description:
  • Decode Base58 string (without checksum)

Source:
Parameters:
Name Type Description
str string

Base58 string

Throws:

If invalid characters found

Type
Error
Returns:

Decoded data

Type
Buffer

decodeAddress(address) → {Object}

Description:
  • Decode any Bitcoin address (auto-detects type)

Source:
Parameters:
Name Type Description
address string

Bitcoin address

Throws:

If address invalid

Type
DecodingError
Returns:

Decoded address information

Type
Object

decodeExtendedKey(extendedKey) → {Object}

Description:
  • Decode a Base58Check-encoded extended key

Source:
Parameters:
Name Type Description
extendedKey string

Extended key (xprv/xpub/tprv/tpub)

Throws:

If key format is invalid

Type
Error
Returns:

Decoded key information

Type
Object

decodeExtendedKey(extendedKey) → {Object}

Description:
  • Decode an extended key (xprv/xpub/tprv/tpub)

Source:
Parameters:
Name Type Description
extendedKey string

Extended key string

Throws:

If key format invalid

Type
DecodingError
Returns:

Decoded key information

Type
Object

decodeLegacyAddress(address) → {Object}

Description:
  • Decode a legacy (Base58Check) address

Source:
Parameters:
Name Type Description
address string

Bitcoin address

Throws:

If address invalid

Type
DecodingError
Returns:

Decoded {hash160, network, type, version}

Type
Object

decodeSegwit(hrp, addr) → {Object}

Description:
  • Decode a SegWit address

Source:
Parameters:
Name Type Description
hrp string

Expected human-readable part

addr string

Bech32 address to decode

Throws:

If address invalid

Type
Error
Returns:

Decoded {version, program}

Type
Object

decodeSegwitAddress(address) → {Object}

Description:
  • Decode a SegWit (Bech32/Bech32m) address

Source:
Parameters:
Name Type Description
address string

Bech32 address

Throws:

If address invalid

Type
DecodingError
Returns:

Decoded {program, version, network, type}

Type
Object

decodeWIFPrivateKey(wif) → {Buffer}

Description:
  • Decode a WIF-encoded private key

Source:
Parameters:
Name Type Description
wif string

WIF-encoded private key

Throws:

If WIF format is invalid

Type
ECDSAError
Returns:

32-byte private key

Type
Buffer

decodeWIFPrivateKey(wif) → {Object}

Description:
  • Decode a WIF-encoded private key

Source:
Parameters:
Name Type Description
wif string

WIF string

Throws:

If WIF format invalid

Type
DecodingError
Returns:

Decoded {privateKey, network, compressed}

Type
Object

derive(path, extendedKey) → {Object}

Description:
  • Derive a child key at a given path from an extended key

Source:
Parameters:
Name Type Description
path string

BIP32 derivation path (e.g., "m/44'/0'/0'/0/0")

extendedKey string

Parent extended key (xprv/xpub)

Throws:

If path or key is invalid

Type
Error
Returns:

Derived key information

Type
Object

deriveChildKey(parentKeyInfo, index, hardenedopt) → {Object}

Description:
  • Derive a child key from a parent key

Source:
Parameters:
Name Type Attributes Default Description
parentKeyInfo Object

Parent key information

index number

Child index (0-2147483647)

hardened boolean <optional>
false

Whether to use hardened derivation

Throws:

If hardened derivation attempted on public key

Type
Error
Returns:

Child key information

Type
Object

doubleHash256(data) → {Buffer}

Description:
  • Double SHA256 hash for checksums

Source:
Parameters:
Name Type Description
data Buffer

Data to hash

Returns:

32-byte hash

Type
Buffer

encode(hrp, data, specopt) → {string}

Description:
  • Encode data as Bech32/Bech32m

Source:
Parameters:
Name Type Attributes Default Description
hrp string

Human-readable part

data Array.<number>

5-bit values to encode

spec string <optional>
'bech32'

Encoding spec ('bech32' or 'bech32m')

Returns:

Encoded address

Type
string

encode(buffer) → {string}

Description:
  • Encode buffer to Base58 (without checksum)

Source:
Parameters:
Name Type Description
buffer Buffer

Data to encode

Throws:

If input is not a Buffer

Type
Error
Returns:

Base58-encoded string

Type
string

encodeAddress(versionByte, hash160Data) → {string}

Description:
  • Encode a version byte and hash to Base58Check address

Source:
Parameters:
Name Type Description
versionByte number

Network version byte

hash160Data Buffer

20-byte hash

Returns:

Base58Check address

Type
string

encodeExtendedKey(keyInfo) → {string}

Description:
  • Encode key information to a Base58Check extended key

Source:
Parameters:
Name Type Description
keyInfo Object

Key information object

Returns:

Base58Check-encoded extended key

Type
string

encodeExtendedKey(type, context) → {string}

Description:
  • Encode extended key components to Base58Check format

Source:
Parameters:
Name Type Description
type string

Key type ('private' or 'public')

context Object

Key context with version, depth, chain code, etc.

Returns:

Base58Check-encoded extended key

Type
string

encodeP2PKH(publicKey, networkopt) → {string}

Description:
  • Encode public key to P2PKH (legacy) address

Source:
Parameters:
Name Type Attributes Default Description
publicKey Buffer | string

Compressed/uncompressed public key

network string <optional>
'main'

Network type

Returns:

Base58Check P2PKH address

Type
string

encodeP2SH(scriptHash, networkopt) → {string}

Description:
  • Encode script hash to P2SH address

Source:
Parameters:
Name Type Attributes Default Description
scriptHash Buffer | string

20-byte script hash

network string <optional>
'main'

Network type

Returns:

Base58Check P2SH address

Type
string

encodePush(data) → {Buffer}

Description:
  • Encode data as a push operation

Source:
Parameters:
Name Type Description
data Buffer

Data to push

Returns:

Push operation bytes

Type
Buffer

encodeSegwit(hrp, version, program) → {string}

Description:
  • Encode a SegWit address

Source:
Parameters:
Name Type Description
hrp string

Human-readable part ('bc' or 'tb')

version number

Witness version (0-16)

program Buffer

Witness program

Returns:

Bech32/Bech32m address

Type
string

encodeVarInt(n) → {Buffer}

Description:
  • Encode a variable-length integer

Source:
Parameters:
Name Type Description
n number | bigint

Number to encode

Returns:

VarInt encoded

Type
Buffer

encodeVarInt(n) → {Buffer}

Description:
  • Encode a variable-length integer

Source:
Parameters:
Name Type Description
n number

Number to encode

Returns:

VarInt bytes

Type
Buffer

encodeWIF(privateKey, networkopt, compressedopt) → {string}

Description:
  • Encode private key to WIF format

Source:
Parameters:
Name Type Attributes Default Description
privateKey Buffer | string

32-byte private key

network string <optional>
'main'

Network type

compressed boolean <optional>
true

Use compressed format

Returns:

WIF-encoded private key

Type
string

generateDerivationPath(optionsopt) → {string}

Description:
  • Generate a BIP44 derivation path

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Path options

Returns:

Derivation path string

Type
string

generateEphemeralKeyShares(n, t) → {Object}

Description:
  • Generate ephemeral key inverse shares for threshold signing

    This implements Section 4.2 of the whitepaper:

    1. Generate shared ephemeral key k using JVRSS
    2. Generate blinding value b using JVRSS
    3. Calculate k^-1 shares using INVSS
    4. Calculate r = x mod n from k·G
Source:
Parameters:
Name Type Description
n number

Number of participants

t number

Threshold degree

Returns:

Ephemeral key data

Type
Object

generateMasterKey(seed, networkopt) → {Array}

Description:
  • Generate BIP32 master keys from a seed

Source:
Parameters:
Name Type Attributes Default Description
seed string | Buffer

16-64 byte seed (typically from BIP39)

network string <optional>
'main'

Network type ('main' or 'test')

Throws:

If seed is invalid or key generation fails

Type
Error
Returns:

[masterKeys, masterKeyContext]

Type
Array

generateSecureRandom(bytes) → {BN}

Description:
  • Generate a cryptographically secure random element in Z_n

Source:
Parameters:
Name Type Default Description
bytes number 32

Number of bytes for randomness

Returns:

Random element in [1, n-1]

Type
BN

getFingerprint(publicKey) → {Buffer}

Description:
  • Get the fingerprint of a public key (first 4 bytes of HASH160)

Source:
Parameters:
Name Type Description
publicKey Buffer

Compressed public key

Returns:

4-byte fingerprint

Type
Buffer

hash160(data) → {Buffer}

Description:
  • Compute HASH160 (SHA256 + RIPEMD160) of data

Source:
Parameters:
Name Type Description
data Buffer

Input data to hash

Returns:

20-byte HASH160 result

Type
Buffer

hash160(data) → {Buffer}

Description:
  • Hash160 (SHA256 + RIPEMD160)

Source:
Parameters:
Name Type Description
data Buffer

Data to hash

Returns:

20-byte hash

Type
Buffer

hash160(buffer) → {Buffer}

Description:
  • Compute HASH160 (SHA256 + RIPEMD160) of input

Source:
Parameters:
Name Type Description
buffer Buffer

Input data

Returns:

20-byte hash result

Type
Buffer

hash160(data) → {Buffer}

Description:
  • Compute HASH160 of data

Source:
Parameters:
Name Type Description
data Buffer

Input data

Returns:

20-byte hash

Type
Buffer

hash160(data) → {Buffer}

Description:
  • Hash160 (SHA256 + RIPEMD160)

Source:
Parameters:
Name Type Description
data Buffer

Data to hash

Returns:

20-byte hash

Type
Buffer

hash256(data) → {Buffer}

Description:
  • Double SHA256 hash

Source:
Parameters:
Name Type Description
data Buffer

Data to hash

Returns:

32-byte hash

Type
Buffer

normalizeUnicode(text, formopt) → {string}

Description:
  • Normalize Unicode text using specified form

Source:
Parameters:
Name Type Attributes Default Description
text string

Text to normalize

form string <optional>
'NFKD'

Normalization form

Throws:

If input is not a string

Type
Error
Returns:

Normalized text

Type
string

polymod(values) → {number}

Description:
  • Compute Bech32 polymod checksum

Source:
Parameters:
Name Type Description
values Array.<number>

Values to checksum

Returns:

Checksum value

Type
number

rmd160(buffer) → {Buffer}

Description:
  • Compute RIPEMD160 hash of input

Source:
Parameters:
Name Type Description
buffer Buffer | ArrayBuffer | TypedArray

Input data

Throws:

If input is missing, wrong type, or too large

Type
Error
Returns:

20-byte hash result

Type
Buffer

rotl(x, n) → {number}

Description:
  • Rotate left operation for 32-bit integers

Source:
Parameters:
Name Type Description
x number

Value to rotate

n number

Number of bits

Returns:

Rotated value

Type
number

runJVRSS(n, t) → {Object}

Description:
  • Run a standalone JVRSS protocol and return results Convenience function for generating a shared secret

Source:
Parameters:
Name Type Description
n number

Number of participants

t number

Threshold

Returns:

JVRSS result with shares and public key

Type
Object

secureClear(buffer) → {void}

Description:
  • Securely clear sensitive data from a buffer

Source:
Parameters:
Name Type Description
buffer Buffer

Buffer to clear

Returns:
Type
void

secureClear(data) → {void}

Description:
  • Securely clear sensitive data from memory

Source:
Parameters:
Name Type Description
data Uint8Array | Uint32Array

Data to clear

Returns:
Type
void

sha256(data) → {Buffer}

Description:
  • SHA256 hash helper

Source:
Parameters:
Name Type Description
data Buffer

Data to hash

Returns:

32-byte hash

Type
Buffer

taggedHash(tag, data) → {Buffer}

Description:
  • Tagged hash for BIP322

Source:
Parameters:
Name Type Description
tag string

Hash tag

data Buffer

Data to hash

Returns:

32-byte tagged hash

Type
Buffer

taggedHash(tag, data) → {Buffer}

Description:
  • Tagged hash for Taproot (BIP340)

Source:
Parameters:
Name Type Description
tag string

Hash tag

data Buffer

Data to hash

Returns:

32-byte tagged hash

Type
Buffer

taggedHash(tag, data) → {Buffer}

Description:
  • Tagged hash for Taproot

Source:
Parameters:
Name Type Description
tag string

Hash tag

data Buffer

Data to hash

Returns:

32-byte hash

Type
Buffer

validateAddress(address, networkopt) → {Object}

Description:
  • Validate any Bitcoin address (auto-detects type)

Source:
Parameters:
Name Type Attributes Default Description
address string

Address to validate

network string <optional>
'main'

Network type

Returns:

Validation result

Type
Object

validateAndGetNetwork(network) → {Object}

Description:
  • Validate and get network configuration

Source:
Parameters:
Name Type Description
network string

Network type ('main', 'test', 'mainnet')

Throws:

If network is invalid

Type
Error
Returns:

Network configuration

Type
Object

validateBuffer(value, expectedLengthopt, fieldNameopt) → {boolean}

Description:
  • Validate a value is a Buffer with optional length check

Source:
Parameters:
Name Type Attributes Default Description
value *

Value to validate

expectedLength number | null <optional>
null

Expected byte length

fieldName string <optional>
'value'

Field name for error messages

Throws:

If validation fails

Type
ValidationError
Returns:

True if valid

Type
boolean

validateBufferLength(value, minLength, maxLength, fieldNameopt) → {boolean}

Description:
  • Validate buffer length is within range

Source:
Parameters:
Name Type Attributes Default Description
value Buffer

Buffer to validate

minLength number

Minimum length

maxLength number

Maximum length

fieldName string <optional>
'value'

Field name

Returns:

True if valid

Type
boolean

validateChildKey(childKeyBN) → {Buffer}

Description:
  • Validate a derived child key against curve parameters

Source:
Parameters:
Name Type Description
childKeyBN BN

Child key as big number

Throws:

If key is zero or >= curve order

Type
Error
Returns:

32-byte formatted key

Type
Buffer

validateDerivationPath(path) → {boolean}

Description:
  • Validate a BIP32 derivation path

Source:
Parameters:
Name Type Description
path string

Derivation path (e.g., "m/44'/0'/0'/0/0")

Throws:

If path format is invalid

Type
Error
Returns:

True if valid

Type
boolean

validateEntropyQuality(entropy) → {Object}

Description:
  • Validate entropy quality using Shannon entropy

Source:
Parameters:
Name Type Description
entropy Buffer

Entropy bytes to validate

Returns:

Validation result with isValid, score, issues

Type
Object

validateExtendedKey(key, expectedPrefixopt) → {boolean}

Description:
  • Validate a Base58Check-encoded extended key

Source:
Parameters:
Name Type Attributes Default Description
key string

Extended key to validate

expectedPrefix string | null <optional>
null

Expected key prefix

Throws:

If key is invalid

Type
Error
Returns:

True if valid

Type
boolean

validateHexString(value, expectedLengthopt, fieldNameopt) → {boolean}

Description:
  • Validate a hex string

Source:
Parameters:
Name Type Attributes Default Description
value string

String to validate

expectedLength number | null <optional>
null

Expected length

fieldName string <optional>
'value'

Field name

Returns:

True if valid

Type
boolean

validateNumberRange(value, min, max, fieldNameopt) → {boolean}

Description:
  • Validate number is within range

Source:
Parameters:
Name Type Attributes Default Description
value number

Number to validate

min number

Minimum value

max number

Maximum value

fieldName string <optional>
'value'

Field name

Returns:

True if valid

Type
boolean

validatePrivateKey(privateKey) → {Buffer}

Description:
  • Validate a private key format and value

Source:
Parameters:
Name Type Description
privateKey string | Buffer | Uint8Array

Private key to validate

Throws:

If key is invalid

Type
ECDSAError
Returns:

Validated 32-byte private key

Type
Buffer

validatePrivateKey(key, fieldNameopt) → {Object}

Description:
  • Validate a private key

Source:
Parameters:
Name Type Attributes Default Description
key string | Buffer

Private key

fieldName string <optional>
'private key'

Field name

Returns:

Validation result with format

Type
Object

validatePublicKey(publicKey) → {Buffer}

Description:
  • Validate a public key format and value

Source:
Parameters:
Name Type Description
publicKey string | Buffer | Uint8Array

Public key to validate

Throws:

If key is invalid

Type
ECDSAError
Returns:

Validated public key

Type
Buffer

validatePublicKey(key, fieldNameopt) → {Object}

Description:
  • Validate a public key

Source:
Parameters:
Name Type Attributes Default Description
key string | Buffer

Public key

fieldName string <optional>
'public key'

Field name

Returns:

Validation result with compressed flag

Type
Object

validateSeed(seed) → {Buffer}

Description:
  • Validate a seed for BIP32 master key generation

Source:
Parameters:
Name Type Description
seed string | Buffer

Seed as hex string or Buffer

Throws:

If seed is missing, wrong type, or wrong length

Type
Error
Returns:

Validated seed buffer

Type
Buffer