PrivacyScrubber SDK: Embed Local PII Masking
Build Privacy-First AI Apps with Zero-Trust Data Masking
AI Summary / Key Takeaways
"Bring our high-performance, client-side PII detection engine directly into your own applications. The PrivacyScrubber SDK allows you to scrub sensitive data within your own web apps or Node.js backends with zero external network dependencies."
Enterprise-Grade AI Privacy
Add custom redaction rules and priority support with PRO.
Why Legacy DLP Fails AI Workflows
Building an AI wrapper or SaaS product often means sending raw user data to OpenAI or Anthropic APIs, turning you into a high-risk Data Processor. Implementing custom regex masking is brittle, misses context-dependent entities like names, and creates significant technical debt.
How to Mask PII in Local Memory
Install via npm
Add the SDK to your project using npm or yarn. It works universally across modern browsers (ES Modules) and Node.js environments.
Initialize Engine
Import the scanner and load your desired detection profiles (e.g., General, Healthcare, Finance) natively in your application state.
Scrub & Reveal API
Call the .scrub() method before making outgoing LLM requests, and .reveal() to re-hydrate the AI response seamlessly.
What Teams Achieve with Local PII Masking
Why Adopt the PrivacyScrubber SDK?
When you integrate the PrivacyScrubber SDK into your application, you instantly offload the liability of handling raw Personal Identifiable Information (PII) before it hits your backend or third-party AI APIs. By running the sanitization client-side, you achieve true Privacy by Design.
Developer-First Integration
We built the SDK with an intuitive, synchronous API that seamlessly fits into your existing data flow. Whether you are building an AI chatbot in React or processing massive CSV logs in Node.js, the implementation takes minutes, not weeks.
import { PrivacyScrubber } from '@privacyscrubber/sdk'; // Initialize with a specific compliance profile
const scrubber = new PrivacyScrubber({ profile: 'legal', customRules: [{ type: 'CASE_ID', pattern: /CASE-\d{4}/g }]
}); // Intercept user input before LLM dispatch
const userInput = "Review CASE-8821 for John Doe.";
const { cleanText, sessionMap } = scrubber.scrub(userInput); // cleanText: "Review [CASE_ID_1] for [NAME_1]."
const aiResponse = await fetch('/api/llm', { body: cleanText }); // Re-hydrate the response for the user
const finalOutput = scrubber.reveal(aiResponse, sessionMap);Enterprise-Grade Performance
Speed is critical when intercepting user input. Our hybrid NLP+Regex engine is optimized to run on the main thread or within Web Workers with near-zero latency. Scrubbing a typical 5,000-word document takes less than 15 milliseconds on a modern mobile device, ensuring your application remains highly responsive.
Licensing & Source Code Access
The SDK is delivered as part of the PrivacyScrubber Enterprise tier. This includes full access to the un-obfuscated source code, allowing your internal Security and DevOps teams to audit every line of cryptography and regex logic before deploying it to your production environments.
Feature Reliability & Audit
This enterprise feature is powered by our Local-First Sanitization Engine. Unlike legacy cloud DLP tools, PrivacyScrubber processes your PrivacyScrubber SDK: Embed Local PII Masking logic 100% within your browser's V8 sandbox. This architectural decision ensures that even the most complex detection patterns never expose raw data to an external API.
Airplane Mode
Verified feature operational integrity without network connectivity.
Step-by-Step Guide
How to use this feature
Install Package
Run 'npm install @privacyscrubber/sdk' in your terminal.
Import SDK
import { PrivacyScrubber } from '@privacyscrubber/sdk';
Instantiate
const scrubber = new PrivacyScrubber({ profile: 'general' });
Sanitize Data
const { cleanText, sessionMap } = scrubber.scrub(userInput);
Frequently Asked Questions
What environments does the SDK support?
The PrivacyScrubber SDK is built as an isomorphic library. It runs securely in the browser (React, Vue, Vanilla JS, Web Workers), in Node.js backends, and inside Electron/Tauri desktop wrappers.
Does the SDK require an API key to function?
No. The SDK operates in a completely air-gapped manner. There are no API keys, no telemetry, and no network requests made by the library. You must possess a valid Enterprise License to use the SDK in commercial production environments, but the library itself has zero DRM phoning home.
How large is the SDK bundle?
The core NLP and regex engine is heavily optimized. The minified, gzipped bundle size is approximately ~180KB for the general profile. Heavy industry-specific dictionaries (e.g., medical terminologies) can be lazy-loaded on demand to preserve fast Time-to-Interactive (TTI).
How does pricing work for the SDK?
The SDK is available across three tiers: PRO ($15/mo) for solo developers building personal scripts, TEAMS ($99/mo) for unlimited CI/CD pipeline volume across your startup's backend servers, and ENTERPRISE (Custom) for full source code access and air-gapped deployment.
Protect Your Team's AI Prompts in Under 30 Seconds
Protect My TeamNo server uploads. Works 100% offline in browser RAM.