Repository navigation
feat(#11281): bring up the wifi hotspot and pairing - #443
Open
paulpascal wants to merge 29 commits into
Open
paulpascal wants to merge 29 commits into
paulpascal wants to merge 29 commits into
Conversation
5 of 7 tasks
paulpascal
force-pushed
the
11281-wifi-hotspot
branch
from
September 23, 2026 00:09
3f44075 to
17d0b17
Compare
paulpascal
force-pushed
the
11281-wifi-hotspot
branch
from
October 10, 2026 20:52
c81e8d1 to
e15d0fe
Compare
…he scanner a way out
paulpascal
force-pushed
the
11281-wifi-hotspot
branch
from
October 10, 2026 22:50
e15d0fe to
2b23263
Compare
paulpascal
marked this pull request as ready for review
October 11, 2026 13:49
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 #11281 (android half). The webapp half is medic/cht-core#11450.
Brings up a local-only hotspot and a local server behind it, so two phones can pair with no network.
The host starts a
LocalOnlyHotspotand serves over TLS, with a key made for the session in the Android keystore. The QR carries the ssid, password, ip, port, a timestamp and the fingerprint of the host's public key. The peer scans it, joins, and checks the host against that fingerprint before pairing counts as done, so a network that only has the right name is not enough.We pin the public key, not the whole certificate: the keystore can hand back different certificate bytes than the TLS stack presents for the same key, and only the key proves who the host is.
A platform limit shapes this.
LocalOnlyHotspotneeds API 26 while our minSdk is 21, so hosting is gated at 26 and reported throughoffline_sync_host_available(), likemrdt_available()andsms_available(). Joining works on everything we support:WifiNetworkSpecifierfrom API 29, a saved network below it.Before hosting, the session key self-tests with a real loopback handshake, so a device that cannot serve TLS from the keystore fails right away with a code instead of later at an odd moment.
Everything sent back to the webapp is a stable code, never a sentence, and every code has a key in cht-core in all five languages. The 7 bridge methods keep their
snake_casenames (the webapp calls them by that string), so they carry@SuppressWarnings("java:S100"). Happy to switch to a project exclusion if you prefer.If the system stops the hotspot, the server goes down with it and the webapp is told (
hotspot_stopped); a peer that loses the network reportsnetwork_lost. Keeping the session alive while the app is in the background (a foreground service) comes with #11282, where there is a transfer to protect.