bw) is the primary secrets manager for this dotfiles setup. It stores SSH keys, age encryption keys, and AWS credentials securely in your Bitwarden vault.
Installation
The bootstrap script automatically installs Bitwarden CLI using either snap or npm:bootstrap.sh:27-37
Login and Unlock Flow
During bootstrap, the script checks Bitwarden’s authentication status and performs login/unlock as needed:bootstrap.sh:51-62
How It Works
- Authentication Check:
bw statusreturns the current vault status - Login: If unauthenticated, prompts for email and master password
- Unlock: If locked, prompts for master password and exports session token
- Sync: Synchronizes vault with Bitwarden servers
Session Management
After bootstrap, use thebw_unlock() function for session management:
dot_bash_functions:20-24
Usage
The
BW_SESSION environment variable must be exported for chezmoi to access Bitwarden during chezmoi apply.Chezmoi Integration
Bitwarden is configured in chezmoi’s config with auto-unlock:.chezmoi.toml.tmpl:41-43
bitwarden "item" "name"- Retrieve item notesbitwardenFields "item" "name"- Retrieve custom fields
Common Operations
Check Vault Status
Lock Vault
Sync Vault
Security Best Practices
- Never commit
BW_SESSIONtokens to git - Lock your vault when leaving your machine:
bw lock - Use session timeout for automatic locking
- Store the master password securely (password manager, not in dotfiles)
Troubleshooting
Session Expired
If you get authentication errors:Sync Issues
If items aren’t found:Permission Denied
EnsureBW_SESSION is exported: