aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/test/java/mygram
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-22 12:04:10 +0200
committerDanilo M. <danix@danix.xyz>2026-10-22 12:04:10 +0200
commit48b44a6e27b87ee8bf5340a8d7ff37afaf04b7f9 (patch)
tree1eb779b880a78bda3af7bed4eb93a43dafd288bc /app/src/test/java/mygram
parenta605449390de7737e718e6d10574e5581cf757e3 (diff)
downloadmygram-droid-48b44a6e27b87ee8bf5340a8d7ff37afaf04b7f9.tar.gz
mygram-droid-48b44a6e27b87ee8bf5340a8d7ff37afaf04b7f9.zip
Optional app PIN, settings header, pink selection ring
- A PIN (4 to 8 digits, salted SHA-256 in prefs) set in Settings shows a logo splash with a PIN prompt at start and whenever the app returns after leaving the screen; Back there leaves the app. - Settings gets the back-arrow header shared with the folder grid (Ui.header) and scrolls, since the PIN fields overflow the screen. - Tile and list focus rings use the icon pink. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'app/src/test/java/mygram')
-rw-r--r--app/src/test/java/mygram/droid/LogicTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/src/test/java/mygram/droid/LogicTest.java b/app/src/test/java/mygram/droid/LogicTest.java
index e807725..6fb45aa 100644
--- a/app/src/test/java/mygram/droid/LogicTest.java
+++ b/app/src/test/java/mygram/droid/LogicTest.java
@@ -107,4 +107,23 @@ public class LogicTest {
assertFalse(d.press(2000));
assertFalse("301 ms is too slow", d.press(2301));
}
+
+ @Test
+ public void validatesPins() {
+ assertTrue(Prefs.validPin("1234"));
+ assertTrue(Prefs.validPin("12345678"));
+ assertFalse(Prefs.validPin("123"));
+ assertFalse(Prefs.validPin("123456789"));
+ assertFalse(Prefs.validPin("12a4"));
+ assertFalse(Prefs.validPin(""));
+ }
+
+ @Test
+ public void hashesPinsWithSalt() {
+ String h = Prefs.hash("00ff", "1234");
+ assertEquals(64, h.length());
+ assertEquals(h, Prefs.hash("00ff", "1234"));
+ assertFalse(h.equals(Prefs.hash("00fe", "1234")));
+ assertFalse(h.equals(Prefs.hash("00ff", "1235")));
+ }
}