/// Combining multiple key generations should yield a valid generation.
/// TODO(DFN-1412): Extend these tests for the case where keys have gaps.
Combining multiple key generations should yield a valid generation.
TODO(DFN-1412): Extend these tests for the case where keys have gaps.
Combining multiple key generations should yield a valid generation . TODO ( DFN - 1412 ) : Extend these tests for the case where keys have gaps .
pub fn assert_keygen_composes(
        generations: &[(PublicCoefficients, Vec<SecretKey>)],
        threshold: NumberOfNodes,
        seed: Randomness,
        message: &[u8],
    ) {
        // Sum public_coefficients and secret keys.  We treat the vector of secret keys
        // as a polynomial so that we can use polynomial addition.
        let public_coefficients = &generations
            .iter()
            .cloned()
            .map(|(public_coefficients, _)| public_coefficients)
            .sum::<PublicCoefficients>();
        let secret_keys = &generations
            .iter()
            .map(|(_, secret_keys)| secret_keys)
            .map(|coefficients| Polynomial {
                coefficients: (*coefficients).to_vec(),
            })
            .sum::<Polynomial>()
            .coefficients;
        test_valid_public_coefficients(public_coefficients, secret_keys, threshold, seed, message);
    }
pub fn assert_keygen_composes ( generations : & [ ( PublicCoefficients , Vec < SecretKey > ) ] , threshold : NumberOfNodes , seed : Randomness , message : & [ u8 ] , ) { // Sum public_coefficients and secret keys.  We treat the vector of secret keys // as a polynomial so that we can use polynomial addition. let public_coefficients = & generations . iter ( ) . cloned ( ) . map ( | ( public_coefficients , _ ) | public_coefficients ) . sum :: < PublicCoefficients > ( ) ; let secret_keys = & generations . iter ( ) . map ( | ( _ , secret_keys ) | secret_keys ) . map ( | coefficients | Polynomial { coefficients : ( * coefficients ) . to_vec ( ) , } ) . sum :: < Polynomial > ( ) . coefficients ; test_valid_public_coefficients ( public_coefficients , secret_keys , threshold , seed , message ) ; }
Combining multiple key generations should yield a valid generation.
Combining multiple key generations should yield a valid generation .
generations
&[(PublicCoefficients, Vec<SecretKey>)]
threshold
NumberOfNodes
seed
Randomness
message
&[u8]