JavaScript/TypeScript SDK
The AnotiAI PII Masker SDK for JavaScript/TypeScript provides easy integration for masking and unmasking personally identifiable information (PII) in your applications.
Installation
npm install @anotiai/pii-masker
# or
yarn add @anotiai/pii-masker
Quick Start
import { AnotiaiPIIMasker } from "@anotiai/pii-masker";
// Initialize with your API key
const client = new AnotiaiPIIMasker("your_anotiai_api_key");
// Mask PII in text
const result = await client.mask("My email is john@example.com");
console.log(result.masked_text); // "My email is [REDACTED_EMAIL_1]"
// Unmask when needed
const unmasked = await client.unmask(result.masked_text, result.pii_map);
console.log(unmasked.unmasked_text); // "My email is john@example.com"
Features
- PII Detection and Masking: Automatically detect and mask emails, phone numbers, names, addresses, and more.
- Batch Processing: Process multiple texts efficiently.
- Safe Chat: Chat with LLMs while automatically masking PII.
- Streaming Support: Handle streaming responses.
- TypeScript Support: Full type definitions included.
Next Steps
- API Reference - Detailed method documentation
- Examples - Code examples and best practices
- Error Handling - How to handle errors
Supported PII Types
- Email, Phone Number, Person (names)
- Credit Card, SSN, Passport
- Address, URL, IP Address
- License Plate, Crypto Address
- API Key, Date/Time
- And more...