@tpmjs/tools-secret-scan-text
Scan text for potential secrets using regex patterns. Detects API keys, tokens, passwords, AWS credentials, and more
Test @tpmjs/tools-secret-scan-text (secretScanText) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-secret-scan-textpnpm add @tpmjs/tools-secret-scan-textyarn add @tpmjs/tools-secret-scan-textbun add @tpmjs/tools-secret-scan-textdeno add npm:@tpmjs/tools-secret-scan-textimport { secretScanText } from '@tpmjs/tools-secret-scan-text';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { secretScanText } from '@tpmjs/tools-secret-scan-text';
const result = await generateText({
model: openai('gpt-4o'),
tools: { secretScanText },
prompt: 'Your prompt here...',
});
console.log(result.text);(text: string) => Promise<unknown>Available configuration options
textstringThe text to scan for secrets
Schema extracted: 2/27/2026, 4:16:35 AM
Scan text for potential secrets using regex patterns.
Detects the following types of secrets:
npm install @tpmjs/tools-secret-scan-text
import { secretScanText } from '@tpmjs/tools-secret-scan-text'; const code = ` const AWS_ACCESS_KEY = "AKIAIOSFODNN7EXAMPLE"; const apiKey = "sk-proj-1234567890abcdef"; const dbUrl = "postgres://user:password123@localhost:5432/mydb"; `; const result = await secretScanText.execute({ text: code }); console.log(result); // { // secrets: [ // { // type: 'aws-access-key', // value: 'AKIAIOSFODNN7EXAMPLE', // line: 2, // column: 24, // context: '...const AWS_ACCESS_KEY = "AKIAIOSFODNN7EXAMPLE";...', // severity: 'critical' // }, // { // type: 'openai-api-key', // value: 'sk-proj-1234567890abcdef', // line: 3, // column: 17, // context: '...const apiKey = "sk-proj-1234567890abcdef";...', // severity: 'critical' // }, // { // type: 'postgres-connection', // value: 'postgres://user:password123@localhost:5432/mydb', // line: 4, // column: 17, // context: '...const dbUrl = "postgres://user:password123@localhost:5432/mydb";...', // severity: 'critical' // } // ], // secretCount: 3, // patterns: [ // { type: 'aws-access-key', count: 1 }, // { type: 'openai-api-key', count: 1 }, // { type: 'postgres-connection', count: 1 } // ], // metadata: { // linesScanned: 5, // scanDurationMs: 2 // } // }
MIT
Downloads/month
6
GitHub Stars
0
Quality Score