feat(core): add a persisted user-principal identity - #168
Merged
Merged
Conversation
Devices have always been issuers; a user has never been one. This adds a keypair scoped to the machine account rather than any one bridge slot, persisted at ~/.agent-comms/user-identity.json, so every bridge process this account runs can mint capability tokens from the same principal regardless of which one happens to be running. Creation races against a concurrent caller with an exclusive file create rather than identity-store.ts's PID-probed lock: this key is never itself a routed mesh peer, so there is no live-collision concern to guard against, only first-write-wins at creation time. Proven end to end with a real mintCapabilityToken call from the principal to a device identity, verified with the principal's own device-id as rootIssuer.
Mearman
marked this pull request as ready for review
September 17, 2026 14:28
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🎉 This PR is included in version 3.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Closes #160
Adds the user principal as a first-class issuer: a keypair scoped to the machine account rather than any one bridge slot, persisted at
~/.agent-comms/user-identity.json, wrapped through the sametoIdentityPortadapter every bridge identity already uses.Unlike a bridge's own per-slot identity, this key is never itself a routed mesh peer, so there's no live-collision concern a PID-probed lock exists to guard against (identity-store.ts's own mechanism). The only race that matters is first-write-wins at creation, handled with an exclusive (
wx) file create instead.Proven end to end with a real
mintCapabilityTokencall from the principal to a device identity, verified with the principal's own device-id asrootIssuer— seesrc/test/user-principal-mints-device-grant.test.ts.Deliberately out of scope, per the parent epic (#159) and its own sub-issue breakdown:
room:member/{ kind: "group" }) is a syntactically valid placeholder only, not the real grant shape Device-to-user membership tokens #161 will define.Test plan
pnpm lintpnpm typecheckpnpm test(792 passed)