Expand description
CORD-02 §5 Guestbook Plane — membership motion, coalesced flat.
One Stream per Community (community_root-keyed,
super::derive::guestbook_group_key), carrying ONLY membership motion:
self-signed Joins/Leaves (3306), authorized Kicks (3309), and
refounder-signed post-Refounding Snapshots (3312) — never messages, never
authority (a Ban lives on the Control Plane). The plane is off-consensus:
nothing in Control or Chat depends on it, so it loads last and can lag
without harm.
Everything here is PURE — no DB, no network, no clock reads. The +1h
forward-clock rule takes now_ms as a parameter, and the two authority
questions arrive from the caller’s Control Plane fold: can_kick (the
KICK bit + strict outrank) and snapshot_authority (the npub whose
Refounding minted the epoch being folded).
Guestbook seals are ENCRYPTED (20013) by spec: a plaintext seal would make
a member’s signed membership record liftable as a standalone public
artifact, so parse_guestbook_event rejects the plaintext form outright.
Structs§
- Guestbook
Event - One parsed guestbook event: the entry plus the identity the coalesce tie-break runs on — the INNER rumor id, never the wrap’s (a wrap id differs per re-wrap, and two clients holding different wraps of one rumor would fork on ties).
- Member
State - One npub’s folded guestbook state — the winning entry, flat.
Enums§
- Guestbook
Entry - The typed guestbook entries (CORD-02 §5). Authors (
member/actor/refounder) are the seal-verified real keys, proven bystream::open_wrapbefore parsing ever starts. - Guestbook
Error - Errors from the guestbook layer (envelope errors ride inside).
- Source
- Whether the winning entry was the member’s own word or a refounder’s secondhand snapshot seed.
- Verdict
- An npub’s final coalesced state.
Constants§
- MAX_
FUTURE_ MS - Entries dated further than this ahead of the receiver’s clock are dropped outright (CORD-02 §5) — ample for deep clock skew, and the deterrent against squatting “latest” with a forged future date.
- SNAPSHOT_
CHUNK - Snapshot chunk size: 400 members per event (CORD-02 §5). 400 hex pubkeys of JSON is ~27 KB — comfortably inside the NIP-44 65,535-byte cap at every nesting layer, with headroom for the envelope.
Functions§
- build_
join_ rumor - A self-signed Join, optionally echoing the invite attribution from the
bundle that admitted the author (
["invite", creator, label], CORD-05 §1). - build_
kick_ rumor - An admin-signed Kick naming its target and citing the Grant it acts under
(the
vac, CORD-04 §5) — absent when the owner acts (supreme, no grant to cite). Whether it’s honored is the reader’s call (coalesce’scan_kick), never the writer’s. - build_
leave_ rumor - A self-signed Leave.
- build_
snapshot_ rumors - Refounder-signed snapshot rumors seeding a new epoch’s Guestbook: present
members only, chunked at
SNAPSHOT_CHUNK, every chunk carrying["snap", <id>, <i>, <n>](1-based) and ONE shared timestamp — the one-id-one-time invariant is what lets readers reject torn chunk sets. No survivors still yields one empty chunk, so the Refounding’s guestbook step is observable either way. - coalesce
- Coalesce parsed guestbook events flat: one final
MemberStateper npub (CORD-02 §5), order-independent overevents. - complete_
memberlist - The Complete Memberlist: coalesced
Joinedmembers ∪ observed authors, minus the Banlist.observedmaps author → the newest ms they were seen publishing anywhere in the Community (an author seen publishing is observably present, included even if their Join never arrived). Observation counts FORWARD only: it re-enters an author whose activity is strictly newer than their latest departure — a departed member’s old history can never resurrect them. - parse_
guestbook_ event - Parse a guestbook event from an ALREADY-VERIFIED
OpenedStream(one produced bystream::open_wrap, which proved the seal signature, the author binding, the rumor id, and the strictms). Strict on the seal form: guestbook rumors MUST ride encrypted seals (CORD-02 §5). - seal_
guestbook_ rumor - Seal a guestbook rumor (encrypted form) into a wrap at
guestbook_pk. Local-keys convenience; bunker accounts usestream::seal_content+ their remote signer +stream::wrap_sealfor identical wire output.