EnforceCore EnforceCore

Redactor

The Redactor scans and masks sensitive information (PII) in real-time.

Classes

Redactor

Engine for detecting and replacing PII patterns.

redact(text: str, rules: list[str] = None) -> RedactionResult

Scans text and replaces detected entities with placeholders.

  • text: Input string to scan.
  • rules: Optional list of rule names to apply (e.g., ["EMAIL", "CREDIT_CARD"]).
  • Returns: RedactionResult with redacted text and metadata.

Data Structures

RedactionResult

  • original_text: The input text.
  • redacted_text: The text with sensitive data replaced by [REDACTED: TYPE].
  • matches: List of DetectedEntity objects.

DetectedEntity

  • type: Type of PII (e.g., EMAIL).
  • start: Start index in original text.
  • end: End index in original text.
  • score: Confidence score (0.0 - 1.0).