Repository navigation
Conversation
A remote client no longer stores a copy of the machine's token. It pairs once with a code a person reads from `codework service pair`, and gets a session only it holds. - `POST /pair` exchanges a one-time code (10 minutes) for a session token. The machine keeps a hash of it in <home>/devices.json. - `POST /ticket` takes the session token in Authorization and answers a ticket that opens one socket within 60 seconds. A session unused for 30 days is refused. - `codework service devices` lists devices; `codework service revoke` removes one and closes its open sockets. - The home's token is made per server start again and is accepted from loopback only. <home>/token is gone. - A device may call everything a local caller may, except pairing and device management. - The app server adds a remote server with a pairing code, takes a ticket for every connection, and reports a lost pairing as `paired: false`. - `--server` now defaults to the home's server, and a server bound to every address answers to this computer's loopback names. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
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.
Stacked on the CLI error fixes, which are stacked on #173.
Why
A remote client stored a copy of the machine's token: one long-lived secret for every client of a home, with no way to cut off one device. Now each client pairs once and holds its own session.
How it works
codework service pairprints a one-time code (XXXXX-XXXXX, 10 minutes).POST /pairwith{ code, label }answers{ id, token }. The machine stores a hash of the token in<home>/devices.json(mode 0600).POST /ticketwithAuthorization: Bearer <token>answers a ticket: single use, 60 seconds. A session unused for 30 days is refused.codework service deviceslists devices.codework service revoke <id>removes one and closes its open sockets.What else changes
<home>/tokenis gone.Server.Forbidden.{ url, code }. Every connection takes a fresh ticket. A lost pairing shows aspaired: false, separate from unreachable, and is not retried. The session token never reaches the renderer.--serverdefaults to the home's server instead of port 7433. A server bound to every address answers to this computer's loopback names.Breaking
0.0.0.0works.Verified
vp check,vp run typecheck, knip exportspackages/codeworktests, in parallel, three runsapps/servernon-live suiteAlso driven by hand in the Electron app with the CLI and three OrbStack machines: a real prompt locally; a server restart and recovery; pairing all three machines; a wrong code; sessions from each machine reaching the app; a follow-up sent to a machine from the app; a machine restart and reconnect; a revoke, and pairing again.
Known gaps
ws://to a non-loopback host.metrics.simulation.live.test.tswas updated for pairing but not run.devices.json, which the fixture keeps.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.