Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added combine_signatures_with_threshold #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,19 @@ impl PublicKeySet {
Ok(Signature(interpolate(self.commit.degree(), samples)?))
}

/// Combines the shares into a signature that can be verified with the main public key. taking a threshold value as argument
pub fn combine_signatures_with_threshold<'a, T, I>(
threshold: usize,
shares: I,
) -> Result<Signature>
where
I: IntoIterator<Item = (T, &'a SignatureShare)>,
T: IntoFr,
{
let samples = shares.into_iter().map(|(i, share)| (i, &(share.0).0));
Ok(Signature(interpolate(threshold, samples)?))
}

/// Combines the shares to decrypt the ciphertext.
pub fn decrypt<'a, T, I>(&self, shares: I, ct: &Ciphertext) -> Result<Vec<u8>>
where
Expand Down