Skip to content

feat(core): add a persisted user-principal identity - #168

Merged
Mearman merged 1 commit into
mainfrom
feat/user-principal-issuer
Sep 17, 2026
Merged

Mearman merged 1 commit into
mainfrom
feat/user-principal-issuer

Conversation

@Mearman

@Mearman Mearman commented Sep 17, 2026

Copy link
Copy Markdown
Member

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 same toIdentityPort adapter 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 mintCapabilityToken call from the principal to a device identity, verified with the principal's own device-id as rootIssuer — see src/test/user-principal-mints-device-grant.test.ts.

Deliberately out of scope, per the parent epic (#159) and its own sub-issue breakdown:

Test plan

  • pnpm lint
  • pnpm typecheck
  • pnpm test (792 passed)

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
Mearman marked this pull request as ready for review September 17, 2026 14:28
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-17T14:32:33.090245Z ad8052c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit 9f175eb into main Sep 17, 2026
6 checks passed
@Mearman
Mearman deleted the feat/user-principal-issuer branch September 17, 2026 14:28
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User principal as a first-class issuer

1 participant