@did-btc1/key-pair
    Preparing search index...

    Class PrivateKeyUtils

    Utility class for creating and working with PrivateKey objects. PrivateKeyUtils

    Index

    Constructors

    Methods

    • Computes the public key bytes from a private key bytes.

      Parameters

      • privateKeyBytes: Bytes

        The private key bytes

      Returns Bytes

      The public key bytes

      If the public key is not compressed or not derived

    • Create a new PrivateKey object from a bigint secret.

      Parameters

      • secret: bigint

        The secret bigint

      Returns PrivateKey

      A new PrivateKey object

    • Checks if the private key is valid.

      Parameters

      • bytes: Bytes

        The private key bytes

      Returns boolean

      True if the private key is valid, false otherwise

    • Static method to generate random private key bytes.

      Returns Bytes

      Uint8Array of 32 random bytes.

    • Convert a private key bytes to a bigint secret.

      Parameters

      • secret: bigint

        The private key secret.

      Returns Bytes

      The private key secret as private key bytes.

    • Convert a PrivateKey or PrivateKeyBytes to a KeyPair.

      Parameters

      • bytes: Bytes

      Returns KeyPair

      The KeyPair object containing the public and private keys

      If the private key is not valid

    • Convert a bigint secret to private key bytes.

      Parameters

      • bytes: Bytes

        The private key bytes

      Returns bigint

      The private key bytes as a bigint secret