Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / passwords / AGENTS.md
| 1 | # AGENTS.md — passwords/ (':passwords') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `passwords/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install passwords (dev by default)._ |
| 6 | <!-- last-reviewed: 2026-10-16 --> |
| 7 | - Gradle: :passwords / dir: passwords/ |
| 8 | - Package roots present: ui, data, domain, platform, sync |
| 9 | - Entry files: MainActivity.kt, Route.kt, Navigation.kt |
| 10 | - Deps: :library:biometric, :library:room, :library:network |
| 11 | - Metadata: metadata_data/passwords.md (present) |
| 12 | - Rust: yes / screenshotTest: yes |
| 13 | |
| 14 | ## Overview |
| 15 | **Purpose:** Offline password manager + passkey provider + autofill service + FIDO caBLE security key, with KDBX-file sync. Vault encrypts behind biometric keys. |
| 16 | **Key features:** |
| 17 | - Passwords + TOTP with domain-match fill; imports from Bitwarden/Chrome/Firefox/LastPass/1Password/Dashlane |
| 18 | - Passkeys as an Android credential provider (`PasskeyCredentialService`, `PasskeyEntries`); autofill via `PasswordAutofillService` |
| 19 | - KDBX sync to a user-chosen file (`KdbxSyncEngine` + scheduler/worker over the Rust KDBX core); caBLE tunnel turns the phone into a desktop security key (only network use) |
| 20 | **Architecture / data-flow:** `ui/` vault + passkey + settings → `platform/PasswordsViewModel` → `data/PasswordRepository` over SQLCipher Room (`Password`/`Passkey`/`SyncSnapshot`); `domain/` holds pure credential logic (CBOR, merge, TOTP, domain-match); composition stays locked (`MaFragmentActivity`, `autoSetContent=false`) until the biometric gate passes; everysync relays vault snapshots via `sync/EntryMapper`. |
| 21 | **Entry points + reading order:** `Route` → `MainActivity.kt` (biometric gate first) → `Navigation.kt` → `platform/PasswordsViewModel.kt` → `data/PasswordRepository.kt` → `sync/KdbxSyncEngine.kt`. |
| 22 | **Gotchas:** |
| 23 | - Biometric-gated `MaFragmentActivity` pattern (shared with photos): never render vault content before unlock succeeds |
| 24 | - caBLE is a full FIDO stack (`platform/cable/` Noise/P-256/CTAP) — touch it only with the spec beside you |
| 25 | - KDBX crypto runs in Rust (`util/KdbxNative`); Kotlin side is orchestration only |
| 26 | |
| 27 | ## Key files |
| 28 | ### Root — entry + navigation |
| 29 | - com/vayunmathur/passwords/MainActivity.kt — biometric gate before composition |
| 30 | - com/vayunmathur/passwords/Navigation.kt |
| 31 | - com/vayunmathur/passwords/Route.kt |
| 32 | ### data/ — encrypted Room vault |
| 33 | - com/vayunmathur/passwords/data/PasswordDatabase.kt |
| 34 | - com/vayunmathur/passwords/data/PasswordRepository.kt |
| 35 | - com/vayunmathur/passwords/data/Password.kt |
| 36 | - com/vayunmathur/passwords/data/Passkey.kt |
| 37 | - com/vayunmathur/passwords/data/PasskeyStore.kt |
| 38 | - com/vayunmathur/passwords/data/Converters.kt |
| 39 | - com/vayunmathur/passwords/data/SyncSnapshot.kt |
| 40 | - com/vayunmathur/passwords/data/SyncSnapshotDao.kt |
| 41 | ### domain/ — pure credential logic (no Android) |
| 42 | - com/vayunmathur/passwords/domain/CredentialMerge.kt |
| 43 | - com/vayunmathur/passwords/domain/DomainMatch.kt |
| 44 | - com/vayunmathur/passwords/domain/TOTP.kt |
| 45 | - com/vayunmathur/passwords/domain/Cbor.kt |
| 46 | - com/vayunmathur/passwords/domain/ImportSource.kt |
| 47 | - com/vayunmathur/passwords/domain/PasskeyLink.kt |
| 48 | ### platform/ — ViewModel, autofill, passkeys, backup |
| 49 | - com/vayunmathur/passwords/platform/PasswordsViewModel.kt |
| 50 | - com/vayunmathur/passwords/platform/PasswordsUiContract.kt |
| 51 | - com/vayunmathur/passwords/platform/PasswordAutofillService.kt |
| 52 | - com/vayunmathur/passwords/platform/PasskeyCredentialService.kt |
| 53 | - com/vayunmathur/passwords/platform/PasskeyEntries.kt |
| 54 | - com/vayunmathur/passwords/platform/PasskeyUtils.kt |
| 55 | - com/vayunmathur/passwords/platform/AppBackupAgent.kt |
| 56 | - com/vayunmathur/passwords/platform/KdbxBackupFormat.kt |
| 57 | ### platform/cable/ — FIDO caBLE security-key stack |
| 58 | - com/vayunmathur/passwords/platform/cable/CableActivity.kt |
| 59 | - com/vayunmathur/passwords/platform/cable/CableService.kt |
| 60 | - com/vayunmathur/passwords/platform/cable/CableSession.kt |
| 61 | - com/vayunmathur/passwords/platform/cable/CableTunnel.kt |
| 62 | - com/vayunmathur/passwords/platform/cable/CableAdvertiser.kt |
| 63 | - com/vayunmathur/passwords/platform/cable/CableQr.kt |
| 64 | - com/vayunmathur/passwords/platform/cable/CableEid.kt |
| 65 | - com/vayunmathur/passwords/platform/cable/CableKeys.kt |
| 66 | - com/vayunmathur/passwords/platform/cable/Crypter.kt |
| 67 | - com/vayunmathur/passwords/platform/cable/Noise.kt |
| 68 | - com/vayunmathur/passwords/platform/cable/P256.kt |
| 69 | - com/vayunmathur/passwords/platform/cable/Ctap.kt |
| 70 | - com/vayunmathur/passwords/platform/cable/CtapProcessor.kt |
| 71 | - com/vayunmathur/passwords/platform/cable/CborReader.kt |
| 72 | - com/vayunmathur/passwords/platform/cable/TunnelDomains.kt |
| 73 | - com/vayunmathur/passwords/platform/cable/WebAuthnAuthenticator.kt |
| 74 | ### sync/ — KDBX file sync + relay mapping |
| 75 | - com/vayunmathur/passwords/sync/KdbxSyncEngine.kt |
| 76 | - com/vayunmathur/passwords/sync/KdbxSyncScheduler.kt |
| 77 | - com/vayunmathur/passwords/sync/KdbxSyncWorker.kt |
| 78 | - com/vayunmathur/passwords/sync/KdbxSyncSettings.kt |
| 79 | - com/vayunmathur/passwords/sync/KdbxPasswordHelper.kt |
| 80 | - com/vayunmathur/passwords/sync/EntryMapper.kt — everysync relay mapping |
| 81 | ### util/ — Rust KDBX bridge |
| 82 | - com/vayunmathur/passwords/util/KdbxNative.kt — JNI bridge, orchestration only in Kotlin |
| 83 | ### ui/ — vault, passkeys, settings |
| 84 | - com/vayunmathur/passwords/ui/PasswordScreen.kt |
| 85 | - com/vayunmathur/passwords/ui/PasswordPage.kt |
| 86 | - com/vayunmathur/passwords/ui/PasswordEditScreen.kt |
| 87 | - com/vayunmathur/passwords/ui/PasswordEditPage.kt |
| 88 | - com/vayunmathur/passwords/ui/PasswordScreenSection.kt |
| 89 | - com/vayunmathur/passwords/ui/PasskeyPage.kt |
| 90 | - com/vayunmathur/passwords/ui/PasskeyAuthActivity.kt |
| 91 | - com/vayunmathur/passwords/ui/PasskeyLinkDialog.kt |
| 92 | - com/vayunmathur/passwords/ui/MenuScreen.kt |
| 93 | - com/vayunmathur/passwords/ui/MenuPage.kt |
| 94 | - com/vayunmathur/passwords/ui/SettingsPage.kt |
| 95 | - com/vayunmathur/passwords/ui/AutofillSettingsActivity.kt |
| 96 | |
| 97 | ## Verify (this module only) |
| 98 | ``` |
| 99 | ./gradlew :passwords:compileDevKotlin |
| 100 | ./gradlew :passwords:lint |
| 101 | ./gradlew :passwords:checkMetadata |
| 102 | ``` |