pub struct Generic {
pub participants: Set<PublicKey>,
pub signer: Option<(u32, PrivateKey)>,
}Expand description
Generic Ed25519 signing scheme implementation.
This struct contains the core cryptographic operations without protocol-specific context types. It can be reused across different protocols (simplex, aggregation, etc.) by wrapping it with protocol-specific trait implementations via the macro.
Fields§
§participants: Set<PublicKey>Participants in the committee.
signer: Option<(u32, PrivateKey)>Key used for generating signatures.
Implementations§
Source§impl Generic
impl Generic
Sourcepub fn signer(
participants: Set<PublicKey>,
private_key: PrivateKey,
) -> Option<Self>
pub fn signer( participants: Set<PublicKey>, private_key: PrivateKey, ) -> Option<Self>
Creates a new generic Ed25519 scheme instance.
Sourcepub const fn verifier(participants: Set<PublicKey>) -> Self
pub const fn verifier(participants: Set<PublicKey>) -> Self
Builds a verifier that can authenticate signatures without generating them.
Sourcepub fn me(&self) -> Option<u32>
pub fn me(&self) -> Option<u32>
Returns the index of “self” in the participant set, if available.
Sourcepub fn sign<S, D>(
&self,
namespace: &[u8],
subject: S::Subject<'_, D>,
) -> Option<Attestation<S>>
pub fn sign<S, D>( &self, namespace: &[u8], subject: S::Subject<'_, D>, ) -> Option<Attestation<S>>
Signs a subject and returns the signer index and signature.
Sourcepub fn verify_attestation<S, D>(
&self,
namespace: &[u8],
subject: S::Subject<'_, D>,
attestation: &Attestation<S>,
) -> bool
pub fn verify_attestation<S, D>( &self, namespace: &[u8], subject: S::Subject<'_, D>, attestation: &Attestation<S>, ) -> bool
Verifies a single attestation from a signer.
Sourcepub fn verify_attestations<S, R, D, I>(
&self,
rng: &mut R,
namespace: &[u8],
subject: S::Subject<'_, D>,
attestations: I,
) -> Verification<S>where
S: Scheme<Signature = Ed25519Signature>,
R: Rng + CryptoRng,
D: Digest,
I: IntoIterator<Item = Attestation<S>>,
pub fn verify_attestations<S, R, D, I>(
&self,
rng: &mut R,
namespace: &[u8],
subject: S::Subject<'_, D>,
attestations: I,
) -> Verification<S>where
S: Scheme<Signature = Ed25519Signature>,
R: Rng + CryptoRng,
D: Digest,
I: IntoIterator<Item = Attestation<S>>,
Batch-verifies attestations and returns verified attestations and invalid signers.
Sourcepub fn assemble<S, I>(&self, attestations: I) -> Option<Certificate>
pub fn assemble<S, I>(&self, attestations: I) -> Option<Certificate>
Assembles a certificate from a collection of attestations.
Sourcepub fn verify_certificate<S, R, D>(
&self,
rng: &mut R,
namespace: &[u8],
subject: S::Subject<'_, D>,
certificate: &Certificate,
) -> bool
pub fn verify_certificate<S, R, D>( &self, rng: &mut R, namespace: &[u8], subject: S::Subject<'_, D>, certificate: &Certificate, ) -> bool
Verifies a certificate using batch verification.
Sourcepub fn verify_certificates<'a, S, R, D, I>(
&self,
rng: &mut R,
namespace: &[u8],
certificates: I,
) -> bool
pub fn verify_certificates<'a, S, R, D, I>( &self, rng: &mut R, namespace: &[u8], certificates: I, ) -> bool
Verifies multiple certificates in a batch.
pub const fn is_attributable(&self) -> bool
pub const fn certificate_codec_config(&self) -> <Certificate as Read>::Cfg
pub const fn certificate_codec_config_unbounded() -> <Certificate as Read>::Cfg
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Generic
impl RefUnwindSafe for Generic
impl Send for Generic
impl Sync for Generic
impl Unpin for Generic
impl UnwindSafe for Generic
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> 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