r/madeinrust • u/derekleeth • 22h ago
Majority AI Coded TerminalLynx update: the same Rust core (russh + iroh + SQLite CRDTs) now runs on Android
A couple of weeks ago I shared TerminalLynx, my first Rust project after ~20 years of Python backend work: a local-first SSH/SFTP connection manager that syncs your devices and shared team vaults directly peer-to-peer over iroh (QUIC) with no central server or cloud account.
Today I shipped the 1.3.2 beta (including the first Android APK), and wanted to share the Rust parts that were the most interesting to build since last time:
- Same Rust core on Android (russh, iroh, sqlx/SQLite). The core crate compiled for aarch64-linux-android via Tauri v2's mobile support with almost zero changes to the SSH, SFTP, or sync code. Most of the platform work was around Android's lifecycle: a Kotlin foreground service holds a wake/Wi-Fi lock so the Tokio runtime and active russh sessions aren't killed when you switch apps, plus fighting soft keyboards (especially Samsung's)
- Reaching AndroidKeyStore directly from Rust via jni and ndk-context**. On desktop, the keyring crate stores the device's root secret in the OS keychain. On Android, instead of bouncing through an async Tauri Kotlin plugin, Rust calls java.security.KeyStore and javax.crypto.Cipher (AES/GCM/NoPadding) directly over JNI on the calling thread. Hardware-backed AES-256-GCM (StrongBox where available, otherwise TEE) seals the 64-byte identity secret with the user ID as AAD and writes the sealed blob to disk—so it works synchronously during startup and from any Tokio task.
- Ephemeral peer state alongside a signed CRDT log. Everything durable in TerminalLynx syncs as Ed25519-signed, HLC-stamped operations in an append-only SQLite outbox log. For 1.3.1 I added "Open tabs on your devices" ("what's my desktop got open right now?"). Putting tab churn into the CRDT op log would bloat the log forever and broadcast your personal tabs to teammates. Instead, open tabs travel as a separate ephemeral message type over the already-authenticated
irohQUIC session—only between your own paired devices, never signed into the op log, with only the latest snapshot kept per device. - Fixing multi-NIC mDNS in minutes with [patch.crates-io] I hit a known upstream issue where iroh-mdns-address-lookup only binds to the OS's default multicast interface. On Windows (and macOS/Linux machines with WSL/Hyper-V, Docker, or VPN virtual adapters), the lowest-metric interface is often a virtual NIC, so LAN discovery silently failed. Cargo's [patch.crates-io] made it trivial to vendor iroh-mdns-address-lookup and pass every non-loopback IPv4 interface to swarm-discovery's add_interface_v4 whenever endpoint addresses change, without waiting on an upstream release.
- Offline recovery kits (
argon2+chacha20poly1305+qrcode). Since there's no server to reset your account if your only device dies, the app now generates a recovery kit (encrypted with Argon2id + ChaCha20-Poly1305 and rendered as a printable SVG QR code in pure Rust via theqrcodecrate, no image libraries needed) alongside rolling encrypted backups you can point at a NAS or Syncthing/Nextcloud folder.
Between how painless [patch.crates-io] is, sharing one crate across desktop and Android, and the speed and memory footprint, Rust is seriously making me rethink some Python services I deployed at work this year.
There's a free tier (25 connections, 3 devices) on Windows, macOS, Linux, and now Android (beta APK behind the "Show the latest beta" switch on the download page): TerminalLynx (docs: https://terminallynx.com/docs, changelog: https://terminallynx.com/changelog/).
I probably should have waited on the Android app because I did not realize how much of a challenge that was going to be. Writing enterprise backends and creating connecters between various vendor platforms to allow them to talk to each other is easier than making an Android app work the way you want it to.
Happy to answer any questions!
