pub struct FileAuditSink { /* private fields */ }Available on crate feature
auth only.Expand description
File-based audit sink that writes JSONL (one JSON line per event).
Supports optional cryptographic chaining — when enabled, each event includes the SHA-256 hash of the previous event’s JSON representation, creating an append-only tamper-evident log.
Implementations§
Source§impl FileAuditSink
impl FileAuditSink
Sourcepub fn new(path: impl Into<PathBuf>) -> Result<FileAuditSink, Error>
pub fn new(path: impl Into<PathBuf>) -> Result<FileAuditSink, Error>
Create a new file audit sink.
Sourcepub fn with_chaining(path: impl Into<PathBuf>) -> Result<FileAuditSink, Error>
pub fn with_chaining(path: impl Into<PathBuf>) -> Result<FileAuditSink, Error>
Create a new file audit sink with cryptographic hash chaining enabled.
Each event will include a prev_hash field containing the SHA-256 hash
of the previous event’s JSON, creating a tamper-evident append-only log.
Trait Implementations§
Source§impl AuditSink for FileAuditSink
impl AuditSink for FileAuditSink
Source§fn log<'life0, 'async_trait>(
&'life0 self,
event: AuditEvent,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FileAuditSink: 'async_trait,
fn log<'life0, 'async_trait>(
&'life0 self,
event: AuditEvent,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
FileAuditSink: 'async_trait,
Log a single audit event.
Source§fn log_batch<'life0, 'async_trait>(
&'life0 self,
events: Vec<AuditEvent>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn log_batch<'life0, 'async_trait>(
&'life0 self,
events: Vec<AuditEvent>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Log a batch of audit events atomically. Read more
Source§fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
_filter: &'life1 AuditFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<AuditEvent>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
_filter: &'life1 AuditFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<AuditEvent>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Query audit events matching the given filter. Read more
Auto Trait Implementations§
impl !Freeze for FileAuditSink
impl RefUnwindSafe for FileAuditSink
impl Send for FileAuditSink
impl Sync for FileAuditSink
impl Unpin for FileAuditSink
impl UnsafeUnpin for FileAuditSink
impl UnwindSafe for FileAuditSink
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