use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct HashChain {
pub prev_hash: [u8; 32],
pub event_hash: [u8; 32],
}
#[cfg(feature = "blake3")]
pub fn compute_hash(content_bytes: &[u8]) -> [u8; 32] {
blake3::hash(content_bytes).into()
}
#[cfg(feature = "blake3")]
pub fn verify_chain(content_bytes: &[u8], chain: &HashChain, expected_prev: &[u8; 32]) -> bool {
chain.prev_hash == *expected_prev && chain.event_hash == compute_hash(content_bytes)
}