autoconfigcache

package
v8.19.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

AutoConfig cache encryption.

The cache stores environment metadata (including SDK keys and mobile keys) in Redis or DynamoDB. Encryption at rest provides defense in depth against unauthorized read access to the persistent store.

Uses AES-256-GCM with a random nonce per item and HKDF-SHA256 for key derivation from the configured CacheEncryptionKey (or the AutoConfig key as a fallback).

Index

Constants

View Source
const CurrentModelVersion = 1

CurrentModelVersion is the version of the serialization format. Increment this when the shape of EnvironmentRep or FilterRep changes.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedItem

type CachedItem struct {
	Kind         ModelKind       `json:"kind"`
	ModelVersion int             `json:"modelVersion"`
	Data         json.RawMessage `json:"data"`
}

CachedItem is the versioned envelope stored in the cache. It wraps the actual data with kind and version metadata so we can detect and handle format changes on read.

type ModelKind

type ModelKind string

ModelKind identifies the type of data stored in a CachedItem.

const (
	ModelKindEnvironment ModelKind = "environment"
	ModelKindFilter      ModelKind = "filter"
)

type Store

type Store interface {
	io.Closer
	// GetAll returns the cached PutContent, or nil if the cache is empty.
	GetAll(ctx context.Context) (*autoconfig.PutContent, error)
	// SetAll writes the full PutContent to the store, removing stale items.
	SetAll(ctx context.Context, content autoconfig.PutContent) error
	// Upsert writes a single item to the store.
	Upsert(ctx context.Context, kind autoconfig.CacheKind, id string, data interface{}) error
	// Delete removes a single item from the store.
	Delete(ctx context.Context, kind autoconfig.CacheKind, id string) error
}

Store reads and writes the encrypted AutoConfig cache in the configured persistent store (Redis or DynamoDB). Each environment and filter is stored as an individual item, encrypted separately. The cache key namespaces entries so multiple Relay instances can share the same store.

func NewStore

func NewStore(c config.Config, loggers ldlog.Loggers) (Store, error)

NewStore creates a Store from the Relay config. Returns a Redis or DynamoDB-backed store when CacheKey is set and a backing store is configured; otherwise returns a noopStore.

Jump to

Keyboard shortcuts

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