pub struct AuditChain { /* private fields */ }Expand description
Tamper-evident append-only audit log.
Implementations§
Source§impl AuditChain
impl AuditChain
Sourcepub fn with_storage(path: impl AsRef<Path>) -> Result<Self>
pub fn with_storage(path: impl AsRef<Path>) -> Result<Self>
Create an AuditChain backed by a JSONL file. Loads existing entries if the file exists.
Sourcepub fn append(
&mut self,
agent_id: &str,
action: &str,
result: AuditResult,
provenance_id: &str,
agent_kp: &KeyPair,
authorization_level: u8,
physical: bool,
) -> Result<&AuditEntry>
pub fn append( &mut self, agent_id: &str, action: &str, result: AuditResult, provenance_id: &str, agent_kp: &KeyPair, authorization_level: u8, physical: bool, ) -> Result<&AuditEntry>
Append a new signed entry to the chain.
Sourcepub fn verify(&self) -> (bool, usize, Option<String>)
pub fn verify(&self) -> (bool, usize, Option<String>)
Verify the hash chain integrity.
Returns (valid, entries_checked, broken_at_entry_id).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn entries(&self) -> &[AuditEntry]
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuditChain
impl RefUnwindSafe for AuditChain
impl Send for AuditChain
impl Sync for AuditChain
impl Unpin for AuditChain
impl UnsafeUnpin for AuditChain
impl UnwindSafe for AuditChain
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