summaryrefslogtreecommitdiff
path: root/source/storage
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-19 22:28:09 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-19 22:28:09 +0200
commit35042ff04ffc50e55ff59a385849442be4429d6b (patch)
tree3c142dd9bfb995b7aacdf39128e591dd3f9370de /source/storage
parent871aba901501302586895d266fe4569665d9fe70 (diff)
feat(ui): add the list, OTP detail, PIN entry, menu, info screens and glance
List with live codes and countdowns, adaptive rows and lazy headers; OTP detail with ring or bar, next code and HOTP next; PIN keypad or button selector with create, unlock, change, lockout display and pending promotion; native menu; glance with the entry count; self-test after the first frame; option properties with defaults. Codes are computed one per timer event, apart from drawing, for the watchdog. A UI-test build (uitest.jungle) starts with fake entries, PIN 123456 and a frozen clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/storage')
-rw-r--r--source/storage/Vault.mc14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/storage/Vault.mc b/source/storage/Vault.mc
index 0bb3cbc..95f77c9 100644
--- a/source/storage/Vault.mc
+++ b/source/storage/Vault.mc
@@ -352,7 +352,7 @@ class Vault {
private function newId() as String {
var id = "";
do {
- var random = Cryptography.randomBytes(Entry.ID_LENGTH);
+ var random = TestMode.ON ? testIdBytes() : Cryptography.randomBytes(Entry.ID_LENGTH);
var alphabetSize = Entry.ID_ALPHABET.length();
id = "";
for (var i = 0; i < Entry.ID_LENGTH; i++) {
@@ -364,6 +364,18 @@ class Vault {
return id;
}
+ // UI-test build only: predictable IDs, so screenshots are reproducible.
+ private var _testIdCounter as Number = 0;
+
+ private function testIdBytes() as ByteArray {
+ _testIdCounter++;
+ var out = new [Entry.ID_LENGTH]b;
+ for (var i = 0; i < Entry.ID_LENGTH; i++) {
+ out[i] = (_testIdCounter * (7 + i * 3) + i * 11) & 0xFF;
+ }
+ return out;
+ }
+
// Store a value, turning a store-full error into VaultError FULL.
private function write(key as String, value as Application.Storage.ValueType) as Void {
try {