Skip to content

Prism id on stitch alone: each app keeps its own device, nothing to deploy - #73

Merged
afflom merged 4 commits into
mainfrom
claude/project-thread-i4vn2z
Nov 14, 2026
Merged

afflom merged 4 commits into
mainfrom
claude/project-thread-i4vn2z

Conversation

@afflom

@afflom afflom commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Sign-in now runs on stitch's Prism id with nothing to deploy beyond the frame (prism/identity/4). It replaces the passkey frame, whose passkey was tied to one device and locked people out. The id page at id.uor.foundation and the registry mailbox from earlier revisions of this PR are gone.

How it works

  • Create a Prism id: createPrism, then stitch's threshold recovery with one paper share, downloaded as a recovery kit (the share plus the log). There's no prompt, password or passkey.
  • Each app origin keeps its own device of the id, in its own IndexedDB, with non-extractable WebCrypto keys.
  • Another app or device joins with stitch's link offer. The signed-in app shows a prism-link: URI. The new one answers on the rendezvous topic and shows six digits, which the person types into the first app.
  • Use a recovery kit: recoverPrism with rotateRecovery. This browser becomes the device, every other device is removed, and a new kit replaces the old one. A kit the devices' shared state shows was already used is refused.
  • Devices / Remove: revokeDevice, which rotates the key. Sign-in first takes in sync messages, so a device removed elsewhere stops signing.
  • Devices meet on stitch's relay through Prism id's createRelayBus (feat(prism-id): relay bus, link QR codes, public log for hosts, refreshing cadence afflom/stitch#2). The frame exports PRISM_RELAY, and the page build puts it and its wss: origin in connect-src, in place of the old frame-src for the accounts origin.

identity/stitch-sync.mjs copies prism-id.js with the stitch modules it imports, each in its own scope, plus the 37 model decisions they call. It is pinned to stitch e3efc6e. The minified copy is 83 KB and is fetched only when the visitor reaches for the account icon.

Tests (npm run test:identity): 16 of 16 pass. That is eight session checks plus the flow in Chromium across two app origins, with an in-memory relay standing in for the real one: create, reload, sign out and back in, keys can't be extracted, a second app joins by link and code (a wrong code is refused), remove a device, recover from the kit, and the old kit is refused.

Still stitch's to define (see identity/PROTOCOL.md):

  • A used kit replayed against its own old log is refused only by devices that have seen the newer recovery.
  • Hosts don't yet hear about revocations from a device that never syncs.
  • The relay keeps messages for 30 minutes.

🤖 Generated with Claude Code

https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T

An account was its first passkey, and a new device joined only by a
signature from a device the owner still had, so a lost or unreachable
device locked its owner out of every Prism app for good.

prism/identity/2 adds recovery keys (Ed25519), which the owner keeps as a
56-character recovery code, and names keys by κ (sha256:<hex> of the
SPKI). A new account's first key is a recovery key: the sign-in page
creates the passkey, starts the account with the recovery key, binds the
passkey with a recovery signature, shows the code once, then asks the
passkey to sign the session. No prompt is added. On any device, "Lost
your device? Use a recovery code" binds that device's passkey with the
code and signs in to the same account. A signed-in account makes a new
code from the panel (Recovery code), which is how accounts made before
this get their first one.

The frame verifies κ key IDs (key/2) and keeps key/1 records valid,
checks recovery bindings as bare Ed25519 signatures, refuses a recovery
key signing a session, and raises the binding chain bound from 5 to 32.
A sign-in page that predates recovery codes says so instead of hanging,
so the frame can ship before the page.

Needs UOR-Foundation/kappa-registry's POST /passkey/recovery deployed
before the identity page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T

afflom commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Keeping this draft for compatibility and lost-device qualification. The current author retains implementation ownership; no duplicate branch has been opened. Review is at f0bda71 with registry #25 at 3396981d and Foundry #186 at 8ea6d8f.

The documented registry→identity→frame rollout breaks mixed versions. New registry registrations return key/2, which old frames reject. Old identity Add device signs a base64url key ID while the new registry verifies sha256:. New identity also cannot work with the old registry's missing recovery endpoint/old bind format. New frame with old identity/registry is a safe initial step, but the registry/identity transition needs compatibility handling, including stale open clients, before deployment.

Please preserve security through the full lost-device journey:

  • makeRecovery adds a code while older codes stay usable; recover adds a passkey without retiring the lost device. Provide explicit, accurately described code/device retirement or replacement, preserving the account and live descendant keys. Backend root revocation is supported by the source, but recovery-first root retirement needs a direct integration test.
  • Run a clean-browser recovery flow against the actual Rust registry, including a legacy key/1 account, fresh recovery-first account, lost-key rejection, old-code retirement, same account ID and usable descendants. identity/dev.mjs explicitly skips registration verification and has no revoke route, so its browser success cannot establish this combined boundary.
  • Update the trust model: JavaScript now handles a bearer recovery seed and signs recovery bindings without biometric approval. The README's hostile-page/biometric claim is no longer true. Preserve accurate disclosure of the existing seven-day session/revocation limitation.

Independent evidence: 18 verifier tests plus seven compatibility/security probes passed. Browser execution here was blocked before tests by Chromium socket() EPERM, so no browser/full acceptance pass is claimed. The live identity script still matches the old base. node identity/publish.mjs builds static files; it does not itself deploy the identity origin. No deployment or real account operation has been performed in this review.

Account recovery restores signing access. It does not restore browser-local project/chat history or a stranded DB3 store. Keep that scope explicit. Please return the updated exact heads and mixed-version/end-to-end evidence for re-review.

Replaces passkeys with stitch's Prism id (afflom/stitch, pinned in
identity/stitch.lock; identity/stitch-sync.mjs copies src/prism-id.js and
the 14 Stitch.PrismId model decisions it calls into identity/prism-id.mjs).

- The Prism id page holds this browser's non-extractable device keys in
  id.uor.foundation's own storage and runs as a window, so every app reaches
  the same device. Creating an id needs no prompt; its recovery code is shown
  once and its escrow goes to the registry mailbox (or a recovery file).
- A session is the id's prism/session/1 action for the app's origin; the
  frame checks it with Prism id's verifyAction before keeping it.
- Devices share their logs as sealed sync messages in the mailbox, so a
  device removed elsewhere stops signing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
@afflom afflom changed the title Never lose a Prism account with a lost device (prism/identity/2) Sign in to every Prism app with a stitch Prism id (prism/identity/3) Nov 13, 2026
… the trust model

Review follow-up for prism/identity/3:
- The Prism id page publishes to /3/ on the accounts origin and the frame
  opens /3/, so the prism/identity/1 page at / keeps serving open apps on
  older frames: registry, page and frame each deploy without breaking
  mixed versions.
- The page lists the id's devices (browsers and recovery codes) with
  Remove (Prism id's revokeDevice); a removed browser stops signing at its
  next sync, a removed code links nothing. Tested end to end in Chromium.
- README: the page's script holds the device keys and handles recovery
  codes in the clear; there is no biometric prompt; sessions last up to
  8 days and removal reaches apps only through the signer's log; recovery
  restores the id, not app data kept in the lost browser.
- dev.mjs and test.mjs take PRISM_REGISTRY to run the browser flow against
  a real kappa-registry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T

afflom commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Thanks. That review was of the passkey design at f0bda71. Since then the stack has moved to stitch's Prism id (prism/identity/3; see the PR description), and I've addressed each point against the new design. Draft status is unchanged.

Exact heads: template a473018, kappa-registry#25 11cb932, foundry#186 40f813d, prism-devrel#6 6b98d67. The frame/ and identity/ copies in Foundry and devrel are byte-identical to the template's. stitch is pinned at 78159ba (stitch#2).

Mixed versions: every step is now additive.

  • The registry branch is back to main for every passkey file. key/2, recovery keys and /passkey/recovery are gone, so deployed frames and the deployed page see exactly prism/identity/1. The only addition is the /prism/topic/ mailbox.
  • The new page publishes to id.uor.foundation/3/ and the new frame opens /3/. The prism/identity/1 page at / keeps serving open apps that still run older frames.
  • So the registry and the page can deploy in either order, and the frame merges last.

Retirement: the page lists every device of the id (browsers and recovery codes), each with Remove. Remove calls stitch's revokeDevice, which also rotates the private key. The Chromium test runs the whole lost-device path:

  1. Create an id.
  2. Recover it on a clean browser with the code. Same id.
  3. Make a new code there.
  4. Remove the lost browser and every code.
  5. The lost browser's next sign-in shows "This device was removed" and signs nothing.
  6. A retired code brings nothing back.

Real registry: PRISM_REGISTRY=<url> npm run test:identity runs the browser flow against a real kappa-server. Run locally against target/debug/kappa-server at 11cb932 with KAPPA_PASSKEY_ORIGINS=http://localhost:8792, the result is 14 pass and 1 skip. The skipped test is the recovery-file test, which needs the in-memory mailbox to be emptied. Against the dev mailbox it's 15/15. The preflight and the identity-origin write policy were exercised for real. Registry tests: 19 unit tests and 4+4 HTTP tests.

Trust model: the README now says the following:

  • The page's script holds the device keys. They are non-extractable but usable, so a hostile page could sign anything the device can.
  • There's no biometric prompt. The click in the window is the consent.
  • A recovery code is a bearer secret, handled in the clear while it's shown or typed.
  • Sessions last up to 8 days. An app learns of a removal only from the signer's log, so a stolen browser that never syncs can keep signing.
  • Recovery restores the id, not app data kept only in the lost browser (local projects, chats, DB3).

Not claimed: no deployment and no real account operation was done. node identity/publish.mjs only builds static files.


Generated by Claude Code

…eploy

prism/identity/4. The id page at id.uor.foundation and the registry mailbox
are gone. The frame runs stitch's Prism id in the app's own page, so a Prism
app needs no server of Prism's own:

- Each app origin keeps its own device of the id (IndexedDB prism-id),
  made with no prompt. Create a Prism id is createPrism, then stitch's
  threshold recovery with one paper share, downloaded as a recovery kit
  (the share and the log).
- Another app or device joins by stitch's link offer: the signed-in app
  shows a prism-link: URI, the new one answers on the rendezvous topic and
  shows six digits, and the person types them into the first. A wrong code
  is refused and the offer stays usable.
- Use a recovery kit is recoverPrism with rotateRecovery: this browser
  becomes the device, every other device is removed, a new kit replaces the
  old. A kit that what the devices shared shows was already used is refused.
- Devices lists the id's devices; Remove is revokeDevice. Sign-in first takes
  in the sync messages, so a removed device stops.
- Devices meet on stitch's relay through Prism id's createRelayBus. The frame
  exports PRISM_RELAY, and the page build adds it and its wss: origin to
  connect-src in place of frame-src for the old accounts origin.

identity/stitch-sync.mjs now copies prism-id.js with the stitch modules it
imports (relay framing and what that imports), each in its own scope, and
the 37 model decisions they call. Pinned to stitch e3efc6e (afflom/stitch#2).

npm run test:identity: 16 of 16, the eight session checks and the flow in
Chromium across two app origins with an in-memory relay standing in for
the real one (create, reload, sign out and in, non-extractable keys, join by
link and code, remove, recover from the kit, old kit refused).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
@afflom afflom changed the title Sign in to every Prism app with a stitch Prism id (prism/identity/3) Prism id on stitch alone: each app keeps its own device, nothing to deploy Nov 14, 2026
@afflom
afflom marked this pull request as ready for review November 14, 2026 00:46
@afflom
afflom merged commit 215cdc2 into main Nov 14, 2026
4 checks passed
afflom added a commit to maurathat/uor-template that referenced this pull request Nov 14, 2026
Revert the identity integration introduced by UOR-Foundation#73 while preserving later template changes. Regenerate the canonical frame lock. No stored account, recovery-kit, project, or chat data is deleted.
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.

2 participants