pub struct ContentRedactor {
secret_detector: SecretDetector,
pii_detector: PiiDetector,
config: RedactionConfig,
}Expand description
Redacts sensitive content from text.
Fields§
§secret_detector: SecretDetector§pii_detector: PiiDetector§config: RedactionConfigImplementations§
Source§impl ContentRedactor
impl ContentRedactor
Sourcepub const fn with_config(config: RedactionConfig) -> Self
pub const fn with_config(config: RedactionConfig) -> Self
Creates a new content redactor with custom config.
Sourcepub const fn config(&self) -> &RedactionConfig
pub const fn config(&self) -> &RedactionConfig
Returns the configuration.
Sourcepub fn redact(&self, content: &str) -> String
pub fn redact(&self, content: &str) -> String
Redacts sensitive content, returning the redacted text.
Sourcepub fn redact_with_flag(&self, content: &str) -> (String, bool)
pub fn redact_with_flag(&self, content: &str) -> (String, bool)
Returns the redacted content and a flag indicating if anything was redacted.
Sourcepub fn needs_redaction(&self, content: &str) -> bool
pub fn needs_redaction(&self, content: &str) -> bool
Checks if content needs redaction.
Sourcepub fn detected_types(&self, content: &str) -> Vec<String>
pub fn detected_types(&self, content: &str) -> Vec<String>
Returns the types of sensitive content found.
Sourcefn log_pii_detection_if_any(&self, pii_matches: &[PiiMatch])
fn log_pii_detection_if_any(&self, pii_matches: &[PiiMatch])
Logs PII detection events for audit compliance (GDPR/SOC2).
Only logs when matches are found to avoid noise.
Sourcefn get_replacement(&self, type_name: &str, length: usize) -> String
fn get_replacement(&self, type_name: &str, length: usize) -> String
Gets the replacement string based on mode.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ContentRedactor
impl RefUnwindSafe for ContentRedactor
impl Send for ContentRedactor
impl Sync for ContentRedactor
impl Unpin for ContentRedactor
impl UnwindSafe for ContentRedactor
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].