Redact Core - PII Detection and Anonymization Engine
A high-performance, Rust-based PII detection and anonymization library designed as a replacement for Microsoft Presidio.
Features
- Pattern-based Detection: Regex-based PII recognizers for structured data
- NER Support: Named Entity Recognition using ONNX Runtime (via redact-ner)
- Multiple Anonymization Strategies: Replace, mask, hash, encrypt
- Policy-Aware: Configurable rules and thresholds
- Multi-platform: Server, WASM, mobile support
- High Performance: Zero-copy where possible, efficient overlap resolution
Example
use redact_core::{AnalyzerEngine, AnonymizerConfig, AnonymizationStrategy};
let mut analyzer = AnalyzerEngine::new();
let text = "Contact John Doe at john@example.com or 555-1234";
let result = analyzer.analyze(text, None).unwrap();
println!("Detected {} entities", result.detected_entities.len());
// Anonymize with replacement strategy
let config = AnonymizerConfig {
strategy: AnonymizationStrategy::Replace,
..Default::default()
};
let anonymized = analyzer.anonymize(text, None, &config).unwrap();
println!("Anonymized: {}", anonymized.text);