signData
Signs data with Schnorr BIP-340 signature.
This is the main entry point for transaction signing.
Process:
Create SigningKey from private key (32 bytes)
Sign data using Schnorr BIP-340
Free SigningKey memory
Return 64-byte signature
Usage Example:
val privateKey: ByteArray = hdWallet.selectAccount(0)
.selectRole(MidnightKeyRole.NIGHT_EXTERNAL)
.deriveKeysAt(0)
.privateKey
val transactionData = intent.serialize() // Midnight Intent bytes
val signature = TransactionSigner.signData(privateKey, transactionData)
// signature is 64 bytes: [R (32 bytes) || s (32 bytes)]Content copied to clipboard
Signature Format:
64 bytes total
First 32 bytes: R (public nonce commitment)
Last 32 bytes: s (signature scalar)
Conforms to BIP-340 standard
Return
64-byte Schnorr signature, or null on error
Parameters
privateKey
32-byte secp256k1 private key (from BIP-32 derivation)
data
Data to sign (transaction intent, arbitrary bytes)
Throws
if privateKey is not 32 bytes