pub enum Scheme<P: PublicKey, V: Variant> {
Signer {
participants: Set<P>,
polynomial: Sharing<V>,
share: Share,
},
Verifier {
participants: Set<P>,
polynomial: Sharing<V>,
},
CertificateVerifier {
identity: V::Public,
},
}Expand description
BLS12-381 threshold implementation of the Scheme trait.
It is possible for a node to play one of the following roles: a signer (with its share), a verifier (with evaluated public polynomial), or an external verifier that only checks recovered certificates.
Variants§
Implementations§
Source§impl<P: PublicKey, V: Variant> Scheme<P, V>
impl<P: PublicKey, V: Variant> Scheme<P, V>
Sourcepub fn signer(
participants: Set<P>,
polynomial: Sharing<V>,
share: Share,
) -> Option<Self>
pub fn signer( participants: Set<P>, polynomial: Sharing<V>, share: Share, ) -> Option<Self>
Constructs a signer instance with a private share and evaluated public polynomial.
The participant identity keys are used for committee ordering and indexing. The polynomial can be evaluated to obtain public verification keys for partial signatures produced by committee members.
Returns None if the share’s public key does not match any participant.
participants- ordered set of participant identity keyspolynomial- public polynomial for threshold verificationshare- local threshold share for signing
Sourcepub fn verifier(participants: Set<P>, polynomial: Sharing<V>) -> Self
pub fn verifier(participants: Set<P>, polynomial: Sharing<V>) -> Self
Produces a verifier that can authenticate votes but does not hold signing state.
The participant identity keys are used for committee ordering and indexing. The polynomial can be evaluated to obtain public verification keys for partial signatures produced by committee members.
participants- ordered set of participant identity keyspolynomial- public polynomial for threshold verification
Sourcepub const fn certificate_verifier(identity: V::Public) -> Self
pub const fn certificate_verifier(identity: V::Public) -> Self
Creates a verifier that only checks recovered certificates.
This lightweight verifier can authenticate recovered threshold certificates but cannot verify individual votes or partial signatures.
identity- public identity of the committee (constant across reshares)
Sourcepub fn participants(&self) -> &Set<P>
pub fn participants(&self) -> &Set<P>
Returns the ordered set of participant public identity keys in the committee.
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.
Sourcepub fn polynomial(&self) -> &Sharing<V>
pub fn polynomial(&self) -> &Sharing<V>
Returns the evaluated public polynomial for validating partial signatures produced by committee members.
Sourcepub fn encrypt<R: Rng + CryptoRng>(
&self,
rng: &mut R,
namespace: &[u8],
target: Round,
message: impl Into<Block>,
) -> Ciphertext<V>
pub fn encrypt<R: Rng + CryptoRng>( &self, rng: &mut R, namespace: &[u8], target: Round, message: impl Into<Block>, ) -> Ciphertext<V>
Encrypts a message for a target round using Timelock Encryption (TLE).
The encrypted message can only be decrypted using the seed signature from a certificate of the target round (i.e. notarization, finalization, or nullification).
Trait Implementations§
Source§impl<P: PublicKey, V: Variant + Send + Sync> Scheme for Scheme<P, V>
impl<P: PublicKey, V: Variant + Send + Sync> Scheme for Scheme<P, V>
Source§type PublicKey = P
type PublicKey = P
Source§type Certificate = Signature<V>
type Certificate = Signature<V>
Source§fn me(&self) -> Option<u32>
fn me(&self) -> Option<u32>
None if the scheme is a verifier-only instance.Source§fn participants(&self) -> &Set<Self::PublicKey>
fn participants(&self) -> &Set<Self::PublicKey>
Source§fn sign<D: Digest>(
&self,
namespace: &[u8],
subject: Subject<'_, D>,
) -> Option<Attestation<Self>>
fn sign<D: Digest>( &self, namespace: &[u8], subject: Subject<'_, D>, ) -> Option<Attestation<Self>>
None if the scheme cannot sign (e.g. it’s a verifier-only instance).Source§fn verify_attestation<D: Digest>(
&self,
namespace: &[u8],
subject: Subject<'_, D>,
attestation: &Attestation<Self>,
) -> bool
fn verify_attestation<D: Digest>( &self, namespace: &[u8], subject: Subject<'_, D>, attestation: &Attestation<Self>, ) -> bool
Source§fn verify_attestations<R, D, I>(
&self,
_rng: &mut R,
namespace: &[u8],
subject: Subject<'_, D>,
attestations: I,
) -> Verification<Self>
fn verify_attestations<R, D, I>( &self, _rng: &mut R, namespace: &[u8], subject: Subject<'_, D>, attestations: I, ) -> Verification<Self>
Source§fn assemble<I>(&self, attestations: I) -> Option<Self::Certificate>where
I: IntoIterator<Item = Attestation<Self>>,
fn assemble<I>(&self, attestations: I) -> Option<Self::Certificate>where
I: IntoIterator<Item = Attestation<Self>>,
None if the threshold is not met. Read moreSource§fn verify_certificate<R: Rng + CryptoRng, D: Digest>(
&self,
_rng: &mut R,
namespace: &[u8],
subject: Subject<'_, D>,
certificate: &Self::Certificate,
) -> bool
fn verify_certificate<R: Rng + CryptoRng, D: Digest>( &self, _rng: &mut R, namespace: &[u8], subject: Subject<'_, D>, certificate: &Self::Certificate, ) -> bool
Source§fn verify_certificates<'a, R, D, I>(
&self,
_rng: &mut R,
namespace: &[u8],
certificates: I,
) -> bool
fn verify_certificates<'a, R, D, I>( &self, _rng: &mut R, namespace: &[u8], certificates: I, ) -> bool
false at the first failure.Source§fn is_attributable(&self) -> bool
fn is_attributable(&self) -> bool
Source§fn certificate_codec_config(&self) -> <Self::Certificate as Read>::Cfg
fn certificate_codec_config(&self) -> <Self::Certificate as Read>::Cfg
Source§fn certificate_codec_config_unbounded() -> <Self::Certificate as Read>::Cfg
fn certificate_codec_config_unbounded() -> <Self::Certificate as Read>::Cfg
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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)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>
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>
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