Stores: seal sign-in files with an Android Keystore key

credentials.json for GOG, Epic and Amazon is an AES-256-GCM envelope
({"v":1,"alg":"AES/GCM","iv","ct"}) under a non-exportable AndroidKeyStore
key (StrongBox if present, else TEE, no user authentication). StoreAccounts
stays the one layer every reader and writer uses.

A plain file from an earlier build is sealed at start, verified, then
replaced. Without a Keystore the file stays plain (logged once, retried next
start); a file that no longer opens is deleted and the store reads as signed
out.
This commit is contained in:
The412Banner committed 2026-10-09 14:14:46 -04:00
1 parent 38e3fa2a33
commit c248d3e1c4
6 files changed
+326 -8

No files matched your search

+16
View File
@@ -7,6 +7,22 @@ the timeline, then lessons and backlog. Companion to the README (what the app *d
---
## 2026-10-09 - `feat/store-credentials-keystore`: store sign-ins sealed with the Android Keystore
- **What:** `filesDir/stores/<store>/credentials.json` (GOG, Epic, Amazon: tokens, ids, names,
expiry) is now an AES-256-GCM envelope (`{"v":1,"alg":"AES/GCM","iv","ct"}`) under a
non-exportable AndroidKeyStore key (StrongBox if present, else TEE; no user authentication).
`StoreAccounts` is the one layer; `CredentialCipher` holds the envelope and the key.
- **Upgrade:** a plain file is sealed at the first start (verified, then replaced); users stay
signed in. Log: `stores: credentials encrypted <store>`.
- **Fallbacks:** no Keystore - stays plain, logged once, retried next start; a file that will not
open - deleted, signed out (sign-in card), never a crash.
- **Session:** the guest sees the envelope only; it never read the files (the Epic code comes over
the request channel, written beside the launcher and deleted by it).
- **Tests:** `StoreAccountsCipherTest` (round trip, sealed on disk, migration of all three stores,
tampered file, lost key, garbage, no-Keystore fallback then sealed next start, sign-out). Not yet
on a device.
## 2026-10-08 - `feat/private-logs`: every log in app-private storage, shared as one scrubbed zip
- **Where logs live:** `files/logs/` (`LinuxRuntime.logDir`), nothing under `Download/DroidDeck`