LLFourn / secp256kfun

A pure-rust secp256k1 library optimised for fun
BSD Zero Clause License
100 stars 28 forks source link

frost: Isolate creating shares and creating PoP #149

Closed nickfarrow closed 1 year ago

nickfarrow commented 1 year ago

After discussion today, we do not need to know the other partys' polynomials in order to create their secret shares, PROVIDED we have some pre-existing way to assign the other parties an index

    pub fn create_shares(
        &self,
        party_indexes: impl Iterator<Item = usize>,
        scalar_poly: &Vec<Scalar>,
    ) -> Vec<Scalar<Secret, Zero>> {
    pub fn create_proof_of_posessions(
        &self,
        keygen_id: &[u8],
        scalar_poly: &Vec<Scalar>,

This PR is a step towards passing non-standard participant indexes into frost key generation as opposed to 1, 2, 3, ....

I also added create_shares_and_pop() which behaves similar to the existing usage before this PR. I did this primarily because the iterator of indexes is not so friendly to pass in 1..=n_parties, and we will soon be adding a sorting algorithm.

nickfarrow commented 1 year ago

TODO: Use BTreeMap in new_keygen and elsewhere, preventing duplicate party indexes