pub trait EventVerifier: Send + Sync {
// Required methods
fn compute_hash<P: Serialize>(&self, event: &Event<P>) -> [u8; 32];
fn verify_chain<P: Serialize>(
&self,
current: &Event<P>,
previous_hash: &[u8; 32],
) -> bool;
fn algorithm(&self) -> HashAlgorithm;
// Provided method
fn verify_hash<P: Serialize>(
&self,
event: &Event<P>,
expected: &[u8; 32],
) -> bool { ... }
}Expand description
Trait for cryptographic event verification.
Implementations of this trait provide hash computation and verification for events, enabling tamper-evident audit logs.
Required Methods§
Sourcefn verify_chain<P: Serialize>(
&self,
current: &Event<P>,
previous_hash: &[u8; 32],
) -> bool
fn verify_chain<P: Serialize>( &self, current: &Event<P>, previous_hash: &[u8; 32], ) -> bool
Verify hash chain (current depends on previous).
Sourcefn algorithm(&self) -> HashAlgorithm
fn algorithm(&self) -> HashAlgorithm
Get the algorithm used by this verifier.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.