Documentation
¶
Index ¶
- type BoltStore
- func (s *BoltStore) Close() error
- func (s *BoltStore) Create(tokenHash string, policyJSON string, expiresAt string) error
- func (s *BoltStore) Delete(tokenHash string) error
- func (s *BoltStore) Get(tokenHash string) (*TokenRecord, error)
- func (s *BoltStore) Init() error
- func (s *BoltStore) List() ([]TokenRecord, error)
- func (s *BoltStore) Lookup(tokenHash string) (*policy.Policy, error)
- func (s *BoltStore) Reload() error
- func (s *BoltStore) SetEmitter(e events.Emitter)
- func (s *BoltStore) StartFileWatch(interval time.Duration)
- func (s *BoltStore) Update(tokenHash string, policyJSON string, expiresAt string) error
- type TokenRecord
- type TokenStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltStore ¶
type BoltStore struct {
// contains filtered or unexported fields
}
func NewBoltStore ¶
NewBoltStore creates a new BoltStore. If encryptionSecret is non-empty, policies are encrypted at rest using AES-256-GCM.
func (*BoltStore) List ¶
func (s *BoltStore) List() ([]TokenRecord, error)
func (*BoltStore) SetEmitter ¶
SetEmitter configures the event emitter for token lifecycle events.
func (*BoltStore) StartFileWatch ¶
StartFileWatch starts a goroutine that polls the DB file for changes and reloads.
type TokenRecord ¶
type TokenRecord struct {
ID int64
TokenHash string
Policy *policy.Policy
PolicyRaw string
CreatedAt string
ExpiresAt string // RFC3339 timestamp or empty for no expiration
}
TokenRecord represents a stored token with its policy.
type TokenStore ¶
type TokenStore interface {
// Init initializes the store (create tables, load cache, etc.)
Init() error
// Create stores a new token hash → policy mapping with optional expiration.
Create(tokenHash string, policyJSON string, expiresAt string) error
// Get retrieves a single token record by hash. Returns nil if not found.
Get(tokenHash string) (*TokenRecord, error)
// Update replaces the policy and/or expiration for an existing token.
Update(tokenHash string, policyJSON string, expiresAt string) error
// Delete removes a token by its hash.
Delete(tokenHash string) error
// Lookup retrieves a policy by token hash. Returns nil if not found or expired.
Lookup(tokenHash string) (*policy.Policy, error)
// List returns all token records.
List() ([]TokenRecord, error)
// Reload refreshes the in-memory cache from the database.
Reload() error
// Close cleans up resources.
Close() error
}
TokenStore is the interface for token persistence and lookup.
Click to show internal directories.
Click to hide internal directories.