{"id":28151462,"url":"https://github.com/sidmohan0/pii-rust-worker","last_synced_at":"2025-06-11T02:04:17.143Z","repository":{"id":292614761,"uuid":"981417754","full_name":"sidmohan0/pii-rust-worker","owner":"sidmohan0","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-11T04:26:32.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-11T05:21:42.128Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/sidmohan0.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}},"created_at":"2025-05-11T04:00:00.000Z","updated_at":"2025-05-11T04:26:36.000Z","dependencies_parsed_at":"2025-05-11T05:32:07.306Z","dependency_job_id":null,"html_url":"https://github.com/sidmohan0/pii-rust-worker","commit_stats":null,"previous_names":["sidmohan0/pii-rust-worker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Fpii-rust-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Fpii-rust-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Fpii-rust-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Fpii-rust-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidmohan0","download_url":"https://codeload.github.com/sidmohan0/pii-rust-worker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidmohan0%2Fpii-rust-worker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259184739,"owners_count":22818266,"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-15T04:12:22.554Z","updated_at":"2025-06-11T02:04:17.107Z","avatar_url":"https://github.com/sidmohan0.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PII Checker for Cloudflare Workers\n\nA simple, accurate PII checker for common patterns with three privacy policy operations: redact, anonymize, and hash.\n\n## Features\n\n- **Lightweight and Efficient**: Compiles to WebAssembly with a small footprint\n- **Deterministic Regex Patterns**: Pre-compiled patterns for common PII types\n- **Privacy Policies**:\n  - **REDACT**: Replace PII with the same number of █ characters\n  - **ANONYMIZE**: Replace with type indicators like `\u003cEMAIL_1\u003e`, `\u003cPHONE_2\u003e`\n  - **HASH**: Replace with SHA-256 hash (first 8 hex characters)\n- **Supported PII Types**:\n  - Email addresses\n  - Phone numbers (US format)\n  - Social Security Numbers (SSN)\n  - Credit card numbers\n\n## API Usage\n\nSend a POST request to the `/pii` endpoint with the following JSON structure:\n\n```json\n{\n  \"text\": \"Text containing PII to process\",\n  \"fields\": [\"EMAIL\", \"PHONE\", \"SSN\", \"CREDIT_CARD\"],\n  \"priv_policy\": \"REDACT\" | \"ANONYMIZE\" | \"HASH\"\n}\n```\n\nResponse format:\n\n```json\n{\n  \"redacted\": \"Processed text with PII handled according to policy\",\n  \"map\": [\n    [\"PII_TYPE\", \"original_value\", \"replacement_value\"],\n    ...\n  ]\n}\n```\n\n## Example\n\nInput:\n```json\n{\n  \"text\": \"Contact John at john@example.com or 555-123-4567\",\n  \"fields\": [\"EMAIL\", \"PHONE\"],\n  \"priv_policy\": \"REDACT\"\n}\n```\n\nOutput:\n```json\n{\n  \"redacted\": \"Contact John at ████████████████ or ████████████\",\n  \"map\": [\n    [\"EMAIL\", \"john@example.com\", \"████████████████\"],\n    [\"PHONE\", \"555-123-4567\", \"████████████\"]\n  ]\n}\n```\n\n## Development\n\n1. Make sure you have Rust and wrangler installed.\n2. Clone the repository.\n3. Run the examples: `cargo run --example test_pii`\n4. Deploy to Cloudflare Workers: `wrangler deploy`\n\n## Implementation Details\n\n- Uses lazy_static to compile regex patterns only once\n- Processes matches back-to-front to avoid shifting offsets\n- Returns both the processed text and a mapping of original-to-replacement values","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidmohan0%2Fpii-rust-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidmohan0%2Fpii-rust-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidmohan0%2Fpii-rust-worker/lists"}