From b60552e4d42f67058455779eed476a76986b5478 Mon Sep 17 00:00:00 2001 From: Niko PLP Date: Sat, 17 Aug 2024 22:19:28 +0300 Subject: [PATCH] added combine_signatures_with_threshold --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index cedd7c2..832ae04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 + where + I: IntoIterator, + 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> where