How to use the @react-native-community/async-storage.removeItem function in @react-native-community/async-storage

To help you get started, we’ve selected a few @react-native-community/async-storage 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 MetaMask / metamask-mobile / app / components / Views / SyncWithExtension / index.js View on Github external
if (password === this.password) {
			const biometryType = await SecureKeychain.getSupportedBiometryType();
			if (biometryType) {
				this.setState({ biometryType, biometryChoice: true });
			}

			const authOptions = {
				accessControl: this.state.biometryChoice
					? SecureKeychain.ACCESS_CONTROL.BIOMETRY_CURRENT_SET_OR_DEVICE_PASSCODE
					: SecureKeychain.ACCESS_CONTROL.DEVICE_PASSCODE
			};

			await SecureKeychain.setGenericPassword('metamask-user', password, authOptions);

			if (!this.state.biometryChoice) {
				await AsyncStorage.removeItem('@MetaMask:biometryChoice');
			} else {
				// If the user enables biometrics, we're trying to read the password
				// immediately so we get the permission prompt
				try {
					if (Platform.OS === 'ios') {
						await SecureKeychain.getGenericPassword();
					}
					await AsyncStorage.setItem('@MetaMask:biometryChoice', this.state.biometryType);
				} catch (e) {
					Logger.error('User cancelled biometrics permission', e);
					await AsyncStorage.removeItem('@MetaMask:biometryChoice');
				}
			}
		}

		try {
github atulmy / crate / code / mobile / src / modules / user / api / actions.js View on Github external
export function unsetUserLocally() {
  // Remove token
  AsyncStorage.removeItem('token')
  AsyncStorage.removeItem('user')
}
github improvein / personal-cryptofolio / src / data / DataStorage.js View on Github external
static clearData = async () => {
    await AsyncStorage.removeItem(DATA_SETTINGS);
    await AsyncStorage.removeItem(DATA_PIN_HASH);
    await AsyncStorage.removeItem(DATA_ASSETS);
    await AsyncStorage.removeItem(DATA_PRICES);
    await AsyncStorage.removeItem(DATA_PRICES_FETCHTIME);
    // remove transactions
    const keys = await AsyncStorage.getAllKeys();
    for (let k = 0; k < keys.length; k += 1) {
      const key = keys[k];
      if (key.includes(DATA_ASSET_HIST)) {
        await AsyncStorage.removeItem(key);
      }
    }
  };
github MetaMask / metamask-mobile / app / components / Views / CreateWallet / index.js View on Github external
InteractionManager.runAfterInteractions(async () => {
			const { KeyringController } = Engine.context;
			await Engine.resetState();
			await KeyringController.createNewVaultAndKeychain('');
			await SecureKeychain.setGenericPassword('metamask-user', '');
			await AsyncStorage.removeItem('@MetaMask:biometryChoice');
			await AsyncStorage.removeItem('@MetaMask:nextMakerReminder');
			await AsyncStorage.setItem('@MetaMask:existingUser', 'true');
			// Get onboarding wizard state
			const onboardingWizard = await AsyncStorage.getItem('@MetaMask:onboardingWizard');
			// Check if user passed through metrics opt-in screen
			const metricsOptIn = await AsyncStorage.getItem('@MetaMask:metricsOptIn');
			// Making sure we reset the flag while going to
			// the first time flow
			this.props.passwordUnset();
			this.props.setLockTime(-1);
			this.props.seedphraseNotBackedUp();
			setTimeout(() => {
				if (!metricsOptIn) {
					this.props.navigation.navigate('OptinMetrics');
				} else if (onboardingWizard) {
					this.props.navigation.navigate('HomeNav');
				} else {
github MetaMask / metamask-mobile / app / core / InstaPay / index.js View on Github external
cleanUp: async () => {
		await AsyncStorage.removeItem('@MetaMask:InstaPayUsername');
		await AsyncStorage.removeItem('@MetaMask:InstaPayMnemonic');
		await AsyncStorage.removeItem('@MetaMask:InstaPay');
		await AsyncStorage.removeItem('@MetaMask:lastKnownInstantPaymentID');
		await AsyncStorage.removeItem('@MetaMask:InstaPayVersion');
		Store.reset();
		instance.stop();
	},
	reloadClient,
github wendelfreitas / animavita / packages / mobile / src / services / authFacebook.js View on Github external
export const handleLoginFacebook = async () => {
  let accessData;

  try {
    accessData = await getAccessData();

    const info = await getAccountInfo(accessData);

    return { user: info };
  } catch (err) {
    await AsyncStorage.removeItem('@facebook:accessData');
    return { error: 'Houve um erro ao recuperar os dados!' };
  }
};
github guardian / editions / projects / Mallard / src / helpers / push-tracking.ts View on Github external
const clearPushTracking = async (): Promise =>
    AsyncStorage.removeItem(PUSH_TRACKING_KEY)
github shoutem / extensions / shoutem.auth / app / session.js View on Github external
export const clearSession = () => AsyncStorage.removeItem(getStorageKey());
github microsoft / appcenter-sdk-react-native / TestApp / app / AttachmentsProvider.js View on Github external
static async updateItem(key, value) {
    if (value !== null && value !== undefined) {
      await AsyncStorage.setItem(key, value);
    } else {
      await AsyncStorage.removeItem(key);
    }
  }
github LiskHQ / lisk-mobile / src / utilities / storage.js View on Github external
export async function persistData(key, data) {
  try {
    await AsyncStorage.removeItem(key);
    await AsyncStorage.setItem(key, JSON.stringify(data));
    return data;
  } catch (error) {
    throw new Error('Error saving data');
  }
}