Class SeedSigner
java.lang.Object
com.codename1.crypto.wallet.SeedSigner
- All Implemented Interfaces:
Signer
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Wipes the seed; the signer cannot sign afterwards.static SeedSignerfromMnemonic(String mnemonic, String passphrase) A signer over the seed of a mnemonic and an optional passphrase.byte[]The 32-byte Ed25519 public key at a SLIP-10 path; every index is hardened.intThe 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 formerkleRoot(nullfor a key-path-only output).
-
Constructor Details
-
SeedSigner
public SeedSigner(byte[] seed) A signer over a seed, which is copied.
-
-
Method Details
-
fromMnemonic
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()Description copied from interface:SignerThe fingerprint of the BIP-32 master key, which PSBTs record to say whose keys they want.- Specified by:
getMasterFingerprintin interfaceSigner
-
getSecp256k1PublicKey
Description copied from interface:SignerThe compressed 33-byte secp256k1 public key at a BIP-32 path.- Specified by:
getSecp256k1PublicKeyin interfaceSigner
-
signSecp256k1
Description copied from interface:SignerAn ECDSA signature over a 32-byte hash with the secp256k1 key at a path: RFC 6979 deterministic, low-S, with its recovery id.- Specified by:
signSecp256k1in interfaceSigner
-
signTaproot
Description copied from interface:SignerA BIP-340 signature over a 32-byte Taproot sighash with the secp256k1 key at a path, tweaked by BIP-341 formerkleRoot(nullfor a key-path-only output).- Specified by:
signTaprootin interfaceSigner
-
getEd25519PublicKey
Description copied from interface:SignerThe 32-byte Ed25519 public key at a SLIP-10 path; every index is hardened.- Specified by:
getEd25519PublicKeyin interfaceSigner
-
signEd25519
Description copied from interface:SignerAn Ed25519 signature over a message with the SLIP-10 key at a path.- Specified by:
signEd25519in interfaceSigner
-
destroy
public void destroy()Wipes the seed; the signer cannot sign afterwards.
-