Documentation
¶
Overview ¶
Package adapters provides concrete implementations of the ports interfaces.
Index ¶
- type EncryptedFileStore
- func (e *EncryptedFileStore) DeleteSession(_ context.Context, id string) error
- func (e *EncryptedFileStore) ListSessions(_ context.Context) ([]string, error)
- func (e *EncryptedFileStore) LoadSession(_ context.Context, id string) (*ports.SessionData, error)
- func (e *EncryptedFileStore) SaveSession(_ context.Context, id string, data *ports.SessionData) error
- type EnvKeyProvider
- type FileStore
- func (f *FileStore) DeleteSession(_ context.Context, id string) error
- func (f *FileStore) ListSessions(_ context.Context) ([]string, error)
- func (f *FileStore) LoadSession(_ context.Context, id string) (*ports.SessionData, error)
- func (f *FileStore) SaveSession(_ context.Context, id string, data *ports.SessionData) error
- type KeyProvider
- type MemoryStore
- func (m *MemoryStore) DeleteSession(_ context.Context, id string) error
- func (m *MemoryStore) ListSessions(_ context.Context) ([]string, error)
- func (m *MemoryStore) LoadSession(_ context.Context, id string) (*ports.SessionData, error)
- func (m *MemoryStore) SaveSession(_ context.Context, id string, data *ports.SessionData) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EncryptedFileStore ¶
type EncryptedFileStore struct {
// contains filtered or unexported fields
}
EncryptedFileStore persists sessions as encrypted files in a directory. Uses AES-256-GCM encryption with a key stored separately.
The encryption format is: nonce (12 bytes) || ciphertext || auth tag (16 bytes) This provides both confidentiality and integrity verification.
File extension is ".enc" to distinguish from plaintext session files.
func NewEncryptedFileStore ¶
func NewEncryptedFileStore(dir string, keyProvider KeyProvider) (*EncryptedFileStore, error)
NewEncryptedFileStore creates an EncryptedFileStore. Creates the directory if needed. The keyProvider will be used to retrieve the encryption key for each operation.
func (*EncryptedFileStore) DeleteSession ¶
func (e *EncryptedFileStore) DeleteSession(_ context.Context, id string) error
DeleteSession removes an encrypted session file.
func (*EncryptedFileStore) ListSessions ¶
func (e *EncryptedFileStore) ListSessions(_ context.Context) ([]string, error)
ListSessions returns all session IDs (files with .enc extension).
func (*EncryptedFileStore) LoadSession ¶
func (e *EncryptedFileStore) LoadSession(_ context.Context, id string) (*ports.SessionData, error)
LoadSession reads and decrypts session data from a file.
func (*EncryptedFileStore) SaveSession ¶
func (e *EncryptedFileStore) SaveSession(_ context.Context, id string, data *ports.SessionData) error
SaveSession encrypts and saves session data to a file.
type EnvKeyProvider ¶
type EnvKeyProvider struct {
EnvVar string
}
EnvKeyProvider fetches key from environment variable (for dev/testing). This is NOT recommended for production use.
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore persists sessions as JSON files in a directory.
func NewFileStore ¶
NewFileStore creates a FileStore. Creates the directory if needed.
func (*FileStore) DeleteSession ¶
func (*FileStore) ListSessions ¶
func (*FileStore) LoadSession ¶
func (*FileStore) SaveSession ¶
type KeyProvider ¶
KeyProvider retrieves the encryption key. Implement this to fetch from keychain, env var, or wherever you store secrets.
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is an in-memory StateStore. Sessions survive for the lifetime of the process but are lost on exit. This is the default when no persistent store is configured.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
NewMemoryStore constructs an empty in-memory store.
func (*MemoryStore) DeleteSession ¶
func (m *MemoryStore) DeleteSession(_ context.Context, id string) error
func (*MemoryStore) ListSessions ¶
func (m *MemoryStore) ListSessions(_ context.Context) ([]string, error)
func (*MemoryStore) LoadSession ¶
func (m *MemoryStore) LoadSession(_ context.Context, id string) (*ports.SessionData, error)
func (*MemoryStore) SaveSession ¶
func (m *MemoryStore) SaveSession(_ context.Context, id string, data *ports.SessionData) error