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.

AdapterOptionsUse it for
InMemoryStorageAdapternoneTests, SSR, and as a fallback.
SafeLocalStorageAdapterstorage, fallbackStorage, onFallbacklocalStorage that switches to memory when blocked, full or unavailable. Check isUsingFallback.
HostStorageRelayAdaptertransport (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 HostStorageRelayAdapter shares with the client.