How it Works
kredenv follows a local-first secret management model. Secrets live in an encrypted vault on your machine and are injected into your shell environment only when required.
The Flow
kredsfile.yaml local vault
(what's needed) → (encrypted secrets) → shell environment- You declare what secrets a project needs in
kredsfile.yaml - Each developer stores their own secret values in their local vault
- When you enter a project directory, kredenv reads the manifest, decrypts the vault in memory, and injects the declared secrets as environment variables
- When you leave the directory, the secrets are unloaded from your shell
Encryption
Running kredenv setup initializes the local vault:
- You create a master password
- Argon2id derives a 256-bit encryption key from that password
- Secrets are encrypted using AES-256-GCM
The vault is stored locally on your machine. Secret values are never written to disk in plaintext. The master password is stored in your OS keyring (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux) with a file-based fallback for headless environments.
Directory Discovery
When your shell detects a directory change, kredenv searches for the nearest kredsfile.yaml by walking up the directory tree from the current working directory.
The recursion depth is controlled by the recurse field in the manifest:
recurse: 3 # walk up to 3 levels looking for a kredsfile.yamlThis allows nested project structures while keeping secret lookup predictable.
Secret Injection
Whenever your working directory changes, the shell hook:
- Unloads any previously loaded secrets
- Locates the nearest
kredsfile.yaml - Checks if
autoload: trueis set - Decrypts the vault in memory
- Resolves the declared secrets
- Injects them into the shell environment
The vault is decrypted in memory only — never written to disk unencrypted.
Automatic Unloading
When you leave a project directory, kredenv unloads the injected variables from your shell session. This prevents secrets from leaking into unrelated commands or other projects.
Secrets exist in your environment only while the project scope is active.
Per-Developer Vault
Each developer maintains their own encrypted vault on their machine. The repository contains only the kredsfile.yaml, which declares which secrets are required. Each developer populates their vault independently.
This design avoids committing secrets to version control, distributing plaintext .env files, or sharing credentials across machines.