{"id":28312390,"url":"https://github.com/dschoon/react-pii-mask","last_synced_at":"2026-02-22T12:37:04.650Z","repository":{"id":273806006,"uuid":"920942111","full_name":"dschoon/react-pii-mask","owner":"dschoon","description":"React component for automatically masking Personally Identifiable Information (PII) on the client","archived":false,"fork":false,"pushed_at":"2025-01-23T04:09:06.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-18T05:54:50.915Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dschoon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-01-23T03:34:38.000Z","updated_at":"2025-03-14T19:01:09.000Z","dependencies_parsed_at":"2025-01-23T04:24:54.782Z","dependency_job_id":"6c44d8e1-e020-4544-9275-3f9a506423fc","html_url":"https://github.com/dschoon/react-pii-mask","commit_stats":null,"previous_names":["dschoon/react-pii-mask"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dschoon/react-pii-mask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschoon%2Freact-pii-mask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschoon%2Freact-pii-mask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschoon%2Freact-pii-mask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschoon%2Freact-pii-mask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dschoon","download_url":"https://codeload.github.com/dschoon/react-pii-mask/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschoon%2Freact-pii-mask/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261314345,"owners_count":23140051,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-05-24T17:09:44.497Z","updated_at":"2025-10-23T19:03:06.190Z","avatar_url":"https://github.com/dschoon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React PII Mask\n\nA React component for automatically masking Personally Identifiable Information (PII) in your application.\n\n## Features\n\n- 🔒 Automatic PII detection and masking\n- 🎯 Class-based targeting for known PII elements\n- 🔄 Real-time DOM observation for dynamic content\n- 🎨 Built-in styling with visual indicators\n- 📱 TypeScript support\n\n## Installation\n\n```bash\nnpm install react-pii-mask\n# or\nyarn add react-pii-mask\n# or\npnpm add react-pii-mask\n```\n\n## Run Example\n\nTo run the examples locally:\n\n```bash\ngit clone https://github.com/dschoon/react-pii-mask.git\ncd react-pii-mask\npnpm install\ncd examples\npnpm install\npnpm dev\n```\n\nThen open [http://localhost:5173](http://localhost:5173) to see the examples in action.\n\n## Usage\n\n### Basic Setup\n\nWrap your app with the PIIFilter component:\n\n```tsx\nimport { PIIFilter } from 'react-pii-mask';\n\nfunction App() {\n  return (\n    \u003cPIIFilter\u003e\n      {/* Your app content */}\n    \u003c/PIIFilter\u003e\n  );\n}\n```\n\n### Class-based Masking\n\nAdd PII classes to elements you want to mask:\n\n```tsx\n\u003cdiv\u003e\n  \u003cp className=\"email\"\u003euser@example.com\u003c/p\u003e\n  \u003cp className=\"phone\"\u003e123-456-7890\u003c/p\u003e\n  \u003cp className=\"name\"\u003eJohn Doe\u003c/p\u003e\n  \u003cp className=\"pii\"\u003eSensitive Data\u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Automatic Detection\n\nThe component automatically detects and masks:\n- Email addresses\n- Phone numbers\n- Social Security Numbers\n- Full names\n\n### Custom Styling\n\nImport the default styles or create your own:\n\n```tsx\nimport 'react-pii-mask/styles.css';\n```\n\n## API\n\n### PIIFilter Component\n\nThe main component that handles PII masking:\n\n```tsx\nimport { PIIFilter } from 'react-pii-mask';\n\ninterface PIIFilterProps {\n  // Optional array of HTML tags to skip when masking\n  skipTags?: string[];\n  // Whether to preserve format characters (@ . - etc) when masking\n  preserveFormat?: boolean;\n  // Character to use for masking (default: '*')\n  maskCharacter?: string;\n  // Whether to automatically detect and mask PII (default: true)\n  autoDetect?: boolean;\n  // Array of RegExp patterns to ignore when masking\n  ignorePatterns?: RegExp[];\n}\n\n// Default skipTags: ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'BUTTON', 'LABEL']\n```\n\n## Examples\n\nBasic usage with default settings:\n```tsx\n\u003cPIIFilter\u003e\n  \u003cdiv\u003e\n    \u003ch1\u003eThis heading won't be masked\u003c/h1\u003e\n    \u003cp\u003eThis email@example.com will be masked as ****************\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/PIIFilter\u003e\n```\n\nDisable auto-detection (only mask elements with PII classes):\n```tsx\n\u003cPIIFilter autoDetect={false}\u003e\n  \u003cdiv\u003e\n    \u003cp\u003etest@email.com won't be masked\u003c/p\u003e\n    \u003cp className=\"pii\"\u003eThis will be masked\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/PIIFilter\u003e\n```\n\nIgnore specific patterns:\n```tsx\n\u003cPIIFilter \n  ignorePatterns={[\n    /Public Information/i,\n    /^ID: \\d+$/\n  ]}\n\u003e\n  \u003cdiv\u003e\n    \u003cp\u003eID: 12345 won't be masked\u003c/p\u003e\n    \u003cp\u003ePublic Information won't be masked\u003c/p\u003e\n    \u003cp\u003etest@email.com will be masked\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/PIIFilter\u003e\n```\n\nFormat-preserving masking:\n```tsx\n\u003cPIIFilter preserveFormat\u003e\n  \u003cdiv\u003e\n    \u003cp\u003etest@gmail.com will be masked as ****@*****.***\u003c/p\u003e\n    \u003cp\u003e123-456-7890 will be masked as ***-***-****\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/PIIFilter\u003e\n```\n\nCustom mask character:\n```tsx\n\u003cPIIFilter maskCharacter=\"X\" preserveFormat\u003e\n  \u003cdiv\u003e\n    \u003cp\u003etest@gmail.com will be masked as XXXX@XXXXX.XXX\u003c/p\u003e\n    \u003cp\u003eWithout preserveFormat: XXXXXXXXXXXXXXX\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/PIIFilter\u003e\n```\n\n\u003cbr /\u003e\n\n### Screenshot of Example\n\n![React PII Mask](https://cdn.schoon.me/work/react-pii-mask.png)\n\n\u003cbr /\u003e\n\n## Utility Functions\n\n```tsx\nimport { maskPII, containsPII } from 'react-pii-mask';\n\n// Mask text\nmaskPII('sensitive text'); // Returns: '************'\n\n// Check for PII\ncontainsPII('test@email.com'); // Returns: true\n```\n\n## Types\n\n```tsx\nimport type { PIIClass, PIIPattern } from 'react-pii-mask';\n\n// Available PII classes\ntype PIIClass = 'name' | 'email' | 'phone' | 'pii';\n\n// Pattern types\ntype PIIPattern = 'email' | 'phone' | 'id' | 'name';\n```\n\n\u003cbr /\u003e\n\n## License\n\nMIT © [SchoonLabs](https://www.schoonlabs.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdschoon%2Freact-pii-mask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdschoon%2Freact-pii-mask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdschoon%2Freact-pii-mask/lists"}