How to use the expo-secure-store.deleteItemAsync 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 _clearData = async (key): Promise => {
  try {
    await AsyncStorage.removeItem(key);
  } catch (error) {
    logWarn(`Unable to delete data (key = ${key}) from storage.`);
  }
  try {
    await SecureStore.deleteItemAsync(key);
  } catch (error) {
    logWarn(`Unable to delete data key = ${key} from secure storage.`);
  }
};
github tasitlabs / tasit / decentraland / helpers / storage.ts View on Github external
const _clearData = async (key): Promise => {
  try {
    await AsyncStorage.removeItem(key);
  } catch (error) {
    logWarn(`Unable to delete data (key = ${key}) from storage.`);
  }
  try {
    const returnValue = await SecureStore.deleteItemAsync(key);
  } catch (error) {
    logWarn(`Unable to delete data key = ${key} from secure storage.`);
  }
};
github syousif94 / frugalmaps / buncha / utils / User.js View on Github external
}
    const noValue =
      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 neverdull-agency / expo-unlimited-secure-store / src / storage.js View on Github external
return new Promise(async (resolve, reject) => {
        try {
            const currentStorageFileUri = await fixedStorageUri(secureStoreOptions);
            if (currentStorageFileUri) {
                let storageString = await FileSystem.readAsStringAsync(currentStorageFileUri);
                storage = JSON.parse(storageString);
                delete storage.key;
                storageString = JSON.stringify(storage);

                const newStorageFileUri = await generateStorageFileUri();
                await FileSystem.writeAsStringAsync(newStorageFileUri, storageString);
                await SecureStore.setItemAsync(storageFileUriKey, newStorageFileUri, secureStoreOptions);
                await FileSystem.deleteAsync(currentStorageFileUri, { idempotent: true });
            } 

            await SecureStore.deleteItemAsync(key, secureStoreOptions);

            resolve();
        } catch (e) {
            reject(e);
        }
    });
};
github expo / expo / apps / native-component-list / src / screens / SecureStoreScreen.tsx View on Github external
_deleteValue = async (key: string) => {
    try {
      await SecureStore.deleteItemAsync(key, {});
      Alert.alert('Success!', 'Value deleted', [
        { text: 'OK', onPress: () => {} },
      ]);
    } catch (e) {
      Alert.alert('Error!', e.message, [{ text: 'OK', onPress: () => {} }]);
    }
  }

expo-secure-store

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

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis