pub trait Scheme: Verifier {
type Signature: Clone + Debug + PartialEq + Eq + Hash + Send + Sync + CodecFixed<Cfg = ()>;
// Required methods
fn me(&self) -> Option<Participant>;
fn participants(&self) -> &Set<Self::PublicKey>;
fn sign<D: Digest>(
&self,
subject: Self::Subject<'_, D>,
) -> Option<Attestation<Self>>;
fn verify_attestation<R, D>(
&self,
rng: &mut R,
subject: Self::Subject<'_, D>,
attestation: &Attestation<Self>,
strategy: &impl Strategy,
) -> bool
where R: CryptoRng,
D: Digest;
fn assemble<I>(
&self,
attestations: NonEmpty<I>,
strategy: &impl Strategy,
) -> Result<Self::Certificate, AssemblyError>
where I: Iterator<Item = Attestation<Self>> + Send;
fn is_attributable() -> bool;
// Provided method
fn verify_attestations<R, D, I>(
&self,
rng: &mut R,
subject: Self::Subject<'_, D>,
attestations: I,
strategy: &impl Strategy,
) -> Verification<Self>
where R: CryptoRng,
D: Digest,
I: IntoIterator<Item = Attestation<Self>>,
I::IntoIter: Send { ... }
}Expand description
Cryptographic surface for multi-party certificate schemes.
A Scheme extends Verifier with the signing surface: it produces attestations, validates
them (individually or in batches), and assembles certificates. Implementations may override the
provided defaults to take advantage of scheme-specific batching strategies.
Required Associated Types§
Required Methods§
Sourcefn 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.
Sourcefn participants(&self) -> &Set<Self::PublicKey>
fn participants(&self) -> &Set<Self::PublicKey>
Returns the ordered set of participant public identity keys managed by the scheme.
Sourcefn 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).
Sourcefn verify_attestation<R, D>(
&self,
rng: &mut R,
subject: Self::Subject<'_, D>,
attestation: &Attestation<Self>,
strategy: &impl Strategy,
) -> bool
fn verify_attestation<R, D>( &self, rng: &mut R, subject: Self::Subject<'_, D>, attestation: &Attestation<Self>, strategy: &impl Strategy, ) -> bool
Verifies a single attestation against the participant material managed by the scheme.
Sourcefn assemble<I>(
&self,
attestations: NonEmpty<I>,
strategy: &impl Strategy,
) -> Result<Self::Certificate, AssemblyError>
fn assemble<I>( &self, attestations: NonEmpty<I>, strategy: &impl Strategy, ) -> Result<Self::Certificate, AssemblyError>
Assembles a non-empty stream of attestations into a certificate.
Insufficient input returns AssemblyError::InsufficientAttestations.
A signer-unique quorum already verified for one subject must assemble successfully.
Sourcefn is_attributable() -> bool
fn is_attributable() -> bool
Returns whether per-participant fault evidence can be safely exposed.
Schemes where individual signatures can be safely reported as fault evidence should
return true.
Provided Methods§
Sourcefn 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. Empty input produces an empty result in both sets.
Callers must not include duplicate attestations from the same signer: duplicates may produce incorrect results.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".