EnvVault 🔐
EnvVault is a secure environment variable management tool that helps you store, retrieve, and share sensitive environment variables safely. It uses strong encryption to protect your secrets while providing a simple command-line interface for everyday use.
Features
- 🔒 Secure Storage: All environment variables are encrypted with NaCl secretbox using a master password
- 🔑 Password Caching: Background daemon caches your master password in-memory temporarily for convenience
- 🧩 Simple CLI: Intuitive commands for managing your environment variables
- 🚀 Command Execution: Run commands with your secret environment variables injected
- 🔄 Key Rotation: Change your master password while preserving your stored variables
Installation
go install git.jrop.me/jonathan/envvault@latest
Make sure your Go bin directory is in your PATH.
Quick Start
Initialize the Vault
First, create your encrypted vault:
envvault init
You'll be prompted to create a master password. Choose a strong one!
Adding Environment Variables
Add variables to your vault:
# Prompt for value (doesn't show in terminal or history)
envvault add API_KEY
# Provide value directly (will show in shell history)
envvault add DATABASE_URL "postgres://user:pass@localhost:5432/mydb"
Listing Variables
View your stored variables:
# List only variable names
envvault list
# List names and values
envvault list -v
Running Commands with Environment Variables
Execute commands with your secret variables injected:
# Run with all environment variables
envvault exec -- node server.js
# Run with only specific variables
envvault exec -e API_KEY -e DATABASE_URL -- node server.js
Removing Variables
Remove variables you no longer need:
envvault rm API_KEY
Changing Your Master Password
Update your master password while preserving your variables:
envvault rekey
How It Works
EnvVault uses a two-layer encryption approach:
- A random 32-byte master key is generated and used to encrypt your environment variables
- The master key is encrypted with your password using scrypt for key derivation
- When needed, the master key is decrypted using your password
- The daemon temporarily caches your password in memory for convenience
This approach means your environment variables remain secure even if your vault file is compromised.
Password Daemon
EnvVault includes a daemon that caches your master password temporarily:
# Start daemon with default 5-minute timeout
envvault daemon
# Start daemon with custom timeout (in minutes)
envvault daemon --timeout 10
The daemon is automatically started when needed and stores your password securely in memory.
Security Considerations
- Your master password is never stored on disk
- The daemon caches your password in memory only for the specified timeout period
- All encryption uses industry-standard algorithms (NaCl secretbox, scrypt)
- The vault file and key file are stored with 0600 permissions
License
Copyright (c) 2025 Jonathan Apodaca jrapodaca@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.