018db4819c01536e553b57607060fb44f9cda737
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
59bd6e106b |
feat(phase-1/m4.3c): ViewModels off APPLICATION_KEY; DesktopContainer implements AppGraph
Completes the M4.3 container seam:
* NoteListViewModel + NoteEditorViewModel (UiStates and SharedImage
included) move to commonMain. NoteEditorViewModel had zero android.*
imports; its four withContext(Dispatchers.IO) sites become
withContext(ioDispatcher) — a new internal expect/actual whose ACTUALS
are literally Dispatchers.IO on both targets, so Android behaviour is
byte-identical (invariant §2.1), merely spelled through the seam.
* New commonMain EncryptionBadge/LibraryVerification: the read-only
mirror of :core:data's EncryptionVerification. Required because
:core:data is an androidLibrary invisible to commonMain and must stay
so (invariant §2.3 — objectbox-android vs objectbox-java classpaths).
AppGraph gains encryptionBadge; both containers map the real verifier
result 1:1 at their own seam.
* SettingsViewModel stays in androidMain (SecurityManager, Keystore key
provider, BackupManager Uri IO, CarnetImporter are genuine Android-only
services — the graph was NOT widened to fake them, §9) but its factory
now takes the concrete AppContainer via a new LocalAndroidContainer,
provided alongside LocalAppGraph in IncidoApp. No APPLICATION_KEY /
IncidoApplication reference survives in ANY ViewModel: all six call
sites (drawer, list, editor, settings, pin setup, pin change) build
factories from the graph/container locals at composition time.
* M4.3 exit proof: DesktopContainer : AppGraph — the same face
(noteRepository/settingsRepository/encryptionBadge) the commonMain
ViewModels consume, compiler-checked by :desktopApp building against
:composeApp's jvm target. repository → noteRepository rename.
The stand-in two-pane UI still runs (M4.5 consumes the real screens).
Verification (all green, one suite):
./gradlew assembleDebug :composeApp:compileKotlinJvm :desktopApp:build
→ BUILD SUCCESSFUL
./gradlew :desktopApp:run … --self-test --exit-after 6 → SELFTEST id=1, clean exit
./gradlew :core:data-jvm:smoke → RESULT: M1a PASS
crypto legs (separate processes): leg-A ALL-OK → LEG-B PASS/ALL-OK
git diff '*/objectbox-models/*' → empty
|
||
|
|
6b8db18cdf |
docs(phase-1/m3.4): M3 status + scripted key-envelope legs; plan handed to M4
Closes milestone M3 (DESKTOP_PHASE_PLAN §5). Code (one addition): --key-export / --key-import CLI legs in Main.kt — the SecurityActions menu's exact codec calls, headless. This makes the pending physical-phone leg a one-liner once a Waydroid container is live (recipe recorded in the feasibility doc). Docs: DESKTOP_FEASIBILITY.md gains the M3.1–M3.4 status section with the actual run output (leg A/B, KEYENV logs, 0600 ls lines); plan §1 lists the two crypto legs among the must-stay-green commands; §5 marked DONE; first-actions now point a fresh session at M4 task 1. Exit criteria, per the plan's wording: - encrypted desktop library passes EncryptionVerifier's trial-decrypt sweep: MET (leg A verified=1 failed=0, wrong key -> AEAD failure count, leg B relaunch all-ok). - phone-exported recovery key decrypts on desktop: MET at format level (shared codec source, 84B INCKEY1 envelope, AEADBadTagException on wrong passphrase, byte-identical key into a fresh 0600 file); the physical phone export is FLAGGED pending (Waydroid container FROZEN, start is sudo-gated) with the exact re-run recipe — not assumed done. Verified: ./gradlew assembleDebug, :core:data-jvm:smoke, :spike:data-jvm:run, :desktopApp:run --self-test, and both crypto legs — all green in one final pass (one self-test teardown hang under the compositor, rc=124, clean on immediate rerun — recorded, environmental). |
||
|
|
000f4095cc |
feat(phase-1/m3.3): desktop at-rest encryption — key file, container wiring, security menu
Milestone M3 task 3 (DESKTOP_PHASE_PLAN §5). Three pieces:
1. DesktopKeyProvider — the JVM FieldKeyProvider. The plan's keyring
condition is FAILed honestly: no keyring library is in the catalog
and the candidates are unverified on this stack, so the sanctioned
fallback applies: the 32-byte field key lives in `field.key` inside
the library dir, written via temp+atomic-move with 0600 POSIX perms
(File.setReadable/setWritable fallback for non-POSIX fs). It speaks
the phone's recovery format natively through EncryptedKeyCodec
(importRecoveryKey / exportRecoveryKey — INCKEY1, PBKDF2-200k,
AES-GCM, wrong passphrase throws before anything is written).
Key retention on disable: the sweep decrypts first, then flags
clear, but the key file stays (Android's deleteKey-on-disable is
Keystore-scoped; keeping it lets users re-enable and re-export).
Stated, not silent.
2. DesktopContainer now mirrors AppContainer fully: settings -> cipher
auto-install from snapshot (isEncryptionActive AND key on disk)
BEFORE the repository -> NoteCryptoService -> EncryptionVerifier ->
checkNow at startup. shutdown() cancels appScope.
3. UI: SecurityActions menu (theme cycle + encrypt/decrypt toggle +
recovery-key import/export, incl. Android's overwrite-warning gate)
reusing the backup menu's pickFile/PassphraseDialog (now internal,
parameterized title/extensions). theme_mode drives Material3 via
colorScheme (M3 MaterialTheme has no darkTheme param). dynamic_color
/ use_biometric / block_screenshots are NOT shown — no JVM
equivalent, hide-don't-fake. Window geometry persists to its own
incido_window.preferences_pb (desktop-only state; position left to
KWin).
Verification (scripted legs in Main.kt, --crypto-self-test / --crypto-reopen):
leg A: probe note -> key+cipher+sweep -> verifier trial-decrypt
PASS (verified=1 failed=0) -> transparent repo read -> WRONG KEY
REJECTED via AEAD tag -> INCKEY1 envelope 84 bytes, wrong-pw
rejected, key byte-match -> LEG-A PASS.
leg B (separate process = real relaunch): settings survived, cipher
auto-installed, sweep all-ok, decrypt sweep reverses it -> PASS.
:desktopApp:run --self-test regression green; assembleDebug green.
ls confirms field.key is -rw------- (0600).
One environmental note: a leg-A run earlier in the session wedged in
XWayland window teardown (never reached exitApplication); the rerun
auto-exited cleanly — same one-off as the M3.2 startup wedge.
|
||
|
|
8db835640e |
feat(phase-1/m3.1): :core:settings — SettingsRepository shared, store injected
Milestone M3 task 1 (DESKTOP_PHASE_PLAN §5): move UserSettings +
SettingsRepository into a plain kotlin("jvm") module so the desktop
build reads/writes the SAME preferences keys and .preferences_pb format
the phone uses. Package name org.incido.compose.data.settings kept, so
the Android diff is file moves + one constructor change.
Seam: SettingsRepository now takes an injected DataStore<Preferences>.
Android supplies the preferencesDataStore(name = "incido_settings")
Context-extension store (new AndroidSettingsStore.kt, moved verbatim);
desktop builds it with PreferenceDataStoreFactory.create(
corruptionHandler = ReplaceFileCorruptionHandler, produceFile) — the
Phase-0 API delta (no Context extension on the multiplatform core
artifact). snapshot() keeps runBlocking for startup-only use.
DesktopContainer grows settingsRepository first, mirroring AppContainer
construction order ahead of M3's cipher install. dynamic_color /
use_biometric / block_screenshots keys ride along but have no desktop
UI — hidden, not faked (M3 exit rule).
Verified: ./gradlew assembleDebug (green; :app needed :core:settings on
its classpath — MainActivity reads userSettingsFlow, same pattern as
:core:domain) + ./gradlew :desktopApp:run --args="--data-dir
/tmp/incido-desktop-smoke --self-test --exit-after 6" (RENDER/SELFTEST
sequence intact) + ./gradlew :core:data-jvm:smoke (green).
|
||
|
|
52ccceb732 |
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.
|
||
|
|
031d8570b4 |
feat(phase-1/m2.3): import dedupe — importing the same file twice adds nothing
Phase 1 M2 task 3 (tools/DESKTOP_PHASE_PLAN.md §4). Logic lives in BackupBridge so both platforms get it through the one bridge: - BackupBridge.import gains skipExisting (default true) and returns ImportSummary(imported, skipped). A note is skipped when the library already holds the key (createdAt, updatedAt, sha256(content)) — the triple the export preserves verbatim, trustworthy only since the M2 import-timestamp fix. Keys are snapshotted BEFORE importing, so two genuinely identical notes inside one file still both import into a fresh library; only a second import of the same file is a no-op. Snapshotted keys include trashed notes. skipExisting=false restores the old additive behaviour (the documented override). - Android: BackupManager.import passes the flag and returns the summary (signature-identical call for SettingsViewModel); its snackbar now reports the skip count. Screen layouts untouched — exit criterion "Android backup screens unchanged" holds. - Desktop: the import confirm dialog swaps its "duplicates persist" warning for a working "Skip notes that are already here" checkbox (default ON); scripted path prints the re-import outcome. - Format unchanged: formatVersion stays 1 (streaming/dedupe-at-format level stays a Phase-2 formatVersion=2 idea). Verification passed: :core:data-jvm:backupSmoke (new step — re-import skipped=27, override added 27, store=54; RESULT M2 round-trip PASS on the real export) + :desktopApp:run --args="--data-dir /tmp/incido-m2t3 --backup-import <export> --backup-export … --exit-after 8" (imported=27 skipped=0 → exported=27 → reimport imported=0 skipped=27, clean exit) + assembleDebug + :core:data-jvm:smoke + :desktopApp:run --self-test — all green; output recorded in DESKTOP_FEASIBILITY.md. Known limitation (by design): attachments are not in the key. |
||
|
|
cf0e74b68d |
feat(phase-1/m2.2): desktop Import/Export — the phone bridge has a UI
Phase 1 M2 task 2 (tools/DESKTOP_PHASE_PLAN.md §4): :desktopApp can now speak the phone's backup format through the extracted bridge. - New BackupActions.kt: top-bar overflow menu (Import from file… / Export plain / Export encrypted). Import = AWT FileDialog -> BackupBridge.preview -> passphrase dialog on INCDBK1 (wrong passphrase stays open for retry) -> BackupPreview confirm dialog -> import. Export = save-picker -> exportPlain / passphrase + exportEncrypted. All heavy bridge calls run on Dispatchers.IO; results via Snackbar. - Same package-level BackupBridge calls Android's BackupManager shim makes — format shared by construction, not reimplementation. Android's PassphraseDialog.kt deliberately NOT ported (M4 moves the real one to common code). - :desktopApp gains implementation(:core:backup). - Scripted headless path for CI: --backup-import/--backup-export drive the identical bridge calls without dialog clicking. Verification passed: :desktopApp:run --args="--data-dir /tmp/... --backup-import <real phone export> --backup-export /tmp/m2t4-exp.json --exit-after 8" (preview 27 / imported 27 / exported 27, clean exit) + :core:data-jvm:backupSmoke on the DESKTOP-written export (all PASS) + python cross-check: notes (createdAt,updatedAt,content) and attachment Base64 identical phone->desktop->phone + assembleDebug + :core:data-jvm:smoke + :desktopApp:run --self-test — all green. Output recorded in DESKTOP_FEASIBILITY.md (incl. one unreproduced first-run exit hang to watch in M5). |
||
|
|
5f45b0921b |
feat(phase-1/m1b): :desktopApp — desktop shell over the real repository
Phase 1 milestone M1b: a Compose Multiplatform window driven by the same
NoteRepositoryImpl the Android app uses, over its own ObjectBox library.
DesktopContainer mirrors AppContainer's construction order (store,
CipherHolder, repository). Owns its library at
$XDG_DATA_HOME/incido — a separate library per machine,
since ObjectBox is single-writer; the backup file (M2)
is the only bridge to the phone. --data-dir opens
another library, e.g. one pulled off a phone.
Main.kt two panes, save-as-you-type with a 400ms debounce,
favourite toggle. Material 3 defaults on purpose: the
app's theme and screens arrive with the M4 composeApp
conversion, which deletes this stand-in.
Verified headlessly (--self-test drives the same repository calls the "+"
button and the star make, --exit-after auto-closes), against a library
previously written by :core:data-jvm:smoke — i.e. a different module's
generated MyObjectBox, same schema:
RENDER notes=0 selected=null first frame (collectAsState initial value)
RENDER notes=1 selected=1 ObjectBox flow delivered
SELFTEST wrote note id=2 write path through the UI's own calls
RENDER notes=2 selected=2 and it came back through the flow
reopen -> RENDER notes=2 persisted
Gotcha recorded in the findings doc: the first composition always sees the
empty initial value of collectAsState, so anything asserting on note counts
must watch the flow rather than the first frame.
Still synthetic: theme + screens. Not wired yet: settings, encryption (M3),
backup bridge (M2), packaging (M5). assembleDebug verified green.
|