Class Signer

Class that signs BIP-322 signature using a private key. Reference: https://github.com/LegReq/bip0322-signatures/blob/master/BIP0322_signing.ipynb

Constructors

Methods

  • Check if a given public key is the public key for a claimed address.

    Parameters

    • publicKey: Buffer

      Public key to be tested

    • claimedAddress: string

      Address claimed to be derived based on the provided public key

    Returns boolean

    True if the claimedAddress can be derived by the provided publicKey, false if otherwise

  • Sign a BIP-322 signature from P2WPKH, P2SH-P2WPKH, and single-key-spend P2TR address and its corresponding private key. Network is automatically inferred from the given address.

    Parameters

    • privateKey: string

      Private key used to sign the message

    • address: string

      Address to be signing the message

    • message: string

      message_challenge to be signed by the address

    Returns string | Buffer

    BIP-322 simple signature, encoded in base-64