Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PublicKey

PublicKey represents an ED25519 public key

export
class

PublicKey

Hierarchy

  • PublicKey

Index

Properties

Private pk

pk: Buffer

Methods

toAddress

  • Returns an address derived from the public key

    memberof

    PublicKey

    Returns Address

toBase58

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

    memberof

    PublicKey

    Returns string

toBuffer

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

    memberof

    PublicKey

    Returns Buffer

verify

  • verify(msg: Buffer, sig: Buffer): boolean
  • Verify a signature

    memberof

    PublicKey

    Parameters

    • msg: Buffer

      The message that was signed

    • sig: Buffer

      The message's signature

    Returns boolean

Static from

  • Instantiate a PublicKey from a base58 encoded public key string

    static
    throws

    InvalidPublicKeyChecksum|InvalidPublicKeyVersion|InvalidPublicKeySize

    memberof

    PublicKey

    Parameters

    • str: string

    Returns PublicKey

Static fromBuffer

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

    static
    memberof

    PublicKey

    Parameters

    • buf: Buffer

    Returns PublicKey