
Research
/Security News
Popular npm Packages in the keyv and Cacheable Namespaces Compromised in Active Supply Chain Attack
Popular npm packages keyv and cacheable compromised.
Encrypted secrets for Next.js. No vault needed.
Store encrypted secrets in your repo. Decrypt them at runtime with a single key. Zero external dependencies beyond Node.js built-in crypto.
npm install vaultbox
# 1. Initialize lockbox in your project
npx lockbox init
# 2. Store secrets
npx lockbox set DATABASE_URL "postgresql://user:pass@host/db"
npx lockbox set API_KEY "sk-secret-key" --env production
# 3. Use in your code
import { createLockbox } from "vaultbox";
const box = createLockbox();
// Get a secret (returns undefined if missing)
const dbUrl = box.secret("DATABASE_URL");
// Get a secret (throws if missing)
const apiKey = box.require("API_KEY");
// Get all secrets for the current NODE_ENV
const all = box.secrets();
lockbox initGenerates a .lockbox-key file (random 256-bit key), creates the .secrets/ directory, and adds .lockbox-key to .gitignore.
lockbox set <name> <value> [--env ENV]Encrypts a secret and stores it in .secrets/{env}.json. Default environment: development.
lockbox set STRIPE_KEY sk_live_abc123
lockbox set STRIPE_KEY sk_test_xyz789 --env production
lockbox get <name> [--env ENV]Decrypts and prints a single secret.
lockbox get STRIPE_KEY
lockbox get STRIPE_KEY --env production
lockbox list [--env ENV]Lists stored secret names (values are not shown).
lockbox list
lockbox list --env production
lockbox env [--env ENV]Outputs all secrets in .env format. Useful for piping:
lockbox env --env production > .env.local
lockbox rotateGenerates a new encryption key and re-encrypts all secrets across all environments.
lockbox rotate
lockbox import <file> [--env ENV]Imports secrets from an existing .env file.
lockbox import .env
lockbox import .env.production --env production
createLockbox(config?)Creates a lockbox instance that reads secrets for the current NODE_ENV.
import { createLockbox } from "vaultbox";
const box = createLockbox();
// Or with custom paths:
const box = createLockbox({
keyPath: ".lockbox-key", // default
secretsDir: ".secrets", // default
});
Methods:
| Method | Returns | Description |
|---|---|---|
secret(name) | string | undefined | Get a decrypted secret |
require(name) | string | Get a secret; throws if missing |
secrets() | Record<string, string> | All secrets for current env |
encrypt(plaintext) | EncryptedEnvelope | Encrypt arbitrary text |
decrypt(envelope) | string | Decrypt an envelope |
rotate() | string | Re-encrypt everything; returns new key |
generateKey()Generate a random 256-bit encryption key as a hex string.
import { generateKey } from "vaultbox";
const key = generateKey(); // 64-char hex string
lockbox init generates a random 256-bit master key and writes it to .lockbox-keyset a secret, lockbox:
.secrets/{env}.jsonCommit these files (encrypted, safe to share):
.secrets/development.json.secrets/production.jsonNever commit (added to .gitignore by lockbox init):
.lockbox-keyShare the key with your team via a secure channel (1Password, Slack DM, etc). In CI/CD, set the LOCKBOX_KEY environment variable.
# CI/CD example
LOCKBOX_KEY=your-hex-key-here npm run build
lockbox rotate
This generates a new key, re-encrypts every secret in every environment, and writes the new key to .lockbox-key. Distribute the new key to your team and update CI/CD.
# Import your existing .env file
lockbox import .env
# Import production secrets
lockbox import .env.production --env production
# Verify
lockbox list
lockbox list --env production
# Remove the old .env files
rm .env .env.production
MIT
FAQs
Encrypted secrets for Next.js. No vault needed.
The npm package vaultbox receives a total of 12 weekly downloads. As such, vaultbox popularity was classified as not popular.
We found that vaultbox demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.