edShard method

  1. @override
FrostDealerShard edShard({
  1. required List<int> secret,
  2. required List<int> coefficients,
  3. required int maxParticipants,
  4. bool isScalar = true,
})
override

Dealer shard (Ed25519 suite): same shapes, 32-byte points. isScalar: true (default) = canonical scalars, false = RFC 8032 seeds expanded in the backend.

Implementation

@override
FrostDealerShard edShard({
  required List<int> secret,
  required List<int> coefficients,
  required int maxParticipants,
  bool isScalar = true,
}) {
  if (coefficients.length % 32 != 0) {
    _badArg(
      coefficients.length,
      'Frost.edShard',
      'must hold whole 32-byte scalars.',
      'coefficients',
    );
  }
  final result = api.frostEdShard(
    secret32: secret.asBytes,
    coeffsConcat: coefficients.asBytes,
    nCoeffs: coefficients.length ~/ 32,
    max: maxParticipants,
    isScalar: isScalar,
  );
  return result
      .map(
        (e) => FrostDealerShard(
          shares: _parseShares(e.sharesConcat),
          poly: e.polyConcat,
        ),
      )
      .unwrapOrThrowCryptoError();
}