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

    Class PrivateKey

    Encapsulates a secp256k1 private key Provides get methods for different formats (raw, secret, point). Provides helpers methods for comparison, serialization and publicKey generation. PrivateKey

    Implements

    Index

    Constructors

    • Instantiates an instance of PrivateKey.

      Parameters

      • seed: PrivateKeySeed

        bytes (Uint8Array) or secret (bigint)

      Returns PrivateKey

      If seed is not provided, not a valid 32-byte private key or not a valid bigint secret

    Accessors

    • get hex(): Hex

      Returns the raw private key as a hex string.

      Returns Hex

      The private key as a hex string

      IPrivateKey.hex

    • get point(): bigint

      Return the private key point.

      Returns bigint

      The private key point.

      IPrivateKey.point

      If the public key is undefined or not compressed

    Methods

    • Checks if this private key is equal to another.

      Parameters

      Returns boolean

      True if the private keys are equal, false otherwise

      IPrivateKey.equals

    • Checks if the private key is valid.

      Returns boolean

      True if the private key is valid, false otherwise

      IPrivateKey.computePublicKey

    • Returns the private key as a JSON object.

      Returns PrivateKeyJSON

      IPrivateKey.json