Repository navigation
feat(prism-id): relay bus, link QR codes, public log for hosts, refreshing cadence - #2
Conversation
Prism id's next milestone: a recovery device is an ordinary prism/device/1 linked by the ordinary link flow, whose private keys are sealed (AES-GCM, HKDF from a 32-byte seed) in a public-safe prism/recovery-escrow/1 object with the private boundary and the log. The owner keeps the seed as a 56-character Crockford recovery code with three check bytes. recoverOnto opens the escrow and links the new browser's own non-extractable device through createLinkOffer/acceptLinkRequest/completeLink, so Stitch.PrismId decides it like any link; a recovery device revoked in a newer log links nothing. No model rule is added. Lives in src/prism-id.js so the product register's modeled artifacts are unchanged (contracts.json regenerated). tests/prism-recovery.test.js: code round trip and typo refusal, recovery onto a new device with the private boundary, escrow bound to its code, revoked recovery refused. node --test tests/prism-*.test.js: 15 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
A recovery device (class recovery) is linked through the ordinary link flow; its keys, keyring and log are sealed under a key derived from a 56-char Crockford recovery code. recoverOnto links the new browser's own device; later rotations reach the recovery device as a member, so old codes keep opening newly sealed content. Revoked recovery devices link nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
ECDSA signatures are malleable and envelopes are keyed by their own kappa, so anyone could add a second genesis envelope for a prism (same body, other signature) and resolvePrism refused every log that held both. Resolution now takes any genesis of the prism whose signature verifies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
|
The Generated by Claude Code |
… resolve - createRelayBus implements the prism bus contract (publish, subscribe) on stitch's own transport: the warm relay with stitch's relay framing across devices and origins, BroadcastChannel within one origin. The relay topic is a domain-separated hash of the prism topic (at most 64 characters), every message names its prism topic, a subscriber delivers only that topic, and a bus never hears itself. subscribe first delivers what the relay still holds (the warm lifetime), then live messages; fetch returns what it holds. Effects (fetch, WebSocket, BroadcastChannel) are injectable. - resolvePrism takes any genesis of the prism whose signature verifies. ECDSA signatures are malleable and envelopes are keyed by their own kappa, so a second genesis envelope (same body, other signature) made every log that held both unresolvable. tests/prism-bus.test.js: framing and hashed topics over an ntfy-shaped relay, a multi-frame message, two devices linking over the rendezvous topic with the six-digit code then syncing a removal, and the copied genesis. npm test 445 of 446; the one failure (source-authoring, prism-code axioms.mjs missing in this checkout) fails identically on the base commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
…rsedes recovery codes (drops b85ef0d) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
…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
|
A gap in threshold recovery that Foundry's frame ran into. It isn't fixed here, because the fix belongs in A used recovery share still works when replayed against the log it came with. Say Reproduce: Foundry's frame refuses this on the recovering device once its sync shows a newer recovery device. Other devices still accept it. One possible model rule: a recovery device's binds made after it was replaced don't count, or a recovery device may revoke itself only once. Generated by Claude Code |
… recovery); relay bus implements retained The bus contract now names retained(topic). createRelayBus's poll of the warm relay becomes retained, so log-free recovery and offline catch-up read stitch's relay. docs/prism-id.md says the relay's 30-minute warm lifetime bounds both. product/contracts.json rebinds the implementation hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
…ocations from, refreshing cadence
linkQr(uri) encodes a prism-link URI as an ISO/IEC 18004 QR code (byte
mode, level M, smallest version, lowest-penalty mask) and returns
{size, modules}. Checked against jsQR 1.4.0 over versions 1 to 38; the test
pins one vector's module digest and the finder patterns.
logTopic(prism) is a public topic derived from the prism id alone.
publishLog puts the signed public records there; heardLog merges what the
bus retains on it, skipping other prisms, oversize and malformed messages.
verifyAction takes { bus } and merges heardLog first, so a removed device
that never syncs is refused once another device published its removal.
createSyncCadence({ refresh }) sends a real sync and the public log every
refresh ticks, so the warm relay (30 minutes) keeps a recent copy while any
member is online.
docs/prism-id.md documents all three and lists what stays open (a replayed
old recovery, retention when every member is offline). The threat model is
left unchanged so the retained proof evidence holds; product/contracts.json
rebinds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
Additions to Prism id on top of
claude/project-thread-nkgrlb, now including 4166b87 (hybrid ML-DSA signatures, passkey approvals, log-free recovery, cover traffic). Foundry's frame pins stitch's Prism id and runs on it alone, with no server of its own.createRelayBusimplements the bus contract (publish,subscribe,retained) on stitch's own transport. Across devices and origins it uses stitch's warm relay with stitch's relay framing; within one origin it uses BroadcastChannel. The relay topic is a domain-separated hash of the prism topic.retained(topic)is what the relay still holds (the warm lifetime, 30 min), so offline catch-up and log-free recovery read the relay.linkQr(uri)returns the QR code for a link offer as{size, modules}: ISO/IEC 18004, byte mode, level M, the smallest version, the lowest-penalty mask. It was checked against jsQR 1.4.0 over versions 1 to 38, and the test pins one vector.Public log (
logTopic,publishLog,heardLog): a topic derived from the prism id alone that carries the signed public records. WithverifyAction(..., {bus}), a host merges what that topic retains before deciding. A removed device that never syncs is therefore refused once another device has published its removal. Forged records, other prisms' logs and junk on the topic count for nothing (tested).createSyncCadence({refresh}): everyrefreshticks, the cadence sends a real sync and the public log. While any member is online, the warm relay then always holds a recent copy.resolvePrism takes any genesis of the prism whose signature verifies. ECDSA malleability had made a copied genesis able to break resolution.
Still open (listed in docs/prism-id.md, under "Open"):
The threat model doc is left unchanged, because it is a
Product.Securitysource and editing it would invalidate the retained proof evidence. Those rows should move there in the next attested revision.Tests:
tests/prism-bus.test.jshas 7 tests.npm testpasses 453 of 454. The one failure issource-authoring, becauseprism-code/src/axioms.mjsis missing; it fails identically on the base. No.lex.texchanged; onlyproduct/contracts.jsonrebinds.🤖 Generated with Claude Code
https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T