Direct core · JavaScript
JavaScript core
Use the core when your application already owns the text boundary and needs findings and sanitized output directly.
01 · JavaScript
Scan and redact
Initialize once, pass a string, and use the returned redacted text. The example value is deliberately synthetic.
import { initialize, scanAndRedact } from "@redact-secret/core";
await initialize();
const result = scanAndRedact("API_KEY=SYNTHETIC_REVOKED_CONTEXT_VALUE");
console.log(result.text, result.findings.length);02 · JavaScript
Runtime boundary
The package supports Node.js and the browser. Use the web-stream subpath for streaming browser text. Detection does not send input over the network.
- A finding reports byte ranges, detector identity, confidence, and action.
- A block or processing failure must stop the caller from forwarding the original value.