| Crates.io | envcipher |
| lib.rs | envcipher |
| version | 0.1.2 |
| created_at | 2026-01-23 08:02:42.799913+00 |
| updated_at | 2026-01-23 09:58:01.352644+00 |
| description | Encipher .env files to make accidental leaks harmless |
| homepage | |
| repository | https://github.com/iamprecieee/envcipher |
| max_upload_size | |
| id | 2063768 |
| size | 87,064 |
Encrypt .env files using AES-256-GCM with keys stored in your OS keychain. Decrypt on demand for local development without managing separate key files.
pip install envcipher
Provides both the CLI and Python library.
cargo install envcipher
CLI only.
git clone https://github.com/iamprecieee/envcipher
cd envcipher
cargo build --release
envcipher init # Generate key, store in OS keychain
envcipher edit # Decrypt -> edit -> re-encrypt
envcipher lock # Encrypt .env in place
envcipher unlock # Decrypt .env to plaintext
envcipher run -- <cmd> # Run command with decrypted env vars
envcipher status # Show encryption status
import envcipher
import os
# Load encrypted .env into os.environ
envcipher.load()
# Access secrets
api_key = os.getenv("API_KEY")
Custom path:
envcipher.load(path="/path/to/.env")
Works with both encrypted and plaintext files.
# Export key
envcipher export-key
# Output: qQWntX6r7eANxsyKHbkJtuXtzW0Hy5zjJGvDSxMKM9I=
# Import on another machine
envcipher import-key qQWntX6r7eANxsyKHbkJtuXtzW0Hy5zjJGvDSxMKM9I=
Share keys through secure channels only.
| Component | Implementation |
|---|---|
| Encryption | AES-256-GCM, 96-bit random nonces |
| Key Storage | OS keychain (Keychain / Credential Manager / Secret Service) |
| Memory | Keys zeroized on drop |
| Format | ENVCIPHER:v1:<nonce>:<ciphertext> |
Designed for: Protecting secrets from accidental commits, local development encryption at rest, small team key sharing.
Not designed for: Production secret management, zero-trust environments, HSM requirements.
No. Use envcipher edit or the unlock-edit-lock workflow. Manual edits corrupt the format.
Yes, but we recommend using .gitignore and sharing via export-key/import-key instead. Committing encrypted files is safe only if your team securely shares the key.
Keys are stored in your OS keychain. If you lose access (e.g., fresh OS install), get a teammate to run export-key.
Currently manual: decrypt with old key, run init in a fresh directory to generate new key, re-encrypt.
Not recommended. Envcipher is designed for local development. CI runners have ephemeral keychains, and storing the key as a CI secret defeats the purpose. Use native secret management instead (GitHub Secrets, AWS Secrets Manager, etc.).
Yes. Each project directory gets its own key (hashed by directory path). Moving a project folder requires re-importing the key.