piilite FAQ

Short answers to the questions people ask most about piilite.

What is piilite?

piilite is a free, open-source JavaScript library that finds and masks personal data (PII) in text. It is built for Indian data: Aadhaar, PAN, GSTIN, UPI IDs, +91 phone numbers, Indian names and addresses, OTPs and API keys. It has zero dependencies, weighs about 28 KB gzipped and runs in Node.js, browsers, Bun and Deno.

Is piilite free to use in commercial projects?

Yes. piilite is MIT licensed, so you can use it in personal and commercial projects for free. Keep the copyright notice from the LICENSE file.

Does piilite use AI or send my data anywhere?

No. piilite uses patterns, checksums and rules only. It makes no network calls and runs entirely on your server or in the user's browser, so the text you scan never leaves your machine.

How do I detect Aadhaar numbers in JavaScript?

Install piilite with npm install piilite and call new Piilite({ types: ["AADHAAR"] }).scan(text). It returns each Aadhaar number with its position. piilite checks the Verhoeff checksum, so random 12-digit numbers are not flagged, and it skips numbers labelled as UTR, order or reference numbers.

How does piilite validate Aadhaar, PAN and GSTIN numbers?

Aadhaar and Aadhaar VID numbers must pass the Verhoeff checksum UIDAI uses. PAN numbers must have a valid holder-type letter in the fourth position. GSTIN numbers must start with a real state code, contain a valid PAN and pass the GSTIN mod-36 checksum. Card numbers are checked with the Luhn algorithm.

Does piilite work with Hindi and Hinglish text?

Yes. piilite understands Hinglish phrases such as "mera naam … hai" and "ghar ka pata", digits written in nine Indian scripts (for example ९८७६५४३२१०), spoken numbers like "nau aath saat", and "my name is" in Hindi, Marathi, Bengali, Punjabi, Gujarati, Odia, Tamil, Telugu, Kannada and Malayalam.

How do I mask PII before sending a prompt to an LLM like ChatGPT or Claude?

Call shield.detect(prompt), send the returned redacted text to the model, then call shield.restore(answer, redactionMap) on the reply. The model only sees placeholders like [NAME_1] and [PHONE_IN_1]; the real values stay on your server.

Can piilite put the original values back into the AI's answer?

Yes. restore(text, redactionMap) replaces placeholders with the original values. It is fuzzy by default, so it also handles placeholders a model rewrote, such as "[NAME 1]", "[name_1]" or "NAME_1".

Can piilite redact streaming LLM output?

Yes. shield.redactStream(asyncIterable), shield.createStream() and shield.transformStream() redact text as it arrives. They hold back a short tail so a phone number or name split across two chunks is never leaked.

Does piilite work in the browser, Node.js, Bun and Deno?

Yes. piilite has no dependencies and uses only standard JavaScript, so it runs in Node.js 18 and later, modern browsers, Bun, Deno and edge runtimes. It ships as an ES module and as CommonJS.

Does piilite support TypeScript?

Yes. piilite ships its own type definitions for the core and for the piilite/openredaction, piilite/express and piilite/react entry points.

Does piilite make my app compliant with India's DPDP Act?

piilite helps you minimise personal data, for example before logging it or sending it to an AI provider, and it has a dpdp preset for the Digital Personal Data Protection Act, 2023. Compliance also depends on consent, purpose, storage and security, so piilite alone does not make an app compliant. This is not legal advice.

How accurate is piilite?

On a held-out benchmark of 480 synthetic samples that was never used for tuning, piilite caught 84.3% of personal data with 99.7% precision. Every ID-style type (Aadhaar, PAN, GSTIN, UPI, phone, bank account, email, cards, licences) scored 100%. Names scored 71.6% and addresses 50%.

What are piilite's limitations?

Names with no clue around them and addresses without a label, house marker or PIN code can be missed, because piilite does not use an AI model. Some types (bank account, passport, UAN, OTP) need a label nearby. The benchmark data is synthetic, so real text may contain cases it does not cover.

How is piilite different from OpenRedaction?

OpenRedaction is a broader, global library with 570+ patterns and enterprise modules such as audit logging and RBAC. piilite focuses on Indian data and is far more accurate on it (84.3% vs 45.7% recall in the benchmark), is smaller, and can use OpenRedaction's global patterns through its optional piilite/openredaction bridge.

How is piilite different from Microsoft Presidio?

Presidio is a Python framework that combines patterns with NLP models such as spaCy and usually runs as a separate service. piilite is a JavaScript library that runs inside your app with no models and no service, and it covers Indian formats out of the box. Presidio can catch more free-text names; piilite is lighter and faster to adopt in JavaScript projects.

How do I report a missed or wrong detection?

Open an issue on GitHub with a sample sentence that uses fake data. Confirmed cases become tests, so they stay fixed.

Last updated · piilite 0.3.0