keyAggAndTweak method

  1. @override
Secp256k1Point keyAggAndTweak({
  1. required List<List<int>> publicKeys,
  2. required List<MuSig2Tweak> tweaks,
})
override

Aggregates non-empty publicKeys and applies tweaks; returns the tweaked aggregate point. Throws on empty or malformed input.

Implementation

@override
Secp256k1Point keyAggAndTweak({
  required List<List<int>> publicKeys,
  required List<MuSig2Tweak> tweaks,
}) {
  final agg = api.keyAggAndTweak(
    keys: publicKeys.map((e) => e.asBytes).toList(),
    tweaks:
        tweaks
            .map((e) => BuMusig2Tweak(tweak32: e.tweak, isXOnly: e.isXOnly))
            .toList(),
  );
  return agg
      .map((e) => Secp256k1Point.fromBytes(e))
      .unwrapOrThrowCryptoError();
}