auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 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(deviceName string) (string, error)

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

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(deviceName string) error

DeleteAPIKey removes the API key for a device from the keyring.

func (*KeyringStore) GetAPIKey

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

GetAPIKey retrieves the API key for a device from the keyring.

func (*KeyringStore) HasAPIKey

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

HasAPIKey checks whether an API key is stored for a device.

func (*KeyringStore) SetAPIKey

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

SetAPIKey stores an API key for a device in the keyring.

type Store

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

Store defines the interface for per-device 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