Skip to content

Commit

Permalink
Merge pull request #194 from LLFourn/pair_secret_share_new_unchecked
Browse files Browse the repository at this point in the history
[❄] Add PairedSecretShare::new_unchecked
  • Loading branch information
LLFourn authored Sep 6, 2024
2 parents 32eb006 + 029bfab commit 8e6fd71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions schnorr_fun/src/frost/share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,13 @@ impl<T: Normalized, Z: ZeroChoice> PairedSecretShare<T, Z> {
}

impl<Z: ZeroChoice, T: PointType> PairedSecretShare<T, Z> {
/// Pair a secret share to a shared key.
/// Pair a secret share to a shared key without checking its valid.
///
/// Users are meant to use [`pair_secret_share`] to create this
/// You're meant to use [`pair_secret_share`] to create this which guarantees the pairing is
/// correct with respect to the `SharedKey`.
///
/// [`pair_secret_share`]: SharedKey::pair_secret_share
pub(crate) fn new(secret_share: SecretShare, public_key: Point<T, Public, Z>) -> Self {
/// [`pair_secret_share`]: crate::frost::SharedKey::pair_secret_share
pub fn new_unchecked(secret_share: SecretShare, public_key: Point<T, Public, Z>) -> Self {
Self {
secret_share,
public_key,
Expand Down
5 changes: 4 additions & 1 deletion schnorr_fun/src/frost/shared_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ impl<T: PointType, Z: ZeroChoice> SharedKey<T, Z> {
return None;
}

Some(PairedSecretShare::new(secret_share, self.public_key()))
Some(PairedSecretShare::new_unchecked(
secret_share,
self.public_key(),
))
}

/// The threshold number of participants required in a signing coalition to produce a valid signature.
Expand Down

0 comments on commit 8e6fd71

Please sign in to comment.