8000 feat(sync): sync with the group relay as one more peer by ahmet-cetinkaya · Pull Request #350 · ahmet-cetinkaya/whph · GitHub
[go: up one dir, main page]

Skip to content

feat(sync): sync with the group relay as one more peer - #350

Open
ahmet-cetinkaya wants to merge 5 commits into
mainfrom
feat/sync-relay-client
Open

ahmet-cetinkaya wants to merge 5 commits into
mainfrom
feat/sync-relay-client

Conversation

@ahmet-cetinkaya
@ahmet-cetinkaya ahmet-cetinkaya commented Dec 3, 2026 •
Copy link
Copy Markdown
Owner

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.
  • App: relay config (url, token, fingerprint) kept in the sync key file; the engine adds the relay as a peer, tracks lost ranges until a LAN session covers them, and applies the relay's restore switch once.
  • Removing the relay, or being removed from the group, clears the relay config and its status.
  • The relay loopback tests moved into whph_sync_relay.

Testing

  • Core and relay package tests, including loopback tests against a real relay.
  • Full sync_acceptance suite on c81b4479b (138 tests) passed; the last commit, bebe1baaf, adds a small removed-device test and was not re-run in the full suite.

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
ahmet-cetinkaya changed the base branch from feat/sync-relay-server to main December 3, 2026 19:45
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

0