credentials

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

func (*Credentials) Set

func (c *Credentials) Set(key string, value string) error

Set stores a value in the keyring for the specified key. If keyring is not supported, it falls back to file storage.

Jump to

Keyboard shortcuts

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