Options
All
  • Public
  • Public/Protected
  • All
Menu

A class representing an ECDSA public/private key pair that identifies an XU node on the network and can sign messages to prove their veracity.

Hierarchy

  • NodeKey

Index

Constructors

constructor

  • new NodeKey(privKey: Buffer, pubKey: string, path: string): NodeKey
  • Parameters

    • privKey: Buffer

      The 32 byte private key

    • pubKey: string

      The public key in hex string format.

    • path: string

    Returns NodeKey

Properties

Optional password

password: undefined | string

Private Readonly path

path: string

Readonly privKey

privKey: Buffer

The 32 byte private key

Readonly pubKey

pubKey: string

The public key in hex string format.

Methods

childSeed

  • Derives a child mnemonic seed from the private key for the swap client.

    Parameters

    Returns string

    a BIP39 mnemonic

getMnemonic

  • getMnemonic(): Promise<string[]>

sign

  • sign(msg: Buffer): Buffer
  • Signs a message with the private key.

    Parameters

    • msg: Buffer

      the data to sign

    Returns Buffer

    the signature

toFile

  • toFile(password?: undefined | string): Promise<void>
  • Saves the private key to a file, optionally encrypted by a password.

    Parameters

    • Optional password: undefined | string

      an optional password parameter for encrypting the private key

    Returns Promise<void>

Static fromBytes

  • fromBytes(bytes: Buffer, path?: undefined | string): NodeKey
  • Converts a buffer of bytes to a NodeKey. Uses the first 32 bytes from the buffer to generate the private key. If the buffer has fewer than 32 bytes, the buffer is right-padded with zeros.

    Parameters

    • bytes: Buffer
    • Optional path: undefined | string

    Returns NodeKey

Static fromFile

  • fromFile(path: string, password?: undefined | string): Promise<NodeKey>
  • Load a NodeKey from a file.

    Parameters

    • path: string

      the path to the file

    • Optional password: undefined | string

      an optional password to decrypt the file

    Returns Promise<NodeKey>

    a NodeKey if a file containing a valid ECDSA private key exists at the given path

Static generate

  • generate(path?: undefined | string): Promise<NodeKey>

Static getPath

  • getPath(xudir: string, instanceId?: number): string

Generated using TypeDoc