Interface Signer

All Known Implementing Classes:
SeedSigner

public interface Signer

Everything that touches a wallet's private keys, behind one interface. The keys are addressed by derivation path and never leave the implementation: it answers public keys and signatures. SeedSigner derives them from a seed in memory; a product with real money implements this over a hardware device, a vault the user unlocks, or a key service that holds the keys and logs every signature.

An implementation that cannot do one kind of signature (a cloud KMS with secp256k1 and no Ed25519, say) throws UnsupportedOperationException from it.

  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    The 32-byte Ed25519 public key at a SLIP-10 path; every index is hardened.
    int
    The fingerprint of the BIP-32 master key, which PSBTs record to say whose keys they want.
    byte[]
    The compressed 33-byte secp256k1 public key at a BIP-32 path.
    byte[]
    signEd25519(DerivationPath path, byte[] message)
    An Ed25519 signature over a message with the SLIP-10 key at a path.
    signSecp256k1(DerivationPath path, byte[] hash32)
    An ECDSA signature over a 32-byte hash with the secp256k1 key at a path: RFC 6979 deterministic, low-S, with its recovery id.
    byte[]
    signTaproot(DerivationPath path, byte[] sighash, byte[] merkleRoot)
    A BIP-340 signature over a 32-byte Taproot sighash with the secp256k1 key at a path, tweaked by BIP-341 for merkleRoot (null for a key-path-only output).
  • Method Details

    • getMasterFingerprint

      int getMasterFingerprint()
      The fingerprint of the BIP-32 master key, which PSBTs record to say whose keys they want.
    • getSecp256k1PublicKey

      byte[] getSecp256k1PublicKey(DerivationPath path)
      The compressed 33-byte secp256k1 public key at a BIP-32 path.
    • signSecp256k1

      Secp256k1.EcdsaSignature signSecp256k1(DerivationPath path, byte[] hash32)
      An ECDSA signature over a 32-byte hash with the secp256k1 key at a path: RFC 6979 deterministic, low-S, with its recovery id.
    • signTaproot

      byte[] signTaproot(DerivationPath path, byte[] sighash, byte[] merkleRoot)
      A BIP-340 signature over a 32-byte Taproot sighash with the secp256k1 key at a path, tweaked by BIP-341 for merkleRoot (null for a key-path-only output).
    • getEd25519PublicKey

      byte[] getEd25519PublicKey(DerivationPath path)
      The 32-byte Ed25519 public key at a SLIP-10 path; every index is hardened.
    • signEd25519

      byte[] signEd25519(DerivationPath path, byte[] message)
      An Ed25519 signature over a message with the SLIP-10 key at a path.