π enbu
An end-to-end encrypted .env manager with independent Identity and Storage backends.
Why
Development requires sensitive information like API keys and database passwords, but existing approaches have problems:
- Slack/Discord/Email lack E2EE
- Confusing characters like
1, I, l and italic rendering cause copy-paste errors
- Every change requires notifying everyone manually
- Even if you encrypt: the delivery channel for the password or decryption key is often insecure
- Dedicated secret managers?
- External services come with cost and operational overhead
- AWS/Google Cloud/1Password require contracts and account management
- Significant organizational burden in both cost and operations
- Just commit it to Git!
- Ciphertext persists permanently in Git history
- Future algorithm weaknesses could allow retroactive decryption
Features
- Pluggable storage β OCI registries or S3-compatible object storage
- E2E encrypted β Only each member's local private key can decrypt
- Simple CLI β After setup, just
enbu add and enbu pull
See ROADMAP.md for planned features.
Install
go install github.com/enbu-net/enbu@latest
Or download a binary from Releases. On Linux,
Releases also has packages that install shell completions; the desktop app's .deb and
.rpm add it to the app menu and register enbu:// links:
sudo apt install ./enbu_vX.Y.Z_linux_amd64.deb # Debian, Ubuntu
sudo dnf install ./enbu_vX.Y.Z_linux_amd64.rpm # Fedora, RHEL
sudo apk add --allow-untrusted ./enbu_vX.Y.Z_linux_amd64.apk # Alpine
sudo pacman -U ./enbu_vX.Y.Z_linux_amd64.pkg.tar.zst # Arch
sudo apt install ./enbu-desktop_vX.Y.Z_linux_amd64.deb # Desktop app (GTK 4, WebKitGTK 6.0)
Quick Start
1. Choose storage
In a repository whose origin is on GitHub, sign in and run init. The workspace is
stored on GHCR beside the repository, at oci://ghcr.io/OWNER/REPO-enbu:
enbu auth login
enbu init
GHCR creates the package private to you. So that teammates can join, open the package's
settings on GitHub, connect the repository and turn on "Inherit access from repository";
init prints this reminder.
Anywhere else, name the storage with --storage. ghcr.io always uses enbu's GitHub
login; any other OCI registry uses the Docker credential configuration:
enbu init --storage oci://registry.example.com/team/secrets
For S3, create a bucket first and use the AWS SDK's default credential chain:
enbu init --storage s3://your-bucket/team/workspace --region ap-northeast-1
For an S3-compatible service, also pass --endpoint https://s3.example.com --path-style.
See Storage configuration and tests.
2. Initialize each member's workspace
init creates or reuses a local Identity and a separate signing key, saves a generated
workspace UUID and storage configuration in enbu.toml, and updates .gitignore.
The first device to run init becomes the workspace admin and records control_genesis
in enbu.toml: the trusted digest every other device verifies the member list against.
Commit and share enbu.toml. Each member runs enbu init in their own folder.
The UUID binds local Identity and environment-switch state to the workspace, so
moving its folder or changing its storage URL does not select a new Identity.
3. Add or edit secrets
enbu add DATABASE_URL "postgres://..."
enbu add API_KEY "sk-..."
enbu edit API_KEY "sk-new..."
# Environment-specific secrets
enbu add --env dev DATABASE_URL "postgres://dev/..."
enbu add --env prod DATABASE_URL "postgres://prod/..."
add creates a new secret and fails if the key already exists. Use edit to update an existing secret.
Leave out the value to keep it off the command line and out of shell history:
enbu add API_KEY asks for it with a hidden prompt, reads it from stdin when
piped, or takes it from --value-file PATH (- for stdin). Multi-line values
such as certificates work this way.
To bring an existing .env into enbu at once:
enbu import .env # reads ./.env into the current environment
enbu import app.env # any dotenv file, "-" for stdin
Variables that already exist with the same value are left alone; one with a
different value stops the import unless you pass --overwrite.
4. Delete secrets
enbu delete API_KEY
5. Pull secrets
enbu pull # Writes to .env file
enbu pull --env dev # Writes to the configured output for dev
Each pull writes the secrets, then a marker line. Variables below the marker
(a local DEBUG=1, say) that enbu does not store are kept there and listed on
stderr, so a pull never throws them away silently. Variables above the marker
belong to enbu: one deleted from the environment leaves the file on the next pull
and is listed as removed. In a file without the marker (written by an older enbu,
or by hand), a variable the environment's history once held is treated as a
deleted secret and removed; the others are kept. Kept variables are rewritten in
sorted order without their comments. enbu pull --replace overwrites the file
completely. A file that is not valid dotenv is not overwritten without --replace;
the desktop app asks before overwriting it.
To use the secrets without writing them to disk at all, run the command through enbu:
enbu run -- npm start # secrets become environment variables of npm
enbu run -e prod -- ./migrate # another environment
enbu run --preserve-env -- make # variables already set in the shell win
The command's exit status is returned as is.
When the command's output is not a terminal, as in CI or a log file, secret values of
6 characters or more are replaced with <concealed by enbu>. --no-masking turns
this off. Only the value as stored (and each line of a multi-line value) is matched;
a value the command transforms, such as base64- or URL-encoded, is printed as is.
6. Add a team member
Being able to write to storage does not make anyone a member. A new member runs enbu init
inside the repository (with the shared enbu.toml), which leaves a join request and prints the
device fingerprint, for example a1b2-c3d4-e5f6-0718-293a. Send that fingerprint to an admin
over another channel (chat, in person). The admin then picks the request from a list:
enbu member approve # choose the request, compare the fingerprint, confirm
enbu member requests # list devices waiting for approval
enbu member list # list members
enbu member remove # remove a member and re-encrypt without them
Approving re-encrypts every environment, so the new member can enbu pull right away.
In scripts, pass --device <fingerprint-or-device-id> (and --yes to skip the prompt).
The desktop app has the same approval list on its Members screen.
Removing a member cannot revoke secrets that device already read: rotate them.
Environments
Manage environments with enbu switch:
enbu switch -c dev # Create and switch to dev
enbu switch -c prod # Create and switch to prod
enbu switch dev # Switch to dev
enbu switch - # Switch back to previous
enbu switch -l # List environments
enbu switch -d staging # Delete an environment (its stored revisions stay)
enbu switch -d staging --purge # Delete it and its stored revisions (admin)
enbu switch --purge-incarnation ID # Reclaim what an earlier plain delete left (admin)
enbu switch -m old new # Rename an environment (its secrets and history move with it)
Switching is personal: the environment you switched to is kept on your device, not in
enbu.toml, so it never shows up as a Git change. default_env in enbu.toml is the team's
default, used until you switch.
enbu.toml lists the environments and their output files. enbu switch -c writes them for
you:
version = "v1alpha2"
workspace_id = "11111111-1111-4111-8111-111111111111"
control_genesis = "sha256:β¦" # written by the first init; never edit it
default_env = "dev"
[storage]
url = "oci://ghcr.io/your-org/your-repo-enbu"
[env.dev]
output = ".env.dev"
incarnation = "6f1cβ¦" # where dev's secrets are stored; keep it when editing
[env.prod]
output = ".env.prod"
incarnation = "0b7eβ¦"
An environment you add by hand without an incarnation is stored under its name, and keeps
that place when it is renamed. Changing an incarnation makes the environment show other
secrets, so the desktop settings editor refuses it, as it refuses changes to workspace_id
and control_genesis.
Use -e/--env with add, edit, delete, import, run, pull, and sync to override the current environment. Recipients are shared across all environments β Without -e, enbu uses the environment set by switch.
Concurrent edits and history
Two people saving at the same time both keep their change. If they changed the same secret
differently, reading stops until someone chooses; nothing is picked for you:
enbu resolve # list the conflicting values and an ID
enbu resolve --seen ID API_KEY=sk-new # use a value (or --pick KEY=N, --delete KEY)
The desktop app shows the same choice on its Secrets screen.
Revisions are never deleted on their own; an admin removes old ones (on storage that can delete):
enbu history list # revisions that changed the secrets, oldest first
enbu history diff 3 5 # keys added, removed or changed between two revisions
enbu history restore 3 # publish revision 3's content as a new revision
enbu history compact --keep 50 # admin: delete revisions older than the latest 50
Identity storage
New workspace identities prefer TPM 2.0 on Linux and Windows, and Secure Enclave on macOS.
Hardware P-256 private keys stay on the device. Encryption uses age Tagged Recipients;
X25519 recipients can be included in the same encrypted file.
New identities are post-quantum hybrids, so ciphertext stored today stays safe against a
future quantum computer: ML-KEM-768 + X25519 (age1pq1β¦) in the OS keyring, and
ML-KEM-768 + P-256 (age1tagpq1β¦) on hardware. TPMs cannot run ML-KEM yet, so the
P-256 half stays in the TPM and the ML-KEM seed is sealed by the TPM (on macOS it is
encrypted to the Secure Enclave key). A file is post-quantum only when every member has a hybrid key;
with any classical member it is encrypted classically. Members created before this
switch with enbu identity upgrade, which keeps their fingerprint; an admin approves
the new key with enbu member approve, and enbu member list shows how many members
have upgraded. Members on an enbu that predates hybrid keys must update enbu first.
| OS |
Hardware |
Fallback for new identities |
| Linux |
TPM 2.0 (/dev/tpmrm0) |
Secret Service (GNOME Keyring / KWallet), else systemd-creds --user |
| Windows |
TPM 2.0 through TBS |
Credential Manager |
| macOS |
Secure Enclave (Apple silicon, or Intel with a T2 chip) |
Keychain |
On Linux, /dev/tpmrm0 belongs to the tss group on most distributions, so a
user outside it gets the keyring fallback. sudo usermod -aG tss $USER, then log
in again, lets enbu use the TPM; enbu doctor reports which one it found.
A server, container or WSL often has neither a usable TPM nor a Secret Service. There
enbu keeps the software keys in files under its data directory, encrypted with
systemd-creds --user (systemd 256 or later), which binds them to the user and to the
machine's host key, and to the TPM when one exists. The user does not need TPM access.
enbu doctor # No authentication or persistent key creation
enbu identity create # Create or reuse this workspace's local Identity
enbu identity show # Backend, algorithm, recipient and device
enbu identity upgrade # Move this device to a post-quantum hybrid key
export ENBU_IDENTITY_BACKEND=auto # Default: hardware if available, otherwise keyring
# Other choices: hardware (required), keyring (software key: OS keyring, or systemd-creds without one)
export ENBU_IDENTITY_CLASSICAL=1 # Create pre-hybrid keys (X25519 / P-256) for old teammates
Fallback is allowed only when hardware is unavailable before creation begins.
Creation errors and saved-key load errors never silently replace the key.
init registers the saved recipient and reuses it after a registration failure.
Hardware identities have no private-key export API. TPM metadata contains encrypted
child blobs bound to the original TPM; Secure Enclave metadata contains the key wrapped
by the Secure Enclave, which only the same Mac can use. Secure Enclave keys require the
device to be unlocked and do not prompt for Touch ID on every use.
On macOS the Secure Enclave keys are not stored in the Keychain: the data-protection
Keychain needs a provisioning profile that a standalone executable cannot carry, so
the wrapped key is kept in the metadata instead and works with unsigned builds.
doctor checks that a key can be created and restored, without saving anything.
Secure Enclave identities created by earlier versions (a Keychain reference) are not
loaded; create the identity again.
Version 1 metadata is stored under identities/ in enbu's local data directory
($XDG_DATA_HOME/enbu when set; otherwise the platform's application data directory).
Old identities are not migrated or loaded. Plaintext Identity storage is removed.
ENBU_BACKEND configures authentication token storage only and does not select an Identity backend.
Identity E2E runs on Linux, Windows and macOS with a pinned test-only vTPM SDK and
local OCI HTTP fixture. Run task identity/test/e2e with an unlocked OS keyring.
The normal CLI excludes the software TPM transport. On a real TPM or Secure Enclave
device, run ENBU_TEST_NATIVE_IDENTITY=1 go test -v ./pkg/identity for native integration tests.
Hardware device validation is separate from the required GitHub-hosted E2E matrix.
How TPM keys are generated, and which tests check it, is in docs/identity.md.
On a real Linux or Windows TPM, run the complete CLI lifecycle against local HTTP
fixtures with ENBU_TEST_NATIVE_IDENTITY=1 go test -v -count=1 -timeout=5m -tags=identitye2e -run '^TestNativeTPMCLI$' ./test/identitye2e.
This uses a production CLI build, temporary repository data and the host TPM,
covering init/add/pull/edit/sync/history and Identity reload between CLI processes.
JSON output
Pass --json to any command when invoking enbu from a process such as a VS Code extension.
The command writes exactly one JSON value to stdout.
{"ok":true,"data":{"action":"add","environment":"dev","key":"API_KEY"},"warnings":[]}
{"ok":false,"error":{"message":"secret \"API_KEY\" already exists"}}
Successful commands exit with status 0.
Errors are also written to stdout as JSON and exit with status 1.
Errors enbu cannot classify show a generic message; set ENBU_DEBUG=1 to print
the underlying cause on stderr.
enbu pull --json does not write an .env file; it returns the decrypted secrets in data.secrets.
Do not log or persist this response.
enbu auth login --device --json is unsupported because Device Flow must display a code before authentication finishes.
Use enbu auth login --json for browser authentication.
Test coverage
The Coverage workflow publishes Tobari reports for all Go unit tests, scenarios,
CLI E2E, and Identity E2E, plus React coverage. See test coverage
for local commands and report usage.
How It Works
Storage (OCI registry / S3 prefix)
βββ c-{digest} β Signed member list (each one names its parent)
βββ r-{digest} β A device asking to join (carries no authority)
βββ s-{scope}-{digest} β A revision of one environment: signed state + ciphertext
Storage is untrusted. A name is only a locator; signatures are the authority:
- Nothing is overwritten. Every update is a new revision named after its own digest, so two
people saving at the same time publish side by side and neither update is lost. The next
reader merges them like Git: different secrets combine, and a secret changed in two ways
stops until someone runs
enbu resolve.
- Signed Control lists the trusted devices, their signing keys and age recipients. Each new
Control is signed by an admin of its parent, starting from the genesis digest in
enbu.toml.
If two admins change the members at once, the Control forks and everything waits for
enbu member resolve-fork.
- Signed State binds a ciphertext digest and its parent revisions to the device that wrote
it. Readers verify the author and signature before decrypting, and set aside anything a
non-member published.
- Local checkpoints remember the Control and State heads this device accepted, so storage
cannot silently hide them. A delayed listing is retried, not treated as lost data.
- Pinned trust root. Each device remembers the first
control_genesis it verified for a
workspace, and the workspace and genesis each checkout's enbu.toml first named. If a later
enbu.toml names another one, every command stops with trust_root_changed; after an admin
confirms out of band that they re-created the workspace, run enbu init --accept-new-genesis.
A fresh clone in a new folder still trusts its first enbu.toml.
- The recipient set is built only from the verified Control. The signing key is a separate keypair
from the encryption key (hardware P-256 when available, Ed25519 in the OS keyring otherwise) and
is never written to storage.
Not covered: storage denying service, hiding the newest revision from a fresh device with no
checkpoint, a malicious admin, and stolen admin keys. A removed member who can still write to
storage can publish a revision that claims the control they knew; reads and history set it aside,
but a device that has not yet seen the removal still accepts it.
enbu add β Creates a new secret, encrypts for the verified members, signs a new revision, and publishes it
enbu edit β Updates an existing secret and publishes a new revision
enbu delete β Removes a secret and publishes a new revision
enbu pull β Merges the current revisions, decrypts with your private key, writes to .env
enbu sync β Re-encrypts and re-signs for the current member list
enbu resolve β Chooses between a secret that two people changed at the same time
GitHub authentication & initialization flow
sequenceDiagram
participant User
participant CLI as enbu CLI
participant Auth as auth.enbu.net
participant GitHub as GitHub OAuth
participant GHCR as Storage
User->>CLI: enbu auth login
CLI->>CLI: Start 127.0.0.1 callback listener
CLI->>Auth: Create PKCE session
Auth-->>CLI: GitHub authorization URL
CLI-->>User: Open browser
User->>GitHub: Authorize in browser
GitHub-->>CLI: Authorization code via loopback callback
CLI->>Auth: Exchange code with PKCE verifier
Auth-->>CLI: Access token
CLI->>CLI: Store token in OS keychain
CLI-->>User: β Authenticated
User->>CLI: enbu init
CLI->>CLI: Create or load repository Identity and signing key
CLI->>GHCR: Create the genesis Control (first device only)
Note over GHCR: The genesis digest is saved in enbu.toml
GHCR-->>CLI: Done
CLI-->>User: β Initialized
Secret Addition Flow
sequenceDiagram
participant User
participant CLI as enbu CLI
participant GHCR as Storage
User->>CLI: enbu add KEY VALUE
CLI->>GHCR: Fetch the Control DAG and verify the signed chain
GHCR-->>CLI: Verified members
CLI->>CLI: Encrypt with age for the members' recipients
CLI->>CLI: Sign the state with the signing key
CLI->>GHCR: Publish a new revision beside the current ones
GHCR-->>CLI: Done
CLI-->>User: β Secret added
Member Addition Flow
sequenceDiagram
participant New as New Member
participant Admin as Admin
participant CLI as enbu CLI
participant GHCR as Storage
New->>CLI: enbu init (shared enbu.toml)
CLI->>GHCR: Verify Control from the genesis digest
CLI->>GHCR: Write request-{device-id} (no authority)
CLI-->>New: Waiting for approval, fingerprint a1b2-c3d4-...
New-->>Admin: Fingerprint, over another channel
Admin->>CLI: enbu member approve
CLI->>GHCR: List requests, show the fingerprint
Admin->>CLI: Confirm the fingerprint matches
CLI->>GHCR: Append a Control signed by the admin
CLI->>GHCR: Re-encrypt and re-sign every environment
New->>CLI: enbu pull
CLI->>GHCR: Verify Control and State
CLI->>CLI: Decrypt with private key
CLI-->>New: Write .env