Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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.`);
}
};
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.`);
}
};