Masking is the least glamorous part of a document pipeline and the one that tends to be discovered late — usually when someone asks why a full Aadhaar number is sitting in a support ticket attachment.
The requirement is narrow: keep the document useful, remove the identifiers.
What “preserving layout” actually buys you
The naive approach is to extract the text, drop the sensitive fields, and store the remainder. That destroys the document. You can no longer show it to a reviewer, attach it to a case file, or prove what was on the page.
Masking works the other way round. The engine detects sensitive regions — Aadhaar numbers, PAN, and other identifiers — and redacts them while preserving document layout exactly. Only the detected regions are covered. Everything else, including the parts a human reviewer needs to make a decision, is untouched.
The output is still the document. It is just missing the twelve digits.
The QR code is the part people miss
This is the failure mode worth internalising. A masked Aadhaar card with a neat black box over the number is not masked if the QR code beside it still encodes that same number. Anything with a phone camera can read it back.
So masking has to cover the machine‐readable surface too: Aadhaar QR code and barcode regions are redacted so the number cannot leak through a machine‐readable code.
If you are evaluating a masking tool, this is the first thing to test. Mask a document, then scan the result with a QR reader. If it returns the number, the tool has given you a document that looks compliant and is not.
It runs on your hardware, and that is the point
The masking engine runs on your own hardware as part of the Abscode on‐premise deployment. Not as a hosted API.
That is a deliberate constraint rather than a missing feature. The documents that need masking are exactly the documents you do not want to send anywhere: KYC bundles, eKYC PDFs, scanned identity cards. Routing them through a third‐party service to have their identifiers removed inverts the goal.
On‐premise means KYC documents never leave your infrastructure. The compliance conversation becomes much shorter when the honest answer to “who else processes this” is “nobody”.
It also aligns with what DPDP, GDPR and UIDAI guidance on Aadhaar handling are each pushing toward from different directions: minimise what you hold, minimise who touches it, be able to show what you did.
Audit counts, not audit vibes
Masking without a record is hard to defend. Per‐document redaction counts give you something concrete — how many regions were detected and covered on each document — which is what turns “we mask PII” into something you can put in front of an auditor.
It is also your regression signal. A batch where the average redaction count drops sharply is either a change in document mix or a detector that has stopped working. Both are worth a look.
When masking is the wrong tool
Reach for something else when:
- You need the identifier. Masking is lossy and deliberately irreversible. If a downstream process needs to match on PAN, mask the copy you retain, not the one you match against.
- The document is already structured. If you have already extracted fields into JSON, control access at the field level. Masking is for when the document itself must survive as a document.
- You need reversibility. Tokenisation, not redaction, is the answer when an authorised party must be able to recover the original value.
- The sensitive content is free text. Pattern‐based detection is strong on formatted identifiers and weaker on a phone number written out in a covering letter. Know where the boundary is.
Where it belongs in the pipeline
Mask as early as the workflow allows — ideally right after capture and extraction, before the document lands anywhere durable. Every hop after that is another copy to account for.
The common ordering that works:
- Capture on device
- Extract the fields you need, into your own system
- Mask the document
- Store the masked version; discard the original unless you are legally required to keep it
Step 4 is where most of the risk actually lives, and it is a retention policy question rather than a technical one. Masking makes it survivable.


