Skip to main content

Installation

npm install anonyma
# or
pnpm add anonyma
# or
yarn add anonyma

The package has no runtime dependencies. Zod is an optional peer dependency, needed only for the schemas in anonyma/schemas:

npm install zod

Requirements​

  • A JavaScript runtime with the Web platform: Node.js 18 or later, Bun, Deno, Cloudflare Workers or a browser. The library uses Web Crypto, WHATWG streams and TextEncoder, and no Node.js module. On Node.js 18, which has no global crypto, it loads node:crypto lazily. CI runs the same feature checks on every one of these runtimes; Workers run them without nodejs_compat.
  • TypeScript 5.0 or later (optional). The package ships full declarations and is written without any.
  • Zod 3.25.4 or later, or Zod 4 (optional), for anonyma/schemas. It imports the zod/v3 entry point that both provide, so its types are the same with either.

The package is published as ESM and CommonJS, and is tree-shakeable: import only what you use.

Entry points​

Start with anonyma. The other entry points add features you can adopt one at a time.

ImportWhat it gives youGuide
anonymadetect(), anonymize(), objects, tokens, presets, batches, strategies, errorsQuick start
anonyma/engineCompiled pipelines with validating detectors, every strategy, chunk-safe streamsSpan engine
anonyma/vaultSession, keyed and sealed tokenizers, a key ring with rotation, token vaultsKeys and token vaults
anonyma/aiChat-message and JSON sanitizers, restoration of complete and streamed model outputLLMs and AI tools
anonyma/auditA hash-chained audit log without personal data, signed receiptsAudit trail and receipts
anonyma/complianceRegulation profiles with citations, a policy parser, erasure planningRegulations and policies
anonyma/middlewareScrubbing of HTTP payloads; adapters in anonyma/middleware/express and …/honoHTTP middleware
anonyma/mcpA Model Context Protocol server without dependenciesLLMs and AI tools
anonyma/streamWHATWG TransformStream wrappers around anonymize() and tokenize()Batches and streams
anonyma/validatorsChecksum validators: Luhn, mod-97, mod-11, CPF, CNPJ and moreChecksum validators
anonyma/detectorsEvery detector, and the registries that hold themDetecting personal data
anonyma/schemasZod schemas, function-calling tool definitions and a capability manifest (needs Zod)LLMs and AI tools
anonyma/cryptoLow-level Web Crypto helpersAPI reference

Companion packages​

Three packages are published separately and take anonyma as a peer dependency: