Skip to content
English

Storage

The Storage panel lists the keys and values in your app’s AsyncStorage and MMKV instances, and looks up SecureStore keys by name. You can edit, add and delete keys from the desktop app.

Using Storage in the desktop app

Accepts false | StoragePluginConfig Opt-in
StoragePluginConfig
OptionTypeDefaultDescription
asyncStorageAsyncStorageLike—AsyncStorage instance to read, write and delete string values from.
mmkvRecord<string, MMKVLike>—MMKV instances to inspect, keyed by the name the desktop app shows for each one.
secureStoreSecureStoreLike—SecureStore module to read, write and delete individual keys from. It cannot list its keys.

Pass the storage your app uses to init():

index.ts
import AsyncStorage from '@react-native-async-storage/async-storage';
import { init } from '@xerlock/client';
import * as SecureStore from 'expo-secure-store';
import { createMMKV } from 'react-native-mmkv';
const caseFiles = createMMKV({ id: 'case-files' });
init({
storage: {
asyncStorage: AsyncStorage,
mmkv: { caseFiles },
secureStore: SecureStore,
},
});

Each MMKV instance is listed by its key in mmkv, so caseFiles appears as mmkv::caseFiles.

Changes your app makes show up in the panel as they happen:

  • MMKV: each change is reported through the instance’s addOnValueChangedListener.
  • AsyncStorage: the SDK wraps the write methods of the object you pass, such as setItem and multiRemove, and reports each write once it finishes. Pass the same object your app writes with. If the object can’t be changed, for example because it’s frozen, click Refresh to see new values.
  • SecureStore can’t report changes. Click Refresh to read a key again.

The SDK doesn’t depend on AsyncStorage, MMKV or expo-secure-store. Any object with these shapes works:

AsyncStorageLike
MemberDescription
getAllKeys(): Promise<readonly string[]>Resolves to every key in storage.
multiGet(keys: readonly string[]): Promise<readonly (readonly [string, string | null])[]>Resolves to [key, value] pairs for the given keys.
getItem(key: string): Promise<string | null>Resolves to the value for key, or null if it isn't set.
setItem(key: string, value: string): Promise<void>Sets key to value.
removeItem(key: string): Promise<void>Removes key.
MMKVLike
MemberDescription
getAllKeys(): string[]Returns every key currently stored.
getString(key: string): string | undefinedDecodes key as a string, or returns undefined if it isn't set or doesn't decode as one.
getNumber(key: string): number | undefinedDecodes key as a number, or returns undefined if it isn't set or doesn't decode as one.
getBoolean(key: string): boolean | undefinedDecodes key as a boolean, or returns undefined if it isn't set or doesn't decode as one.
set(key: string, value: string | number | boolean): voidSets key to a string, number or boolean value.
delete?(key: string): voidRemoves key. Renamed to remove in react-native-mmkv v4.
remove?(key: string): voidRemoves key. The v4 replacement for delete.
addOnValueChangedListener?(listener: (key: string) => void): { remove(): void }Calls the listener with each key that changes, and returns a handle to stop listening. Enables live updates.
SecureStoreLike
MemberDescription
getItemAsync(key: string, options?: SecureStoreOptionsLike): Promise<string | null>Resolves to the value for key, or null if it isn't set.
setItemAsync(key: string, value: string, options?: SecureStoreOptionsLike): Promise<void>Sets key to value.
deleteItemAsync(key: string, options?: SecureStoreOptionsLike): Promise<void>Removes key.
AFTER_FIRST_UNLOCK?: numberKeychain accessibility constant matching SecureStoreKeychainAccessible's AFTER_FIRST_UNLOCK.
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY?: numberKeychain accessibility constant matching AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY.
ALWAYS?: numberKeychain accessibility constant matching ALWAYS.
ALWAYS_THIS_DEVICE_ONLY?: numberKeychain accessibility constant matching ALWAYS_THIS_DEVICE_ONLY.
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY?: numberKeychain accessibility constant matching WHEN_PASSCODE_SET_THIS_DEVICE_ONLY.
WHEN_UNLOCKED?: numberKeychain accessibility constant matching WHEN_UNLOCKED.
WHEN_UNLOCKED_THIS_DEVICE_ONLY?: numberKeychain accessibility constant matching WHEN_UNLOCKED_THIS_DEVICE_ONLY.

Leave out storage, or pass false, to hide the Storage panel for this app.

  • The Storage panel is missing: pass storage to init().
  • AsyncStorage changes don’t appear until you refresh: pass init() the same AsyncStorage object your app writes with.