Repository navigation
feat(messaging): per-device person messaging credentials (0082) - #242
agent-relay-code[bot] wants to merge 9 commits into
Conversation
Each signed-in device gets its own Relaycast device token for the person's agent instead of the agent's shared token. Tokens are stored encrypted in person_device_credentials (migration 0080), bound to the sign-in session, probed on every serve, renewed inside one hour of expiry and revoked when the sign-in ends. Co-Authored-By: Claude <noreply@anthropic.com>
…into feat/person-device-credentials
…e the device Relaycast returns, bound the sign-out revoke - A sign-in row deleted while its device token is being minted no longer fails the save: the token is recorded revoked with no sign-in, the request answers 401 and the token is revoked upstream or by the sweep. - The credential body is read like the hosted route: a null or absent refusedTokenSha256 is no report and other keys are ignored. - The device served and stored is the one in Relaycast's mint answer; an answer naming another device id or kind is refused. - Sign-out waits at most 5 seconds for the upstream device-token revoke. - Tests no longer assume a device token prefix. - Schema manifest regenerated for migration 0080. Co-Authored-By: Claude <noreply@anthropic.com>
…into feat/person-device-credentials
Another open change uses 0080. Schema manifest regenerated. Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Local checks, run one at a time under the host's memory guard. On 81048b1 (the content of the pushed head before the migration was renumbered): typecheck clean; On c23ea09 (pushed head; only the migration file name, two text mentions and the manifest differ): Not run locally: the full suite. CI on this head is the complete run. |
|
Contract re-check: the upstream device-token route now has an accepted head. I compared it with the head this PR was written against. The mint request and its Exact-head CI on c23ea09 is green (both required jobs). This PR still carries |
Main took 0081 for another table. The migration file is renamed, the identity doc names 0082 and the verifier schema manifest is regenerated through the synthetic PostgreSQL 15 harness. Co-Authored-By: Claude <noreply@anthropic.com>
CHANGELOG.md keeps both sides. Co-Authored-By: Claude <noreply@anthropic.com>
…n-device-credentials CHANGELOG conflict only: both Unreleased entries kept. Co-Authored-By: Claude <noreply@anthropic.com>
…ntials CHANGELOG conflict only: both Unreleased entries kept, main wording of the session summaries bullet. Co-Authored-By: Claude <noreply@anthropic.com>
What
POST /api/v1/workspaces/{id}/messaging/identity/credentialnow gives each signed-in device its own Relaycast device token for the person's agent, instead of the agent's shared token. This is the relay-control side of the per-device person messaging credential that the hosted service has; one client works against both.webdevice. A bearer sign-in is its owndesktoporclidevice, with an id derived from the session. Device fields in the request body are ignored.POST /v1/agents/{name}/device-tokenswith the workspace key, 12 hour TTL, expectedagent_id. The device served and stored is the one in Relaycast's answer (it cleans the name); an answer naming another agent, device id or kind is502.person_device_credentials(migration 0082), tokens encrypted, one row per workspace, person and device. Rows are deleted with their sign-in row.{"refusedTokenSha256": "<64 lowercase hex>"}forces a re-mint when it matches the stored token, at most once per device per 30 seconds (429 rate_limited). Null or absent is no report; other keys are ignored; invalid JSON, a non-object or a malformed hash is400.401(bearer) or403(web) and the minted token is revoked upstream. A sign-in row deleted mid-mint leaves the token recorded, revoked, for the same upstream revoke.404 not_found"Route not found" answer, with the agent confirmed by lookup) the shared token is served in the old shape and the fallback is logged.403 handoff_not_exchanged/403 handoff_not_capable. A gate-only install mints no device token.Details:
docs/identity.md, "Person messaging credential".Not final
429 rate_limitedhere also sendsRetry-After; the hosted route sends none. Clients must not depend on it.403 device_revokedexists for client parity. No Control route leaves a row in that state today.Differences from the shared token that clients see
deviceandexpiresAt.Checks
test/person-device-credentials.test.ts,test/messaging.test.ts,test/desktop-mcp-credentials.test.ts,test/app.test.ts,test/admin.test.ts(results in the first comment).Hold
merge-train:hold: the upstream route is not final, and another open PR also adds a migration; whichever lands second keeps its own number only if they still differ.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
The messaging credential endpoint now mints each signed-in device its own 12-hour Relaycast device token for the person's agent, instead of serving the agent's shared token. The device comes from the server-side session only; device fields in the request body are ignored.
Minting and storage
person_device_credentials(migration 0082), re-minted within an hour of expiry or when refused, and the response gainsdeviceandexpiresAt.Revocation and scope
Written for commit 795edd2. Summary will update on new commits.