{"id":50288528,"url":"https://github.com/codewithveek/pii-mask","last_synced_at":"2026-05-28T04:04:00.301Z","repository":{"id":343685438,"uuid":"1176008389","full_name":"codewithveek/pii-mask","owner":"codewithveek","description":"A developer-first PII masking toolkit for TypeScript and JavaScript. Detect, mask, tokenize, and anonymize personally identifiable information across structured data, freeform text, CLI pipelines, and React UIs.","archived":false,"fork":false,"pushed_at":"2026-04-01T18:14:17.000Z","size":603,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-02T05:34:48.628Z","etag":null,"topics":["ai-security","ai-tools","pii","pii-anonymization","pii-detection","pii-protection","pii-redaction"],"latest_commit_sha":null,"homepage":"https://pii-mask.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codewithveek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-08T13:47:27.000Z","updated_at":"2026-04-01T18:14:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/codewithveek/pii-mask","commit_stats":null,"previous_names":["codewithveek/pii-mask"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/codewithveek/pii-mask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithveek%2Fpii-mask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithveek%2Fpii-mask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithveek%2Fpii-mask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithveek%2Fpii-mask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithveek","download_url":"https://codeload.github.com/codewithveek/pii-mask/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithveek%2Fpii-mask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33593409,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-security","ai-tools","pii","pii-anonymization","pii-detection","pii-protection","pii-redaction"],"created_at":"2026-05-28T04:03:59.453Z","updated_at":"2026-05-28T04:04:00.295Z","avatar_url":"https://github.com/codewithveek.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @pii-mask\n\nA developer-first PII masking toolkit for TypeScript and JavaScript. Detect, mask, tokenize, and anonymize personally identifiable information across structured data, freeform text, CLI pipelines, and React UIs.\n\n## Packages\n\n| Package                               | Description                                                   | Install                     |\n| ------------------------------------- | ------------------------------------------------------------- | --------------------------- |\n| [`@pii-mask/core`](./packages/core)   | Zero-dependency masking engine with 31 built-in detectors     | `pnpm add @pii-mask/core`   |\n| [`@pii-mask/cli`](./packages/cli)     | File I/O adapter for CSV, JSON, JSONL, and TXT files          | `pnpm add -g @pii-mask/cli` |\n| [`@pii-mask/react`](./packages/react) | React bindings — `\u003cMaskPII\u003e`, `usePIIMask`, `usePIIMaskTable` | `pnpm add @pii-mask/react`  |\n| [`@pii-mask/nlp`](./packages/nlp)     | Optional NLP extension for freeform name/place detection      | `pnpm add @pii-mask/nlp`    |\n\n## Quick Start\n\n```ts\nimport { createMasker } from '@pii-mask/core';\n\nconst masker = createMasker({ mode: 'redact' });\n\n// Structured data\nconst { result } = masker.maskObject({\n  name: 'John Doe',\n  email: 'john@example.com',\n  ssn: '123-45-6789',\n});\n// → {\"name\":\"John Doe\",\"email\":\"[REDACTED]\",\"ssn\":\"[REDACTED]\"}\n\n// Freeform text\nconst { result: text } = masker.maskString('Contact me at john@example.com');\n// → \"Contact me at [REDACTED]\"\n\n// Region-scoped detection (only run detectors for specific countries)\nconst ngMasker = createMasker({ mode: 'mask', regions: ['NG'] });\n\n// Detection-only (no masking)\nconst { detections } = masker.detectString('john@example.com');\n// → ['email']\n\n// Session for cross-call consistency (shared token map and counters)\nconst session = masker.createSession();\nmasker.maskString('john@example.com', undefined, session);\nmasker.maskString('john@example.com', undefined, session); // same token/label\n```\n\n## Masking Modes\n\n| Mode           | Behaviour                                                     | Reversible |\n| -------------- | ------------------------------------------------------------- | ---------- |\n| `mask`         | Partial obscure — preserves type shape (`jo***n@example.com`) | No         |\n| `redact`       | Full replacement with `[REDACTED]`                            | No         |\n| `pseudonymize` | Consistent labels per session (`EMAIL_1`, `SSN_2`)            | No         |\n| `anonymize`    | Same as pseudonymize — consistent labels                      | No         |\n| `tokenize`     | Random token (`\u003c\u003cPII_a1b2c3d4\u003e\u003e`), restorable via token map   | Yes        |\n| `substitute`   | Plausible fake value via `@faker-js/faker`                    | No         |\n\n## Built-in Detectors\n\n### Contact\n\n- `email` — Email addresses\n- `phone` — Phone numbers (powered by `libphonenumber-js`, 20+ country local formats)\n\n### Government ID\n\n- `ssn-us` — US Social Security Numbers\n- `nin-ng` — Nigerian National Identification Numbers\n- `bvn-ng` — Nigerian Bank Verification Numbers\n- `aadhaar-in` — Indian Aadhaar numbers\n- `pan-in` — Indian PAN cards\n- `said-za` — South African ID numbers\n- `nin-uk` — UK National Insurance Numbers\n- `nik-id` — Indonesian NIK numbers\n- `cpf-br` — Brazilian CPF numbers\n- `passport` — Passport numbers\n- `sin-ca` — Canadian Social Insurance Numbers\n\n### Financial\n\n- `credit-card` — Credit/debit card numbers (Luhn-validated)\n- `iban` — International Bank Account Numbers\n\n### Network\n\n- `ip-address` — IPv4 addresses\n- `ipv6` — IPv6 addresses\n- `mac-address` — Hardware MAC addresses\n\n### Biometric\n\n- `dob` — Dates of birth (ISO 8601 and common formats)\n\n### Identity\n\n- `person-name` — Person names (key-name heuristic)\n- `address` — Physical addresses (key-name heuristic)\n- `uuid` — UUID v1–v5\n- `mongodb-objectid` — MongoDB ObjectIds (24-char hex)\n- `vin` — Vehicle Identification Numbers\n\n### Secrets\n\n- `secret-key` — API keys, tokens, passwords (key-name heuristic)\n- `jwt` — JSON Web Tokens\n- `bcrypt-hash` — bcrypt password hashes\n- `hex-secret` — Long hex strings (32+ chars)\n- `aws-key` — AWS access key IDs (AKIA/ASIA prefix)\n- `github-pat` — GitHub personal access tokens\n- `platform-token` — Slack (xox\\*) and Stripe (sk*/rk*) tokens\n\n## Architecture\n\n```\n┌─────────────┐   ┌──────────────┐   ┌───────────────┐\n│ @pii-mask/  │   │ @pii-mask/   │   │ @pii-mask/    │\n│ cli         │   │ react        │   │ nlp           │\n└──────┬──────┘   └──────┬───────┘   └───────┬───────┘\n       │                 │                    │\n       └─────────────────┼────────────────────┘\n                         │\n                  ┌──────┴──────┐\n                  │ @pii-mask/  │\n                  │ core        │\n                  └─────────────┘\n```\n\nAll packages depend only on `core`. No circular dependencies.\n\n## Development\n\n```bash\n# Prerequisites: Node.js \u003e= 18, pnpm\n\n# Install dependencies\npnpm install\n\n# Build all packages\npnpm turbo build\n\n# Run all tests\npnpm turbo test\n\n# Typecheck\npnpm turbo typecheck\n\n# Lint\npnpm turbo lint\n```\n\n\u003e **Always use pnpm.** Never use npm or yarn — this repo uses pnpm workspaces exclusively.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithveek%2Fpii-mask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithveek%2Fpii-mask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithveek%2Fpii-mask/lists"}