Skip to content

feat: pair clients with a code shown to the operator - #2

Merged
avpbynf merged 1 commit into
devfrom
feat/pair-clients
Oct 2, 2026
Merged

avpbynf merged 1 commit into
devfrom
feat/pair-clients

Conversation

@avpbynf

@avpbynf avpbynf commented Oct 2, 2026

Copy link
Copy Markdown
Owner

What changes

A Talk client can get a token by pairing instead of having one pasted into it. POST /pairing/request opens 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/confirm with that code mints a token named <client name> (paired). The mDNS record says pairing=1 or pairing=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_TOKEN is empty.

What proves it

  • ruff, mypy clean, 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.
  • Not yet run against a live client, nor the dashboard section opened in a browser.

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.

@avpbynf
avpbynf force-pushed the feat/pair-clients branch from 9ce821e to caa53cd Compare October 2, 2026 10:34
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
avpbynf force-pushed the feat/pair-clients branch from caa53cd to e2812e5 Compare October 2, 2026 17:09
@avpbynf
avpbynf merged commit a6521a7 into dev Oct 2, 2026
5 checks passed
@avpbynf
avpbynf deleted the feat/pair-clients branch October 2, 2026 17:11
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