> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://accounts.tempo.xyz/api/mcp` to find what you need.

# `Storage`

Pluggable storage adapters for persisting [`Provider`](/docs/api/provider) state (connected accounts, session keys, etc.). Pass a `Storage` to `Provider.create({ storage })` to control where state is read from and written to.

The default is `Storage.idb()` in the browser and `Storage.memory()` otherwise.

## Adapters

[Storage.combine](/docs/api/storage.combine): Combine multiple storage adapters into one

[Storage.cookie](/docs/api/storage.cookie): Persist state to document.cookie

[Storage.from](/docs/api/storage.from): Create a Storage adapter from a custom implementation

[Storage.idb](/docs/api/storage.idb): Persist state to IndexedDB

[Storage.localStorage](/docs/api/storage.localStorage): Persist state to localStorage

[Storage.memory](/docs/api/storage.memory): In-memory storage for SSR and tests

## React Native

React Native adapters ship as optional subpaths so apps only install the native dependencies they use. See the [React Native guide](/docs/guides/react-native) for platform setup.

[asyncStorage](/docs/api/storage.asyncStorage): Persist non-sensitive state to AsyncStorage

[secureMmkv](/docs/api/storage.secureMmkv): Persist state to encrypted MMKV, key in the Keychain/Keystore

## Comparison

| Adapter                                                  | Persistence | Environment  | Notes                                                                                                    |
| -------------------------------------------------------- | ----------- | ------------ | -------------------------------------------------------------------------------------------------------- |
| [`Storage.idb`](/docs/api/storage.idb)                   | Persistent  | Browser      | Default in the browser. Stores raw values (no JSON serialization).                                       |
| [`Storage.localStorage`](/docs/api/storage.localStorage) | Persistent  | Browser      | Synchronous; values are JSON-serialized.                                                                 |
| [`Storage.cookie`](/docs/api/storage.cookie)             | Persistent  | Browser      | Uses `SameSite=None; Secure`. Deep objects are flattened to stay within the 4 KB-per-cookie limit.       |
| [`Storage.memory`](/docs/api/storage.memory)             | Ephemeral   | Any          | Default outside the browser. Useful for SSR and tests.                                                   |
| [`asyncStorage`](/docs/api/storage.asyncStorage)         | Persistent  | React Native | Plain-text AsyncStorage; for non-sensitive state.                                                        |
| [`secureMmkv`](/docs/api/storage.secureMmkv)             | Persistent  | React Native | AES-256-encrypted MMKV with the key in the Keychain/Keystore; use when the provider manages access keys. |
| [`Storage.combine`](/docs/api/storage.combine)           | —           | Any          | Reads return the first non-null result; writes propagate to every storage.                               |
| [`Storage.from`](/docs/api/storage.from)                 | —           | Any          | Wraps a custom implementation, optionally scoping all keys under a prefix.                               |
