
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
envx-crypto-tool
Advanced tools
Secure AES-256-CBC encryption tool for .env files with password-based key derivation
A secure, password-based encryption tool for .env
files that preserves comments and formatting while providing military-grade AES-256-CBC encryption.
# Install via npm
npm install envx-crypto-tool
# Or download directly
curl -o envx-crypto-tool.js https://raw.githubusercontent.com/cwdx/envx-crypto-tool/main/envx-crypto-tool.js
# If installed via npm
npx envx encrypt mypassword .env
npx envx decrypt mypassword .env
# If using direct download
node envx-crypto-tool.js encrypt mypassword .env
node envx-crypto-tool.js decrypt mypassword .env
# Your app loads encrypted vars automatically
ENVX_PASSWORD=mypassword node app.js
Add to your package.json
:
{
"scripts": {
"start": "sh -c 'ENVX_PASSWORD=\"$0\" node src/index.js'",
"encrypt": "sh -c 'node envx-crypto-tool.js encrypt \"$0\" .env'",
"decrypt": "sh -c 'node envx-crypto-tool.js decrypt \"$0\" .env'"
}
}
Then use:
yarn encrypt mypassword # Encrypt .env
yarn start mypassword # Run app with encrypted .env
yarn decrypt mypassword # Decrypt .env
# Encrypt file (overwrites original)
envx-crypto-tool encrypt <password> [file]
# Decrypt file (overwrites original)
envx-crypto-tool decrypt <password> [file]
# Examples
envx-crypto-tool encrypt secret123 .env
envx-crypto-tool decrypt secret123 .env.production
# Show help
envx-crypto-tool --help
# Show version
envx-crypto-tool --version
FOO=BAR
API_KEY=secret123
DATABASE_URL=postgres://localhost/mydb
#/---------------------------- **[ENVX]** ----------------------------/
#/ password-key encryption for .env files /
#/ [how it works](./README.md) /
#/--------------------------------------------------------------------/
ENVX_PUBLIC_KEY="baa5a0964d3320fbc0c6a922140453c8"
ENVX_SALT="a1b2c3d4e5f6789012345678901234567890123456789012345678901234"
FOO=aes-256-cbc:c792dd7d7e429420ea1b27ef45491d9a:368a45707d4307d6f62e887cf8845a30
API_KEY=aes-256-cbc:f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6:9z8y7x6w5v4u3t2s1r0q9p8o7n6m5l4k
DATABASE_URL=aes-256-cbc:a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6:q1w2e3r4t5y6u7i8o9p0a1s2d3f4g5h6
KEY=aes-256-cbc:IV:ENCRYPTED_DATA
IV
: 32-character hex string (16 bytes)ENCRYPTED_DATA
: Hex-encoded encrypted valuescrypt(password, salt, 32)
AES-256-CBC(value, key, iv)
SHA256(password).substring(0, 32)
for verificationKEY=aes-256-cbc:IV:ENCRYPTED
ENVX_PUBLIC_KEY
and ENVX_SALT
headersscrypt(password, salt, 32)
using extracted saltAES-256-CBC-DECRYPT(encrypted, key, iv)
.env
formatThe tool provides clear error messages for common issues:
# Missing password
ā Missing password
Usage: envx-crypto-tool <command> <password> [file]
# File already encrypted
ā File already encrypted
Usage: envx-crypto-tool decrypt <password> .env
# Wrong password
ā Invalid password
Usage: envx-crypto-tool decrypt <correct-password> .env.encrypted
# File not found
ā File not found: missing.env
import { encrypt, decrypt } from './envx-crypto-tool.js';
import crypto from 'crypto';
// Generate salt for encryption
const salt = crypto.randomBytes(32);
// Encrypt text
const result = encrypt("secret-value", "mypassword", salt);
console.log(result); // { iv: "a1b2c3...", encrypted: "9z8y7x..." }
// Decrypt text
const decrypted = decrypt("9z8y7x...", "a1b2c3...", "mypassword", salt);
console.log(decrypted); // "secret-value"
.env
files before committing to git# Before committing sensitive .env
cp .env .env.backup # Backup original
envx-crypto-tool encrypt mypass123 .env # Encrypt in place
git add .env # Commit encrypted version
git commit -m "Add encrypted env"
# After pulling encrypted .env
envx-crypto-tool decrypt mypass123 .env # Decrypt in place
# Now .env contains plaintext for development
# In your deployment script
envx-crypto-tool decrypt $ENV_PASSWORD .env.production
# App can now read decrypted environment variables
Proprietary - All rights reserved
Issues and pull requests welcome!
FAQs
Secure AES-256-CBC encryption tool for .env files with password-based key derivation
The npm package envx-crypto-tool receives a total of 766 weekly downloads. As such, envx-crypto-tool popularity was classified as not popular.
We found that envx-crypto-tool 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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.