Repository navigation
feat(prism-id): a replayed old recovery kit binds and revokes nothing - #3
Merged
Merged
Conversation
Checkpoint: runtime conformance passed; formal SDK verification remains pending.
Checkpoint exact locally tested tree a2ec17c. Full 17-module LexLean/Lean/leanchecker/axiom verification passed; 104 JS tests and independent custody vectors passed. Native Prism artifact and real browser/provider qualification remain pending. Expanded standards and operator-experience work continues separately.
Verify 20 actual LexLean modules, 1179 declaration audits and 186 runtime tests. Implement strict JCS/I-JSON, RFC8484 DNS wire transport, bounded relay framing across the supported object range, lifecycle transitions and source-owned operator journeys. Retain explicit native artifact, real-host qualification and operational completeness limitations.
Checkpoint of 227 passing runtime tests, five strata and independent custody checks. Records exact 23-module source verification with 1,221 audits. Native acceptance remains blocked by the separately reproduced Laws compilation issue; no gate is weakened.
Exact source verification: 23 modules, 1232 audits, 79 successful verifier processes. Runtime: 242 tests plus five strata and independent Python vectors. Origin-local keys and cross-tab durable journal do not claim private-key backup or browser qualification. Native gate remains unchanged.
Verified checkpoint: 262 runtime tests, independent recovery vectors, 23-module pinned source proof with 1266 declaration audits. This does not claim native Prism artifact acceptance, real-host qualification or full operational completion. Native Laws compiler fix remains required; no acceptance gate weakened.
…ete guest qualification
…e without rebuilding
Preserve actual attestation and manifest bytes while deriving the existing source summary from verifier records and current inputs. Check direct lexicon tree digests and full workspace coverage before replacing outputs, and replace the summary last. Keep source retention separate from native Prism acceptance. No SDK lock, model, or retained proof changes. Validation: 19 focused retention tests, full npm test (383 tests and five layer checks), independent Python custody verification, and diff checks.
…fication Preserve diagnostic and work histories. Product files exactly match work/stitch-proof-evidence at fa5b2d0; retain its newer source-evidence helper and diagnostic records. Resolve the additive guest qualification documentation with that complete version. The sole extra file is the existing host-qualification workflow retargeted to staging/stitch-upstream-reconciliation. It exercises runtime and real Chromium checks without changing or claiming the separately pending native SDK acceptance. No upstream PR head, SDK lock, source/proof bytes, guest image or deployment is changed.
Diagnostic/stitch candidate browser
… evidence suite Reconcile full Stitch implementation & proof evidence suite
Add source-derived product facets, a real-byte recovery explorer, scoped evidence catalogs and artifact-only pinned-SDK source authoring. Keep native acceptance gate and SDK pins unchanged.
Import Foundation.Arch directly for nested feature acceptance projections. Preserve source obligations and refresh deterministic bindings; source verification remains pending the real SDK rerun.
Reproduce actual SDK formatting and keep official Prism checks before full LexLean proof verification. Preserve exact axiom enforcement, pins, native gate and diagnostic evidence for the pinned helper's multiline-report parsing defect.
Register authoritative Quality/Security lexicons and validate typed facet links. Correct OPM and sequence ownership without inventing architecture edges. Source lock and evidence require actual unchanged-SDK authoring; native gate remains strict.
Import the unchanged-SDK generated lock and exact stdout-selected original attestation/build records: 1910 audited declarations, 124 proof processes. Record actual 419-test and 14-browser-scenario evidence; native Prism artifact acceptance remains a separate unchanged gate.
…king Add Stitch.PrismId (app/src/Stitch/PrismId.lex.tex) with deviceMaySign, bindAllowed, linkOfferAccepted, boundaryShared and boundaryVisibleTo, and theorems unlinkedDeviceCannotSign, revokedDeviceCannotSign, unlinkedSignerCannotBind, invalidBindSignatureRefused, usedOfferRefused, expiredOfferRefused, singleIdentityBoundaryPrivate, twoIdentitiesMakeBoundaryShared and nonMemberSeesOnlyPublished. Add src/prism-id.js: uor-addr canonical JSON and kappa (NFC required, integers only, UTF-8 member order), non-extractable P-256 device keys, genesis record (prism id = kappa of genesis), bind and revoke records, set-union log merge, QR link offer with secret-derived rendezvous topic, ECDH/HKDF/AES-GCM wrap of the private boundary key, sealed private content, sync topic derived from the boundary key, and an in-memory bus with the substrate publish/subscribe contract. Every authorization decision calls the generated model binding. Register prismId as a product component and asset, renumber the architecture indexes canonically, regenerate facets, bindings and the product register, and retain new source evidence from the pinned SDK (lexlean verify --all: 39 modules). npm test: 430 pass, 0 fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3Le2ZWWHa47YS9u3wT
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
Device records carry a class (browser, native, mobile, embedded) and a claimed key protection (software, platform, secure-element). Binds carry a role: member, or delegate with a non-empty action scope. Delegates never receive the private boundary and cannot bind or revoke. Model additions in Stitch.PrismId: mayAdminister, linkGate with a person-confirmed six-digit code, receivesPrivateBoundary, scopeAdmits, actionAllowed, actionGate/actionFresh (audience, nonce, time window), hostAdmitsDevice (attestation required when a host demands hardware keys), boundaryKeyAdmitted. New theorems: delegateCannotBind, foreignPrismBindRefused, unconfirmedLinkRefused, wrongSecretRefused, delegateNeverReceivesPrivateBoundary, delegateOutsideScopeRefused, revokedDeviceActionRefused, replayedActionRefused, wrongAudienceActionRefused, staleActionRefused, unattestedDeviceRefusedWhenRequired, staleBoundaryKeyRefused. Runtime: every revocation carries a new boundary key wrapped to each remaining member; the sync topic moves with it; stale keys refuse to seal. Signed actions are bound to an audience with a nonce and verified by hosts against the prism log. Logs over 4096 records and sync messages over 4 MiB are refused before parsing. Cross-runtime conformance: tests/fixtures/prism-id-vectors.json and an independent standard-library Python verifier. Threat model: docs/prism-id-threat-model.md (objectives, trust boundaries, adversaries, assets, STRIDE per element, attack trees, device-class threats, LINDDUN, assumptions, residuals). Sixteen Prism* threats join the official Security facet with gate, review and proof evidence. lexlean verify --all under the pinned SDK: 39 modules. npm test: 441 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3Le2ZWWHa47YS9u3wT
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
- R6: hybrid ECDH + ML-KEM-768 wraps for devices that advertise a kem key; classical wraps to such devices are refused (hybridWrapRequired). - R5: sealed sync messages padded (ISO 7816-4) to power-of-two buckets >= 1 KiB. - R1: hardenSession keeps only non-extractable HKDF-derived seal/topic keys; hardened devices cannot link members or set up recovery (mayShareBoundary). - R4: threshold recovery (Shamir over GF(256)) with device or paper guardians, releaseShare re-wraps to a confirmed new device, recoverPrism binds it, revokes every other device and can rotate recovery. Recovery revocations take precedence; members cannot revoke or replace the recovery device (revocationCounts, recoveryBindAllowed, thresholdMet). - R3: per-host personas: separate prisms with per-device persona keys, kept in step on sync, recovered via keys wrapped to the main recovery device. - R7: admitDevice requires a host-pinned verifier binding the attestation to the device signing key (attestationBinds). Model: 6 definitions and 8 theorems added to Stitch.PrismId, verified under the pinned SDK (39 modules). Security facet: 5 rows updated, 5 added (32 threats). 32 prism-id tests pass on node 22 and node 24; npm test 451/451. Threat model and protocol docs updated with residual status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3Le2ZWWHa47YS9u3wT
… 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
…og-free recovery, cover traffic - R6: devices with ML-DSA-65 (FIPS 204) sign every record and action with P-256 and ML-DSA; verifiers with ML-DSA refuse a stripped or invalid ML-DSA signature (hybridSignatureAccepted); hosts can require it (requirePostQuantum). Recovery secrets carry the ML-DSA key. - R1: device records may bind a passkey (rp, origin, P-256 key). Hosts mark actions with requirePresence; the action then needs a user-verified WebAuthn assertion whose challenge is SHA-256 of the canonical action body (presenceSatisfied). Personas take their own passkey. - R4: recoverPrism accepts a bus instead of records and rebuilds the log and persona logs from retained sealed sync by following rotations wrapped to the recovery device. Memory bus retains up to 256 messages per topic. - R5: createSyncCadence and publishCover send one fixed-size message per tick, real or cover; receivers ignore cover messages. - Device record checks generalized to optional kem, pqsign, presence fields. Model: 2 definitions and 5 theorems added to Stitch.PrismId, verified under the pinned SDK (39 modules). Security facet: 33 threats (PrismQuantumForgery added; origin script, sync observation, recovery loss updated). 37 prism-id tests pass on node 22 and node 24; npm test 456/456. Threat model gains a section of designed next closures (D1-D5). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Asa3Le2ZWWHa47YS9u3wT
… 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
feat(prism-id): relay bus, link QR codes, public log for hosts, refreshing cadence
- resolvePrism: a retired recovery device (one a recovery device revoked,
itself included) keeps only its retirement; its other binds and
revocations count only where that retirement lists them in keep. The
existing revocationCounts predicate takes this as its overruled input.
- A recovery device is retired once: two counting retirements that keep
different records refuse to resolve with code fork, so a host that hears
a replay which also forged a second retirement acts for neither side.
- revokeDevice keeps the revoked device's binds and revocations.
- admitRecords merges into a held log and refuses a retirement of a
recovery device the held log already retires; receiveSync uses it, and
heardLog takes { own: true } for a device checking its own log.
- recoverPrism leaves already retired recovery devices alone, so a second
recovery with the newer kit does not fork the log; resolvePrism returns
retired.
- tests/prism-replay.test.js: replay against the old log, replay that forks,
recovery again with the newer kit. docs/prism-id.md: Recovery and Open.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3NdLCxdzL1iQw9rg5T
Owner
Author
|
The Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the "replayed old recovery" gap from docs/prism-id.md (Open).
Before: after a recovery retires its recovery device, the old shares still combine. Replayed against an old log they bound a second recovery device and members of their own, and a merged log showed two active recovery devices.
Now:
keep. The existingStitch.PrismId.revocationCountspredicate takes this as its overruled input, so the model is unchanged.fork). A host that hears a forged second retirement then acts for neither side, so the replay never acts as the person.admitRecordsrefuses such a retirement on any device that already holds one.receiveSyncuses it, andheardLog(..., { own: true })applies it for a device checking its own log.revokeDevicenow keeps the revoked device's revocations as well as its binds.recoverPrismleaves recovery devices that are already retired alone, andresolvePrismreturns them asretired.Tests:
tests/prism-replay.test.jshas 3 tests:They live outside the Product.Security sources, so retained proof evidence stays valid. prism-id plus bus tests: 47/47.
Not fixed: a holder of the old kit can still deny the id at hosts by forking. That stays in docs Open, pending witnessed ordering (D4).
Generated by Claude Code