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.