pub struct Scheme<P: PublicKey, V: Variant> { /* private fields */ }Expand description
BLS12-381 threshold signature scheme wrapper.
Implementations§
Source§impl<P: PublicKey, V: Variant> Scheme<P, V>
impl<P: PublicKey, V: Variant> Scheme<P, V>
Sourcepub fn signer(
namespace: &[u8],
participants: Set<P>,
polynomial: Sharing<V>,
share: Share,
) -> Option<Self>
pub fn signer( namespace: &[u8], participants: Set<P>, polynomial: Sharing<V>, share: Share, ) -> Option<Self>
Creates a new signer instance with a private share and evaluated public polynomial.
Sourcepub fn verifier(
namespace: &[u8],
participants: Set<P>,
polynomial: Sharing<V>,
) -> Self
pub fn verifier( namespace: &[u8], participants: Set<P>, polynomial: Sharing<V>, ) -> Self
Creates a verifier that can authenticate partial signatures.
Sourcepub fn certificate_verifier(namespace: &[u8], identity: V::Public) -> Self
pub fn certificate_verifier(namespace: &[u8], identity: V::Public) -> Self
Creates a lightweight verifier that only checks recovered certificates.
Sourcepub fn identity(&self) -> &V::Public
pub fn identity(&self) -> &V::Public
Returns the public identity of the committee (constant across reshares).
Returns the local share if this instance can generate partial signatures.
Trait Implementations§
Source§impl<P: PublicKey, V: Variant> Scheme for Scheme<P, V>
impl<P: PublicKey, V: Variant> Scheme for Scheme<P, V>
Source§type PublicKey = P
type PublicKey = P
Public key type for participant identity used to order and index the participant set.
Source§type Certificate = Certificate<V>
type Certificate = Certificate<V>
Certificate assembled from a set of attestations.
Source§fn me(&self) -> Option<Participant>
fn me(&self) -> Option<Participant>
Returns the index of “self” in the participant set, if available.
Returns
None if the scheme is a verifier-only instance.Source§fn participants(&self) -> &Set<Self::PublicKey>
fn participants(&self) -> &Set<Self::PublicKey>
Returns the ordered set of participant public identity keys managed by the scheme.
Source§fn sign<D: Digest>(
&self,
subject: Self::Subject<'_, D>,
) -> Option<Attestation<Self>>
fn sign<D: Digest>( &self, subject: Self::Subject<'_, D>, ) -> Option<Attestation<Self>>
Signs a subject.
Returns
None if the scheme cannot sign (e.g. it’s a verifier-only instance).Source§fn verify_attestation<R, D>(
&self,
_rng: &mut R,
subject: Self::Subject<'_, D>,
attestation: &Attestation<Self>,
_strategy: &impl Strategy,
) -> boolwhere
R: CryptoRngCore,
D: Digest,
fn verify_attestation<R, D>(
&self,
_rng: &mut R,
subject: Self::Subject<'_, D>,
attestation: &Attestation<Self>,
_strategy: &impl Strategy,
) -> boolwhere
R: CryptoRngCore,
D: Digest,
Verifies a single attestation against the participant material managed by the scheme.
Source§fn verify_attestations<R, D, I>(
&self,
rng: &mut R,
subject: Self::Subject<'_, D>,
attestations: I,
strategy: &impl Strategy,
) -> Verification<Self>
fn verify_attestations<R, D, I>( &self, rng: &mut R, subject: Self::Subject<'_, D>, attestations: I, strategy: &impl Strategy, ) -> Verification<Self>
Batch-verifies attestations and separates valid attestations from signer indices that failed
verification. Read more
Source§fn assemble<I, M>(
&self,
attestations: I,
strategy: &impl Strategy,
) -> Option<Self::Certificate>
fn assemble<I, M>( &self, attestations: I, strategy: &impl Strategy, ) -> Option<Self::Certificate>
Assembles attestations into a certificate, returning
None if the threshold is not met. Read moreSource§fn verify_certificate<R, D, M>(
&self,
rng: &mut R,
subject: Self::Subject<'_, D>,
certificate: &Self::Certificate,
_strategy: &impl Strategy,
) -> bool
fn verify_certificate<R, D, M>( &self, rng: &mut R, subject: Self::Subject<'_, D>, certificate: &Self::Certificate, _strategy: &impl Strategy, ) -> bool
Verifies a certificate that was recovered or received from the network.
Source§fn verify_certificates<'a, R, D, I, M>(
&self,
rng: &mut R,
certificates: I,
strategy: &impl Strategy,
) -> boolwhere
R: CryptoRngCore,
D: Digest,
I: Iterator<Item = (Self::Subject<'a, D>, &'a Self::Certificate)>,
M: Faults,
fn verify_certificates<'a, R, D, I, M>(
&self,
rng: &mut R,
certificates: I,
strategy: &impl Strategy,
) -> boolwhere
R: CryptoRngCore,
D: Digest,
I: Iterator<Item = (Self::Subject<'a, D>, &'a Self::Certificate)>,
M: Faults,
Verifies a stream of certificates, returning
false at the first failure.Source§fn is_attributable() -> bool
fn is_attributable() -> bool
Returns whether per-participant fault evidence can be safely exposed. Read more
Source§fn is_batchable() -> bool
fn is_batchable() -> bool
Returns whether this scheme benefits from batch verification. Read more
Source§fn certificate_codec_config(&self) -> <Self::Certificate as Read>::Cfg
fn certificate_codec_config(&self) -> <Self::Certificate as Read>::Cfg
Encoding configuration for bounded-size certificate decoding used in network payloads.
Source§fn certificate_codec_config_unbounded() -> <Self::Certificate as Read>::Cfg
fn certificate_codec_config_unbounded() -> <Self::Certificate as Read>::Cfg
Encoding configuration that allows unbounded certificate decoding. Read more
Auto Trait Implementations§
impl<P, V> Freeze for Scheme<P, V>
impl<P, V> RefUnwindSafe for Scheme<P, V>
impl<P, V> Send for Scheme<P, V>
impl<P, V> Sync for Scheme<P, V>
impl<P, V> Unpin for Scheme<P, V>
impl<P, V> UnwindSafe for Scheme<P, V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more