The memory store provides a full store.Store implementation backed by Go maps and sync.RWMutex. It requires no external dependencies and is ideal for testing and development.
Setup01
import "github.com/xraph/keysmith/store/memory"
store := memory.New()Features02
Implements the complete
store.Storecomposite interface (keys, policies, scopes, usage, rotation)Thread-safe via
sync.RWMutexO(1) key lookup by hash via secondary index
Key-scope junction tracking for scope assignment
No external dependencies
Usage with the engine03
eng, err := keysmith.NewEngine(keysmith.WithStore(memory.New()))Limitations04
Data is lost when the process exits
Not suitable for production use
No persistence, replication, or backup support
Single-process only (no multi-instance coordination)
When to use05
| Scenario | Recommended |
| Unit tests | Yes |
| Integration tests | Yes |
| Local development | Yes |
| CI pipelines | Yes |
| Production | No -- use PostgreSQL |