Skip to content

Commit

Permalink
[❄] Add SignatureShare newtype
Browse files Browse the repository at this point in the history
  • Loading branch information
LLFourn committed Jan 14, 2025
1 parent b631710 commit 12329ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions schnorr_fun/src/frost/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ where
Frost::default()
}

/// A Frost signature share.
pub type SignatureShare = Scalar<Public, Zero>;

#[cfg(test)]
mod test {

Expand Down
10 changes: 5 additions & 5 deletions schnorr_fun/src/frost/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{binonce, frost::PartyIndex, Signature};
use alloc::collections::{BTreeMap, BTreeSet};
use secp256kfun::{poly, prelude::*};

use super::{NonceKeyPair, PairedSecretShare, SharedKey, VerificationShare};
use super::{NonceKeyPair, PairedSecretShare, SharedKey, SignatureShare, VerificationShare};
/// A FROST signing session used to *verify* signatures.
///
/// Created using [`coordinator_sign_session`].
Expand Down Expand Up @@ -65,7 +65,7 @@ impl CoordinatorSignSession {
pub fn verify_signature_share(
&self,
verification_share: VerificationShare<impl PointType>,
signature_share: Scalar<Public, Zero>,
signature_share: SignatureShare,
) -> Result<(), SignatureShareInvalid> {
let X = verification_share.share_image;
let index = verification_share.index;
Expand Down Expand Up @@ -106,7 +106,7 @@ impl CoordinatorSignSession {
pub fn verify_and_combine_signature_shares(
&self,
shared_key: &SharedKey<EvenY>,
signature_shares: BTreeMap<PartyIndex, Scalar<Public, Zero>>,
signature_shares: BTreeMap<PartyIndex, SignatureShare>,
) -> Result<Signature, VerifySignatureSharesError> {
if signature_shares.len() < shared_key.threshold() {
return Err(VerifySignatureSharesError::NotEnough {
Expand Down Expand Up @@ -149,7 +149,7 @@ impl CoordinatorSignSession {
pub fn combine_signature_shares(
&self,
final_nonce: Point<EvenY>,
signature_shares: impl IntoIterator<Item = Scalar<Public, Zero>>,
signature_shares: impl IntoIterator<Item = SignatureShare>,
) -> Signature {
let sum_s = signature_shares
.into_iter()
Expand Down Expand Up @@ -215,7 +215,7 @@ impl PartySignSession {
&self,
secret_share: &PairedSecretShare<EvenY>,
secret_nonce: NonceKeyPair,
) -> Scalar<Public, Zero> {
) -> SignatureShare {
if self.public_key != secret_share.public_key() {
panic!("the share's shared key is not the same as the shared key of the session");
}
Expand Down

0 comments on commit 12329ca

Please sign in to comment.