When a user installs your CLI tool, keychain-auth needs to know about it before it can interact with the OS keychain. Registration records your binary’s path and SHA-256 hash in the local policy database, placing it in a zero-trust state — recognized by the daemon but not yet permitted to read, write, or search any secrets. You then authorize specific service namespaces in a separate configuration step.Documentation Index
Fetch the complete documentation index at: https://theseventeen-2abbdf80.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The integration lifecycle
Every CLI tool that integrates with keychain-auth passes through three phases, in order.Registration
Your installer registers the binary with the daemon. The binary is recorded in
config.json with empty permission sets. It cannot access any secrets yet.Authorization
You or your installer grants the binary access to specific service namespaces by editing
~/.config/keychain-auth/config.json. This is a one-time setup step performed after registration.Phase 1: Install-time registration
In your installer script or package post-install hook, run:- Resolves the binary path (e.g.,
/usr/local/bin/your-tool). - Computes its SHA-256 hash.
- Appends a new entry to
~/.config/keychain-auth/config.json.
Registered binaries start with empty permission sets. Your tool is recognized by the daemon, but all read, write, search, and delete operations will be denied until you configure service namespace permissions.
Phase 2: Authorization (policy configuration)
After registration, grant your binary access to the service namespaces it needs. Open~/.config/keychain-auth/config.json and populate the permission fields for your tool’s entry. See Configure service namespace permissions for the full configuration reference and architectural patterns.
Phase 3: Runtime queries
Once registered and authorized, your CLI connects to the daemon socket on each execution. The daemon retrieves your process ID from the kernel (viaSO_PEERCRED on Linux, LOCAL_PEERPID on macOS, or Named Pipe verification on Windows), resolves your binary path, recomputes its SHA-256 hash, and compares it against your config.json. If the path and hash match, the daemon binds your policy to the active connection.
Your tool can then send newline-delimited JSON requests over the socket for the duration of that connection.
Handling binary upgrades
When your tool is updated (for example, your package manager installs a new version), its SHA-256 hash changes. The daemon will reject the updated binary as unregistered until you update the recorded hash. Run this command in your package post-upgrade hook:config.json, and updates the approved hash entry in place — without modifying your existing permission policies.