Repository navigation
feat: bind every machine link to one identity key - #172
Merged
Merged
Conversation
Each home now holds one Ed25519 identity key in machine.json, created inside the existing lock (also for homes connected before this change). At pairing, the identity key signs the new link key's thumbprint; the relay verifies the binding and stores the identity's thumbprint on the pairing and then the link. Links that share identityKeyId, in any workspace, are provably one machine, and the machine list exposes it. Per-link keys stay as they are: a leaked link key still exposes one workspace, and each link keeps its own relay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 #171.
Why
The relay stores one row per workspace link, keyed by a machine id the machine reports itself. So it can't tell that the links in two workspaces belong to the same machine, and two homes can claim the same id with
--machine-id. Multiplayer needs that answer: which workspaces a machine is in, and one machine for an access token to name.What
machine.jsongets anidentity(an Ed25519 key and its RFC 7638 thumbprint), created inside the existing lock. A home connected before this change gets one on its next locked update.{ op: "identity.bind", iat, keyId }, naming the new link key. The pairing request carries that JWS asidentity.identity_key_idon the pairing and copies it onto the link at activation.GET /v1/workspaces/:id/machinesreturnsidentityKeyId.The relay migration is edited in place because #171 isn't merged and nothing is deployed. A local relay database from #171 needs recreating.
Not covered
An exact copy of a home carries the same identity key, so the two copies prove the same identity. Telling them apart needs a startup claim with a generation number, which is separate work.
Tests
identity.json: one home connected to two workspaces shows two different link keys and the sameidentityKeyId. A binding made for another link key and a malformed binding are both refused with 401, and no pairing row is created.vp check,vp run typecheckand knip pass.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.