Skip to content

Keyring Provider

The Keyring provider stores secrets in your system’s native credential store. Recommended for local development.

Providerkeyring
URIkeyring://[folder_prefix]
AccessRead and write
Best forSecure local development
AuthenticationCurrent operating-system user
Default storagemonosecret/{project}/{profile}/{key}
Terminal window
# Set a secret
$ monosecret set DATABASE_URL --provider keyring
Enter value for DATABASE_URL: postgresql://localhost/mydb
Secret DATABASE_URL saved to keyring
# Get a secret
$ monosecret get DATABASE_URL --provider keyring
postgresql://localhost/mydb
# Run with secrets
$ monosecret run --provider keyring -- npm start
  • macOS: Keychain
  • Windows: Credential Manager
  • Linux: Secret Service (GNOME Keyring, KWallet)

Linux only - install if missing:

Terminal window
# Debian/Ubuntu
$ sudo apt-get install gnome-keyring
# Fedora
$ sudo dnf install gnome-keyring
# Arch
$ sudo pacman -S gnome-keyring
keyring://[folder_prefix]
  • folder_prefix: Optional path prefix supporting {project}, {profile}, and {key} placeholders. Defaults to monosecret/{project}/{profile}/{key}.
keyring
keyring://shared/{profile}/{key}
monosecret.toml
[providers]
local = "keyring://"
[profiles.default]
DATABASE_URL = { description = "Database URL", providers = ["local"] }

Each secret is stored under monosecret/{project}/{profile}/{key} as the keyring service, with the current system username as the account. Project and profile names keep convention secrets isolated.

A secret’s ref field names an exact keyring entry instead, useful for reading a credential another application already stored: item is the service, and the optional field is the account (defaults to the current system username). Reads and writes target that entry in place.

[profiles.default]
API_TOKEN = { description = "Token", ref = { item = "com.example.app", field = "me@example.com" }, providers = [
"keyring",
] }

By default, secrets are stored under monosecret/{project}/{profile}/{key}, which isolates them per project. To share secrets across projects, use a custom folder prefix via the URI:

~/.config/monosecret/config.toml
[defaults.providers]
shared = "keyring://monosecret/shared/{profile}/{key}"

The URI supports {project}, {profile}, and {key} placeholders. By omitting {project}, multiple projects can read and write the same keyring entry:

# monosecret.toml (in project-A and project-B)
[profiles.default]
ARTIFACTORY_USER = { description = "Artifactory user", providers = ["shared"] }

Both projects will resolve ARTIFACTORY_USER from keyring service monosecret/shared/default/ARTIFACTORY_USER.