signBip340 method
Signs a given digest using the BIP-340 (Schnorr) signature scheme.
digest: The 32-byte message digest to be signed. It must be exactlyBitcoinSignerUtils.baselenbytes in length.tapTweakHash: (Optional) A tweak applied to the private key for Taproot-related signatures.aux: (Optional) Auxiliary random data used to add entropy to the signature for security against side-channel attacks.
Implementation
List<int> signBip340({
required List<int> digest,
List<int>? tapTweakHash,
List<int>? aux,
}) {
final signature = _signingKey.signBip340(
digest: digest,
aux: aux,
tapTweakHash: tapTweakHash,
);
if (verifierKey.verifyBip340Signature(
digest: digest,
signature: signature,
tapTweakHash: tapTweakHash,
)) {
return signature;
}
throw CryptoSignException.signatureVerificationFailed;
}