feat(fbrain): daemon completes viewer-session wraps; viewer-session list/revoke - #577
Draft
futurepaul wants to merge 1 commit into
Draft
feat(fbrain): daemon completes viewer-session wraps; viewer-session list/revoke#577futurepaul wants to merge 1 commit into
futurepaul wants to merge 1 commit into
Conversation
…ist/revoke Phase 2b of the brain:// live viewer plan. The agent (key-holding client) completes pending viewer-session wraps opportunistically on sync, mirroring the grant-wrap contract: - sync reads pendingViewerWraps from the export (admin-gated field from 2a) and NIP-44 wraps the current Folder Key to each waiting ephemeral npub (finite-nostr nip44), posting to the viewer-session-wraps route. v1 auto-approve rule: only wraps the Brain owner requested complete; stranger-requested and org-brain wraps stay pending for the later approval-card generalization. Never blocks sync; skipped quietly when the Folder Key is not openable here. - sync now --summary reports 'viewer sessions:' rows. - new fbrain viewer-session list/revoke surfaces the key-delivery records with status and expiry (revocation = key hygiene only). Tests: - unit: the wire payload is real NIP-44 ciphertext the ephemeral key decrypts into exactly the Folder Key; non-owner and org-brain wraps never POST; the raw key never persists to disk. - process acceptance (Direction-3, real server, live clock): fixture ephemeral key requests via the owner identity, owner sync completes the wrap, the ephemeral key unwraps the Folder Key, the encrypted-read returns ciphertext that decrypts to the known plaintext, the /brain-updates SSE notification is observed after a CLI edit in another terminal, delta fetch picks up the edit, a 1s TTL lapses to an honest 403 'viewer session expired', and CLI revocation yields 403 'viewer session revoked'.
This was referenced Aug 19, 2026
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.
Stack: #576 → #577 → #578 → #579. Builds on the 2a server routes.
Phase 2b of the brain:// live viewer plan. The agent (key-holding
client) completes pending viewer-session wraps opportunistically on
sync, mirroring the grant-wrap contract:
from 2a) and NIP-44 wraps the current Folder Key to each waiting
ephemeral npub (finite-nostr nip44), posting to the
viewer-session-wraps route. v1 auto-approve rule: only wraps the
Brain owner requested complete; stranger-requested and org-brain
wraps stay pending for the later approval-card generalization.
Never blocks sync; skipped quietly when the Folder Key is not
openable here.
records with status and expiry (revocation = key hygiene only).
Tests:
decrypts into exactly the Folder Key; non-owner and org-brain wraps
never POST; the raw key never persists to disk.
ephemeral key requests via the owner identity, owner sync completes
the wrap, the ephemeral key unwraps the Folder Key, the
encrypted-read returns ciphertext that decrypts to the known
plaintext, the /brain-updates SSE notification is observed after a
CLI edit in another terminal, delta fetch picks up the edit, a 1s
TTL lapses to an honest 403 'viewer session expired', and CLI
revocation yields 403 'viewer session revoked'.
Stack created with GitHub Stacks CLI • Give Feedback 💬