How to use the expo-secure-store.setItemAsync 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.`);
  }
};
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 Cretezy / redux-persist-expo-securestore / src / index.js View on Github external
setItem: (key, value) =>
      SecureStore.setItemAsync(replacer(key, replaceCharacter), value, options),
    removeItem: key =>
github syousif94 / frugalmaps / buncha / utils / User.js View on Github external
value === null || (typeof value === "string" && !value.length);
    const json = JSON.stringify(value);
    if (WEB) {
      if (User.secureKeys.has(key) || User.persistedKeys.has(key)) {
        if (noValue) {
          delete localStorage[key];
        } else {
          localStorage[key] = json;
        }
      }
    } else {
      if (User.secureKeys.has(key)) {
        if (noValue) {
          SecureStore.deleteItemAsync(key);
        } else {
          SecureStore.setItemAsync(key, json);
        }
      } else if (User.persistedKeys.has(key)) {
        if (noValue) {
          AsyncStorage.removeItem(key);
        } else {
          AsyncStorage.setItem(key, json);
        }
      }
    }
  });
github ikuseiGmbH / smart-village-app-app / src / auth.js View on Github external
.then((json) => {
      SecureStore.setItemAsync('ACCESS_TOKEN', json.access_token);
    })
    .finally(() => callback && callback());

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