auth

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAPIKey = errors.New("no API key configured")
)

Functions

func GetAPIKey

func GetAPIKey() (string, error)

GetAPIKey checks the env var first, then falls back to the keyring.

Types

type KeyringBackendInfo

type KeyringBackendInfo struct {
	Value  string
	Source string
}

KeyringBackendInfo holds the resolved keyring backend value and its source.

func ResolveKeyringBackendInfo

func ResolveKeyringBackendInfo() (KeyringBackendInfo, error)

ResolveKeyringBackendInfo determines the keyring backend from env, config, or default.

type KeyringStore

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

KeyringStore implements Store using the system keyring.

func (*KeyringStore) DeleteAPIKey

func (s *KeyringStore) DeleteAPIKey() error

DeleteAPIKey removes the API key from the keyring.

func (*KeyringStore) GetAPIKey

func (s *KeyringStore) GetAPIKey() (string, error)

GetAPIKey retrieves the API key from the keyring.

func (*KeyringStore) HasAPIKey

func (s *KeyringStore) HasAPIKey() (bool, error)

HasAPIKey checks whether an API key is stored in the keyring.

func (*KeyringStore) SetAPIKey

func (s *KeyringStore) SetAPIKey(key string) error

SetAPIKey stores an API key in the keyring.

type Store

type Store interface {
	SetAPIKey(key string) error
	GetAPIKey() (string, error)
	DeleteAPIKey() error
	HasAPIKey() (bool, error)
}

Store defines the interface for API key storage.

func OpenDefault

func OpenDefault() (Store, error)

OpenDefault opens the default keyring store.

Jump to

Keyboard shortcuts

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