credgate: Detect Indian Personal Data Before It Reaches Language Models
Source:R/credgate-package.R
credgate-package.RdDetects personal data in text before it is sent to a large language model, with Indian identifiers built in: Aadhaar (validated with the Verhoeff checksum), Aadhaar Virtual ID, PAN, GSTIN, voter ID, passport, driving licence, CKYC, ration card and job card numbers, UPI IDs, IFSC codes, bank account and payment card numbers with expiry dates and verification codes, mobile numbers and Ayushman Bharat (ABHA) health IDs, plus rule-based detection of names and addresses in Latin and Indic scripts. Candidates are validated with checksums, scored from surrounding context and matched through Indic digits and invisible characters. The rules come from a language-neutral specification shared with the 'Python' package of the same name.
Masking
Wherever credgate shows a detected value - printed spans, preview(),
the examples in scan_pii() - it masks letters and digits with X.
Identifiers keep their last 4 characters (2 for values shorter than 8),
as in UIDAI's masked Aadhaar, so you can tell which value matched. Names
and addresses are masked in full.
To mask every value in full, for policies that allow no part of a value
to be shown, set options(credgate.mask = "full") or the environment
variable CREDGATE_MASK=full (the option wins). The default is
"partial". Masking never changes the detected values themselves.
Author
Maintainer: Bharat Sikka bharat8sikka@gmail.com [copyright holder]
Authors:
Aishwarya Bais aishwarya.bais00@gmail.com [copyright holder]