Skip to main content

Module storage

Module storage 

Source
Expand description

Storage Abstraction — Unified key-value, secure, and file storage API.

Provides a trait-based storage layer that abstracts across platforms:

  • Key-value store (AsyncStorage equivalent)
  • Secure storage (iOS Keychain, Android Keystore, Web crypto)
  • File system access (sandboxed app data)

Platform adapters implement StorageBackend for each target. The StorageManager coordinates across backends and provides a type-safe, thread-safe API for the rest of the engine.

Design:

  • All operations are synchronous in the trait (platform can spawn internally)
  • StorageBackend is Send + Sync for safe sharing across threads
  • Secure storage uses a separate trait method set with explicit domain tagging

Structs§

AndroidStorageBackend
Android storage backend stub. Production: SharedPreferences (KV) + Android Keystore (secure) + app files dir (files).
DesktopStorageBackend
Desktop storage backend stub (macOS, Windows, Linux). Production: file-based KV (JSON files) + OS keyring (secure) + file system (files).
IosStorageBackend
iOS storage backend stub. Production: NSUserDefaults (KV) + Keychain (secure) + FileManager (files).
MemoryStorageBackend
In-memory storage backend for testing and as a Web fallback. All data is lost when the process exits.
StorageManager
High-level storage coordinator. Wraps a StorageBackend and provides convenience methods.
StorageNamespace
Namespace for isolating storage domains. Prevents key collisions between different parts of the app.
WebStorageBackend
Web storage backend stub. Production: localStorage (KV) + SubtleCrypto + encrypted localStorage (secure) + IndexedDB (files).

Enums§

StorageError
Errors from storage operations.
StorageValue
Values that can be stored in key-value storage.

Traits§

StorageBackend
Trait that platform-specific storage implementations must implement.

Type Aliases§

StorageResult