Expand description
Persistence for Community protocol local state (GROUP_PROTOCOL.md).
Stores the secrets this account holds: the server-root key and per-channel keys
(epoch-tagged). The DB is already account-scoped (account_dir(npub)/vector.db), so
there is no npub column — a row belongs to whichever account’s DB it lives in.
At-rest encryption: when Local Encryption is on, every secret BLOB and every identifying
metadata field (names, relays, roles, banlist, owner attestation, invite material) is wrapped
with the account’s ENCRYPTION_KEY before it touches disk and unwrapped on read, via the
enc_*/dec_* helpers below. A raw DB then reveals no WHO/WHERE/WHAT. The discriminators
(32-byte raw key vs 60-byte ciphertext; looks_encrypted for text) let a half-migrated DB
read back correctly, so the toggle/PIN-rekey flows and the one-time backfill are safe to re-run.
Structs§
- Author
Footprint - One author’s posting footprint in a Community, from the local store: how much
they have said and the window they said it in. Feeds the moderation panel’s
tenure and volume signals (
crate::community::raid). Times are seconds. - Departures
Seen - The departures this device has already owed take-backs for, and the row each member’s sits in.
- Floor
Writes - One fold’s floor writes, made by
write_folded_headsin a single transaction. - Guestbook
- A community’s stored Guestbook in arrival order, found by rumor id.
- Invite
Link SetRow - A folded per-creator public-invite-link set: the creator’s pubkey (hex) and their active link locators. Used to surface “X has N active invite links” in the UI.
- Pending
Channel Key - One parked key vend awaiting the control fold that proves its grant.
- Pending
Community Invite - A parked invite awaiting the user’s accept/decline decision.
- Policy
Message - One message as the policy engine reads it: the identity, author, channel and text a rule needs to cite what it convicted on.
- Public
Invite Record - A minted public-invite link the owner retains (to list + revoke).
- Stored
Policy - A stored policy: the exact bytes a community declared, plus what the engine needs to use them.
Enums§
- Floor
Family - Which fold a head’s floor belongs to, as its row records it.
Constants§
- FLOOR_
AUTHORITY - A floor of the authority fold: Roles, Grants, the Banlist, Tenures, overwrites, syncs.
- FLOOR_
CONTROL - A floor of the control fold: metadata, Channels, Categories, pins, the invite registry.
- HELD_
HORIZON_ MS - How far past this device’s clock a post may be dated and still be held (CORD-02 §5’s horizon): a later one is left on the relay for a later read.
- MAX_
DEFERRED - MAX_
HELD_ BYTES - MAX_
HELD_ COMMUNITY_ BYTES - MAX_
HELD_ PER_ AUTHOR - MAX_
HELD_ WRAPS - How many held wraps one Channel keeps, how many bytes, how many one author, and how many bytes a Community: past any, those dated furthest from now go first, so a flood dated years ahead or behind, or one author’s, evicts only itself.
Functions§
- adopt_
public_ invite - Keep a public-invite link minted on another of this account’s devices, dated as it was there.
- advance_
channel_ epoch - Apply a received channel rekey’s new key — the atomic archive+head dual-write: in ONE transaction,
ARCHIVE
(channel, new_epoch) -> new_keyincommunity_epoch_keysAND advance the channel’s read-head (community_channels.epoch+channel_key) iffnew_epochexceeds the current head. A caught-up OLDER epoch is archived (its history stays decryptable) but never regresses the head. Atomic so a crash can’t leave the archive ahead of the head or the reverse. Returns whether the head advanced. Epoch comparison is done in RUST (the u64-as-i64 ≥2^63 SQL mis-order trap). - advance_
server_ root_ epoch - banned_
set - The banned-pubkey set for a community, lazily decrypted+parsed from DB on first use and held (no further DB/decrypt) until a fold or delete invalidates it.
- banned_
set_ of banned_setby community id bytes — the inbound hot path’s form.- bump_
membership_ generation - channel_
events - Every event this device stores in
channel_id’s chat, and whether it carries files. - channel_
is_ private - Whether a stored Channel is private,
Nonewhen it isn’t stored. - clear_
banlist_ cache - Drop every cached banlist.
- clear_
channel_ community_ cache - Drop every cached channel→community mapping.
- community_
author_ footprints - Per-author message aggregates across a Community’s channels. Counts only what a person actually SAID — kinds 14/15 — so a reaction spammer doesn’t read as a conversationalist and an edit doesn’t double-count its original.
- community_
channel_ ids - A community’s channel ids, read from the rows alone (no key opened).
- community_
chat_ row_ ids - The
chatsrow ids of a Community’s channels. Deliberately notload_community: that decrypts every channel key and every retained epoch key, and all this needs is the ids. A channel with no events yet has no row and is simply absent. - community_
exists - Whether a Community with this id is already stored locally (joined). Cheaper than
load_communitywhen only existence matters (e.g. inbound-invite dedup). - community_
for_ channel - The id of the Community that owns
channel, if one is stored locally. - community_
held - Whether the community is held locally.
- community_
id_ for_ channel community_for_channelover hex, returning the stored id verbatim.- community_
ids_ beyond_ group_ chat - Every Concord group that is a community rather than a group chat: more than one
channel we hold, or a live invite link. See
crate::notify::is_community. - community_
image - A community’s icon or banner, stored as
CommunityImageJSON. - community_
invite_ join_ counts - Per-link join counts for the owner’s public invites:
label -> distinct joinerswho joined via a link minted byinviter. Distinct by joiner so a rejoin isn’t double-counted. Labels are unique per creator (random fallback ensures it), so (inviter, label) keys a single link. - community_
member_ activity - Observed participants: the best-effort member list of a Community, newest-active first.
Membership is NOT authoritative (a lurker who never posts and never announced won’t appear).
A member is included when they have real activity — a posted message/reaction/edit, OR a
join presence (kind 3306) — UNLESS that is superseded by a more-recent leave, OR they are
banned. So a “leave” actually removes a member, and a leave-then-rejoin/post re-adds them.
created_atis in seconds. Result is capped (anti-flood); seeCOMMUNITY_MEMBER_CAP. - community_
member_ activity_ capped community_member_activitywith the anti-flood display cap OPTIONAL. A roster seed passescapped = falseso EVERY member seeds — a silent truncation there would permanently strand the dropped members (absent from the snapshot → absent frommemberlist()→ excluded from every future rotation). Every other caller keeps the cap.- community_
member_ activity_ strict community_member_activityfor rules where leaving counts: a Grant holder is present only at time 0, so any Leave or Kick of theirs outranks a Role that lingers. Uncapped.- community_
policy_ messages - The evaluation corpus: the newest
limitmessages a Community’s channels hold, with the identity and channelcommunity_recent_textsdiscards. Ordered oldest-first so the caller can clamp from the front. - community_
recent_ texts - The newest
limitmessage texts across a Community’s channels, decrypted, as(npub, created_at_secs, text). Newest-first is the right window for raid work: a wave is by definition recent, and reading the whole history would pay a vault decrypt per row for messages that predate the attack. - control_
wrap_ bodies - The bodies of
idsinview, opened, for those held with one. - control_
wrap_ counts - What
viewholds: bodies, refusals, and the bodies’ bytes as stored. - control_
wrap_ ids - Every wrap id held for
view, the refused ones too, each with its timestamp. - control_
wrap_ page - The next
limitbodies ofviewbelowbelow(a wrap’s timestamp and id), newest first. - converge_
edition_ head_ at_ epoch - Replace the held head with a same-version fork winner (concurrent-edit resolution). Two
authorized editors working from one base both produce
version, and every client must land on the same edition. The winner is decided by the CALLER, which alone can rank authors against its roster (CORD-04 §1: authority first, then the lower inner id) and which compares against the held key fromget_all_edition_heads_full. This only refuses what the caller cannot judge: another version, or another epoch (a Refounding is the advance path’s job). - converge_
family_ head_ at_ epoch converge_edition_head_at_epoch, touching only a row offamily(or one that records none).- converge_
server_ root_ epoch - SAME-EPOCH convergence for the server root (concurrent re-founding heal): two BAN-holders who
re-founded at the same time each sit on their OWN root at the SAME epoch.
advance_server_root_epochrefuses to switch (its guard is strictly monotonic), so this is the sibling that REPLACES the head root atepochwith the deterministic winner (lowest root bytes — the caller decides). Archives the new root + swaps the head, but ONLY while we’re still ATepoch(a later real rotation must win over a stale converge). Returns whether it switched. - delete_
community - Remove a Community and all its local state (channels, retained message keys, parked invites, minted public-invite tokens). Used when the user leaves a Community — there is no protocol “leave” (membership is key possession), so leaving is purely local: drop the keys + stop subscribing.
- delete_
community_ policy - delete_
community_ retain_ keys - self-removal teardown: drop all local community state EXCEPT the held epoch keys
(
community_epoch_keys). Read access to future epochs is already gone (the post-removal keys are never delivered); retaining the OLD keys only preserves the ability to author a3305self-delete of one’s own past messages, each sealed under the epoch key it was sent at. Used by every self-removal trigger (voluntary leave, kick of me, ban-rekey exclusion). - delete_
edition_ head - As
set_edition_head_with_id, stamping an EXPLICIT epoch — the epoch the caller’s fold actually ran under — instead of reading the community row at write time. Closes the TOCTOU where a concurrent re-founding bumpsserver_root_epochbetween a fold and its head persist, which would stamp an old-plane version as the new epoch’s floor and wedge the new epoch’s genuine head. Forget one entity’s floor. - delete_
message_ key - Remove a retained message key (after a successful deletion publish).
- delete_
pending_ invite - Drop a parked invite without joining (the user declined).
- delete_
pending_ invites_ from - Drop every invite this person parked (they were blocked); the count dropped. The inviter is sealed at rest, so the rows are read to match it.
- delete_
public_ invite - Forget a minted public-invite token (after revoking it on relays).
- departures_
seen - drop_
control_ wrap - Forget one wrap of
view, so a sync asks for it again. - drop_
pending_ channel_ key - Discharge ONE candidate (refused, superseded, expired, or undecodable).
- drop_
pending_ channel_ keys_ for - Discharge every candidate for a channel — a key landed, so the rest are moot.
- edition_
head_ entity_ ids - The set of control-entity ids (hex) this account tracks a head for. A base rotation gates its head-advance on re-anchoring covering EVERY one of these (not just a matching count), so a relay that withholds one entity’s editions while over-serving another’s can’t slip a thinned control plane past the rotator.
- edition_
head_ families - Entity → family, for the rows that record one.
- forget_
channel_ chat - Drop what this device holds of a deleted Channel’s Chat Plane: its chat, events and their attachment rows, and wraps held for a later judgment. Its keys stay (CORD-03 §2). Returns whether it held anything.
- forget_
control_ refusals - Forget
view’s refusals judged under any rules butrules, and theoldestlongest standing of the rest, so each is fetched and judged again. Returns how many went. - forget_
guestbook_ wraps - Forget the Guestbook wraps of any plane but
plane, the refusals ofplanejudged under rules other thanrules, and theoldestlongest standing of its other refusals. - forget_
wrap_ owners - Drop the kept
pkeys ofmessage_id’s wraps, once their deletions went out. - get_
all_ edition_ heads_ epoched - get_
all_ edition_ heads_ full - get_
audit_ local - Every act
record_audit_localnoted forcommunity_id:(id, at_ms, entry). - get_
community_ ban_ marks - Per-npub ban marks: lowercase-hex npub →
created_at(secs) of the newest AUTHORIZED banlist edition that named them. Retained past an un-ban on purpose — it is what stops a pre-ban Join resurrecting a phantom member (CORD-02 §5 counts observation forward of the latest Leave, Kick or Ban). - get_
community_ banlist - A Community’s current banlist (hex pubkeys). Empty for an unknown community or empty list.
- get_
community_ banlist_ at - The
created_at(secs) of the banlist edition currently stored, or 0 if none. The version floor the rollback guard compares against. - get_
community_ dissolved - Whether a community has been sealed by a folded + owner-verified GroupDissolved tombstone.
falsefor an unknown community. - get_
community_ invite_ registry - A Community’s current invite-link registry (active link locators, hex). Empty for an unknown
community or a Private one.
is_public= this is non-empty (computed mode). - get_
community_ pin_ versions - A channel’s stored Pin List head:
(raw content, version),Nonewhen no edition has ever folded for it. Each channel’s folded Pin List version, without opening a list. - get_
community_ pins - get_
community_ policies - Every policy a community holds, enabled or not, ordered by id so two clients read them in the same order.
- get_
community_ roles - get_
community_ roles_ at - The
created_at(secs) of the role-graph edition currently stored, or 0 if none. - get_
community_ roles_ shared get_community_roleswithout copying the roster out.- get_
community_ writers - get_
edition_ head - The current head
(version, self_hash)of a control entity’s edition chain, orNoneif no edition is held yet (so the next edition is the genesis, version 1, no prev_hash). - get_
edition_ head_ inner_ id - The held head’s inner id, or
Noneif unheld or pre-migration (NULL). - get_
guestbook - A community’s persisted Guestbook: its membership events in arrival order and the
newest-seen cursor (relay seconds).
([], 0)when never synced. - get_
guestbook_ shared get_guestbookwithout copying the events out: what a fold that only reads them wants.- get_
guestbook_ standing - The Guestbook’s Timeout and Nickname entries, held so every send and paint doesn’t reparse the whole book.
- get_
invite_ link_ sets - Every creator’s active invite-link set for a Community (creator hex + locators). Empty for a Private community (or one not yet re-folded since this table was added).
- get_
message_ key - Read (WITHOUT removing) the retained key for a message by its INNER message id (what
the UI holds). Returns the ephemeral signing
Keys, the OUTER event id to NIP-09-delete, and the relay set — orNoneif not retained (someone else’s message, or already deleted). Peek-only so the key survives a failed deletion publish; the caller removes it withdelete_message_keyonly after the publish succeeds. - get_
pending_ channel_ keys - Every parked vend for a community, for the post-fold re-judge.
- get_
pending_ invite - Read a parked invite’s bundle WITHOUT removing it. Accept is fallible (caps,
owner/authority collision), so the row must survive a rejected accept — peek here,
then
delete_pending_inviteonly after the join succeeds. - get_
server_ root_ epoch - Apply a received SERVER-ROOT (base) rekey’s new root — the base counterpart to
advance_channel_epoch, atomic: in ONE transaction, ARCHIVE(server-root scope, new_epoch) -> new_rootincommunity_epoch_keysAND advance the base head (communities.server_root_epoch+server_root_key) iffnew_epochexceeds the current base epoch (monotonic, compared in RUST). A caught-up OLDER base epoch is archived (its control/base history stays decryptable) but never regresses the head. Returns whether the head advanced. The community row’s CURRENT base epoch — the cheap freshness probe a root-derived write compares its in-hand struct against. - guestbook_
wrap_ ids - The Guestbook wraps of
planethis device has read, with their timestamps. - has_
message_ key - Whether the plane key of a wrap of
message_idis kept. - has_
wrap_ owner - Whether a wrap of
message_idcan be deleted by its owner from here. - heal_
edition_ head - Move a floor a build before marked editions wrote onto the same edition’s real hash. Only while the row still holds that unsigned hash at that version and epoch, so it never lands over a head that moved on in the meantime.
- held_
channel_ ids - Every channel id held under a community we still hold.
- held_
community_ relays - Every relay a held community lists, without opening any key.
- held_
epoch_ key - The held key for one specific
(scope, epoch), orNoneif not held. The open path uses this to select the decryption key by the inbound event’sepochtag. - held_
epoch_ keys - Every held
(epoch, key)for a scope, ascending by epoch. The read paths derive a pseudonym per returned epoch (#zOR-set) so cross-epoch history isn’t stranded. Sorted in Rust (not SQL): epoch is a u64 stored as i64, so a SQLORDER BYwould mis-order epochs >= 2^63. - held_
wrap_ channels - The Channels of
community_idholding wraps. - held_
wrap_ ids - Of
wrap_ids, those held, or deferred while their date is still past the horizon. - held_
wrap_ ids_ in - The ids of the wraps held for one Channel.
- held_
wraps - Every wrap held for
community_id, as(wrap_id, channel_id, wrap), oldest-dated first. - held_
wraps_ in - The wraps held for one Channel, as
(wrap_id, wrap), oldest-dated first. - history_
views - Every past epoch of a private channel held read-only, oldest first.
- hold_
wrap - Hold
wrap, a post byauthor(hex)channel_id’s rules didn’t stand behind on arrival, datedat_ms. Whether it is held: a post dated past the horizon isn’t, nor one the caps evict at once. A marked copy kept beside an evicted wrap goes with it. - holds_
wraps - Whether
community_idholds any wrap. - holds_
wraps_ at - Whether
channel_idholds a wrap byauthor(hex) sent toaddress(a writer address), waiting for a later judgment. - invite_
link_ set_ creators - The creators the folded invite Registry currently lists for this community — the cheap local answer to “might I hold a live public link here?”.
- is_
author_ banned - Whether
authoris banned in this community. The per-event hot check: a HashSet lookup once warm, no DB / decrypt / parse. - is_
author_ banned_ in is_author_bannedby community id bytes.- list_
all_ public_ invites - All minted public-invite links across ALL communities (backfill source for the synced Invite List).
- list_
community_ ids - Ids of every locally-stored Community.
- list_
pending_ invites - All parked invites, newest first.
- list_
public_ invites - All minted public-invite links for a Community, newest first.
- load_
community_ v2 - Load a v2 community by id, or
Noneif absent / not a v2 community. - membership_
generation - Moves whenever what a Guestbook fold reads may have: a store write here, or a Control fold.
- merge_
community_ ban_ marks - MERGE fresh ban marks into the stored set, keeping the LATER time per npub and never dropping an npub. A fold only sees the editions still in its window, so replacing wholesale would forget every ban that has since aged out — precisely the history the suppression depends on.
- next_
wrap_ scrub - The longest-waiting queued scrub:
(message_id, community_id). - note_
pending_ invite_ wrap - Record a gift wrap that delivered
community_id’s parked invite. A sender re-wrapping one invite without end adds nothing past the cap. - owe_
author_ retraction - Owe
channel_ida retraction of whatauthor(hex) posted there fromsince_ms, beforeuntil_mswhen given. - owe_
writer_ retraction - Owe
channel_ida retraction of what it shows dated fromsince_ms. - owed_
author_ retractions - What
community_idowes one author’s posts:(channel, author hex, since_ms, until_ms, generation). - owed_
retractions - The Channels of
community_idowed a retraction:(channel, since_ms, generation). - park_
channel_ key - Park a vended channel key as a CANDIDATE.
- pending_
invite_ exists - pending_
invite_ received_ at - Whether an invite for this id is already parked (inbound dedup).
When a parked invite ARRIVED (unix secs), or
Noneif none is parked. The supersession key for the purge: an invite that arrived AFTER a removal is a genuine re-invite, not residue of the leave. - pending_
invite_ wraps - The gift wraps recorded for a parked invite.
- purge_
control_ wraps - Drop everything held of a community’s Control Plane, and how its relays were read.
- purge_
expired_ pending_ invites - Drop parked invites past their sender-declared NIP-40 expiry OR past the recipient-enforced 24h lifetime (measured from park time — conservative, since parking postdates sending). The lifetime leg is what clears rows parked by builds that predate the ingest-time rule: a machine dormant for a month otherwise boots into a page of fossil invites no other culler can touch (no declared expiry, never held, never tombstoned). Returns the count purged.
- purge_
guestbook_ wraps - Drop every Guestbook wrap recorded for a community, and how its relays were read.
- purge_
pending_ invites_ for_ held_ communities - Drop every parked invite for a community we ALREADY hold — once joined on any device, the
invite must never resurface. Ordering-independent: covers the cross-device case where the
historical gift-wrapped invites are ingested BEFORE the synced membership list rehydrates
those communities (so the ingest-time
community_existsguard saw nothing yet). Returns the count purged. - queue_
wrap_ scrubs - Queue my own
message_idsofcommunity_idto leave the relays, a wrap at a time. - rebase_
edition_ head_ at_ epoch - Move a floor DOWN to the newest edition the Roster still admits, within one epoch. The
caller has proven the held head is served yet refused, on a complete authority fold
(refuse-downgrade guards the newest authorized edition, CORD-04 §1); nothing else may
lower a floor, and a different epoch is never touched.
Only a row of the head’s own
family, or one that records none, moves. - record_
audit_ local - Note an Audit Log act no Control edition records (a moderator’s delete, a voice directive), keyed by the event that carried it so a re-delivery notes nothing twice.
- release_
held_ wrap - Let
wrap_idgo: it stands now. - replace_
invite_ link_ sets - Replace ALL of a Community’s per-creator invite-link sets with the freshly-folded set (latest-wins). Replacing wholesale (not upserting) drops a creator who has revoked every link, so the per-creator view stays in lockstep with the flat registry computed in the same fold.
- save_
community_ v2 - Persist a v2 community + its channels atomically. UPSERT so a metadata re-save preserves banlist/roles (managed by the fold, not here).
- save_
pending_ invite - Park an inbound invite bundle for explicit user consent (the carrier never
auto-joins). First-invite-wins:
INSERT OR IGNOREmeans a later invite for the samecommunity_idcan’t silently rewrite a parked bundle. Returns whether a new row was inserted (false= already pending, caller should not re-notify). - save_
public_ invite - Retain a minted public-invite token so the owner can later list + revoke it.
- seat_
channel_ key - Seat a channel key on a channel that currently holds NONE, without the monotonic epoch guard.
- set_
community_ banlist - Whether the stored set changed: a ban hides what its target already posted, so a painted timeline is stale only then.
- set_
community_ dissolved - Set the owner-dissolution SEAL on a community — PERMANENT + irreversible (no clear path; there is no un-dissolve). Idempotent: re-setting an already-dissolved community is a harmless no-op. Once set, the control fold stops advancing and the inbound path drops every subsequent event. Seal a community as dissolved. Returns whether this call TRANSITIONED it (a live→dissolved flip) so the caller can fire the one-time death notification exactly once — a re-wrapped tombstone (fresh outer id, same owner seal) then can’t spam the handler.
- set_
community_ invite_ registry - Replace a Community’s cached invite-link registry (active link locators, hex), folded from the
owner-signed vsk=5 edition. Empty = Private. The version floor lives in
community_edition_heads(the registry’s own entity), so this is just the content cache (mirrorsset_community_banlist). - set_
community_ pins - Persist a channel’s folded Pin List head — the RAW carried content (either self-describing form), never a re-serialization: republishing must carry the exact bytes, and the byte cap judges what the wire carried. Encrypted at rest like the banlist — a public-form list carries disclosed message keys.
- set_
community_ policy - Store one policy verbatim. The caller validates BEFORE calling: an invalid policy is a rejected edit, not a stored one that evaluates to nothing.
- set_
community_ roles - Replace a Community’s cached role graph (the aggregated
CommunityRoles) + thecreated_at(secs) of the newest per-entity edition it was built from.atis the version floor: the fetch path only calls this with a strictly-newer aggregate, so the role graph can’t roll backwards (same guard as the banlist). - set_
community_ writers - Persist a channel’s folded Writers ledger head (CORD-03 §1), monotonic on version.
- set_
departures_ seen - Record
nowas owed for, writing only the members whose spans changed. - set_
edition_ head - Record the current head (version + self_hash) of a control entity’s edition chain (keyless model).
The send side reads this to emit the next edition as
version+1citingself_hashasprev_hash; the fold uses it as the per-entity refuse-downgrade floor + anchor. Upserts per (community, entity).inner_idandauthorare the head edition’s fork tiebreak key (seeconverge_edition_head_at_epoch). - set_
edition_ head_ at_ epoch - set_
edition_ head_ with_ id - As
set_edition_head, but also records the head edition’sinner_id(the deterministic tiebreak key), so a later same-version convergence can rank against it. A plain advance carries it through. - set_
family_ head_ at_ epoch set_edition_head_at_epochfor a head offamily(FLOOR_AUTHORITYorFLOOR_CONTROL). An authority head takes a coordinate a control row holds; a control head never takes one an authority row holds.- set_
guestbook - set_
pending_ invite_ sent - Record when a parked invite was sent, once.
- settle_
author_ retraction - Clear one author’s owed retraction once done, unless more was owed since it was read.
- settle_
retraction - Clear
channel_id’s owed retraction once done, unless more was owed since it was read. - settle_
wrap_ scrub - Settle a queued scrub:
retrysends it to the back of the queue, otherwise it is done. - store_
control_ wraps - Store
rowsjudged underrules, all or none. A wrap already held keeps its row. Returns how many were new. - store_
epoch_ key - Store one held epoch key in the multi-held archive.
scope_idis a channel_id hex orcrate::community::SERVER_ROOT_SCOPE_HEX. The(community, scope, epoch)PK makes a write for one epoch unable to disturb another epoch’s key — so retained history survives a rekey. Uses REPLACE on the exact coordinate so the fork-resolution apply path can commit the winning key for a contested epoch over a previously-stored loser (the only legitimate same-coordinate overwrite; an epoch key is otherwise immutable). - store_
guestbook_ events - Store the Guestbook events a fold added or restamped, and the cursor: each a row of its own, nothing else rewritten.
- store_
guestbook_ wraps - Record Guestbook wraps as read: (id, timestamp, rules),
rules0 for one whose entry is stored. - store_
history_ view - Archive a past epoch’s read view of a private channel (CORD-03 §5): its conversation key and address, under scopes of their own so neither is ever taken for a channel key.
- store_
message_ key - Retain the ephemeral signing key of a message I published, so I can later
NIP-09-delete it.
relaysis where the deletion must be sent. - store_
wrap_ owner - Keep the
pkey of a wrap I published or met: its holder may delete the wrap (CORD-01 §Deletions) on every relay that refuses the plane key’s deletions. - take_
message_ key - Peek + remove in one call. Prefer
get_message_key+delete_message_keywhen a fallible step sits between, so a failure doesn’t strand the key. - wrap_
owners - Every wrap of
message_idwhosepkey is kept: the key, the wrap’s id, and the relays it was sent to. - write_
folded_ heads - Run one fold’s floor writes in a single transaction: all of them land, or none.
Type Aliases§
- Control
Wrap Row - A stored Control wrap: its id, its own timestamp (seconds), and its body unless it was refused.
- Departure
Spans - Each departed member’s spans away, as the Guestbook fold reads them. Shared, so a fold that moves one member copies no one else’s.