Skip to main content

Crate redact_core

Crate redact_core 

Source
Expand description

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);

Re-exports§

pub use anonymizers::AnonymizationStrategy;
pub use anonymizers::AnonymizerConfig;
pub use anonymizers::AnonymizerRegistry;
pub use engine::AnalyzerEngine;
pub use recognizers::Recognizer;
pub use recognizers::RecognizerRegistry;
pub use types::AnalysisMetadata;
pub use types::AnalysisResult;
pub use types::AnonymizedResult;
pub use types::EntityType;
pub use types::RecognizerResult;
pub use types::Token;

Modules§

anonymizers
engine
policy
recognizers
types

Constants§

VERSION
Version of the redact-core library