Skip to main content

Initialize the module

Call init once before using another operation.

Operations

The browser binding supports the stateless redact, mask, and remove strategies.

JavaScript-native ranges

Findings contain utf16Range. Transformation records contain sourceUtf16Range and outputUtf16Range. These zero-based, end-exclusive ranges work directly with String.prototype.slice.

Unsupported provider operations

Browser/WASM does not accept key or token providers. It returns unsupported_strategy when pseudonymization or tokenization is selected and for every restoration call. 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 throws DataFogError with the same stable fields as the Node.js binding. See Errors.

Structured JSON and PERSON fields

Use discoverFields(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. Core 0.4.0 shares its detector registry with Rust and Python. Runtime capabilities() discovery is exposed by Rust and Python only; this binding retains its existing scan APIs. See the capability inventory and compatibility policy.

Email source context

Use the optional scan format setting ("text", "env", or "sql") to delimit emails in environment assignments or standard SQL quoted strings. See email boundaries for examples and syntax limits.