npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tpmjs/tools-secret-scan-text

v0.2.0

Published

Scan text for potential secrets using regex patterns

Readme

@tpmjs/tools-secret-scan-text

Scan text for potential secrets using regex patterns.

Features

Detects the following types of secrets:

  • AWS Credentials: Access keys, secret keys, account IDs
  • GitHub Tokens: Personal access tokens, OAuth tokens
  • Slack Tokens: Bot tokens, webhooks
  • OpenAI API Keys: API keys for OpenAI services
  • Stripe API Keys: Live and restricted keys
  • Generic API Keys: Common API key patterns
  • JWT Tokens: JSON Web Tokens
  • Private Keys: RSA, EC, DSA, OpenSSH, PGP
  • Database Credentials: PostgreSQL, MySQL, MongoDB connection strings
  • Hardcoded Passwords: Password assignments in code
  • Google API Keys: Google Cloud API keys
  • Twilio API Keys: Twilio service keys
  • SendGrid API Keys: SendGrid API tokens
  • Mailchimp API Keys: Mailchimp API tokens
  • Bearer Tokens: Authorization bearer tokens

Installation

npm install @tpmjs/tools-secret-scan-text

Usage

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
//   }
// }

Severity Levels

  • critical: Immediate security risk (AWS keys, private keys, database credentials)
  • high: Serious risk (API keys, tokens, hardcoded passwords)
  • medium: Moderate risk (account IDs, less sensitive tokens)
  • low: Minor concerns

Use Cases

  • Pre-commit Hooks: Scan code before committing
  • CI/CD Pipelines: Detect secrets in build artifacts
  • Code Reviews: Identify hardcoded credentials
  • Log Analysis: Find accidentally logged secrets
  • Configuration Audits: Check config files for sensitive data

License

MIT