Encrypted Env Manager
EENV keeps secrets safe and dev-friendly:
- Encrypts
.env* → .env*.encwith XChaCha20-Poly1305 (single shared key). - De/encrypts on demand so teammates can pull encrypted files and decrypt locally with the same key.
- Blocks secret leaks by refusing commits that include raw
.env*files. - Generates
.env*.exampleskeletons automatically. - Manages a pre-commit hook so all of the above runs for you.
Active Development
EENV is still under active development.
I’ll do my best to minimize breaking changes, and when they are unavoidable, I’ll announce them ahead of time and specify the release where they’ll occur.
Feedback
Suggestions, issues, and ideas for improvements are very welcome! Please open an issue or discussion in the repo if you’d like to contribute.
cargo install eenvThe binary is
eenv.
In a repo that has .env files:
# one-time setup: installs hook, fixes .gitignore, ensures config, generates examples, encrypts
eenv initFirst time on a new machine (only .enc files exist), run eenv init and enter the shared key to decrypt.
- Prints repo state.
- If
.env*.encexist:- With a valid
eenv.config.json, decrypts to plaintext without clobbering existing files. - If config is missing/invalid, prompts for key and bootstraps it.
- With a valid
- If real
.env*exist:- Generates
.env*.example. - Aligns
.gitignore(keeps examples &.enc, ignores real.env*andeenv.config.json). - Encrypts
.env* → .env*.enc.
- Generates
- Always blocks staging raw
.env*(except*.example/*.enc). - With
--write:- Generates/updates
.env*.example. - Fixes
.gitignoreif needed. - Ensures
eenv.config.jsonexists/valid. - Encrypts
.env* → .env*.encandgit adds produced artifacts.
- Generates/updates
- Installs the pre-commit hook (respects
git config core.hooksPath). --forcewill overwrite a non-EENV hook (backs it up first).
- Removes the EENV pre-commit hook.
--forceremoves the hook file even if it didn’t come from EENV.
(There’s also a small demo greet command.)
eenv init
git add .env*.enc .env*.example .gitignore
git commit -m "Set up EENV"eenv init # enter the shared key when prompted
# now you have decrypted .env files locally (without clobbering existing ones)- Stage your changes as usual.
- The pre-commit hook runs:
- Refuses raw
.env*in the index. - If you want auto-fixes and fresh encryption:
- Run
eenv pre-commit --write(or rely on the hook if you configured it to call with--write).
- Run
- Refuses raw
- The shared key lives in
eenv.config.json(ignored by git).
A stable 32-byte key is derived using BLAKE3; files are encrypted with XChaCha20-Poly1305 using a random per-file nonce. - To rotate the key: update
eenv.config.jsonwith the new key and runeenv pre-commit --write.
# remove the hook
eenv hook uninstall # or: eenv hook uninstall --force(This does not delete your .enc files or config.)
-
Git GUI/clients (e.g., GitHub Desktop)?
If they respect Git hooks (most do when the hook files are in the repo’s hooks path), the EENV pre-commit will run. EENV installs into whatevergit rev-parse --git-path hooksreturns, so it works with customcore.hooksPathtoo. -
“unrecognized subcommand 'PreCommit'”
Use kebab-case:eenv pre-commit(Clap mapsPreCommit→pre-commit).