/// Creates a new dealing: Generates threshold keys, encrypts each secret key.
///
/// # Arguments
/// * `seed` - a secret random number used to generate the threshold keys.
/// * `dealer_secret_key_bytes` - the dealer's ephemeral key, used to encrypt
///   shares.
/// * `dkg_id` is the identifier of the DKG instance this dealing is used for.
/// * `threshold` - the minimum number of receivers needed to sign a valid
///   threshold signature.
/// * `receiver_keys` - the ephemeral public keys of the receivers, used to
///   encrypt their shares.  Given that some receivers may be ineligible this
///   takes the standard form `<Vec<Option<EphemeralPublicKey>>`, where:
///     * the index in the vector corresponds to the receiver index
///     * the `Option` is set to `None` for ineligible, discredited or otherwise
///       non-participating receivers.
/// # Panics
/// * Threshold keys should be generated for every participating receiver.  This
///   method panics if there is a mismatch, i.e.:
///   * there is a receiver with an ephemeral key for which no threshold key is
///     generated, OR
///   * there is a receiver with no ephemeral key for which a threshold key is
///     generated.
/// # Errors
/// * The number of eligible receivers should be equal to or greater than the
///   threshold; otherwise this MUST return an error.  Note: This is checked in
///   the threshold library by `keygen(..)`.
/// * The public keys must be well formed, otherwise this MUST return an error.
/// # Returns
/// The returned data structure contains the threshold public coefficients and
/// encrypted threshold secret keys.  Each encrypted secret key can be decrypted
/// by the corresponding receiver.
Creates a new dealing: Generates threshold keys, encrypts each secret key.
Creates a new dealing : Generates threshold keys encrypts each secret key .
pub fn create_dealing(
    seed: Randomness,
    dealer_secret_key_bytes: EphemeralSecretKeyBytes,
    dkg_id: IDkgId,
    threshold: NumberOfNodes,
    receiver_keys: &[Option<(EphemeralPublicKeyBytes, EphemeralPopBytes)>],
) -> Result<CLibDealingBytes, DkgCreateDealingError> {
    let (bls_public_coefficients, bls_secret_keys) = {
        let selected_nodes: Vec<bool> = receiver_keys.iter().map(|x| x.is_some()).collect();
        keygen(seed, threshold, &selected_nodes[..])
    }
    .map_err(CryptoError::from)
    .map_err(DkgCreateDealingError::UnsupportedThresholdParameters)?;
    let public_coefficients = PublicCoefficientsBytes::from(&bls_public_coefficients);
    let receiver_data = create_receiver_data(
        dkg_id,
        dealer_secret_key_bytes,
        receiver_keys,
        &bls_secret_keys,
    )?;
    Ok(CLibDealingBytes {
        public_coefficients,
        receiver_data,
    })
}
pub fn create_dealing ( seed : Randomness , dealer_secret_key_bytes : EphemeralSecretKeyBytes , dkg_id : IDkgId , threshold : NumberOfNodes , receiver_keys : & [ Option < ( EphemeralPublicKeyBytes , EphemeralPopBytes ) > ] , ) -> Result < CLibDealingBytes , DkgCreateDealingError > { let ( bls_public_coefficients , bls_secret_keys ) = { let selected_nodes : Vec < bool > = receiver_keys . iter ( ) . map ( | x | x . is_some ( ) ) . collect ( ) ; keygen ( seed , threshold , & selected_nodes [ .. ] ) } . map_err ( CryptoError :: from ) . map_err ( DkgCreateDealingError :: UnsupportedThresholdParameters ) ? ; let public_coefficients = PublicCoefficientsBytes :: from ( & bls_public_coefficients ) ; let receiver_data = create_receiver_data ( dkg_id , dealer_secret_key_bytes , receiver_keys , & bls_secret_keys , ) ? ; Ok ( CLibDealingBytes { public_coefficients , receiver_data , } ) }
Creates a new dealing: Generates threshold keys, encrypts each secret key.
Creates a new dealing : Generates threshold keys encrypts each secret key .
The returned data structure contains the threshold public coefficients and
encrypted threshold secret keys.  Each encrypted secret key can be decrypted
by the corresponding receiver.
The returned data structure contains the threshold public coefficients and encrypted threshold secret keys . Each encrypted secret key can be decrypted by the corresponding receiver .
seed
Randomness
dealer_secret_key_bytes
EphemeralSecretKeyBytes
dkg_id
IDkgId
threshold
NumberOfNodes
receiver_keys
&[Option<(EphemeralPublicKeyBytes, EphemeralPopBytes)>]
panics
Threshold keys should be generated for every participating receiver.  This
method panics if there is a mismatch, i.e.:
there is a receiver with an ephemeral key for which no threshold key is
generated, OR
there is a receiver with no ephemeral key for which a threshold key is
generated.
Threshold keys should be generated for every participating receiver . This method panics if there is a mismatch i . e . : there is a receiver with an ephemeral key for which no threshold key is generated OR there is a receiver with no ephemeral key for which a threshold key is generated .
errors
The number of eligible receivers should be equal to or greater than the
threshold; otherwise this MUST return an error.  Note: This is checked in
the threshold library by `keygen(..)`.
The public keys must be well formed, otherwise this MUST return an error.
The number of eligible receivers should be equal to or greater than the threshold ; otherwise this MUST return an error . Note : This is checked in the threshold library by ` keygen ( .. ) ` . The public keys must be well formed otherwise this MUST return an error .