pub struct RedactionScope { /* private fields */ }Expand description
A set of registered secrets: what an agent’s runs redact, beside its
hooks’ Redacters.
RedactionScope::process is the process-wide set, every agent’s
default (crate::AgentBuilder::redaction_scope) and the daemon’s: a
value registered there is hidden from every run in the process and is
never removed. RedactionScope::isolated is a set of its own, for an
agent (or a test) whose secrets must not reach other agents’ runs, and
whose runs must not depend on what other code registered. Give the same
scope to everything that registers for that agent: its secret store and
its Redactor hook. Cheap to clone; clones share the set.
Implementations§
Source§impl RedactionScope
impl RedactionScope
Sourcepub fn is_process(&self) -> bool
pub fn is_process(&self) -> bool
Whether this is the process-wide set.
Sourcepub fn register(&self, value: &str) -> Result<(), SecretTooShort>
pub fn register(&self, value: &str) -> Result<(), SecretTooShort>
Redact value from everything this scope’s runs send out. Errors
(and registers nothing) for a value under MIN_SECRET_CHARS.
Sourcepub fn redact<'a>(&self, text: &'a str) -> Cow<'a, str>
pub fn redact<'a>(&self, text: &'a str) -> Cow<'a, str>
text with every secret in this scope replaced by
[REDACTED:secret].
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for RedactionScope
impl Clone for RedactionScope
Source§impl Debug for RedactionScope
Never the values: which set it is and how many it holds.
impl Debug for RedactionScope
Never the values: which set it is and how many it holds.