keychain

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AccountName is the keychain account identifier used across all platforms.
	AccountName = "m31a"
)

Variables

View Source
var (
	// ErrKeychainUnavailable is returned when the OS keychain is not available
	// (e.g., D-Bus not running on Linux, security CLI missing on macOS).
	ErrKeychainUnavailable = errors.New("keychain unavailable")

	// ErrKeyNotFound is returned when a requested key does not exist in the keychain.
	ErrKeyNotFound = errors.New("key not found")

	// ErrKeychainDecrypt is returned when the keychain secret blob is corrupted
	// or unreadable (e.g., GPG decryption failure on Linux pass backend).
	ErrKeychainDecrypt = errors.New("keychain secret blob is corrupted or unreadable")

	// ErrNotImplemented is returned on platforms where keychain operations
	// are not supported.
	ErrNotImplemented = errors.New("not implemented on this platform")
)

Functions

This section is empty.

Types

type Keychain

type Keychain interface {
	// Get retrieves the value for the given service name.
	// Returns ErrKeyNotFound if the key does not exist.
	// Returns ErrKeychainUnavailable if the keychain backend is unavailable.
	Get(service string) (string, error)

	// Set stores a value for the given service name.
	// If a value already exists for this service, it is overwritten.
	// Returns ErrKeychainUnavailable if the keychain backend is unavailable.
	Set(service, value string) error

	// Delete removes the value for the given service name.
	// Returns ErrKeyNotFound if the key does not exist.
	// Returns ErrKeychainUnavailable if the keychain backend is unavailable.
	Delete(service string) error
}

Keychain provides OS-native secure storage for API keys. Each platform implements this interface using the native secret storage mechanism.

func New

func New() (Keychain, error)

New returns a Linux keychain backed by D-Bus Secret Service with pass CLI fallback.

Jump to

Keyboard shortcuts

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