Store multiple Key Values on SecureStore

Hi there,
I want to store multiple values on SecureStore. Is it possible? I tried using this:

SecureStore.setItemAsync({'key1': 'value1', 'key2': 'value2'})

but it didn’t work. Is there something I’m missing?

Thanks for your help.

1 Like

The method signature takes one key and one value. Please see the docs: You can use Promise.all for concurrency.

1 Like

You could do this…

const saveObject = object => Promise.all(
  Object.keys(object).map(key => {
    const value = JSON.stringify(yourObject[key]);

    return SecureStore.setItemAsync(key, value);

(async () => {
  await saveObject({ key1: 'value1', key2: 'value2' });
  const key1 = await SecureStore.getItemAsync('key1');