# I built an Encrypted Vault for .env files inside VS Code

Published: (January 30, 2026 at 07:00 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for # I built an Encrypted Vault for .env files inside VS Code

Let’s be honest: Handling .env files is a headache. We all know we shouldn’t commit them to Git, but what about local backups?

I realized that while I was being careful with .gitignore, I was casually copy‑pasting .env files to .env.old or .env.backup on my disk… in plain text. If anyone (or any malicious script) got access to my machine, my Stripe keys and DB credentials were sitting there like an open book.

So, I spent the last weekend rewriting the backup engine for my VS Code extension, DotEnvy, to fix this.

Meet DotEnvy v1.4.0 🚀

I just released version 1.4.0, which introduces AES‑256 Encrypted Backups. It allows you to snapshot your environment variables and lock them behind a password directly within VS Code.

🛠️ Under the Hood (For the Geeks)

I didn’t want “fake security” (like Base64 encoding). I wanted something I could trust with my own production keys.

Crypto stack:

  • Algorithm: AES-256-GCM (Authenticated Encryption). This ensures that if the backup file is tampered with (even one bit flipped), the decryption will fail instantly.
  • Key Derivation: PBKDF2 with 310,000 iterations and SHA-256. This makes brute‑forcing the password computationally expensive.
  • Salt & IV: Every single backup generates a unique, cryptographically secure random salt and initialization vector.

⚡ Performance

You might think 310k iterations would be slow. I optimized the implementation to keep the encryption overhead around ~170 ms for a standard .env file. It feels instant.

🌍 Cross‑Platform Portability

The coolest part? Since the encryption is standard, you can:

  • Backup your .env on your Linux workstation.
  • Sync the encrypted file (via Dropbox/Drive/whatever).
  • Restore it on your Mac or Windows laptop just by entering the password.

🔗 Try it out

It’s open source and free. I’d love to hear your feedback or see your PRs!

If you find this useful, a star on GitHub would make my day! Happy coding! 👨‍💻

Back to Blog

Related posts

Read more »