EventVerifier

Trait EventVerifier 

Source
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§

Source

fn compute_hash<P: Serialize>(&self, event: &Event<P>) -> [u8; 32]

Compute hash for an event.

Source

fn verify_chain<P: Serialize>( &self, current: &Event<P>, previous_hash: &[u8; 32], ) -> bool

Verify hash chain (current depends on previous).

Source

fn algorithm(&self) -> HashAlgorithm

Get the algorithm used by this verifier.

Provided Methods§

Source

fn verify_hash<P: Serialize>( &self, event: &Event<P>, expected: &[u8; 32], ) -> bool

Verify event integrity using its hash.

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.

Implementors§