Locksmith vault plugin that retrieves secrets from the macOS Keychain via the Security framework. Authorization is triggered by the OS Keychain on each access.
- Configuration Reference - keychain - canonical YAML schema
- Plugins - SDK and plugin authoring
- macOS only (
darwin/amd64,darwin/arm64). The plugin builds on Linux and Windows, but the resulting binary returns "platform not supported" at startup. - Built with CGo (links the Security framework).
make build-allhandles this on macOS.
The plugin is normally installed automatically by locksmith init from
the embedded bundle into ~/.config/locksmith/plugins/. The build commands
below are for development only.
Build everything from the repository root on macOS:
make build-allThis produces locksmith-plugin-keychain next to the locksmith binary.
To build only this plugin:
cd plugins/keychain
go build -o locksmith-plugin-keychain .Place the binary in one of:
- The same directory as the
locksmithbinary. ~/.config/locksmith/plugins/.- Any directory in
$PATH.
Locksmith discovers plugins automatically by name.
If you fork or modify this plugin, build it manually as above and place the
binary into ~/.config/locksmith/plugins/. The discovery logic picks it
up; vault health will report any version mismatch via compat_warnings.
Minimal configuration in ~/.config/locksmith/config.yaml:
vaults:
keychain:
type: keychain
keys:
notion-token:
vault: keychain
path: notionSee docs/configuration.md
for the full field reference.
The vault has no service: set; the plugin falls back to locksmith as the
service name. The Keychain entry is service=locksmith, account=notion.
vaults:
keychain:
type: keychain
keys:
notion-token:
vault: keychain
path: notionEvery key in the work vault uses com.acme.work as its Keychain service:
vaults:
work:
type: keychain
service: com.acme.work
keys:
slack:
vault: work
path: slack # service=com.acme.work, account=slack
jira:
vault: work
path: jira # service=com.acme.work, account=jiraA path of the form service/account overrides the vault-level service::
vaults:
mixed:
type: keychain
service: com.acme.work
keys:
github:
vault: mixed
path: github/token # service=github, account=token
slack:
vault: mixed
path: slack # service=com.acme.work, account=slackResolution order: service/account in path > vault service: > "locksmith".
keychain: The specified item could not be found in the keychain. (errSecItemNotFound, -25300)
The service/account combination does not exist. Open Keychain Access.app and
search for the entry, or create it via the CLI:
security add-generic-password -s <service> -a <account> -w '<secret>'keychain: Authentication failed. (errSecAuthFailed, -25293)
The Keychain prompt was denied. Re-run the command and complete the prompt.
Path with more than one /
Only one / is allowed in a key path. Use service/account, not
service/sub/account - the latter is rejected at startup.
Plugin does not start on Linux or Windows The keychain plugin is macOS-only. Use a different vault type (e.g. gopass) on non-macOS systems.
provider_darwin.go- macOS implementation via CGo and the Security frameworkprovider_stub.go- stub for non-darwin buildsmain.go-sdk.Serveentry point