# Encrypted offline snapshots in the native app, as an option

EXPO_PUBLIC_ENCRYPT_SNAPSHOTS=1 seals the app's private snapshots with AES-256-GCM under a key that never leaves the device. Sign-out destroys the key first. Off by default until checked on a device.

- **New option: `EXPO_PUBLIC_ENCRYPT_SNAPSHOTS=1`.** The native app's private snapshots (today the todo list) are stored as AES-256-GCM ciphertext instead of plain JSON. The key is 256 random bits per installation in `expo-secure-store`, for this device only and readable only while it is unlocked. Every file is bound to its namespace, account and Organization, so a file copied into another place does not open. No new native module: `expo-crypto` and `expo-secure-store` are already in the development client. See [Mobile](/docs/features/mobile#backend-and-scope). ([1112db0](https://github.com/CarlosZiegler/fofo/commit/1112db0352f6e299dab284df3d644db09e3fc265))
- **Sign-out destroys the key first.** `clearPrivateCaches()` blanks the key, then deletes the folder; a file the deletion misses cannot be read again. An Organization switch still deletes nothing: each Organization keeps its own file for 24 hours. ([1112db0](https://github.com/CarlosZiegler/fofo/commit/1112db0352f6e299dab284df3d644db09e3fc265))
- **For a feature that keeps a snapshot.** A sealed snapshot opens one step after the first render. Read it with `snapshot.restore(scope)` next to `initialData`, as `todo.list.hooks.ts` does. With the option off nothing changes.
- **Off by default.** The format, the key and the store are tested with WebCrypto standing in for the cipher; the native adapters have not run on a device yet (issue #243). [ADR-0022](/docs/adr/0022-encrypted-private-snapshots) records the design and what a device-first product with offline writes would still need. ([bf4e86d](https://github.com/CarlosZiegler/fofo/commit/bf4e86d3c5ff776c553c72666bc310934f24bc08))
