keyring provides a cross-platform keychain/keyring interface
See the codehttps://pkg.go.dev/github.com/tmc/keyring
Keyring provides a common interface to keyring/keychain tools.
License: ISC
Requires Go 1.25 or later.
Currently implemented:
Contributions welcome!
Usage example:
err := keyring.Set("libraryFoo", "jack", "sacrifice")
password, err := keyring.Get("libraryFoo", "jack")
fmt.Println(password) //Output: sacrifice
err = keyring.Delete("libraryFoo", "jack")
Linux requirements:
The default SecretService provider is pure Go and preferred. The
gnome_keyring build tag selects the opt-in cgo/libsecret provider for
environments that specifically require libsecret.
libsecret-devlibsecret-devellibsecretTests on Linux:
$ go test github.com/tmc/keyring
$ # for gnome-keyring provider
$ go test -tags gnome_keyring github.com/tmc/keyring
/usr/bin/security over stdin (base64-encoded
so any byte value survives), so it is not exposed in the process argument list."plain" negotiation, so
secrets traverse the user's D-Bus session bus unencrypted. A local process
able to snoop that bus could read them. A future implementation should use
dh-ietf-1024-sha256 session encryption.KEYRING_PASSPHRASE can leak to child processes and process listings; prefer
FileOptions.Passphrase when using NewFileProvider.Overall
Maintained
Code review
Go module
Latest release
Releases this year
145 followers · starred Jan 2024
25 followers · starred Dec 2018
66 followers · starred Jun 2016
keyring provides a cross-platform keychain/keyring interface
See the codehttps://pkg.go.dev/github.com/tmc/keyring
Keyring provides a common interface to keyring/keychain tools.
License: ISC
Requires Go 1.25 or later.
Currently implemented:
Contributions welcome!
Usage example:
err := keyring.Set("libraryFoo", "jack", "sacrifice")
password, err := keyring.Get("libraryFoo", "jack")
fmt.Println(password) //Output: sacrifice
err = keyring.Delete("libraryFoo", "jack")
Linux requirements:
The default SecretService provider is pure Go and preferred. The
gnome_keyring build tag selects the opt-in cgo/libsecret provider for
environments that specifically require libsecret.
libsecret-devlibsecret-devellibsecretTests on Linux:
$ go test github.com/tmc/keyring
$ # for gnome-keyring provider
$ go test -tags gnome_keyring github.com/tmc/keyring
/usr/bin/security over stdin (base64-encoded
so any byte value survives), so it is not exposed in the process argument list."plain" negotiation, so
secrets traverse the user's D-Bus session bus unencrypted. A local process
able to snoop that bus could read them. A future implementation should use
dh-ietf-1024-sha256 session encryption.KEYRING_PASSPHRASE can leak to child processes and process listings; prefer
FileOptions.Passphrase when using NewFileProvider.Overall
Maintained
Code review
Go module
Latest release
Releases this year
145 followers · starred Jan 2024
25 followers · starred Dec 2018
66 followers · starred Jun 2016