How to use the expo-secure-store.WHEN_UNLOCKED function in expo-secure-store

To help you get started, we’ve selected a few expo-secure-store examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tasitlabs / tasit / decentraland / deprecated / helpers-js / storage.js View on Github external
const _storeData = async (key, value, securely) => {
  try {
    if (securely) {
      // More about options:
      // https://docs.expo.io/versions/latest/sdk/securestore/#securestoresetitemasynckey-value-options
      const options = { keychainAccessible: SecureStore.WHEN_UNLOCKED };
      await SecureStore.setItemAsync(key, value, options);
    } else {
      await AsyncStorage.setItem(key, value);
    }
  } catch (error) {
    throw Error(`Unable to ${securely ? "securely" : ""} store data.`);
  }
};
github tasitlabs / tasit / decentraland / helpers / storage.ts View on Github external
const _storeData = async (key, value, securely): Promise => {
  try {
    if (securely) {
      // More about options:
      // https://docs.expo.io/versions/latest/sdk/securestore/#securestoresetitemasynckey-value-options
      const options = { keychainAccessible: SecureStore.WHEN_UNLOCKED };
      await SecureStore.setItemAsync(key, value, options);
    } else {
      await AsyncStorage.setItem(key, value);
    }
  } catch (error) {
    throw Error(`Unable to ${securely ? "securely" : ""} store data.`);
  }
};

expo-secure-store

Provides a way to encrypt and securely store key–value pairs locally on the device.

MIT
Latest version published 5 months ago

Package Health Score

91 / 100
Full package analysis