tweakKey static method
Tweaks a public key for Taproot (BIP-341).
xBig: The x-coordinate of the public key as aBigInt.tapTweakHash: A 32-byte tweak hash used to modify the key.
Implementation
static ProjectiveECCPoint tweakKey({
required BigInt xBig,
required List<int> tapTweakHash,
}) {
if (tapTweakHash.length != 32) {
throw ArgumentException.invalidOperationArguments(
"tweakKey",
name: "signature",
reason: "Invalid Tap-tweak hash bytes length.",
);
}
final n =
BitcoinSignerUtils.generator * BigintUtils.fromBytes(tapTweakHash);
final outPoint = P2TRUtils.liftX(xBig) + n;
return outPoint as ProjectiveECCPoint;
}