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

@ultimatelemon-eu/crypto

v1.2.0

Published

AES-256-GCM encryption for secrets at rest, keyed by ENCRYPTION_KEY or a key wrapped by Infisical KMS, plus random tokens and SHA-256. Node only, no dependencies.

Readme

@ultimatelemon-eu/crypto

Encrypt secrets before they go into the database: API keys, OAuth tokens, passwords for external systems. AES-256-GCM, Node only, no dependencies.

npm install @ultimatelemon-eu/crypto
import { decrypt, encrypt } from '@ultimatelemon-eu/crypto';

const sealed = encrypt(apiKey); // 'v1.<iv>.<tag>.<data>'
const apiKey = decrypt(sealed);

Key

ENCRYPTION_KEY: 32 random bytes, base64.

node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"

Read on first use, not at import, so a build without secrets works. Missing or not 32 bytes throws; there is no fallback key. Losing the key means losing every value sealed with it.

Key from Infisical KMS

Instead of the key itself, the env can hold the key wrapped by an Infisical KMS key. The app unwraps it once at startup over the internal network and keeps it in memory; the plain key is then stored nowhere.

ENCRYPTION_KEY_WRAPPED=        # ciphertext from the KMS encrypt endpoint
INFISICAL_KMS_URL=             # e.g. http://platform-infisical-2ijmwq:8080
INFISICAL_KMS_CLIENT_ID=       # machine identity with cryptographic-operator
INFISICAL_KMS_CLIENT_SECRET=
INFISICAL_KMS_KEY_ID=
// src/instrumentation.ts (Next.js), or before the server starts
export async function register(): Promise<void> {
  if (process.env.NEXT_RUNTIME !== 'nodejs') return;
  const { loadEncryptionKey } = await import('@ultimatelemon-eu/crypto');
  await loadEncryptionKey();
}

Until loadEncryptionKey() has resolved, encrypt and decrypt throw. A plain ENCRYPTION_KEY wins when both are set and needs no call, so moving back is a matter of setting it again. If Infisical is down at startup the app does not start; running instances are unaffected.

Wrapping an existing key keeps every sealed value readable, nothing is re-encrypted. plaintext is the ENCRYPTION_KEY value as is:

curl -X POST "$INFISICAL_KMS_URL/api/v1/kms/keys/$INFISICAL_KMS_KEY_ID/encrypt" \
  -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \
  -d "{\"plaintext\":\"$ENCRYPTION_KEY\"}"

API

| Function | Returns | Notes | | ---------------------------------- | --------- | -------------------------------------------------------- | | loadEncryptionKey() | Promise | Unwraps ENCRYPTION_KEY_WRAPPED; no-op with a plain key | | encrypt(plaintext, { context? }) | string | v1.<iv>.<tag>.<data>, base64url, fresh IV every call | | decrypt(sealed, { context? }) | string | Throws on tampering, a wrong key or a non-sealed value | | isEncrypted(value) | boolean | Type guard for the v1. format | | randomToken(bytes=32) | string | base64url, for invite links, CSRF, state | | sha256Hex(value) | string | Store a token's hash, not the token |

decrypt also reads the same format written with standard base64, which is what Cellar stored before this package.

Store sealed values in a text column.

Context

Pass the row a value belongs to as context, and it only decrypts with that same context. A sealed password copied into another user's row then fails instead of opening their mailbox. The context is not stored; supply it again when decrypting.

const sealed = encrypt(password, { context: `${userId}:${accountId}` });
const password = decrypt(sealed, { context: `${userId}:${accountId}` });