pub struct HashChainEntry {
pub prev_hash: String,
pub current_hash: String,
pub entry: SqlAuditContext,
}Expand description
Audit log entry with a hash chain.
Each record contains:
prev_hash: thecurrent_hashof the previous record (the first record usesGENESIS_HASH)current_hash: the SHA-256 hash of this record (computed fromprev_hash + entry)entry: the original audit context (already masked)
Any tampering with a historical record causes current_hash to mismatch the
prev_hash of the next record, which is detected by verify_chain.
Fields§
§prev_hash: StringHash of the previous record (the first record uses GENESIS_HASH)
current_hash: StringHash of this record (SHA-256 hexadecimal string, 64 characters)
entry: SqlAuditContextOriginal audit context (already masked)
Implementations§
Source§impl HashChainEntry
impl HashChainEntry
Sourcepub fn genesis(entry: SqlAuditContext) -> Self
pub fn genesis(entry: SqlAuditContext) -> Self
Create the chain head record (prev_hash = GENESIS_HASH)
Sourcepub fn append(prev_hash: &str, entry: SqlAuditContext) -> Self
pub fn append(prev_hash: &str, entry: SqlAuditContext) -> Self
Append a record to the given previous hash
Trait Implementations§
Source§impl Clone for HashChainEntry
impl Clone for HashChainEntry
Source§fn clone(&self) -> HashChainEntry
fn clone(&self) -> HashChainEntry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HashChainEntry
impl Debug for HashChainEntry
Source§impl<'de> Deserialize<'de> for HashChainEntry
impl<'de> Deserialize<'de> for HashChainEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HashChainEntry
impl RefUnwindSafe for HashChainEntry
impl Send for HashChainEntry
impl Sync for HashChainEntry
impl Unpin for HashChainEntry
impl UnsafeUnpin for HashChainEntry
impl UnwindSafe for HashChainEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more