sign static method
Threshold sign over a 32-byte hash (Rust sign_oneshot honest path):
Lagrange-rescales the subset key shares to additive (x = Σ λ·σ)
while fresh nonces stay purely additive; s = k^-1(e + r·x), low-S.
Implementation
static List<int> sign({
required List<DklsProtocolShare> shares,
required List<int> sid,
required List<int> msgHash,
required List<List<int>> seeds,
}) {
const op = 'DklsUtils.sign';
if (shares.isEmpty) {
throw CoreErrors.invalidOperationArguments(
op,
name: 'shares',
reason: 'at least 2 signing shares required.',
);
}
final curve = shares.first.curve;
_checkQuorumCurve(shares, curve, op);
return switch (curve) {
DklsProtocolCurve.k1 => const DklsK1Engine().sign(
shares: shares,
sid: sid,
msgHash: msgHash,
seeds: seeds,
),
DklsProtocolCurve.r1 => const DklsR1Engine().sign(
shares: shares,
sid: sid,
msgHash: msgHash,
seeds: seeds,
),
};
}