credentials

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotConfigured = errors.New("credentials not configured")

ErrNotConfigured is returned when no credentials are stored for the requested profile.

View Source
var ErrReadOnly = errors.New("credential store is read-only")

ErrReadOnly is returned when Set or Delete is called on a read-only store.

Functions

func KeyringServiceName

func KeyringServiceName(profile string) string

KeyringServiceName returns the keyring service name for a profile.

Types

type Credentials

type Credentials struct {
	APIKey   string `json:"apiKey"`
	Token    string `json:"token"`
	AuthMode string `json:"authMode"`
}

Credentials holds the API key, token, and auth mode for a profile.

type EnvStore

type EnvStore struct{}

EnvStore reads credentials from environment variables. It is read-only.

func NewEnvStore

func NewEnvStore() *EnvStore

NewEnvStore creates a new environment-variable-backed credential store.

func (*EnvStore) Delete

func (e *EnvStore) Delete(profile string) error

func (*EnvStore) Get

func (e *EnvStore) Get(profile string) (Credentials, error)

Get reads credentials from TRELLO_API_KEY and TRELLO_TOKEN environment variables. The profile parameter is ignored — env-based auth has no profile concept.

func (*EnvStore) Set

func (e *EnvStore) Set(profile string, creds Credentials) error

type FallbackStore

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

FallbackStore tries the primary Store first and falls back to secondary when credentials are not configured.

func NewFallbackStore

func NewFallbackStore(primary, secondary Store) *FallbackStore

NewFallbackStore creates a new fallback chain with the provided primary and secondary stores.

func (*FallbackStore) Delete

func (f *FallbackStore) Delete(profile string) error

func (*FallbackStore) Get

func (f *FallbackStore) Get(profile string) (Credentials, error)

func (*FallbackStore) Set

func (f *FallbackStore) Set(profile string, creds Credentials) error

type KeyringStore

type KeyringStore struct{}

KeyringStore persists credentials in the OS keyring.

func NewKeyringStore

func NewKeyringStore() *KeyringStore

NewKeyringStore creates a new keyring-backed credential store.

func (*KeyringStore) Delete

func (k *KeyringStore) Delete(profile string) error

func (*KeyringStore) Get

func (k *KeyringStore) Get(profile string) (Credentials, error)

func (*KeyringStore) Set

func (k *KeyringStore) Set(profile string, creds Credentials) error

type MemoryStore

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

MemoryStore is an in-memory Store implementation, primarily for testing.

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore creates a new in-memory credential store.

func (*MemoryStore) Delete

func (m *MemoryStore) Delete(profile string) error

func (*MemoryStore) Get

func (m *MemoryStore) Get(profile string) (Credentials, error)

func (*MemoryStore) Set

func (m *MemoryStore) Set(profile string, creds Credentials) error

type Store

type Store interface {
	Get(profile string) (Credentials, error)
	Set(profile string, creds Credentials) error
	Delete(profile string) error
}

Store defines the interface for credential persistence.

Jump to

Keyboard shortcuts

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