Skip to content

StorageAdapter

Defined in: console-sdk/src/storage/types.ts:35

Minimal async key-value persistence boundary the SDK stores saved devices behind. Implement it to persist anywhere (MMKV, SQLite, a test double); every key the SDK writes is namespaced internally, so an adapter can safely share the host app’s storage.

All methods are promise-returning; the SDK never blocks on storage — hydration is reflected reactively (useConsoleSdk().status, useSavedDevices().isHydrated).

const config = createConsoleConfig({ storage: memoryStorage() });

getAllKeys(prefix): Promise<string[]>

Defined in: console-sdk/src/storage/types.ts:46

Resolves every stored key that starts with prefix (pass '' for all keys). Order is unspecified.

string

Promise<string[]>


getItem(key): Promise<string | null>

Defined in: console-sdk/src/storage/types.ts:37

Resolves the value stored under key, or null when absent.

string

Promise<string | null>


removeItem(key): Promise<void>

Defined in: console-sdk/src/storage/types.ts:41

Removes key; resolves normally whether or not the key existed.

string

Promise<void>


setItem(key, value): Promise<void>

Defined in: console-sdk/src/storage/types.ts:39

Stores value under key, overwriting any existing value.

string

string

Promise<void>