keyring

package
v1.43.2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package keyring provides credential storage backed by the OS keyring with a plain-text file fallback for environments without a usable secret service.

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("secure store: key not found")

ErrKeyNotFound is returned when a key is not present in the secure store.

Functions

func FallbackStoragePath

func FallbackStoragePath(store SecureStore) string

FallbackStoragePath returns the path of the plain-text fallback credentials file, or an empty string if store is not a fallback-capable store.

func IsUsingInsecureStorage

func IsUsingInsecureStorage(store SecureStore) bool

IsUsingInsecureStorage reports whether credentials have been written to the plain-file fallback because the OS keyring was unavailable.

Types

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

MemoryStore is an in-memory SecureStore for use in tests.

func NewMemoryStore

func NewMemoryStore(initial map[string][]byte) *MemoryStore

NewMemoryStore creates a MemoryStore optionally pre-populated with data.

func (*MemoryStore) Get

func (m *MemoryStore) Get(key string) ([]byte, error)

func (*MemoryStore) Remove

func (m *MemoryStore) Remove(key string) error

func (*MemoryStore) Set

func (m *MemoryStore) Set(key string, data []byte, description string) error

type SecureStore

type SecureStore interface {
	Get(key string) ([]byte, error)
	Set(key string, data []byte, description string) error
	Remove(key string) error
}

SecureStore provides access to credential storage.

func NewSecureStore

func NewSecureStore(service, credentialsFilePath string) SecureStore

NewSecureStore returns a store that prefers the OS keyring and falls back to a plain-text file at credentialsFilePath when the keyring is unavailable.

Jump to

Keyboard shortcuts

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