deleteWallet method

  1. @override
Future<void> deleteWallet()
override

Delete this wallet (FR-14): the "delete wallet" / "reset" primitive. CLOSES the live handle first (a wipe refuses while an instance holds the single-writer lock — WalletOpen), THEN deletes the keychain wrap key (so this key store can no longer open the on-disk seals or the DB ciphertext; custodyDisclosure says how strongly, ADR-0571) and removes the data directory. The seed NEVER crosses the bridge.

THROWS (typed WalletApiError) on a wipe FAULT and may LEAVE THE HANDLE CLOSED — but the keychain-first ordering means a fault deletes NOTHING (the seals + files are intact), so the caller RECOVERS the still-usable wallet by calling open again (the OnboardingController owns that recover-by-reopen routing, exactly as it does for rescanFrom). Bounded (a wedged keychain surfaces as the typed retryable timeout, never a permanent spinner). After a SUCCESSFUL shred this instance no longer owns a wallet — the caller resets onboarding to Welcome.

Implementation

@override
Future<void> deleteWallet() async {
  deleteCount++;
  if (holdDelete != null) await holdDelete!.future;
  if (failDelete != null) throw failDelete!;
  exists = false; // the wallet is erased — gone from disk
}