Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / e2ee-p2p / AGENTS.md
| 1 | # AGENTS.md — library/e2ee-p2p/ (':library:e2ee-p2p') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `library/e2ee-p2p/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | - Gradle: :library:e2ee-p2p / dir: library/e2ee-p2p/ |
| 6 | - Package roots present: (E2EE + P2P primitives — `com.vayunmathur.e2ee` package) |
| 7 | - Entry files: E2ee.kt + PqcIdentity.kt (no MainActivity/Route — library) |
| 8 | - Deps: (none — Rust PQC core via JNI) |
| 9 | - Metadata: metadata_data/library-e2ee-p2p.md (absent — libraries have none by design) |
| 10 | - Rust: yes / screenshotTest: no |
| 11 | |
| 12 | ## Overview |
| 13 | **Purpose:** End-to-end encryption + peer-to-peer primitives — PQC identity keys, AES content keys, safety numbers, invite fingerprints. Powers everysync vaults, voxels multiplayer, backup crypto. Relay/server sees ciphertext only. |
| 14 | **How to use:** Identities via `PqcIdentity` (Rust `PqcNative`); content via `E2ee` + `E2eeKeyStore`; verify contacts with `SecurityCode`/`InviteFingerprint`. `PqcIdentity.loadOrCreate` uses a persisted key set only when it is complete and each private half verifies against its public half; an incomplete or mismatched set is regenerated wholesale. |
| 15 | **Entry points:** `E2ee.kt` → `PqcIdentity.kt` → `PqcNative.kt` (Rust bridge). |
| 16 | **Gotchas:** Crypto changes need adversarial review; identity/key loss is unrecoverable by design — recovery flows (BIP-39 in backup) live in consumers, not here. Builds arm64 + armeabi-v7a by default; `-PemulatorAbi=x86_64` additionally builds x86_64 for emulator runs of consumers. |
| 17 | |
| 18 | ## Key files |
| 19 | - com/vayunmathur/e2ee/E2ee.kt |
| 20 | - com/vayunmathur/e2ee/E2eeKeyStore.kt |
| 21 | - com/vayunmathur/e2ee/PqcIdentity.kt |
| 22 | - com/vayunmathur/e2ee/Pqc.kt |
| 23 | - com/vayunmathur/e2ee/PqcNative.kt — Rust bridge |
| 24 | - com/vayunmathur/e2ee/SecurityCode.kt |
| 25 | - com/vayunmathur/e2ee/InviteFingerprint.kt |
| 26 | - com/vayunmathur/e2ee/Hkdf.kt — HKDF-SHA256 key derivation |
| 27 | |
| 28 | ## Verify (this module only) |
| 29 | ``` |
| 30 | ./gradlew :library:e2ee-p2p:compileDevKotlin |
| 31 | ./gradlew :library:e2ee-p2p:lint |
| 32 | ``` |