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

@gotocva/crypto

v1.0.0

Published

SimpleCrypto is a robust and lightweight encryption library for Node.js. It provides a simple and intuitive API for securely encrypting and decrypting strings using AES-256-GCM encryption. With built-in support for salting, key derivation, and configurabl

Readme

@gotocva/crypto

@gotocva/crypto is a lightweight Node.js module that provides an easy-to-use API for encrypting and decrypting strings using AES-256-GCM encryption. This is particularly useful for securing sensitive data, such as API keys, passwords, or other private information.

Installation

Install the package using npm or yarn:

npm install @gotocva/crypto

or

yarn add @gotocva/crypto

Usage

Below is a quick guide to using the @gotocva/crypto module:

Encrypt and Decrypt Strings

const Crypto = require('@gotocva/crypto');

// Initialize Crypto with a secret key (you should store the secret key in environment variables)
const crypto = new Crypto(process.env.SECRET_KEY || 'mySecretKey');

// Encrypt a string
const encryptedString = crypto.encrypt('siva');
console.log('Encrypted String:', encryptedString);

// Decrypt the encrypted string
const decryptedString = crypto.decrypt(encryptedString);
console.log('Decrypted String:', decryptedString);

Output Example

Encrypted String: f5cd39890592299745ffa1e09ec76d480463ce69f3e75b17bc4d4f7bc384de878f79fd8a51ac9fd5cab2218ca085d26839fe4336d1bf37a7b58826d9de5eb062a9421d96ccd53dddb5b77fd0d74594e290f7858212638fecfc33922d299d63e0a5ceca08
Decrypted String: siva

API

new Crypto(secretKey, [options])

Creates an instance of the Crypto class.

  • secretKey (required): A non-empty string used as the encryption key. This should be kept secure and private.
  • options (optional): An object to configure the encryption behavior. Options include:
    • encoding: The encoding format for the output (default: hex).
    • saltLength: The length of the random salt (default: 64).
    • pbkdf2Iterations: The number of iterations for key derivation (default: 100000).

encrypt(value)

Encrypts the given value.

  • value (required): The string to encrypt.
  • Returns: An encrypted string.

decrypt(value)

Decrypts the given encrypted value.

  • value (required): The string to decrypt (must be a valid output from the encrypt method).
  • Returns: The original plaintext string.

Best Practices

  1. Use Environment Variables: Always store your secret key in environment variables to prevent accidental exposure in your codebase.

    export SECRET_KEY="your-secure-key"
  2. Keep the Secret Key Safe: Your encryption is only as strong as the secrecy of your key. Ensure it is never hardcoded in your application.

  3. Secure Dependencies: Regularly update the @gotocva/crypto package to get the latest security updates and features.

Testing

You can test the encryption and decryption process with the following script:

const Crypto = require('@gotocva/crypto');
const crypto = new Crypto('testKey');

const encrypted = crypto.encrypt('testValue');
const decrypted = crypto.decrypt(encrypted);

console.assert(decrypted === 'testValue', 'Decryption failed!');
console.log('All tests passed!');