Repository navigation
feat(sync): sync with the group relay as one more peer - #350
Open
ahmet-cetinkaya wants to merge 5 commits into
Open
ahmet-cetinkaya wants to merge 5 commits into
ahmet-cetinkaya wants to merge 5 commits into
Conversation
A device can sync with a relay as a pinned, token-bearing peer: Noise XX with the relay static checked before the token is sent, no key handover and no refetch requests, the relay's registry rows taken through the normal verification, a per-session upload budget below the relay caps, and a restore switch the app can forbid. Loopback tests in the relay package run the session against the real relay log.
The invitation carries the fingerprint the relay prints, not the raw key, so the session compares the fingerprint of the key it receives in the handshake.
The relay (url, token, pinned key fingerprint) is kept in the key file next to the epoch keys and cleared when the device leaves its group. The engine adds it to the peers of the group, bounds its session in time, keeps the gaps the relay reports until a LAN session fills them, and allows one restore switch from the relay's vector until a LAN session ran. Acceptance tests run the real relay server over loopback.
…moved Removing the relay now drops the entry in the key file (with the restore-switch flag), the gaps the engine remembers and the status row of the relay peer, so a relay added again starts clean.
… from its group The token belongs to the group the device was removed from. A refresh that finds the device removed now clears the relay entry and rewrites the key file.
ahmet-cetinkaya
force-pushed
the
feat/sync-relay-client
branch
from
December 3, 2026 19:45
bebe1ba to
9328d52
Compare
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.
Summary
Add relay mode to the sync client: the app syncs with the group relay as one more peer, next to LAN peers.
Base
Based on
main(the relay server, #346, is merged).Changes
whph_sync_core: relay mode in the async session. The client pins the relay by the fingerprint of its static key and checks it before sending the token.whph_sync_relay.Testing
sync_acceptancesuite onc81b4479b(138 tests) passed; the last commit,bebe1baaf, adds a small removed-device test and was not re-run in the full suite.