Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("keyring: not found")
ErrNotFound is returned by Get when no credential is stored for the given service/user combination. Callers that treat keyring as best-effort should handle this alongside other errors.
Functions ¶
func IsHeadless ¶ added in v1.33.0
func IsHeadless() bool
IsHeadless returns true when no graphical session is available (CI, SSH, containers). Used to decide keyring timeout and whether to skip keyring entirely.
Types ¶
type FileKeyring ¶ added in v1.33.0
type FileKeyring struct{}
FileKeyring stores tokens as AES-256-GCM encrypted files.
func (*FileKeyring) Delete ¶ added in v1.33.0
func (f *FileKeyring) Delete(service, user string) error
Delete removes an encrypted token file.
func (*FileKeyring) Get ¶ added in v1.33.0
func (f *FileKeyring) Get(service, user string) (string, error)
Get reads and decrypts a stored token.
func (*FileKeyring) Set ¶ added in v1.33.0
func (f *FileKeyring) Set(service, user, password string) error
Set encrypts and stores a token.
type Keyring ¶
type Keyring interface {
Get(service, user string) (string, error)
Set(service, user, password string) error
Delete(service, user string) error
}
Keyring abstracts OS credential storage.
type OSKeyring ¶
type OSKeyring struct{}
OSKeyring delegates to the real OS keyring with a configurable timeout so that blocking daemon calls (libsecret, GNOME Wallet) do not hang the CLI.
- macOS → Keychain
- Linux → libsecret / GNOME Keyring / KDE Wallet
- Windows → Credential Manager