Documentation
¶
Overview ¶
Package keystore provides secure storage for API keys.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultKeystorePath ¶
func DefaultKeystorePath() string
DefaultKeystorePath returns the default keystore file path. - macOS/Linux: ~/.iris/keys.enc - Windows: %USERPROFILE%\.iris\keys.enc
Types ¶
type ErrKeyNotFound ¶
type ErrKeyNotFound struct {
Name string
}
ErrKeyNotFound is returned when a requested key does not exist.
func (*ErrKeyNotFound) Error ¶
func (e *ErrKeyNotFound) Error() string
type FileKeystore ¶
type FileKeystore struct {
// contains filtered or unexported fields
}
FileKeystore implements Keystore using encrypted file storage. Keys are stored in a JSON map encrypted with AES-256-GCM.
func NewFileKeystore ¶
func NewFileKeystore(path string) (*FileKeystore, error)
NewFileKeystore creates a new file-based keystore at the given path. The encryption key is derived from machine-specific data.
func (*FileKeystore) Delete ¶
func (f *FileKeystore) Delete(name string) error
Delete removes a key by name.
func (*FileKeystore) Get ¶
func (f *FileKeystore) Get(name string) (string, error)
Get retrieves a value by name.
func (*FileKeystore) List ¶
func (f *FileKeystore) List() ([]string, error)
List returns all stored key names.
func (*FileKeystore) Set ¶
func (f *FileKeystore) Set(name, value string) error
Set stores a key-value pair.
type Keystore ¶
type Keystore interface {
// Set stores a key-value pair.
Set(name, value string) error
// Get retrieves a value by name. Returns error if not found.
Get(name string) (string, error)
// Delete removes a key by name.
Delete(name string) error
// List returns all stored key names.
List() ([]string, error)
}
Keystore defines the interface for secure key storage.
func NewKeystore ¶
NewKeystore creates a new keystore using file-based encrypted storage.