Zero-dependency PII & Secret Redactor for LLM Prompts and AI Pipelines. Guard your enterprise data before sending prompts to OpenAI, Anthropic, or Gemini.
- 🔒 Secrets & API Key Redaction: Automatically detects OpenAI keys, GitHub tokens, AWS keys, JWTs, and Bearer tokens.
- 👤 PII Data Protection: Redacts emails, phone numbers, credit card numbers, SSNs, and IPv4 addresses.
- 🚀 Zero Dependencies: Lightweight, ultra-fast regex engine written in strict TypeScript.
- 🛠️ Configurable: Easily add custom domain patterns or toggle specific redaction categories.
�ash npm install promptshield
` ypescript import { PromptShield } from 'promptshield';
const shield = new PromptShield();
const unsafePrompt = User email: john.doe@company.com API Key: sk-proj1234567890abcdef1234567890 AWS Key: AKIAIOSFODNN7EXAMPLE ;
const result = shield.redact(unsafePrompt);
console.log(result.redactedText); /* Output: User email: [REDACTED_EMAIL] API Key: [REDACTED_OPENAI_KEY] AWS Key: [REDACTED_AWS_KEY] */
console.log(result.hasPII); // true console.log(result.hasSecrets); // true console.log(result.redactedCount); // 3 `
This project is licensed under the MIT License.