Skip to content

feat(mandates): let an app ask whether a mandate still stands - #36

Merged
fabianzimber merged 2 commits into
mainfrom
feat/mandate-status-rpc
Nov 28, 2026
Merged

fabianzimber merged 2 commits into
mainfrom
feat/mandate-status-rpc

Conversation

@fabianzimber

@fabianzimber fabianzimber commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What & why

An app that let a request through keeps the mandate's id (r.mandate from authorize). When it wants to show that mandate later, for example "signed on the 3rd, stopped on the 9th" next to something the mandate once let through, it had no way to ask stem without a fresh chain and a proof of possession.

MandateGateway.status(id) answers that over the service binding:

const s = await env.MANDATES.status(mandateId);
// { status: "active" | "revoked" | "expired" | "unknown", created_at, expires_at, revoked_at }
  • It says nothing about the person, the purpose or the rights, and writes nothing to the trail.
  • It starts from stem's own list of mandates, so asking about an id nobody issued does not create a Durable Object for it. While the list says active, the mandate's object has the last word, because a stop reaches the object first.
  • It is for display only. A request is still let through by authorize, never by status. There is no HTTP route for it.

The first app to use it will be a public page that checks receipts for generated speech and shows whether the voice owner's mandate still stands.

How to test

  • npm run check: 140 tests pass, typecheck and the dry-run build are clean. Run locally on Node 22, CI runs it on Node 26.
  • New tests in test/mandates.test.ts ("asking whether one still stands"): an active mandate with its dates, an unknown id and malformed ids (no object is created), an expired one, a stop that reached the object but not yet the list, a stop through the account, an empty trail afterwards, and mandates switched off.

No migration, no new binding, no config change.

Checklist

  • npm run check passes
  • New migrations are additive (no edits to applied ones)
  • No secrets, account IDs or personal domains in code/config

An app that let a request through keeps the mandate's id. To show that
mandate later ("signed on the 3rd, stopped on the 9th") it had no way to
ask stem without a fresh chain and proof. MandateGateway.status(id)
answers with the state and the dates, nothing about the person, and
writes nothing to the trail. It starts from stem's list of mandates, so
an id nobody issued does not create a Durable Object.
@sonarqubecloud

Copy link
Copy Markdown

@fabianzimber
fabianzimber merged commit c4a215d into main Nov 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant