pub struct WireRedactor {
owners: Vec<Regex>,
}Expand description
Redacts one captured wire trace. Whole-trace rather than per-line because the identity also leaks as a bare name in prose, which is only recognisable once a home path elsewhere in the file supplies it - from the trace, so the same file redacts identically on any machine.
Fields§
§owners: Vec<Regex>Implementations§
Source§impl WireRedactor
impl WireRedactor
Sourcepub fn for_trace<'a>(
lines: impl IntoIterator<Item = &'a str>,
) -> Result<Self, String>
pub fn for_trace<'a>( lines: impl IntoIterator<Item = &'a str>, ) -> Result<Self, String>
Discover the home-directory owner(s) named anywhere in lines. A
trace naming no home path discovers none, so a bare name in its
prose survives.
§Errors
A discovered name below MIN_OWNER_LEN.
Sourcepub fn redact_line(&self, line: &str) -> Result<String, String>
pub fn redact_line(&self, line: &str) -> Result<String, String>
Redact one line, by one of three paths: structurally where the no-op round trip is byte-exact; structurally again on a structure-preserving re-encode (a number-token count match - 17-digit floats re-spell under serde_json’s parse, and that is the canonicalisation); by the text rules otherwise, for a non-JSON line or a JSON line with nothing structurally to redact whose re-encode would differ.
§Errors
Serialisation failure, and account or hook-body fields on a line
whose re-encode loses structure (a number-token count mismatch -
duplicate keys collapse on parse). That arm is LIVE in this
build. The message names the frame’s type, never the body it
refused to write.