deterministicSign method

  1. @override
MuSig2DeterministicSignature deterministicSign({
  1. required List<int> sk,
  2. required List<int> aggotherNonce,
  3. required List<List<int>> publicKeys,
  4. List<MuSig2Tweak> tweaks = const [],
  5. required List<int> msg,
  6. List<int>? rand,
})
override

Generates a deterministic MuSig2 signature Derives a nonce deterministically from 32-byte sk, 66-byte aggotherNonce and msg, aggregates it with publicKeys/tweaks into a session and partial-signs it. Optional rand overrides the nonce randomness. Returns the partial signature with its 66-byte pubnonce. Throws on invalid input.

Implementation

@override
MuSig2DeterministicSignature deterministicSign({
  required List<int> sk,
  required List<int> aggotherNonce,
  required List<List<int>> publicKeys,
  List<MuSig2Tweak> tweaks = const [],
  required List<int> msg,
  List<int>? rand,
}) {
  final result =
      api
          .deterministicSign(
            sk: sk.asBytes,
            aggotherNonce66: aggotherNonce.asBytes,
            publicKeys: publicKeys.map((e) => e.asBytes).toList(),
            msg: msg.asBytes,
            rand: rand?.asBytes,
            tweaks:
                tweaks
                    .map(
                      (e) =>
                          BuMusig2Tweak(tweak32: e.tweak, isXOnly: e.isXOnly),
                    )
                    .toList(),
          )
          .unwrapOrThrowCryptoError();
  return MuSig2DeterministicSignature(
    signature: result.partial,
    pubnonce: result.pubnonce,
  );
}