Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public interface Signer

Known subtypesSeedSigner, VaultSigner

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.

Methods

public abstract int getMasterFingerprint()The fingerprint of the BIP-32 master key, which PSBTs record to say whose keys they want.
public abstract byte[] getSecp256k1PublicKey(DerivationPath path)The compressed 33-byte secp256k1 public key at a BIP-32 path.
public abstract 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.
public abstract 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).
public abstract byte[] getEd25519PublicKey(DerivationPath path)The 32-byte Ed25519 public key at a SLIP-10 path; every index is hardened.
public abstract byte[] signEd25519(DerivationPath path, byte[] message)An Ed25519 signature over a message with the SLIP-10 key at a path.

Method details

getMasterFingerprint

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

getSecp256k1PublicKey

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

signSecp256k1

public abstract 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

public abstract 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

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

signEd25519

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