pub fn keygen_with_dealer<R: RngCore + CryptoRng>(
    num_signers: u8,
    threshold: u8,
    mut rng: R,
) -> Result<(Vec<SharePackage>, PublicKeyPackage), &'static str> {
    let mut bytes = [0; 64];
    rng.fill_bytes(&mut bytes);

    let secret = Secret(Scalar::from_bytes_wide(&bytes));
    let group_public = VerificationKey::from(&secret.0);
    let shares = generate_shares(&secret, num_signers, threshold, rng)?;
    let mut sharepackages: Vec<SharePackage> = Vec::with_capacity(num_signers as usize);
    let mut signer_pubkeys: HashMap<u64, Public> = HashMap::with_capacity(num_signers as usize);

    for share in shares {
        let signer_public = Public(SpendAuth::basepoint() * share.value.0);
        sharepackages.push(SharePackage {
            index: share.receiver_index,
            share: share.clone(),
            public: signer_public,
            group_public,
        });

        signer_pubkeys.insert(share.receiver_index, signer_public);
    }

    Ok((
        sharepackages,
        PublicKeyPackage {
            signer_pubkeys,
            group_public,
        },
    ))
}
/// Allows all participants' keys to be generated using a central, trusted
/// dealer.
///
/// Under the hood, this performs verifiable secret sharing, which itself uses
/// Shamir secret sharing, from which each share becomes a participant's secret
/// key. The output from this function is a set of shares along with one single
/// commitment that participants use to verify the integrity of the share. The
/// number of signers is limited to 255.
Allows all participants' keys to be generated using a central, trusted
dealer.

Under the hood, this performs verifiable secret sharing, which itself uses
Shamir secret sharing, from which each share becomes a participant's secret
key. The output from this function is a set of shares along with one single
commitment that participants use to verify the integrity of the share. The
number of signers is limited to 255.
Allows all participants ' keys to be generated using a central trusted dealer . Under the hood this performs verifiable secret sharing which itself uses Shamir secret sharing from which each share becomes a participant ' s secret key . The output from this function is a set of shares along with one single commitment that participants use to verify the integrity of the share . The number of signers is limited to 255 .
pub fn keygen_with_dealer<R: RngCore + CryptoRng>(
    num_signers: u8,
    threshold: u8,
    mut rng: R,
) -> Result<(Vec<SharePackage>, PublicKeyPackage), &'static str> {
    let mut bytes = [0; 64];
    rng.fill_bytes(&mut bytes);
    let secret = Secret(Scalar::from_bytes_wide(&bytes));
    let group_public = VerificationKey::from(&secret.0);
    let shares = generate_shares(&secret, num_signers, threshold, rng)?;
    let mut sharepackages: Vec<SharePackage> = Vec::with_capacity(num_signers as usize);
    let mut signer_pubkeys: HashMap<u64, Public> = HashMap::with_capacity(num_signers as usize);
    for share in shares {
        let signer_public = Public(SpendAuth::basepoint() * share.value.0);
        sharepackages.push(SharePackage {
            index: share.receiver_index,
            share: share.clone(),
            public: signer_public,
            group_public,
        });
        signer_pubkeys.insert(share.receiver_index, signer_public);
    }
    Ok((
        sharepackages,
        PublicKeyPackage {
            signer_pubkeys,
            group_public,
        },
    ))
}
pub fn keygen_with_dealer < R : RngCore + CryptoRng > ( num_signers : u8 , threshold : u8 , mut rng : R , ) -> Result < ( Vec < SharePackage > , PublicKeyPackage ) , & ' static str > { let mut bytes = [ 0 ; 64 ] ; rng . fill_bytes ( & mut bytes ) ; let secret = Secret ( Scalar :: from_bytes_wide ( & bytes ) ) ; let group_public = VerificationKey :: from ( & secret . 0 ) ; let shares = generate_shares ( & secret , num_signers , threshold , rng ) ? ; let mut sharepackages : Vec < SharePackage > = Vec :: with_capacity ( num_signers as usize ) ; let mut signer_pubkeys : HashMap < u64 , Public > = HashMap :: with_capacity ( num_signers as usize ) ; for share in shares { let signer_public = Public ( SpendAuth :: basepoint ( ) * share . value . 0 ) ; sharepackages . push ( SharePackage { index : share . receiver_index , share : share . clone ( ) , public : signer_public , group_public , } ) ; signer_pubkeys . insert ( share . receiver_index , signer_public ) ; } Ok ( ( sharepackages , PublicKeyPackage { signer_pubkeys , group_public , } , ) ) }
Allows all participants' keys to be generated using a central, trusted
dealer.
Allows all participants ' keys to be generated using a central trusted dealer .
num_signers
u8
threshold
u8
rng
R