Skip to content

Add native Android and iOS apps with a shared Rust client core - #57

Open
vishakh wants to merge 16 commits into
mainfrom
codex/native-clients-shared-rust
Open

vishakh wants to merge 16 commits into
mainfrom
codex/native-clients-shared-rust

Conversation

@vishakh

@vishakh vishakh commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Explorer's client logic previously lived in the web app. This change adds native Kotlin/Compose Android and SwiftUI iOS clients and moves portable client behavior into one Rust library, consumed through WASM on Web and UniFFI on mobile.

Changes

  • Share genotype detection/parsing, gzip decoding, variant matching and scoring, evidence interpretation, result import/export, report selection/prompts, provider configuration, and portable-vault encryption in explorer-core.
  • Add native browsing, DNA import, individual and Run All analysis, results, chat/reports, encrypted vaults, settings, and account flows. A system-browser bridge handles Dynamic sign-in. Mobile payments use StoreKit 2 and Google Play Billing 8.
  • Add authenticated store purchase verification, immutable account binding, an encrypted-proof PostgreSQL ledger, atomic report-credit consumption, native restore/management, and verified Apple/Google notifications. Stablecoin payments are explicitly Web-only; native external checkout links and generic promo-code unlocking are removed.
  • Preserve existing web APIs through TypeScript adapters; add mobile sign-in and portable-vault routes.
  • Automatically persist native genotype data, saved study results and customization using authenticated, atomic encryption. iOS wraps the data key with a user-presence-protected Secure Enclave key; Android uses an authentication-required Keystore key with StrongBox preferred and actual protection-level disclosure. Lock/background clears the decrypted session; files are excluded from OS backup.
  • Add opt-in ciphertext-only native sync with Dynamic account authentication, compare-and-swap revisions, unchanged-genome transfer deduplication and explicit conflict recovery. Each device keeps its own non-exportable wrapping key. A shared Argon2id-protected recovery key enables new-device recovery and v2 portable transfer across Web, iOS and Android. Separate derived keys protect state, genotype data and record authentication.
  • Fix issues found during full-file testing: retain CI/evidence metadata in the Run All API so beta effects are classified correctly, transfer native DNA imports as binary buffers, and preserve in-memory data when navigating to the web portable vault.
  • Accelerate Run All with a bounded native Rayon pool, browser WASM workers, bulk IndexedDB reads, indexed genotype/result lookups and three concurrent 5,000-row native catalog requests. Preserve result/order parity and signed beta effects.
  • Add platform build scripts, Android/iOS/browser CI, pinned public-sample validation, and development documentation.
  • Align both native apps with the Monadic DNA Vault visual system: original branding/illustrations, Space Grotesk and Garamond fonts, color-space-aware palettes, rounded cards and capsule buttons. Canonical assets and a native-resource generator keep the apps aligned; source revision/checksums and font licenses are included in design/vault/.

Validation

  • Next.js production build, TypeScript, ESLint, 58 WASM regression tests, five native Rust contract tests and a numeric parser regression test passed.

  • Android APK builds and lint passed; three Kotlin/native-binding tests and four Android 8/API 26 emulator tests passed, including the Web-only stablecoin notice.

  • A checksum-pinned, publicly volunteered 23andMe file imported 929,696 variants. Web and Android produced the same 142 matches against a frozen 1,000-study GWAS sample: 138 beta effects and four odds ratios. Every checked SNP, genotype, effect type, direction, and score matched an independent Python calculation.

  • An onboarding test verifies shared-scorer parity across a 2 MiB UTF-8 boundary, CRLF, an unterminated final record, existing results and result limits.

  • Three encrypted sync tests passed against PostgreSQL, covering concurrent creation/update, delta reconstruction, account isolation, stale deletes and authentication/size rejection. Independent Node Argon2id/AES-GCM/HMAC decoding verifies the portable format; native file tests cover restart, recovery, tampering and encrypted updates between two stores.

  • Nine store billing tests passed, including forged Apple assertions, wrong account/SKU/environment, pending/refunded states, encrypted proof storage, replay and concurrent credit consumption against PostgreSQL.

  • Verified real backend metadata for all 1,000 records, Web TSV export, and independently decrypted the full Web portable vault after navigation.

  • The iOS app built in macOS CI and all six simulator XCTest tests passed: native bindings, complete public-sample scoring, app file import, bundled Vault fonts/artwork, and SwiftUI rendering. Android builds, lint, and both emulator UI tests also passed after restyling.

  • Native visual review and screenshots document the Vault alignment. Updated iOS snapshots confirm the home heading wraps fully and the result card renders correctly.

  • Performance verification: the same 20,000-study/4,000-match WASM benchmark improved from 840–859 ms to 159 ms (about 5.3×). Chromium analyzed 100,000 cached fixture rows in 2.818 s using four workers; all 14,200 results matched the independent reference. This expanded catalog repeats the pinned 1,000-study fixture with distinct IDs. See benchmarks and reproduction. Timings depend on hardware/cache/network.

Review notes

This is a substantial cross-platform refactor. Native layouts differ from Web. Web retains Stripe and wallet payments; mobile uses the platform stores. Store products and credentials are not yet configured. Follow mobile billing setup to create the four product IDs, apply the database migration, configure server credentials/notifications, and perform Sandbox/Play internal-track purchase testing. Billing is disabled by default. Encrypted sync also defaults off: apply migration 002 using npm run vault:migrate, then configure VAULT_SYNC_ENABLED=true. Web currently exchanges encrypted portable files; automatic cloud sync is implemented in native apps. Physical-device biometric/Secure Enclave/StrongBox checks, lost-key/passcode-removal recovery and deployment verification remain before release. See secure storage and sync. Real account login, provider requests, purchases, signing, and store distribution still need service/device verification. The existing parser excludes internal IDs and single-allele calls; those exclusions are documented. Raw public DNA, credentials, and generated binaries/bindings are not committed.

See client architecture and build instructions and public sample validation for the feature scope, provenance, limitations, and reproduction commands.

Latest verification: Web/Rust/TypeScript/browser CI, Android/iOS CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant