assertMlDsaShareSetConsistent function

void assertMlDsaShareSetConsistent(
  1. List<MlDsaShare> shares
)

Ensures all shares belong to one ceremony and scheme.

Implementation

void assertMlDsaShareSetConsistent(List<MlDsaShare> shares) {
  if (shares.isEmpty) {
    throw InsufficientShares('No ML-DSA shares provided');
  }
  final first = shares.first;
  for (final share in shares.skip(1)) {
    if (share.params != first.params ||
        !PqBytes.constantTimeEquals(share.ceremonyId, first.ceremonyId)) {
      throw WrongCeremony('ML-DSA shares are from different ceremonies');
    }
  }
}