mirror of
https://github.com/block/buzz.git
synced 2026-11-25 02:31:36 +00:00
Back navigation in the machine onboarding flow no longer destroys in-progress key-backup work, and the "Now, test your backup" view only appears once the file is actually on disk. - EncryptedBackupCreator.tsx: new useEncryptedBackupSession() hook lifts everything that must survive step unmounts — the encrypt reducer state (entered password, cached KDF result, committed blob), the verified flag, the saved path, the save-once guard, and the test-flow progress — into a host-owned session. The creator accepts an optional session prop and falls back to a private one, so the settings "Save a new Keycase" card is unchanged. KDF completions now dispatch unguarded so results landing while the step is unmounted still commit. - EncryptedBackupCreator.tsx: advancing to the test view now requires a successful save, not just a committed blob. Canceling the native save dialog (or a save failure) rolls the commit back to the password form and clears the save-once guard so "Download backup" can be clicked again; save errors now render on the form. CTA renamed "Backup key" → "Download backup". - encryptedBackup.ts: new "back-to-password" reducer event discards the committed blob while keeping the passphrase and its cached encryption result, so returning to the form re-downloads instantly without a second KDF run. Covered by a new unit test. - BackupTestFlow.tsx: drop/password/success progress is host-controlled (survives remounts), and the wrong-password hint no longer compares attempt length against the real password (which leaked its length) — it shows only after a 900ms typing pause or an explicit Enter. - DownloadKeyStep.tsx: Back from the test view returns to the password form (via backupSessionToPasswordEntry) instead of leaving the step; the pre-verification footer shows a ghost "Skip for now" instead of a disabled Next; the "back up anytime in Settings" hint only renders on the password form; hasCreated/hasVerified derive from the session (session.created keeps the step outside the ncryptsec confinement scan). - MachineOnboardingFlow.tsx: owns the backup session; the setup (providers) step's Back returns fresh-key users to the "Backup your key with a password" form rather than the key-created page. - BackupStep.tsx: footer hint moved to the download step. - onboarding-backup.spec.ts: pre-verification footer asserts Next is absent (not disabled), documents save-gating, and adds a spec covering test-view Back → password form with the password intact plus instant re-download from the cached encryption. Signed-off-by: Taylor Ho <taylorkmho@gmail.com> Co-authored-by: Taylor Ho <taylorkmho@gmail.com>