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

@watheushenry/local-credentials

v2.4.1

Published

Gerenciador de credenciais criptografadas para Node.js, inspirado no laravel/credentials.

Readme

Local Credentials

Um pacote Node.js desenvolvido para armazenar e gerenciar credenciais de forma segura, utilizando criptografia AES-256 e banco de dados MySQL. Esta solução é ideal para projetos que necessitam armazenar informações sensíveis como chaves de API, tokens de acesso e outras credenciais de forma segura e organizada.

🔐 Características principais

  • Criptografia AES-256 para máxima segurança
  • Integração com MySQL para armazenamento persistente
  • Interface de linha de comando simples e intuitiva
  • Gerenciamento completo de credenciais (adicionar, buscar, listar e remover)
  • Configuração simplificada via arquivo .env

📌 Instalação

Para instalar o pacote em seu projeto, execute o seguinte comando:

npm install @watheushenry/local-credentials

🔧 Configuração

Pré-requisitos

  • Node.js instalado
  • MySQL Server em execução
  • Banco de dados criado para armazenamento das credenciais

Configuração do ambiente

Crie um arquivo .env na raiz do seu projeto com as seguintes variáveis:

DB_HOST=localhost      # Endereço do seu servidor MySQL
DB_USER=root          # Usuário do MySQL
DB_PASS=              # Senha do MySQL
DB_NAME=nome_do_banco # Nome do banco de dados
SECRET_KEY=0123456789abcdef0123456789abcdef # Chave secreta para criptografia

Importante: Mantenha sua SECRET_KEY em segurança e nunca a compartilhe ou comita no controle de versão.

I'll update the README to include both CLI and programmatic usage examples:

🚀 Como Usar

O Local Credentials pode ser utilizado de duas formas: via linha de comando (CLI) ou programaticamente em seu código.

📟 Usando via CLI

✅ Salvando credenciais

npx credentials set <chave> "<valor>"

Exemplo prático:

npx credentials set API_KEY "minha_chave_secreta"

🔍 Recuperando credenciais

npx credentials get <chave>

Exemplo prático:

npx credentials get API_KEY

📜 Listando todas as credenciais

npx credentials list

🗑️ Removendo credenciais

npx credentials delete <chave>

Exemplo prático:

npx credentials delete API_KEY

💻 Usando programaticamente

Você também pode integrar o Local Credentials diretamente em seu código:

const { setCredential, getCredential, listCredentials, deleteCredential } = require('@watheushenry/local-credentials');

async function exemploDeUso() {
  try {
    // 1. Salvar credencial
    await setCredential("apiKey", "meu-segredo-super-seguro");
    console.log("✅ Credencial salva!");

    // 2. Listar credenciais
    console.log("\n🔑 Credenciais salvas:");
    await listCredentials();

    // 3. Obter credencial
    const value = await getCredential("apiKey");
    console.log(`\n🔍 Valor da credencial: ${value}`);

    // 4. Deletar credencial
    await deleteCredential("apiKey");
    console.log("\n🗑️ Credencial removida!");
  } catch (error) {
    console.error("Erro:", error.message);
  }
}

// Executar o exemplo
exemploDeUso();

📝 Detalhes das funções

  • setCredential(chave, valor): Salva uma nova credencial ou atualiza uma existente
  • getCredential(chave): Recupera o valor de uma credencial específica
  • listCredentials(): Retorna uma lista de todas as credenciais salvas
  • deleteCredential(chave): Remove uma credencial específica

⚡ Exemplo de integração em um projeto real

const { setCredential, getCredential } = require('@watheushenry/local-credentials');

async function inicializarAPI() {
  try {
    // Salvar uma nova chave de API
    await setCredential('STRIPE_API_KEY', 'sk_test_...');
    
    // Recuperar a chave quando necessário
    const apiKey = await getCredential('STRIPE_API_KEY');
    
    // Usar a chave em sua aplicação
    const stripe = require('stripe')(apiKey);
    
    // ... resto da sua lógica
  } catch (error) {
    console.error('Erro ao gerenciar credenciais:', error);
  }
}

⚠️ Boas Práticas de Segurança

  1. Sempre utilize senhas fortes para o banco de dados
  2. Mantenha sua SECRET_KEY em um ambiente seguro
  3. Evite compartilhar credenciais em texto plano
  4. Faça backup regular do banco de dados
  5. Monitore o acesso às credenciais

🤝 Contribuindo

Contribuições são sempre bem-vindas! Se você encontrou um bug ou tem uma sugestão de melhoria, por favor:

  1. Abra uma issue descrevendo o problema/sugestão
  2. Fork o repositório
  3. Crie uma branch para sua feature/correção
  4. Envie um pull request

Desenvolvido com ❤️ por WatheusHenry