React Native theorytheory 0/50 · 0%
Security · medium

29. Secure storage and biometrics

Protecting keys and enabling biometric unlock.

Sensitive data like a wallet's encrypted seed should live in hardware-backed secure storage (`react-native-keychain` or `expo-secure-store`), not AsyncStorage, and biometric prompts add a second factor before revealing it.

import * as SecureStore from "expo-secure-store";

async function saveSecret(key: string, value: string) {
  await SecureStore.setItemAsync(key, value);
}

async function readSecret(key: string): Promise<string | null> {
  return SecureStore.getItemAsync(key);
}

Even with secure storage, never display a full seed phrase without an explicit user action and a warning — assume the screen could be recorded or shoulder-surfed.

Check your understanding

  1. 1. Where should an encrypted wallet seed be stored?

  2. 2. What adds a second factor before revealing secrets?

  3. 3. Why be cautious about displaying a seed phrase on screen?