Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ExtendedKey describes a hierarchical deterministic extended key that can be derived. This hierarchical deterministic child key derivation feature is described in the Bitcoin BIP32 standard which can be found at following URL:

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

This class uses features provided by the bitcoinjs/bip32 package and therefor is licensed under the BSD-2 Clause License as mentioned here.

see

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

see

https://github.com/bitcoinjs/bip32

see

https://github.com/nemtech/NIP/issues/12

since

0.1.0

Hierarchy

  • ExtendedKey

Index

Constructors

constructor

Properties

Readonly macType

macType: MACType = MACType.HMAC

network

network: Network

Readonly node

node: NodeEd25519 | BIP32

Static DEFAULT_MAC_TYPE

DEFAULT_MAC_TYPE: MACType = MACType.HMAC

Static property to define which type of message authentication code must be used.

var

{MACType}

Methods

derivePath

Protected encodeAs

  • encodeAs(key: Buffer, encoding?: KeyEncoding): string | Buffer
  • Encode a key into encoding. Default encoding is KeyEncoding.ENC_HEX which results in a hexadecimal notation of the key.

    Parameters

    • key: Buffer
    • encoding: KeyEncoding = KeyEncoding.ENC_HEX

    Returns string | Buffer

getPrivateKey

  • Get the private key of the HD-node.

    This method defaults to returning the hexadecimal notation of the key. Use KeyEncoding.ENC_BIN if you need the binary form.

    see

    {KeyEncoding}

    throws

    {Error} On use of this method with neutered extended keys (public keys).

    Parameters

    Returns string | Buffer

getPublicKey

  • Get the public key in hexadecimal notation.

    This method defaults to returning the hexadecimal notation of the key. Use KeyEncoding.ENC_BIN if you need the binary form.

    see

    {KeyEncoding}

    throws

    {Error} On use of this method with neutered extended keys (public keys).

    Parameters

    Returns string | Buffer

getPublicNode

isMaster

  • isMaster(): boolean
  • Return whether the current node is a master key node or not.

    Returns boolean

isNeutered

  • isNeutered(): boolean
  • Return whether an extended key node is neutered or not.

    Neutered = Public Key only Not Neutered = Private Key available

    Returns boolean

toBase58

  • toBase58(): string
  • This method proxies the conversion to base58 format to the bitcoinjs/bip32 library.

    Returns string

Static createFromBase58

  • Create an extended key hyper-deterministic node by its' Base58 payload.

    This method uses the bitcoinjs/bip32 function named fromBase58 and creates an extended key node by parsing the Base58 binary representation.

    Parameters

    Returns ExtendedKey

Static createFromSeed

  • Create an extended key hyper-deterministic node with the master seed.

    This method uses the bitcoinjs/bip32 function named fromSeed and creates an extended key node by creating HMAC-SHA512 hash of the words 'Bitcoin seed' appended with the seed binary representation.

    The result is split in 2 parts where the left most 32 bytes are the private and right most 32 bytes are the public key.

    see

    https://github.com/bitcoinjs/bip32/blob/master/src/bip32.js#L265

    Parameters

    Returns ExtendedKey

Generated using TypeDoc