Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PrivateKey

PrivateKey represents an Ed25519 key use for constructing an Ellcrys address, signing and verifying a signed messages.

export
class

PrivateKey

Hierarchy

  • PrivateKey

Index

Constructors

constructor

  • Creates an instance of PrivateKey.

    memberof

    PrivateKey

    Parameters

    • Optional seed: Buffer

      32-byte seed used to create the key

    Returns PrivateKey

Properties

Private keypair

keypair: CurveKeyPair

The ED25519 key material

type

{ed25519.CurveKeyPair}

memberof

PrivateKey

Methods

publicKey

sign

  • sign(data: Buffer): Buffer
  • Sign a message

    memberof

    PrivateKey

    Parameters

    • data: Buffer

      The message

    Returns Buffer

toAddress

  • Returns an address derived from the private key

    memberof

    PrivateKey

    Returns Address

toBase58

  • toBase58(): string
  • Returns base58 encode string of the private key

    memberof

    PrivateKey

    Returns string

toBuffer

  • toBuffer(): Buffer
  • Returns the private key as a buffer. The base58 version is added as the 0th byte in the returned buffer

    memberof

    PrivateKey

    Returns Buffer

Static from

  • Instantiate a PrivateKey from a base58 encoded private key string

    static
    throws

    InvalidPrivateKeyChecksum|InvalidPrivateKeyVersion|InvalidPrivateKeySize

    memberof

    PrivateKey

    Parameters

    • str: string

      The base58 encoded private keys

    Returns PrivateKey

Static fromBuffer

  • Instantiate a PrivateKey from a buffer. The buffer's 0th index must contain the private key version.

    static
    memberof

    PrivateKey

    Parameters

    • buf: Buffer

    Returns PrivateKey