From cffa508047e8a7b78ff843e8462acf63089c7183 Mon Sep 17 00:00:00 2001 From: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@buzz.block.builderlab.xyz> Date: Wed, 29 Jul 2026 01:01:50 -0700 Subject: [PATCH] fix(desktop): align password-protected backup semantics Co-authored-by: Taylor Ho Signed-off-by: Taylor Ho --- desktop/src-tauri/src/commands/identity.rs | 2 +- desktop/src-tauri/src/key_backup.rs | 4 +-- desktop/src-tauri/src/key_backup_tests.rs | 8 ++--- .../features/onboarding/ui/BackupTestFlow.tsx | 4 +-- .../onboarding/ui/DownloadKeyStep.tsx | 4 +-- .../onboarding/ui/MachineOnboardingFlow.tsx | 2 +- .../onboarding/ui/NostrKeyImportForm.tsx | 17 +++++----- .../ui/onboardingFlowSteps.test.mjs | 2 +- .../settings/ui/ProfileSettingsCard.tsx | 24 +++++++++----- .../features/settings/ui/SignOutSection.tsx | 16 +++++---- desktop/src/testing/e2eBridge.ts | 4 +-- desktop/tests/e2e/onboarding-backup.spec.ts | 2 +- desktop/tests/e2e/onboarding.spec.ts | 11 ++++++- desktop/tests/e2e/profile-nsec-reveal.spec.ts | 33 +++++++++++++++++++ 14 files changed, 92 insertions(+), 41 deletions(-) diff --git a/desktop/src-tauri/src/commands/identity.rs b/desktop/src-tauri/src/commands/identity.rs index 9abecbd2c..45ae33d99 100644 --- a/desktop/src-tauri/src/commands/identity.rs +++ b/desktop/src-tauri/src/commands/identity.rs @@ -285,7 +285,7 @@ pub async fn save_ncryptsec_copy( let dest = match crate::commands::export_util::pick_save_path( &app_handle, crate::key_backup::BACKUP_FILE_NAME, - "Keycase", + "Password-protected key backup", &["ncryptsec"], ) .await? diff --git a/desktop/src-tauri/src/key_backup.rs b/desktop/src-tauri/src/key_backup.rs index 0a19fb143..418be3bb0 100644 --- a/desktop/src-tauri/src/key_backup.rs +++ b/desktop/src-tauri/src/key_backup.rs @@ -106,7 +106,7 @@ pub fn decrypt_ncryptsec(input: &str, password: &str) -> Result { let encrypted = parse_ncryptsec(input)?; let secret_key = encrypted .decrypt(password) - .map_err(|_| "wrong Keycase password or damaged Keycase".to_string())?; + .map_err(|_| "wrong backup password or damaged key backup".to_string())?; Ok(Keys::new(secret_key)) } @@ -125,7 +125,7 @@ pub fn recover_keys_from_input(input: &str, password: Option<&str>) -> Result([]); // Owned here (not by DownloadKeyStep) so Back navigation — which unmounts - // the step — keeps the created Keycase, entered password, and test progress. + // the step — keeps the created backup, entered password, and test progress. const backupSession = useEncryptedBackupSession(); const handleReadyRuntimeIdsChange = React.useCallback( (runtimeIds: readonly string[]) => { diff --git a/desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx b/desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx index 90eb1f368..900b7b932 100644 --- a/desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx +++ b/desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx @@ -96,7 +96,7 @@ export function NostrKeyImportForm({ if (file.size > NOSTR_KEY_FILE_MAX_BYTES) { setImportError( - "That file is too large to be a Keycase or private key. Choose another file.", + "That file is too large to be a key backup or private key. Choose another file.", ); return; } @@ -126,7 +126,7 @@ export function NostrKeyImportForm({ if (!isValid) { setImportError( isEncryptedInput - ? "Enter the password for this Keycase." + ? "Enter the password for this key backup." : "That doesn't look like a valid nsec. Paste an nsec1 key.", ); return; @@ -244,8 +244,8 @@ export function NostrKeyImportForm({ {/* Hidden file input shared by both variants: the default drop zone and - the spotlight "Use a Keycase" button both open it. Accepts the - .ncryptsec archives our own save flow emits alongside raw .key files. */} + the spotlight "Choose a backup file" button both open it. Accepts the + .ncryptsec backups our own save flow emits alongside raw .key files. */} - Use a Keycase + Choose a backup file ) : ( @@ -358,7 +358,7 @@ export function NostrKeyImportForm({ className="text-sm font-medium text-foreground" htmlFor="nostr-import-passphrase" > - Keycase password + Backup password

- Your Keycase and password stay on this device. + Your backup file and password stay on this device.

) : null} @@ -396,7 +396,8 @@ export function NostrKeyImportForm({ data-testid="nostr-import-encrypted-badge" >