aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/test/java
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-03 14:44:58 +0100
committerDanilo M. <danix@danix.xyz>2026-11-03 14:44:58 +0100
commit2b73e524d9624897f675ccc14f614fc450a7565f (patch)
tree5f90dd4963e0aaeb2c699d86e1a2acc9dceaf366 /app/src/test/java
parent2911783653f699e41a07bb9536460d9d0a1c3b70 (diff)
downloadHardenedPass-2b73e524d9624897f675ccc14f614fc450a7565f.tar.gz
HardenedPass-2b73e524d9624897f675ccc14f614fc450a7565f.zip
fix(app): address the step 5 review and emulator findings
- A store a cancelled attempt already made for the chosen key (its .gpg-id names exactly that key) no longer counts as occupied: choosing the key again commits and moves on instead of refusing. - SSH key import reads at most 100 kB whatever the provider reports, like the PGP import, instead of reading the stream whole. - PGPKeyManager replaces a key through a temporary file moved over it atomically, so a failed write keeps the old key; listings only read .key files, so a stray temporary file is never taken for a key. - "View generated public SSH key" goes through the settings result launcher, so the preference visibility refreshes afterwards. - A plain start from LaunchActivity replaces the task: an open MainActivity (e.g. one whose store vanished) is no longer left below the new one, and one back leaves the app. - The PGP keys screen's import FAB carries its content description itself; M3 cleared the icon's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'app/src/test/java')
-rw-r--r--app/src/test/java/app/passwordstore/ui/setup/SetupModelTest.kt10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/src/test/java/app/passwordstore/ui/setup/SetupModelTest.kt b/app/src/test/java/app/passwordstore/ui/setup/SetupModelTest.kt
index 53ea80cf..9ccddbd3 100644
--- a/app/src/test/java/app/passwordstore/ui/setup/SetupModelTest.kt
+++ b/app/src/test/java/app/passwordstore/ui/setup/SetupModelTest.kt
@@ -137,4 +137,14 @@ class SetupModelTest {
val folder = File(root, "folder").apply { File(this, ".gpg-id").mkdirs() }
assertNull(readGpgId(folder))
}
+
+ @Test
+ fun createdForMatchesOnlyTheChosenKeysGpgId() {
+ val key = PGPIdentifier.fromString("0xf8993a789cdfb014") as PGPIdentifier.KeyId
+ assertEquals(false, createdFor(root, key))
+ File(root, ".gpg-id").writeText(gpgIdText(listOf(key)))
+ assertEquals(true, createdFor(root, key))
+ File(root, ".gpg-id").writeText("F8993A789CDFB014\nB950AE2813841585\n")
+ assertEquals(false, createdFor(root, key))
+ }
}