Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DeterministicKey describes hierarchical deterministic keys that are compatible with the bitcoinjs/bip32 implementation.

This class is used to provide with compatibility for both schemes: BIP32 and NIP6.

see

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

since

0.2.0

Hierarchy

Implements

Index

Constructors

constructor

  • new DeterministicKey(__D: Buffer | undefined, __Q: Buffer | undefined, chainCode: Buffer, network: Network, __DEPTH?: number, __INDEX?: number, __PARENT_FINGERPRINT?: number): DeterministicKey
  • Construct a NodeEd25519 object.

    Parameters

    • __D: Buffer | undefined
    • __Q: Buffer | undefined
    • chainCode: Buffer

      The chain code of the node (32 bytes).

    • network: Network

      The network of the node

    • Default value __DEPTH: number = 0
    • Default value __INDEX: number = 0
    • Default value __PARENT_FINGERPRINT: number = 0

    Returns DeterministicKey

Properties

Private __D

__D: Buffer | undefined

Private __DEPTH

__DEPTH: number

Private __INDEX

__INDEX: number

Private __PARENT_FINGERPRINT

__PARENT_FINGERPRINT: number

Private __Q

__Q: Buffer | undefined

chainCode

chainCode: Buffer

The chain code of the node (32 bytes).

network

network: Network

The network of the node

Accessors

Private depth

  • get depth(): number

fingerprint

  • get fingerprint(): Buffer
  • Getter for the fingerprint of the key.

    The fingerprint are the first 4 bytes of the identifier of the key.

    access

    public

    Returns Buffer

identifier

  • get identifier(): Buffer
  • Getter for the identifier of the key.

    The identifier is build as follows:

    • Step 1: Sha3-256 of the public key
    • Step 2: RIPEMD160 of the sha3 hash
    access

    public

    Returns Buffer

Private index

  • get index(): number

Private parentFingerprint

  • get parentFingerprint(): number

privateKey

  • get privateKey(): Buffer

publicKey

  • get publicKey(): Buffer
  • Getter for the publicKey of the key.

    In case the publicKey is not set, this method should derive from private key.

    abstract
    access

    public

    Returns Buffer

Methods

Abstract derive

Abstract deriveHardened

Abstract derivePath

  • Generic child derivation.

    This method reads the derivation paths and uses derive and deriveHardened accordingly.

    Derivation paths starting with m/ are only possible with master nodes (for example created from seed).

    abstract
    access

    public

    Parameters

    • path: string

    Returns NodeInterface

getD

  • getD(): Buffer | undefined
  • Getter for private field __D.

    This method is added to explicitely expose the __D field to allow sub-classes to make use of it.

    The __D field represents the private key.

    access

    public

    Returns Buffer | undefined

getDepth

  • getDepth(): number

getIndex

  • getIndex(): number

getParentFingerprint

  • getParentFingerprint(): number

getQ

  • getQ(): Buffer | undefined
  • Getter for private field __Q.

    This method is added to explicitely expose the __Q field to allow sub-classes to make use of it.

    The __Q field represents the public key.

    access

    public

    Returns Buffer | undefined

isNeutered

  • isNeutered(): boolean

Abstract neutered

Abstract sign

  • sign(hash: Buffer): Buffer

toBase58

  • toBase58(): string
  • Get the Base58 representation of said key.

    This method is modified to use the Network class to determine privateKey and publicKey prefixes (version field).

    The Base58 representation is laid on 78 bytes with following specification (with || concatenation operator) :

    version || depth || parent || index || chain code || priv/pub

    Private keys are prepended with 0x00, public keys are encoded in X9.62 format.

    see

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

    access

    public

    Returns string

toWIF

  • toWIF(): string

Abstract verify

  • verify(hash: Buffer, signature: Buffer): boolean

Generated using TypeDoc