Represents the private key of an Ed25519 key pair.

Hierarchy (view full)

Implements

Constructors

  • Create a new PrivateKey instance from a Uint8Array or String.

    Parameters

    • hexInput: HexInput

      HexInput (string or Uint8Array)

    Returns Ed25519PrivateKey

Properties

LENGTH: number

Length of an Ed25519 private key

SLIP_0010_SEED: "ed25519 seed" = "ed25519 seed"

The Ed25519 key seed to use for BIP-32 compatibility See more https://github.com/satoshilabs/slips/blob/master/slip-0010.md

Methods

  • Serializes a Serializable value to its BCS representation. This function is the Typescript SDK equivalent of bcs::to_bytes in Move.

    Returns Uint8Array

    the BCS representation of the Serializable instance as a byte buffer

  • Helper function to get a value's BCS-serialized bytes as a Hex instance.

    Returns Hex

    a Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array

  • Derive the Ed25519PublicKey for this private key.

    Returns Ed25519PublicKey

    Ed25519PublicKey

  • Parameters

    Returns void

  • Sign the given message with the private key.

    Parameters

    • message: HexInput

      a message as a string or Uint8Array

    Returns Ed25519Signature

    Signature

  • Get the private key as a hex string with the 0x prefix.

    Returns string

    string representation of the private key

  • Get the private key in bytes (Uint8Array).

    Returns Uint8Array

    Uint8Array representation of the private key

  • Derives a private key from a mnemonic seed phrase.

    To derive multiple keys from the same phrase, change the path

    IMPORTANT: Ed25519 supports hardened derivation only (since it lacks a key homomorphism, so non-hardened derivation cannot work)

    Parameters

    • path: string

      the BIP44 path

    • mnemonics: string

      the mnemonic seed phrase

    Returns Ed25519PrivateKey

  • Generate a new random private key.

    Returns Ed25519PrivateKey

    Ed25519PrivateKey

  • Parameters

    Returns privateKey is Ed25519PrivateKey

    use instanceof Ed25519PrivateKey instead.