How to use expo-secure-store - 10 common examples

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.`);
  }
};
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.`);
  }
};
github expo / expo / apps / native-component-list / src / screens / SecureStoreScreen.tsx View on Github external
_setValue = async (value: string, key: string) => {
    try {
      console.log('securestore: ' + SecureStore);
      await SecureStore.setItemAsync(key, value, {});
      Alert.alert(
        'Success!',
        'Value: ' + value + ', stored successfully for key: ' + key,
        [{ text: 'OK', onPress: () => {} }]
      );
    } catch (e) {
      Alert.alert('Error!', e.message, [{ text: 'OK', onPress: () => {} }]);
    }
  }
github tasitlabs / tasit / decentraland / deprecated / helpers-js / storage.js View on Github external
const _retrieveData = async key => {
  try {
    let value = await AsyncStorage.getItem(key);
    if (value === null) value = await SecureStore.getItemAsync(key);

    return value;
  } catch (error) {
    throw Error(`Unable to retrieve data from storage.`);
  }
};
github tasitlabs / tasit / decentraland / helpers / storage.ts View on Github external
const _retrieveData = async (key): Promise => {
  try {
    let value = await AsyncStorage.getItem(key);
    if (value === null) value = await SecureStore.getItemAsync(key);

    return value;
  } catch (error) {
    throw Error(`Unable to retrieve data from storage.`);
  }
};
github sysgears / apollo-universal-starter-kit / modules / core / common / clientStorage.native.ts View on Github external
export const getItem = async (name: string) => SecureStore.getItemAsync(name);
export const setItem = async (name: string, value: string) => SecureStore.setItemAsync(name, value);
github sysgears / apollo-universal-starter-kit / modules / i18n / common-react / LanguageDetector.native.ts View on Github external
detect: async (callback: (lang: string) => string) => {
    const lng = await SecureStore.getItemAsync('i18nextLng');
    return callback(lng || (await Localization.getLocalizationAsync()).locale.replace('_', '-'));
  },
  init: () => {},

expo-secure-store

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

MIT
Latest version published 4 months ago

Package Health Score

91 / 100
Full package analysis