Documentation
¶
Overview ¶
Package credentials provides secure credential storage for API keys and tokens.
Package credentials provides secure credential storage for API keys and tokens.
Package credentials provides secure credential storage for API keys and tokens.
Package credentials provides secure credential storage for API keys and tokens.
Index ¶
- Constants
- Variables
- type Credential
- type EncryptedFileStore
- func (e *EncryptedFileStore) Available() bool
- func (e *EncryptedFileStore) Delete(key string) error
- func (e *EncryptedFileStore) Get(key string) (string, error)
- func (e *EncryptedFileStore) List() ([]string, error)
- func (e *EncryptedFileStore) Name() string
- func (e *EncryptedFileStore) Path() string
- func (e *EncryptedFileStore) Set(key, value string) error
- type KeychainStore
- type Manager
- func (m *Manager) Delete(key string) error
- func (m *Manager) Get(key string) (string, error)
- func (m *Manager) GetProviderAPIKey(provider string) (string, error)
- func (m *Manager) List() ([]string, error)
- func (m *Manager) Set(key, value string) error
- func (m *Manager) SetProviderAPIKey(provider, apiKey string) error
- func (m *Manager) StoreName() string
- type SecretServiceStore
- func (s *SecretServiceStore) Available() bool
- func (s *SecretServiceStore) Delete(key string) error
- func (s *SecretServiceStore) Get(key string) (string, error)
- func (s *SecretServiceStore) List() ([]string, error)
- func (s *SecretServiceStore) Name() string
- func (s *SecretServiceStore) Set(key, value string) error
- type Store
Constants ¶
const ( KeyOpenAIAPIKey = "indago.openai_api_key" KeyAnthropicAPIKey = "indago.anthropic_api_key" KeyOllamaURL = "indago.ollama_url" KeyLMStudioURL = "indago.lmstudio_url" KeyDefaultProvider = "indago.default_provider" KeyCallbackURL = "indago.callback_url" )
Well-known credential keys
Variables ¶
var ( ErrNotFound = errors.New("credential not found") ErrNotSupported = errors.New("credential storage not supported on this platform") ErrAccessDenied = errors.New("access denied to credential store") ErrInvalidKey = errors.New("invalid credential key") ErrStoreFailed = errors.New("failed to store credential") ErrDeleteFailed = errors.New("failed to delete credential") )
Common errors
Functions ¶
This section is empty.
Types ¶
type Credential ¶
type Credential struct {
Key string `json:"key"`
Description string `json:"description,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
Credential represents a stored credential with metadata.
type EncryptedFileStore ¶
type EncryptedFileStore struct {
// contains filtered or unexported fields
}
EncryptedFileStore implements credential storage using an encrypted file.
func NewEncryptedFileStore ¶
func NewEncryptedFileStore(path string) (*EncryptedFileStore, error)
NewEncryptedFileStore creates a new encrypted file credential store.
func (*EncryptedFileStore) Available ¶
func (e *EncryptedFileStore) Available() bool
Available always returns true as file storage is always available.
func (*EncryptedFileStore) Delete ¶
func (e *EncryptedFileStore) Delete(key string) error
Delete removes a credential from the encrypted file.
func (*EncryptedFileStore) Get ¶
func (e *EncryptedFileStore) Get(key string) (string, error)
Get retrieves a credential from the encrypted file.
func (*EncryptedFileStore) List ¶
func (e *EncryptedFileStore) List() ([]string, error)
List returns all credential keys from the encrypted file.
func (*EncryptedFileStore) Name ¶
func (e *EncryptedFileStore) Name() string
Name returns the store backend name.
func (*EncryptedFileStore) Path ¶
func (e *EncryptedFileStore) Path() string
Path returns the path to the credential file.
func (*EncryptedFileStore) Set ¶
func (e *EncryptedFileStore) Set(key, value string) error
Set stores a credential in the encrypted file.
type KeychainStore ¶
type KeychainStore struct{}
KeychainStore is a stub for non-darwin platforms.
func NewKeychainStore ¶
func NewKeychainStore() *KeychainStore
NewKeychainStore returns nil on non-darwin platforms.
func (*KeychainStore) Available ¶
func (k *KeychainStore) Available() bool
Available returns false on non-darwin platforms.
func (*KeychainStore) Delete ¶
func (k *KeychainStore) Delete(key string) error
Delete is not available on non-darwin platforms.
func (*KeychainStore) Get ¶
func (k *KeychainStore) Get(key string) (string, error)
Get is not available on non-darwin platforms.
func (*KeychainStore) List ¶
func (k *KeychainStore) List() ([]string, error)
List is not available on non-darwin platforms.
func (*KeychainStore) Name ¶
func (k *KeychainStore) Name() string
Name returns the store backend name.
func (*KeychainStore) Set ¶
func (k *KeychainStore) Set(key, value string) error
Set is not available on non-darwin platforms.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages credential storage with fallback support.
func NewManager ¶
NewManager creates a credential manager with platform-appropriate backends.
func NewManagerWithStore ¶
NewManagerWithStore creates a manager with a specific store.
func (*Manager) GetProviderAPIKey ¶
GetProviderAPIKey retrieves the API key for a given provider.
func (*Manager) SetProviderAPIKey ¶
SetProviderAPIKey stores the API key for a given provider.
type SecretServiceStore ¶
type SecretServiceStore struct {
// contains filtered or unexported fields
}
SecretServiceStore implements credential storage using Linux Secret Service (via secret-tool).
func NewSecretServiceStore ¶
func NewSecretServiceStore() *SecretServiceStore
NewSecretServiceStore creates a new Linux Secret Service credential store.
func (*SecretServiceStore) Available ¶
func (s *SecretServiceStore) Available() bool
Available returns true if secret-tool is available.
func (*SecretServiceStore) Delete ¶
func (s *SecretServiceStore) Delete(key string) error
Delete removes a credential using secret-tool.
func (*SecretServiceStore) Get ¶
func (s *SecretServiceStore) Get(key string) (string, error)
Get retrieves a credential using secret-tool.
func (*SecretServiceStore) List ¶
func (s *SecretServiceStore) List() ([]string, error)
List returns all credential keys from Secret Service. Note: secret-tool doesn't have a built-in list command, so this is limited.
func (*SecretServiceStore) Name ¶
func (s *SecretServiceStore) Name() string
Name returns the store backend name.
func (*SecretServiceStore) Set ¶
func (s *SecretServiceStore) Set(key, value string) error
Set stores a credential using secret-tool.
type Store ¶
type Store interface {
// Set stores a credential with the given key.
Set(key, value string) error
// Get retrieves a credential by key.
Get(key string) (string, error)
// Delete removes a credential by key.
Delete(key string) error
// List returns all credential keys.
List() ([]string, error)
// Name returns the store backend name.
Name() string
// Available returns true if this store is available on the current system.
Available() bool
}
Store is the interface for credential storage backends.