Bitwarden Custody

Keep your private keys in Bitwarden

Custody

Install

Add Bitwarden to your Dotenvx installation.

Requires Dotenvx 3.0.


$ dotenvx install --add bitwarden

Install the Bitwarden CLI (bw).

Login

Log in to your Bitwarden account.


$ bw login

Sign in on each machine that needs access.

Encrypt

From the project directory containing your .env file, encrypt and choose more, then Bitwarden when prompted.


$ dotenvx encrypt

Dotenvx prompts to unlock your vault if needed, encrypts your .env file, and stores the private key in Bitwarden. Commit the encrypted .env file with your code.

For .env.production, add -f .env.production.

Already using .env.keys? Follow the Bitwarden migration guide to move your existing private key instead.

Run

When you run your app, Dotenvx reads the private key through bw and loads your decrypted environment variables.


$ dotenvx run -- node index.js

For noninteractive use, provide an unlocked BW_SESSION. Replace node index.js with your app’s start command.

That’s it! Your app now loads encrypted secrets with the private key stored in Bitwarden.


Bitwarden Commands

markdown