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 ¶
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) Remove ¶
func (m *MemoryStore) Remove(key 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.