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 final class SeedSigner

  1. Object
  2. SeedSigner

ImplementsSigner

A Signer over a BIP-39 seed held in memory. Each key is derived when it is needed and wiped after the one signature it makes, so between signatures the process holds the seed and nothing more. destroy wipes the seed.

Holding a seed in memory is right for a test network, a recovery tool or a wallet the user unlocks for a session; a custodial service keeps the seed in a key service instead.

Constructors

public SeedSigner(byte[] seed)A signer over a seed, which is copied.

Methods

public static SeedSigner fromMnemonic(String mnemonic, String passphrase)A signer over the seed of a mnemonic and an optional passphrase.
public int getMasterFingerprint()The fingerprint of the BIP-32 master key, which PSBTs record to say whose keys they want.
public byte[] getSecp256k1PublicKey(DerivationPath path)The compressed 33-byte secp256k1 public key at a BIP-32 path.
public 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 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 byte[] getEd25519PublicKey(DerivationPath path)The 32-byte Ed25519 public key at a SLIP-10 path; every index is hardened.
public byte[] signEd25519(DerivationPath path, byte[] message)An Ed25519 signature over a message with the SLIP-10 key at a path.
public void destroy()Wipes the seed; the signer cannot sign afterwards.

Inherited methods

Constructor details

SeedSigner

public SeedSigner(byte[] seed)
A signer over a seed, which is copied.

Method details

fromMnemonic

public static SeedSigner fromMnemonic(String mnemonic, String passphrase)
A signer over the seed of a mnemonic and an optional passphrase.

Throws

IllegalArgumentException
for a mnemonic whose words or checksum are wrong

getMasterFingerprint

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

getSecp256k1PublicKey

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

signSecp256k1

public 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 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 byte[] getEd25519PublicKey(DerivationPath path)
The 32-byte Ed25519 public key at a SLIP-10 path; every index is hardened.

signEd25519

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

destroy

public void destroy()
Wipes the seed; the signer cannot sign afterwards.