A Secp256k1 ecdsa private key

Hierarchy (view full)

Implements

Constructors

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

    Parameters

    • hexInput: HexInput

      A HexInput (string or Uint8Array)

    Returns Secp256k1PrivateKey

Properties

LENGTH: number

Length of Secp256k1 ecdsa private key

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 Secp256k1PublicKey from this private key.

    Returns Secp256k1PublicKey

    Secp256k1PublicKey

  • Parameters

    Returns void

  • Sign the given message with the private key.

    Note: signatures are canonical, and non-malleable

    Parameters

    • message: HexInput

      a message as a string or Uint8Array

    Returns Secp256k1Signature

    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

  • Derives a private key from a mnemonic seed phrase.

    Parameters

    • path: string

      the BIP44 path

    • mnemonics: string

      the mnemonic seed phrase

    Returns Secp256k1PrivateKey

    The generated key

  • Generate a new random private key.

    Returns Secp256k1PrivateKey

    Secp256k1PrivateKey

  • Parameters

    Returns privateKey is Secp256k1PrivateKey

    use instanceof Secp256k1PrivateKey instead