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

zipherly

v1.0.1

Published

Simplified secure encryption for Node.js web applications

Readme

Zipherly

Simplified secure encryption for Node.js web applications.

MIT License Node.js Version

Overview

Zipherly is a user-friendly encryption library designed to simplify data security in Node.js applications. By abstracting away the complexities of cryptography, Zipherly enables developers to implement strong encryption with minimal effort through a JSON-based configuration system.

Key Features

  • Simple Configuration - JSON-based config system with sensible defaults
  • Strong Encryption - AES-256-GCM, AES-256-CBC, and ChaCha20-Poly1305 support
  • Data Integrity - HMAC signatures for tamper protection
  • Express Integration - Middleware for automatic API payload encryption
  • Key Management - Tools for key generation, rotation, and secure storage
  • Type Definitions - Full TypeScript support

Installation

npm install zipherly

Quick Start

1. Create a configuration file

Create a zipherly.config.json file in your project root:

{
  "encryption": {
    "symmetric": {
      "algorithm": "aes-256-gcm",
      "keySource": "ENV_ZIPHERLY_KEY"
    }
  },
  "hashing": {
    "algorithm": "sha256",
    "hmac": {
      "enabled": true,
      "secretSource": "ENV_ZIPHERLY_HMAC_SECRET"
    }
  },
  "security": {
    "disallowWeakAlgorithms": ["md5", "sha1", "des"]
  }
}

2. Set environment variables

# Generate a secure random key (base64 encoded)
export ZIPHERLY_KEY=$(node -e "console.log(require('crypto').randomBytes(32).toString('base64'))")
export ZIPHERLY_HMAC_SECRET=$(node -e "console.log(require('crypto').randomBytes(64).toString('base64'))")

3. Use Zipherly in your application

const Zipherly = require('zipherly');
const zipherly = new Zipherly();

// Encrypt data
const encrypted = zipherly.encrypt({ username: 'johndoe', role: 'admin' });
console.log('Encrypted:', encrypted);

// Decrypt data
const decrypted = zipherly.decrypt(encrypted);
console.log('Decrypted:', decrypted);

// Sign data
const signed = zipherly.sign({ orderId: '12345', total: 99.99 });
console.log('Signed:', signed);

// Verify signature
const isValid = zipherly.verify(signed);
console.log('Signature valid:', isValid);

4. Use with Express.js

const express = require('express');
const Zipherly = require('zipherly');

const app = express();
app.use(express.json());

const zipherly = new Zipherly();

// Apply encryption middleware to all /api routes
app.use('/api', zipherly.expressMiddleware({
  encryptResponse: true,
  decryptRequest: true
}));

app.post('/api/data', (req, res) => {
  // Request body is automatically decrypted
  console.log('Received:', req.body);
  
  // Response will be automatically encrypted
  res.json({ status: 'success', message: 'Data received' });
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

Configuration Options

Zipherly uses a JSON schema for configuration. Here are the main options:

Encryption

"encryption": {
  "symmetric": {
    "algorithm": "aes-256-gcm",
    "keySource": "ENV_ZIPHERLY_KEY",
    "ivGeneration": "randomBytes"
  }
}

| Option | Description | Default | |--------|-------------|---------| | algorithm | Encryption algorithm | aes-256-gcm | | keySource | Source of encryption key (env variable or file path) | ENV_ZIPHERLY_KEY | | ivGeneration | Method to generate initialization vector | randomBytes |

Hashing

"hashing": {
  "algorithm": "sha256",
  "hmac": {
    "enabled": true,
    "secretSource": "ENV_ZIPHERLY_HMAC_SECRET"
  }
}

| Option | Description | Default | |--------|-------------|---------| | algorithm | Hashing algorithm | sha256 | | hmac.enabled | Enable HMAC signatures | true | | hmac.secretSource | Source of HMAC secret | ENV_ZIPHERLY_HMAC_SECRET |

Security

"security": {
  "disallowWeakAlgorithms": ["md5", "sha1", "des"],
  "enforceIvUniqueness": true,
  "keyRotationDays": 90
}

| Option | Description | Default | |--------|-------------|---------| | disallowWeakAlgorithms | Algorithms not allowed | ["md5", "sha1", "des"] | | enforceIvUniqueness | Enforce IV uniqueness | true | | keyRotationDays | Days before key rotation is recommended | 90 |

For more configuration options, see the configuration guide.

API Reference

Core Methods

  • encrypt(data, options) - Encrypt data
  • decrypt(encryptedData, options) - Decrypt data
  • sign(data, options) - Sign data for integrity verification
  • verify(signedData, options) - Verify signed data
  • hash(data, options) - Create a hash of data
  • deriveKey(password, options) - Derive a key from a password
  • generateKey(length) - Generate a cryptographically secure random key

Middleware

  • expressMiddleware(options) - Create Express.js middleware

Key Management

  • isKeyRotationNeeded(keyPath) - Check if a key needs rotation
  • rotateKey(keyPath, length) - Rotate a key

Examples

See the examples/ directory for more examples:

  • express-basic.js - Basic Express.js integration
  • api-security.js - Different approaches to API payload security
  • key-rotation.js - Key rotation and management

Security Best Practices

  1. Use GCM Mode - Prefer aes-256-gcm over CBC mode for authenticated encryption
  2. Strong Keys - Use cryptographically secure random keys
  3. Secure Storage - Store keys in environment variables or secure key management systems
  4. Regular Rotation - Rotate keys regularly (90 days recommended)
  5. Defense in Depth - Use Zipherly alongside TLS/HTTPS, not as a replacement

License

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Roadmap

See our roadmap for upcoming features:

  • Asymmetric encryption (RSA, ECC)
  • Additional KDF methods (Argon2id)
  • Support for more frameworks (NestJS, Fastify)
  • Plugin system for custom algorithms