Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PromptShield 🛡️

npm version License: MIT Zero Dependency TypeScript

Zero-dependency PII & Secret Redactor for LLM Prompts and AI Pipelines. Guard your enterprise data before sending prompts to OpenAI, Anthropic, or Gemini.


⚡ Features

  • 🔒 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.

📦 Installation

�ash npm install promptshield


🚀 Quick Start

` 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 `


📄 License

This project is licensed under the MIT License.

About

Zero-dependency PII & Secret Redactor for LLM Prompts and AI Pipelines

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages