pub struct AuditRecord {
pub ts: String,
pub kind: AuditKind,
pub peer: Option<String>,
pub service: Option<String>,
pub method: Option<String>,
pub tool: Option<String>,
pub args_hash: Option<String>,
pub bytes_out: Option<u64>,
pub status: Option<String>,
pub latency_ms: Option<u64>,
pub event: Option<String>,
pub target: Option<String>,
}Expand description
One audit record — the union of the event classes, and the record payload of a
StreamFrame::Event. ONE schema for the on-disk JSONL log and the live stream. Every field
beyond ts/kind is optional and elided when absent (skip_serializing_if), so each class
serializes to just its relevant keys (a session record has no method; a trust record has no
bytes_out).
PRIVACY: the proxied-request record carries method + tool (NAME only) +
args_hash ("blake3:<hex>"), and NEVER the raw arguments, the request/response content, or
any tool-output bytes — only a bytes_out COUNT and a status.
Fields§
§ts: StringRFC3339 UTC with millisecond precision, e.g. "2026-07-03T14:02:11.480Z". The YYYY-MM
prefix also selects the monthly file (the rotation boundary), so it is always present.
kind: AuditKind§peer: Option<String>The gate-resolved authenticated peer (attributed by the endpoint_id-keyed trust gate). Absent on local-only events with no remote peer (a manual roster install).
service: Option<String>§method: Option<String>§tool: Option<String>The tool NAME only (never its arguments or output) — e.g. "read_file" for a tools/call.
args_hash: Option<String>"blake3:<hex>" of the request arguments. The raw arguments are NEVER stored.
bytes_out: Option<u64>Byte COUNT of the response sent back to the peer — a count, never the content.
status: Option<String>"ok" / "error" (proxied request) or "ok" / "denied" (blob fetch).
latency_ms: Option<u64>§event: Option<String>Trust-event verb: "pair" / "unpair" / "roster_install" / "revoke" (kind == Trust).
target: Option<String>A reference, NEVER content: a blob hash (BlobFetch) or a trust-event target such as a
nickname or org/serial (Trust).
Implementations§
Source§impl AuditRecord
impl AuditRecord
pub fn session_open(ts: String, peer: Option<String>, service: String) -> Self
Sourcepub fn with_status(self, status: &str) -> Self
pub fn with_status(self, status: &str) -> Self
Set the record’s status ("ok"/"error"/"denied"), returning self for chaining.
Marks a synthesized failure record — e.g. the session_open for a FAILED dial, which
reaches no backend and so is never audited by the far side’s session guard — without a
dedicated constructor. DRY: reuses the existing optional status field.
pub fn session_close(ts: String, peer: Option<String>, service: String) -> Self
Sourcepub fn proxied_request(
ts: String,
peer: Option<String>,
service: String,
method: String,
tool: Option<String>,
args_hash: String,
bytes_out: u64,
status: String,
latency_ms: u64,
) -> Self
pub fn proxied_request( ts: String, peer: Option<String>, service: String, method: String, tool: Option<String>, args_hash: String, bytes_out: u64, status: String, latency_ms: u64, ) -> Self
A completed (request→response correlated) proxied line: method + tool NAME + args_hash, plus
the response’s bytes_out COUNT, status, and latency_ms. PRIVACY: args_hash is a digest;
no raw arguments, request/response content, or tool-output bytes are ever passed in.
Sourcepub fn proxied_notification(
ts: String,
peer: Option<String>,
service: String,
method: String,
tool: Option<String>,
args_hash: String,
) -> Self
pub fn proxied_notification( ts: String, peer: Option<String>, service: String, method: String, tool: Option<String>, args_hash: String, ) -> Self
A proxied NOTIFICATION line (no id, so no response correlates): method + tool + args_hash,
no bytes_out/status/latency_ms. The line is still recorded — every proxied request is audited.
pub fn blob_fetch( ts: String, peer: Option<String>, hash: String, status: String, ) -> Self
pub fn trust(ts: String, event: String, target: Option<String>) -> Self
Trait Implementations§
Source§impl Clone for AuditRecord
impl Clone for AuditRecord
Source§fn clone(&self) -> AuditRecord
fn clone(&self) -> AuditRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more