Help us shape the future of Go! Take the 2026 Go Developer Survey

keyring

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package keyring provides a composite keyring provider that supports multiple backends. It supports macOS Keychain, Windows Credential Manager, and Linux D-Bus Secret Service, with keyctl as a fallback on Linux systems.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("key not found")

ErrNotFound is returned when a requested key is not found in the keyring

Functions

func GenerateUniqueTestKey added in v0.4.0

func GenerateUniqueTestKey() string

GenerateUniqueTestKey creates a unique key name used for keyring availability checks. It combines a timestamp and random bytes to prevent naming collisions when multiple checks run concurrently.

Types

type Provider

type Provider interface {
	Set(service, key, value string) error

	Get(service, key string) (string, error)

	Delete(service, key string) error

	DeleteAll(service string) error

	IsAvailable() bool

	Name() string
}

Provider defines the interface for keyring backends

func NewCompositeProvider

func NewCompositeProvider() Provider

NewCompositeProvider creates a new composite keyring provider that combines multiple backends. It uses zalando/go-keyring as the primary provider and keyctl as a fallback on Linux.

func NewKeyctlProvider

func NewKeyctlProvider() (Provider, error)

NewKeyctlProvider creates a new keyring provider using Linux keyctl. It initializes access to the user keyring for persistence across process invocations.

func NewZalandoKeyringProvider

func NewZalandoKeyringProvider() Provider

NewZalandoKeyringProvider creates a new provider that wraps zalando/go-keyring. This provider supports macOS Keychain, Windows Credential Manager, and Linux D-Bus Secret Service.

Jump to

Keyboard shortcuts

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