Repository navigation
feat: pair clients with a code shown to the operator - #2
Merged
Merged
Conversation
avpbynf
force-pushed
the
feat/pair-clients
branch
from
October 2, 2026 10:34
9ce821e to
caa53cd
Compare
A desktop client can get a token by typing a 6-digit code that only the operator sees, instead of someone copying a token across.
avpbynf
force-pushed
the
feat/pair-clients
branch
from
October 2, 2026 17:09
caa53cd to
e2812e5
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.
What changes
A Talk client can get a token by pairing instead of having one pasted into it.
POST /pairing/requestopens a request and the server generates a 6-digit code that only its operator sees, in the log at WARNING and under "Pairing Requests" in the admin dashboard.POST /pairing/confirmwith that code mints a token named<client name> (paired). The mDNS record sayspairing=1orpairing=0.Stacked on #1: its commits sit below this one.
Why it was not already like that
New. The one thing worth reading closely is how guessing is bounded. Codes live two minutes and five wrong tries drop a request, but that alone bounds nothing, since a dropped request frees its slot and a new one costs nothing: looping request plus five guesses found a code within hours. So ten wrong codes in total, across every request, turn pairing off until the server restarts, which leaves a chance in a hundred thousand. A machine also holds one request at a time, so one machine cannot fill the five slots and keep everyone else out.
Pairing mints tokens without an administrator present, so it stays off while
ADMIN_TOKENis empty.What proves it
ruff,mypyclean, 144 tests green: the full flow mints a token that works on/v1/models, attempts and expiry, the pending cap, one request per machine, the global lock, the code never in a response, the admin listing behind the admin token.What it leaves owing
Once locked, only a restart turns pairing back on. An admin button to unlock would be kinder, and can come later.