// There is currently only one version of DKG.
There is currently only one version of DKG.
There is currently only one version of DKG .
pub fn dealing(
    csp_dealing: &CspDealing,
) -> Result<CLibDealingBytes, dkg_errors::MalformedDataError> {
    if let CspDealing {
        common_data: CspPublicCoefficients::Bls12_381(public_coefficients),
        receiver_data,
    } = csp_dealing
    {
        let receiver_data: Result<Vec<Option<EncryptedShareBytes>>, _> = receiver_data
            .iter()
            .map(|keys_maybe| keys_maybe.map(encrypted_share).transpose())
            .collect();
        Ok(CLibDealingBytes {
            public_coefficients: public_coefficients.clone(),
            receiver_data: receiver_data?,
        })
    } else {
        Err(dkg_errors::MalformedDataError {
            algorithm: AlgorithmId::Secp256k1,
            internal_error: format!("Incorrect type: {:?}", csp_dealing),
            data: None,
        })
    }
}
pub fn dealing ( csp_dealing : & CspDealing , ) -> Result < CLibDealingBytes , dkg_errors :: MalformedDataError > { if let CspDealing { common_data : CspPublicCoefficients :: Bls12_381 ( public_coefficients ) , receiver_data , } = csp_dealing { let receiver_data : Result < Vec < Option < EncryptedShareBytes > > , _ > = receiver_data . iter ( ) . map ( | keys_maybe | keys_maybe . map ( encrypted_share ) . transpose ( ) ) . collect ( ) ; Ok ( CLibDealingBytes { public_coefficients : public_coefficients . clone ( ) , receiver_data : receiver_data ? , } ) } else { Err ( dkg_errors :: MalformedDataError { algorithm : AlgorithmId :: Secp256k1 , internal_error : format ! ( " " csp_dealing ) , data : None , } ) } }
There is currently only one version of DKG.
There is currently only one version of DKG .
csp_dealing
&CspDealing