Skip to main content
Creates and configures an anonymizer instance for PII detection and replacement.

Signature

Parameters

config (optional)

string
default:"'pseudonymize'"
Anonymization mode:
  • 'pseudonymize' — Reversible. Returns an encrypted piiMap for later rehydration.
  • 'anonymize' — Irreversible. No piiMap is returned; PII is permanently removed.
NERConfig
NER model configuration
SemanticConfig
Semantic enrichment configuration
KeyProvider
Encryption key provider. If not provided, generates a random key.
PIIStorageProvider
Storage provider for session-based PII map persistence
AnonymizationPolicy
Default anonymization policy
SecretsConfig
Secrets/credentials detection configuration
TagFormat
Tag format for PII placeholder tags. Controls the delimiters and keyword.
(warnings: Array<{ code: string; message: string }>) => void
Callback for validation warnings. When not provided, warnings are silently ignored — check stats.leakScanPassed in the result instead.
RecognizerRegistry
Custom recognizer registry (uses default if not provided)

Returns

An Anonymizer instance with these methods:

Examples

Basic (Regex Only)

With NER

With Semantic Enrichment

With Storage

Irreversible Anonymization

With Inference Server

With Custom Tag Format

With Custom Thresholds

With Custom Policy

Excluding Countries and Regions