fix(tauri): mobile mDNS browse falls back to instance name for node-id (#318) - #320
Merged
Merged
Conversation
#318) Mobile browse parsers (iOS NWBrowser, Android NsdManager) hard-required a `pk` TXT record. Desktop/server nodes advertised via iroh swarm-discovery publish the base32 endpoint id as the DNS-SD *instance name* and emit no `pk` TXT, so mobile silently skipped every desktop-advertised node. Both browse parsers now fall back to the DNS-SD instance name as the node-id when the `pk` TXT/attribute is absent, validating it parses as a canonical iroh endpoint id (52-char lowercase RFC 4648 base32, `a-z`/`2-7`) before accepting. Malformed names are rejected, not crashed on. The `pk`-present path (mobile→mobile, desktop→mobile) is unchanged. Closes #318 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Jul 7, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #318
Problem
Mobile mDNS browse (iOS
NWBrowser, AndroidNsdManager) hard-required apkTXT record to accept a discovered node. Desktop/server nodes advertised via iroh'siroh-mdns-address-lookup(swarm-discovery) publish the node-id as the DNS-SD instance name (lowercase base32 endpoint id) and emit nopkTXT. Result: both mobile browsers silently skipped every desktop-advertised node — a phone could not discover a laptop/server on the same LAN.Fix
Teach both mobile browse parsers to fall back to the DNS-SD instance name as the node-id when the
pkTXT/attribute is absent, after validating it parses as a canonical iroh endpoint id. Thepk-present path is untouched, so mobile→mobile and desktop→mobile discovery (which already rely on thepkTXT set by the mobile advertise path) are unchanged.iOS —
packages/iroh-http-tauri/ios/Sources/IrohHttpPlugin.swifthandleBrowseResultsnow extracts the DNS-SD instance name fromresult.endpointfirst, then resolves the node-id as:pkTXT if present and non-empty → else the instance name if it validates → else skip. AddedisValidEndpointId(_:).Android —
packages/iroh-http-tauri/android/src/main/java/com/iroh/http/IrohHttpPlugin.ktonServiceResolvedresolves the node-id as:pkattribute if present and non-empty → elseresolved.serviceNameif it validates → elsereturn. AddedisValidEndpointId(...).Base32 validation
A node-id is a 32-byte Ed25519 public key encoded as lowercase RFC 4648 base32 without padding (confirmed in
crates/iroh-http-core/src/encoding.rs—base32::Alphabet::Rfc4648Lower { padding: false }, and the same alphabet inpackages/iroh-http-tauri/src/tests.rs). 32 bytes → exactly 52 chars from thea-z/2-7alphabet. Both helpers require length== 52and that every char is ina-zor2-7, rejecting malformed/non-base32 names instead of crashing.Truncation check: the advertise side caps instance names at 63 chars (Swift
args.pk.prefix(63), Kotlinargs.pk.take(63)). A 52-char id is well under 63, so it is never truncated and the fallback always recovers the full id.Verification
npm run ciis green — Rust/JS build, clippy, tauri crate tests (19 + 4 + 1 doc), and tauri permissions all pass. This proves the change did not break the Rust/JS build, the tauri crate, or permissions. (Thetest:tauri:gueststep reportsvitest: command not found, a local-env gap unrelated to this change; the script still exits 0.)npm run ci. There is no Swift/Kotlin unit-test harness in the plugin, so no native test was added. Correctness was reasoned by reading the surrounding native code and matching the exact on-wire encoding.Manual cross-device repro (required before merge)
Desktop→mobile discovery of a node with no
pkTXT:advertiseAPI (iroh swarm-discovery publishes the base32 node-id as the DNS-SD instance name, nopkTXT).mdns_browse_start/ poll. Expect: adiscoveredevent whosenodeIdequals the desktop node's base32 id.nodeIdand confirm the connection succeeds.pkTXT) is still discovered on both platforms.Notes
pkTXT on desktop for symmetry is blocked upstream (0.4.0 discards custom TXT) and tracked under the Mobile iroh peer discovery parity: feed native browse results into an in-process AddressLookup #310 epic — not required here.