Reference
Storage adapters
The IStorage adapters the SDK ships and when to use each one.
All adapters implement IStorage (getItem, setItem, removeItem, clear, all async). clear() only removes SDK-owned keys (prefix hydra:sdk:), never the game's own data.
| Adapter | Options | Use it for |
|---|---|---|
InMemoryStorageAdapter | none | Tests, SSR, and as a fallback. |
SafeLocalStorageAdapter | storage, fallbackStorage, onFallback | localStorage that switches to memory when blocked, full or unavailable. Check isUsingFallback. |
HostStorageRelayAdapter | transport (required), timeoutMs (15000) | Keeping data on the host shell so Safari cannot partition or wipe it. |
Defaults
The React provider and the Vue plugin use SafeLocalStorageAdapter in a browser and InMemoryStorageAdapter on the server. To keep sessions alive on Safari, pass a HostStorageRelayAdapter; see Safari ITP and host storage.
Key helpers
STORAGE_PREFIX(hydra:sdk:)STORAGE_AUTH_PREFIX(hydra:sdk:auth:)STORAGE_SESSION_PREFIX(hydra:sdk:session:)buildStorageKey(subNamespace, subKey)isSdkStorageKey(key)
See also
- Transports for the transport a
HostStorageRelayAdaptershares with the client.
