Complete guide to implementing and using the Spark Signer for cryptographic operations
SparkSigner
interface to enable flexible implementation of signing operations. This abstraction allows you to customize how cryptographic operations are performed and enables support for different signing strategies including multisig configurations, hardware wallets, and other specialized key management systems.
DefaultSparkSigner
) that handles standard single-signature operations. This can serve as a reference for implementing custom signers that support multisig, hardware wallets, or other advanced signing schemes.generateMnemonic()
Promise<string>
: A 12-word BIP39 mnemonic phrasemnemonicToSeed(mnemonic: string)
mnemonic
: Valid BIP39 mnemonic phrasePromise<Uint8Array>
: 64-byte seed derived from the mnemoniccreateSparkWalletFromSeed(seed, accountNumber?)
seed
: Master seed as bytes or hex stringaccountNumber
: (Optional, default: 0) Account index for key derivationPromise<string>
: Hex-encoded identity public keygetIdentityPublicKey()
Promise<Uint8Array>
: The identity public keygetMasterPublicKey()
Promise<Uint8Array>
: The master public keygeneratePublicKey(hash?)
hash
: (Optional) Deterministic hash for key derivationPromise<Uint8Array>
: The generated public keyremovePublicKey(publicKey)
publicKey
: Public key to removegetTrackedPublicKeys()
Promise<Uint8Array[]>
: Array of tracked public keysgetDepositSigningKey()
Promise<Uint8Array>
: The deposit signing public keygenerateStaticDepositKey(idx)
idx
: Index for the static deposit keyPromise<Uint8Array>
: The static deposit public keygetStaticDepositSigningKey(idx)
idx
: Index for the static deposit keyPromise<Uint8Array>
: The static deposit signing public keygetStaticDepositSecretKey(idx)
idx
: Index for the static deposit keyPromise<Uint8Array>
: The static deposit private keysignMessageWithIdentityKey(message, compact?)
message
: Message to signcompact
: (Optional, default: false) Use compact signature formatPromise<Uint8Array>
: ECDSA signature (DER or compact format)signMessageWithPublicKey(message, publicKey, compact?)
message
: Message to signpublicKey
: Public key to use for signingcompact
: (Optional, default: false) Use compact signature formatPromise<Uint8Array>
: ECDSA signature (DER or compact format)validateMessageWithIdentityKey(message, signature)
message
: Original messagesignature
: Signature to validatePromise<boolean>
: True if signature is validgetSchnorrPublicKey(publicKey)
publicKey
: secp256k1 public keyPromise<Uint8Array>
: Schnorr public keysignSchnorr(message, publicKey)
message
: Message to signpublicKey
: Public key to use for signingPromise<Uint8Array>
: Schnorr signaturesignSchnorrWithIdentityKey(message)
message
: Message to signPromise<Uint8Array>
: Schnorr signaturerestoreSigningKeysFromLeafs(leafs)
leafs
: Array of tree leaf nodessubtractPrivateKeysGivenPublicKeys(first, second)
first
: First public keysecond
: Second public keyPromise<Uint8Array>
: Resulting public key after subtractionsplitSecretWithProofs(params)
params
: Secret sharing parametersPromise<VerifiableSecretShare[]>
: Array of verifiable secret sharesgetRandomSigningCommitment()
Promise<SigningCommitment>
: Random signing commitmentsignFrost(params)
params
: FROST signing parametersPromise<Uint8Array>
: FROST signature shareaggregateFrost(params)
params
: FROST aggregation parametersPromise<Uint8Array>
: Final aggregated signatureencryptLeafPrivateKeyEcies(receiverPublicKey, publicKey)
receiverPublicKey
: Recipient’s public keypublicKey
: Public key whose private key to encryptPromise<Uint8Array>
: Encrypted private keydecryptEcies(ciphertext)
ciphertext
: Encrypted dataPromise<Uint8Array>
: Decrypted public keyhashRandomPrivateKey()
Promise<Uint8Array>
: SHA256 hash of a random private keygenerateAdaptorFromSignature(signature)
signature
: Original signatureadaptorSignature
: The adaptor signatureadaptorPublicKey
: The adaptor public key