store

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultStorePath

func DefaultStorePath() string

DefaultStorePath returns the default store path

Types

type EncryptedFileStore

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

EncryptedFileStore stores credentials encrypted with AES-256-GCM.

Key precedence:

  1. SESHAT_MASTER_KEY env var (64 hex chars = 32 bytes)
  2. Machine-derived key (SHA-256 of machine ID + constant)

Existing plaintext files are read transparently and re-encrypted on the next write, providing a seamless migration path.

func NewEncryptedFileStore

func NewEncryptedFileStore(path string) (*EncryptedFileStore, error)

NewEncryptedFileStore creates a new encrypted file-based auth store. Returns an error only if key derivation fails; a missing file is not an error.

func (*EncryptedFileStore) DeleteCredentials

func (s *EncryptedFileStore) DeleteCredentials(ctx context.Context, provider string) error

DeleteCredentials implements Store.

func (*EncryptedFileStore) ListProviders

func (s *EncryptedFileStore) ListProviders(ctx context.Context) ([]string, error)

ListProviders implements Store.

func (*EncryptedFileStore) LoadCredentials

func (s *EncryptedFileStore) LoadCredentials(ctx context.Context, provider string) (*types.Credentials, error)

LoadCredentials implements Store.

func (*EncryptedFileStore) SaveCredentials

func (s *EncryptedFileStore) SaveCredentials(ctx context.Context, creds *types.Credentials) error

SaveCredentials implements Store.

type FileStore

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

FileStore stores credentials in a JSON file

func NewFileStore

func NewFileStore(path string) (*FileStore, error)

NewFileStore creates a new file-based auth store

func (*FileStore) DeleteCredentials

func (s *FileStore) DeleteCredentials(ctx context.Context, provider string) error

DeleteCredentials implements Store

func (*FileStore) ListProviders

func (s *FileStore) ListProviders(ctx context.Context) ([]string, error)

ListProviders implements Store

func (*FileStore) LoadCredentials

func (s *FileStore) LoadCredentials(ctx context.Context, provider string) (*types.Credentials, error)

LoadCredentials implements Store

func (*FileStore) SaveCredentials

func (s *FileStore) SaveCredentials(ctx context.Context, creds *types.Credentials) error

SaveCredentials implements Store

type MemoryStore

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

MemoryStore is an in-memory store for testing

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore creates a new in-memory store

func (*MemoryStore) DeleteCredentials

func (s *MemoryStore) DeleteCredentials(ctx context.Context, provider string) error

DeleteCredentials implements Store

func (*MemoryStore) ListProviders

func (s *MemoryStore) ListProviders(ctx context.Context) ([]string, error)

ListProviders implements Store

func (*MemoryStore) LoadCredentials

func (s *MemoryStore) LoadCredentials(ctx context.Context, provider string) (*types.Credentials, error)

LoadCredentials implements Store

func (*MemoryStore) SaveCredentials

func (s *MemoryStore) SaveCredentials(ctx context.Context, creds *types.Credentials) error

SaveCredentials implements Store

type Store

type Store interface {
	// Save credentials for a provider
	SaveCredentials(ctx context.Context, creds *types.Credentials) error

	// Load credentials for a provider
	LoadCredentials(ctx context.Context, provider string) (*types.Credentials, error)

	// Delete credentials for a provider
	DeleteCredentials(ctx context.Context, provider string) error

	// List all providers with stored credentials
	ListProviders(ctx context.Context) ([]string, error)
}

Store persists authentication credentials

Jump to

Keyboard shortcuts

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