Skip to main content

SensitivityScanner

Trait SensitivityScanner 

Source
pub trait SensitivityScanner: Send + Sync {
    // Required method
    fn scan(&self, text: &str) -> Option<String>;
}
Expand description

Trait for detecting sensitive content in text.

Implementors define their own patterns and detection logic. The protocol requires only that detected content is categorized by a human-readable name (e.g., “API Key”, “IBAN”, “Bank PIN”).

§Example

use sigil_protocol::SensitivityScanner;

struct RegexScanner { /* ... */ }

impl SensitivityScanner for RegexScanner {
    fn scan(&self, text: &str) -> Option<String> {
        if text.contains("sk-") {
            Some("API Key".to_string())
        } else {
            None
        }
    }
}

Required Methods§

Source

fn scan(&self, text: &str) -> Option<String>

Scan text for sensitive content.

Returns Some(category_name) if sensitive content is detected, or None if the text is safe.

The category name is used in audit logs and vault metadata.

Implementors§