keyring

package
v1.135.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

func New added in v1.33.0

func New() Keyring

New returns the appropriate Keyring implementation. When BITBOTTLE_ALLOW_INSECURE_STORE=1 is set, a file-backed AES-256-GCM keyring is used instead of the OS keyring.

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

func (*OSKeyring) Delete

func (k *OSKeyring) Delete(service, user string) error

Delete removes a password from the OS keyring.

func (*OSKeyring) Get

func (k *OSKeyring) Get(service, user string) (string, error)

Get retrieves a password from the OS keyring.

func (*OSKeyring) Set

func (k *OSKeyring) Set(service, user, password string) error

Set stores a password in the OS keyring.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL