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).
Example
Section titled “Example”const config = createConsoleConfig({ storage: memoryStorage() });Extended by
Section titled “Extended by”Methods
Section titled “Methods”getAllKeys()
Section titled “getAllKeys()”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.
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
Returns
Section titled “Returns”Promise<string[]>
getItem()
Section titled “getItem()”getItem(
key):Promise<string|null>
Defined in: console-sdk/src/storage/types.ts:37
Resolves the value stored under key, or null when absent.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<string | null>
removeItem()
Section titled “removeItem()”removeItem(
key):Promise<void>
Defined in: console-sdk/src/storage/types.ts:41
Removes key; resolves normally whether or not the key existed.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
setItem()
Section titled “setItem()”setItem(
key,value):Promise<void>
Defined in: console-sdk/src/storage/types.ts:39
Stores value under key, overwriting any existing value.
Parameters
Section titled “Parameters”string
string
Returns
Section titled “Returns”Promise<void>