Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("value not found in credentials")
ErrNotFound is the expected error if value isn't found in the credentials store.
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
Credentials provides functionality to manage credentials.
It uses keyring storage with a fallback to file storage if keyring is not supported.
func NewCredentials ¶
func NewCredentials(service string, fs afero.Fs, fallbackFileDir string) *Credentials
NewCredentials creates a new Credentials struct instance.
func (*Credentials) Delete ¶
func (c *Credentials) Delete(key string) error
Delete deletes a value from the keyring for the specified key. If keyring is not supported, it falls back to file storage.
If the value is not found, it returns ErrNotFound. If there is an error during deletion, it returns that error.
func (*Credentials) Get ¶
func (c *Credentials) Get(key string) (string, error)
Get retrieves a value from the keyring for the specified key. If keyring is not supported, it falls back to file storage.
If the value is not found, it returns ErrNotFound. Otherwise, it returns the value or an error if there was an issue during retrieval.