Skip to main content

commonware_cryptography/bls12381/certificate/
mod.rs

1//! BLS12-381 certificate scheme implementations.
2//!
3//! This module provides two signing scheme implementations:
4//!
5//! - [`multisig`]: Multi-signature scheme with attributable signatures
6//! - [`threshold`]: Threshold signature scheme with non-attributable signatures
7
8pub mod multisig;
9pub mod threshold;
10
11use crate::{
12    bls12381::primitives::{sharing::Sharing, variant::Variant},
13    certificate::{AssemblyError, Signers},
14};
15use commonware_utils::Participant;
16
17/// Builds [`Signers`] using the sharing's participant bound and recovery threshold.
18impl<'a, V, I> TryFrom<(&'a Sharing<V>, I)> for Signers
19where
20    V: Variant,
21    I: IntoIterator<Item = Participant>,
22{
23    type Error = AssemblyError;
24
25    fn try_from((quorum, signers): (&'a Sharing<V>, I)) -> Result<Self, Self::Error> {
26        Self::new(quorum.total().get(), signers)?.require(quorum.required())
27    }
28}