API reference › @evolu/react-native › forgetDeviceSecret

function forgetDeviceSecret(
  appName: string & Brand<"UrlSafeString"> & Brand<"AppName">,
): Task<void, UnknownError>;

Defined in: react-native/src/DeviceSecret.ts:136

Deletes the app's stored DeviceSecret, so the next loadDeviceSecret creates a new one, which opens a new, empty device database. It's the start over after a DeviceSecretUnreadableError, or the lasting UnknownError that loadDeviceSecret describes: offer it only after such an error, only when a retry failed too, and only once the user confirms what's lost. The device database the old secret opened is no longer opened, so its AppOwners come back only from their backups, such as their mnemonics, and an AppOwner restored from its backup reopens its own database with its data on this device.

Each app name has its own secret and, on Android, its own Keystore key, which a forget deletes too, so the next load starts clean whatever made the secret unreadable, and a forget touches no other name. It never replaces an unreadable secret on its own, as iOS's Keychain does, because nothing tells whether the secret is lost for good, and then Evolu itself would be the one deleting.