piidact
v0.1.0
Published
Browser-native PII detection and redaction powered by Zig WASM.
Downloads
30
Maintainers
Readme
Piidact
Browser-native PII detection and redaction powered by a Zig WASM core and a typed JavaScript package. Piidact runs locally in the browser or Node, with no runtime npm dependencies and no network calls for detection.
Install
npm install piidactUse
import { load } from "piidact";
const lib = await load({ build: "core" });
const text = "Patient name Jane Doe emailed [email protected].";
const detection = await lib.detect(text);
const redacted = await lib.redact(text);
lib.dispose();The core detects structured PII such as emails, phones, cards, SSNs, IBANs, IPs, URLs, dates, postal addresses, UK NINs, and Canadian SINs. It also includes contextual spans for person names and organizations, plus TOML pattern packs with context gates and checksum validators such as NPI.
const lib = await load({
build: "auto",
modelUrl: "https://cdn.example.com/piidact-model.bin",
cacheStrategy: "memory",
});Detected spans include typed metadata when available, such as { issuer: "visa" } for credit cards.
Local Development
npm run build
npm test
npm run siteThe package exports ESM, CJS, TypeScript declarations, and piidact-core.wasm / piidact-pro.wasm artifacts under dist/.
CLI
npx piidact detect "Email [email protected]"
npx piidact redact "Email [email protected]"
npx piidact pack new --name acme-internal
npx piidact pack train ./acme-internal
npx piidact pack publish ./acme-internal --private --sign ./private-key.pem
npx piidact detect --pack medical=./medical.toml --packs medical "Patient MRN-1234567"Published .piidact-pack artifacts can be loaded with loadPack(). If a public Ed25519 key is provided as signature, Piidact verifies the artifact signature before loading the pack rules.
