feat(phase-1/m2.4a): scripted encrypted backup legs — the app round-trips ICDBKP1 envelopes
Phase 1 M2 task 4, desktop half (tools/DESKTOP_PHASE_PLAN.md §4). New
--backup-export-enc <path> + --backup-passphrase <pw> flags drive the
exact calls the RequirePassphrase/Passphrase dialogs make, headlessly.
Verified across two launches on fresh libraries:
run A: import plain(27) → reimport skipped=27 → exported-enc=27 magic ok
run B: preview encrypted=true → imported=27 → wrong-pw preview rejected
→ reimport imported=0 skipped=27
Gotcha found (and honoured): EncryptedBackupCodec zeroes the passphrase
CharArray in BOTH encrypt and decrypt — the array is single-use fuel.
The dialogs already comply (fresh toCharArray() per call); the scripted
block re-derives it via newPw() for the same reason.
Device half (4b: phone re-imports a desktop-made envelope + sees the
dedupe snackbar) follows on Waydroid with the M2 wrap-up.
This commit is contained in:
1 parent
031d8570b4
commit
52ccceb732
2 files changed
+88
-18
No files matched your search
@@ -401,6 +401,31 @@ Full suite green: `backupSmoke` (9 steps incl. dedupe), `assembleDebug`,
|
||||
`:core:data-jvm:smoke`, scripted desktop run (clean exit),
|
||||
`:desktopApp:run --self-test`.
|
||||
|
||||
**M2 task 4 (desktop leg) — encrypted round-trip via the app: DONE.**
|
||||
New scripted flags `--backup-export-enc <path>` + `--backup-passphrase
|
||||
<pw>` drive the passphrase dialogs' exact call chain headlessly:
|
||||
`exportEncrypted` writes a real ICDBKP1 envelope, and importing it back
|
||||
exercises `preview(stream, pw)` → `import(stream, pw)` → wrong-passphrase
|
||||
preview → deduped re-import, in fresh libraries across two launches:
|
||||
|
||||
```
|
||||
run A: plain import 27 → reimport skipped=27 → exported-enc=27 (magic=ICDBKP1 ok)
|
||||
run B: preview encrypted=true → imported=27 → wrong-pw preview=null (rejected)
|
||||
→ reimport imported=0 skipped=27
|
||||
```
|
||||
|
||||
Caught while writing it: `EncryptedBackupCodec` zeroes the passphrase
|
||||
`CharArray` it consumes — **both in `encrypt` AND `decrypt`** — so every
|
||||
call needs a fresh array. The UI already complies (dialogs re-derive
|
||||
`toCharArray()` per call); the scripted block initially reused one array
|
||||
and died on the second decrypt with `AEADBadTagException`. Worth
|
||||
remembering for the phone device pass and any future caller: treat the
|
||||
passphrase array as single-use fuel. The envelope desktop produces is
|
||||
byte-format-identical to the phone's because both sides now compile the
|
||||
same `:core:backup` codec — the remaining proof for task 4 is the
|
||||
on-device leg (Waydroid: phone re-imports a desktop-made encrypted file
|
||||
+ dedupe snackbar), tracked as M2 task 4b.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user