{"id":42374337,"url":"https://github.com/emorilebo/redact-ai-stream","last_synced_at":"2026-01-27T20:04:59.733Z","repository":{"id":329707622,"uuid":"1120451550","full_name":"emorilebo/redact-ai-stream","owner":"emorilebo","description":"A lightweight Node.js library designed to secure your AI applications by automatically redacting Personally Identifiable Information (PII) from data streams before they reach public APIs (like OpenAI, Anthropic, etc.) and restoring the original data in the response stream.","archived":false,"fork":false,"pushed_at":"2025-12-22T13:37:21.000Z","size":28481,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-23T02:12:36.933Z","etag":null,"topics":["ai","godfreylebo","llm","pii","privacy","redaction","security","stream"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/redact-ai-stream","language":"JavaScript","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/emorilebo.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":"2025-12-21T08:39:17.000Z","updated_at":"2025-12-22T13:37:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/emorilebo/redact-ai-stream","commit_stats":null,"previous_names":["emorilebo/redact-ai-stream"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/emorilebo/redact-ai-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fredact-ai-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fredact-ai-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fredact-ai-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fredact-ai-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emorilebo","download_url":"https://codeload.github.com/emorilebo/redact-ai-stream/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emorilebo%2Fredact-ai-stream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28820352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","godfreylebo","llm","pii","privacy","redaction","security","stream"],"created_at":"2026-01-27T20:04:09.534Z","updated_at":"2026-01-27T20:04:59.728Z","avatar_url":"https://github.com/emorilebo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redact-ai-stream\n\n![NPM Version](https://img.shields.io/npm/v/redact-ai-stream)\n![License](https://img.shields.io/npm/l/redact-ai-stream)\n![Downloads](https://img.shields.io/npm/dm/redact-ai-stream)\n![TypeScript](https://img.shields.io/badge/types-included-blue)\n\n![Redact AI Stream Hero](assets/redact_ai_stream_hero_1766409977618.png)\n\n**Bi-directional PII Redaction for AI Streams**\n\n`redact-ai-stream` is a lightweight, specialized Node.js library designed to secure your AI applications. It acts as a middleware layer, automatically redacting Personally Identifiable Information (PII) from data streams *before* they exit your secure boundary (e.g., to OpenAI, Anthropic), and transparently restoring that data in the incoming response stream.\n\n![How It Works](assets/redact_ai_stream_how_it_works_1766409909844.png)\n\n## Why use this?\n\nWhen building RAG requests or chat interfaces, you often need to send user context to an LLM. However, sending raw email addresses, phone numbers, or credit card details violates privacy compliance (GDPR, CCPA) and security best practices. `redact-ai-stream` solves this by tokenizing sensitive data on the fly.\n\n## Features\n\n*   **Stream-based Redaction**: Integrates natively with Node.js `Transform` streams.\n*   **Bi-directional**: Redacts outgoing data, restores incoming data.\n*   **Session-based Security**: Tokens are unique per session (`\u003cEMAIL_UUID\u003e`).\n*   **Zero-Persistence**: Original PII is held in memory only for the duration of the stream; never stored on disk.\n*   **TypeScript Support**: Written in TypeScript with full type definitions included.\n\n## Installation\n\n```bash\nnpm install redact-ai-stream\n```\n\n## Usage\n\n### TypeScript / ES Modules\n\n```typescript\nimport RedactionSession from 'redact-ai-stream';\nimport { Readable } from 'stream';\n\n// 1. Create a session\nconst session = new RedactionSession();\n\n// 2. Mock input stream (e.g., from an API request)\nconst userInput = Readable.from([\"My email is alice@example.com.\"]);\n\n// 3. Pipe through redaction\nconst redactedStream = userInput.pipe(session.redact());\n\nredactedStream.on('data', (chunk) =\u003e {\n    console.log('To LLM:', chunk.toString());\n    // Output: \"To LLM: My email is \u003cEMAIL_1234-5678...\u003e\"\n});\n\n// ... Send to AI ...\n\n// 4. Restore AI response\nconst aiResponse = Readable.from([\"Sending confirmation to \u003cEMAIL_1234-5678...\u003e.\"]);\nconst finalStream = aiResponse.pipe(session.restore());\n\nfinalStream.on('data', (chunk) =\u003e {\n    console.log('To User:', chunk.toString());\n    // Output: \"To User: Sending confirmation to alice@example.com.\"\n});\n```\n\n### CommonJS\n\n```javascript\nconst RedactionSession = require('redact-ai-stream');\n// Usage is identical to above\n```\n\n## Supported Redactions\n\n| Type | Pattern Example | Token Format |\n| :--- | :--- | :--- |\n| **Email** | `alice@example.com` | `\u003cEMAIL_UUID\u003e` |\n| **Credit Card** | `4532 1234 5678 9012` | `\u003cCC_UUID\u003e` |\n| **Phone** | `+1-555-0123` | `\u003cPHONE_UUID\u003e` |\n\n## License\n\nMIT © Godfrey Lebo\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femorilebo%2Fredact-ai-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femorilebo%2Fredact-ai-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femorilebo%2Fredact-ai-stream/lists"}