This guide walks you through a complete first integration with keychain-auth. By the end, your CLI tool will be registered, granted access to a service namespace, and able to read and write secrets through the daemon. All steps assume keychain-auth is already installed — see the installation guide if not.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.
Start the daemon
Run the daemon in your terminal:On macOS, the daemon listens on Leave the daemon running in a separate terminal, or set it up as a service so it starts automatically. See the installation guide for platform-specific service configuration.
~/Library/Application Support/keychain-auth/agent.sock. On Linux it uses $XDG_RUNTIME_DIR/keychain-auth/agent.sock. On Windows it listens on the Named Pipe \\.\pipe\keychain-auth.You can override the socket path with the --socket flag or the KEYCHAIN_AUTH_SOCKET environment variable:Register your binary
Register the binary you want to grant keychain access to. Run this command from the shell where your tool is installed, so The
which resolves the correct path:register command:- Resolves the absolute path of your binary.
- Computes its SHA-256 hash.
- Appends a new entry to
~/.config/keychain-auth/config.json.
If your binary is updated (recompiled or reinstalled), its SHA-256 hash changes. Re-register it with
keychain-auth upgrade $(which your-tool) to update the approved hash without losing your permission configuration.Configure permissions
Open Grant the binary access to the service namespaces it needs. For example, to allow it to read and write secrets in the The daemon re-reads
~/.config/keychain-auth/config.json and find the entry that register created for your binary. It looks like this:agentsecrets namespace and to use prefix search:config.json on every new connection, so changes take effect immediately — no restart required.Use shared namespaces (e.g., aws or github) when you need to share secrets with other tools. Use a private namespace named after your tool (e.g., agentsecrets) for strict isolation, and segment secrets using hierarchical target names like production/workspace_abc/proj_123/OPENAI_API_KEY.Connect and send your first request
Your tool connects to the daemon over the local socket, sends a JSON request, and reads a JSON response. The connection itself is the session — there are no separate tokens or handshakes.Here is a complete Go example that writes two secrets and then reads them back:The daemon responds with a JSON object on every request:If the binary is not registered or lacks permission for the requested service, the response looks like:Common
reason values are unregistered_binary_pending_approval, action_not_in_policy, service_not_allowed, and malformed_request.Verify in the audit log
Every request — whether approved or denied — is written to the structured JSON audit log. Check it to confirm your requests were recorded:Each line is a JSON object. A successful read entry looks like:Because the audit log captures individual target names rather than opaque “search granted” entries, you can see exactly which secrets each binary accessed and when.
Secret values are never written to the audit log — only target names and metadata. This keeps the log safe to share with your security team or export to a SIEM.
Next steps
- Read the integration guide to learn about install-time registration patterns for distributing your CLI tool to users.
- See the protocol reference for the full request and response schema, including batch atomicity rules and prefix matching.
- Review platform support to understand backend differences across macOS, Linux, and Windows.