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 🙏

© 2025 – Pkg Stats / Ryan Hefner

hecate-keystone

v1.3.1

Published

A secrets manager for my JavaScript projects.

Readme

Hecate Keystone

A lightweight secrets manager client for JavaScript projects. Hecate Keystone provides a simple interface to securely fetch and manage secrets from your Hecate secrets management service with AES encryption.

Features

  • 🔐 Secure secret retrieval from Hecate API with AES decryption
  • 🚀 Simple and intuitive API
  • 🔑 Flexible authentication (environment variables or constructor)
  • 📦 ES Module support
  • ⚡ Built with async/await
  • 🧪 Fully tested
  • 🔒 End-to-end encryption with user-provided keys

Installation

npm install hecate-keystone

Usage

Basic Usage

import Hecate from 'hecate-keystone';

// Initialize with environment variables
// Set HECATE_API_KEY and HECATE_USER_KEY in your environment
const hecate = new Hecate();

// Or pass keys directly to constructor
const hecate = new Hecate('your-api-key-here', 'your-user-key-here');

// Fetch a secret
try {
    const secret = await hecate.getSecret('DATABASE_PASSWORD');
    console.log('Secret value:', secret.value);
    console.log('Secret key:', secret.key);
} catch (error) {
    console.error('Failed to fetch secret:', error);
}

Configuration

Hecate Keystone requires two keys for authentication and decryption:

1. Environment Variables (Recommended)

Set both environment variables:

export HECATE_API_KEY='your-api-key'
export HECATE_USER_KEY='your-user-key'

Then initialize without parameters:

const hecate = new Hecate();

2. Constructor Parameters

Pass both the API key and user key directly to the constructor:

const hecate = new Hecate('your-api-key-here', 'your-user-key-here');

API Reference

new Hecate(apiKey?, userKey?)

Creates a new Hecate client instance.

Parameters:

  • apiKey (string, optional): Your Hecate API key. If not provided, will use HECATE_API_KEY environment variable.
  • userKey (string, optional): Your AES decryption key. If not provided, will use HECATE_USER_KEY environment variable.

Throws:

  • Error: If either the API key or user key is not provided and the corresponding environment variable is not set.

async getSecret(secretName)

Retrieves and decrypts a secret by name from the Hecate service.

Parameters:

  • secretName (string, required): The name of the secret to retrieve.

Returns:

  • Promise<Object>: The secret object containing the key and decrypted value.

Throws:

  • Error: If the secret is not found, decryption fails, or if there's a network error.

Example:

const secret = await hecate.getSecret('API_KEY');
console.log(secret.key);   // 'API_KEY'
console.log(secret.value); // The decrypted secret value

Examples

Check out the examples directory for working code samples:

// See examples/index.js for a complete working example
import Hecate from 'hecate-keystone';

const hecate = new Hecate('your-api-key', 'your-user-key');
const secret = await hecate.getSecret('my-secret');
console.log('Decrypted Secret:', secret);

Error Handling

try {
    const secret = await hecate.getSecret('MY_SECRET');
    // Use the secret
    console.log('Secret retrieved successfully:', secret.value);
} catch (error) {
    if (error.message.includes('not found')) {
        console.error('Secret does not exist');
    } else if (error.message.includes('HECATE_API_KEY')) {
        console.error('API key not configured');
    } else if (error.message.includes('HECATE_USER_KEY')) {
        console.error('User key not configured');
    } else {
        console.error('Error fetching secret:', error.message);
    }
}

Security

  • Secrets are encrypted at rest and decrypted client-side using AES encryption
  • Your user key never leaves your application
  • API communication is secured via HTTPS
  • No sensitive data is logged or stored locally

Requirements

  • Node.js 14.x or higher
  • ES Module support

Development

Running Tests

npm test

Linting

npm run lint

Running Examples

node examples/index.js

Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/YourFeature)
  3. Make your changes
  4. Run tests to ensure everything works (npm test)
  5. Commit your changes (git commit -m 'Add some feature')
  6. Push to the branch (git push origin feature/YourFeature)
  7. Open a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Chames Dinuka

Keywords

  • secrets-manager
  • secrets
  • configuration
  • environment-variables
  • security
  • api-keys
  • encryption
  • aes
  • cryptography