Initialize the module
Callinit once before using another operation.
Persistent Workspace and model detection
UseWorkspace for persistent pseudonyms and strict local restoration. The browser host reviews a prepared change, saves its encrypted state and activates it before releasing the transformed text. FogVault and SQLite3 Multiple Ciphers both support this flow.
The BrowserWorkspace coordinator enables the bundled name and address detector by default. Use setCnnEnabled(false) to disable it. The detector runs in a dedicated Worker. Synchronous scan() uses the rule engine.
See the browser Workspace integration example for setup and commit order, and the embedded CNN reference for model coverage and limits.
Operations
redact, mask, and remove
strategies.
JavaScript-native ranges
Findings containutf16Range. Transformation records contain
sourceUtf16Range and outputUtf16Range. These zero-based, end-exclusive
ranges work directly with String.prototype.slice.
Unsupported provider operations
The stateless browser operations do not accept key or token providers. They returnunsupported_strategy when pseudonymization or tokenization is selected and
for provider-backed restoration. The separate Workspace API described above
owns its mappings and supports strict local restoration.
This is an intentional security boundary, not a missing fallback. Provider
credentials and key custody require a separately designed host integration.
Errors
The JavaScript wrapper throwsDataFogError with the same stable fields as the
Node.js binding. See Errors.
Structured JSON and PERSON fields
UsediscoverFields(data, config?), scanStructured(data, config?),
transformStructured(data, findings, config), and
scanAndTransformStructured(data, config). Scan returns { mappings, findings };
transformation returns { data, transformations }. Located findings contain
path and finding; located records contain path and transformation.
Call await init() first. Selected provider-backed strategies and
restoreStructured reject with unsupported_strategy.
Paths are JSON Pointers. All ranges, including JavaScript UTF-16 ranges,
address the decoded string at that path. See person-field discovery
for aliases, policy configuration, input limits, and examples.
German locale routing and the seven additional entity labels are documented in
the German entity reference.
This SDK shares the Rust detector registry. See the rule inventory for activation settings.
Email source context
Use the optional scanformat setting ("text", "env", or "sql") to
delimit emails in environment assignments or standard SQL quoted strings.
See email boundaries for examples and syntax limits.