itsgoin/crates/core/src
Scott Reimers 74fec3b1fb feat(fof-layer2): wrap-slot dual-derivation seal/open primitives
Foundational crypto for FoF Mode 2 (public body + FoF-gated comments)
and Mode 1 (FoFClosed; later). Implements the dual-derivation wrap
slot from docs/fof-spec/layer-2-mode2-fof-comments.md:

- Each slot is sealed under one V_x and dual-derived:
    read part  → 32B CEK    (read capability for the post)
    sign part  → 32B priv_x (per-V_x signing capability)
- Both halves use ChaCha20-Poly1305 with deterministic key+nonce
  derived from (V_x, slot_binder_nonce) via blake3::derive_key with
  distinct sub-contexts. Receiver trial-decrypts: success on both
  halves yields OpenedWrapSlot{cek, priv_x_seed}.
- 2-byte prefilter tag = blake3-derive("...prefilter", nonce||V_x)[..2].
  Receivers precompute one per held V_x per post; skip non-matching
  slots entirely. Cuts trial-decrypt cost by ~2^16.

slot_binder_nonce (32B random per-post) replaces the spec's literal
"post_id in HKDF info" — PostId = BLAKE3(post) would be circular here.
Same anti-replay property: unique per publish, recipient-free, in the
post header in plaintext.

Also adds derive_cek_comments(cek, slot_binder_nonce) for the
comment-body encryption key (distinct from the post body CEK; lets
Mode 2 keep body public but comments private).

4 unit tests: slot roundtrip, wrong-binder-fails, prefilter tag
stability + keying, cek_comments distinct-per-post.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 07:16:42 -04:00
..
activity.rs ItsGoin v0.3.2 — Decentralized social media network 2026-03-15 20:23:09 -04:00
announcement.rs Network-wide announcements signed by the bootstrap anchor posting id 2026-04-23 01:50:12 -04:00
blob.rs v0.3.6: Active CDN replication, device roles, budgets, tombstones, engagement fix, DOS hardening 2026-03-20 21:00:28 -04:00
connection.rs Fix: dedup concurrent outgoing connects to the same peer 2026-04-22 23:48:49 -04:00
content.rs ItsGoin v0.3.2 — Decentralized social media network 2026-03-15 20:23:09 -04:00
control.rs Network-wide announcements signed by the bootstrap anchor posting id 2026-04-23 01:50:12 -04:00
crypto.rs feat(fof-layer2): wrap-slot dual-derivation seal/open primitives 2026-05-13 07:16:42 -04:00
export.rs Phase 4 (0.6.3-beta): posting-key / network-key split (plumbing) 2026-04-21 22:38:12 -04:00
group_key_distribution.rs Fix: GroupKeyDistribute admin forgery + cap concurrent port scanners 2026-04-22 23:32:10 -04:00
http.rs Phase 2d (0.6.1-beta): route manifest + blob ops through file_holders 2026-04-21 21:09:45 -04:00
identity.rs First-run chooser, node shutdown on switch, file picker, export path fix 2026-04-06 01:58:02 -04:00
import.rs Fix: imported DMs silently hidden from Messages tab 2026-04-23 08:11:11 -04:00
lib.rs Network-wide announcements signed by the bootstrap anchor posting id 2026-04-23 01:50:12 -04:00
network.rs Phase 2g: GroupKeyDistribute \u2192 encrypted post 2026-04-22 23:09:19 -04:00
node.rs feat(fof-layer1): Tauri commands + frontend UI for vouches 2026-05-13 06:47:18 -04:00
profile.rs feat(fof-layer1): receive-path scan populates vouch_keys_received 2026-05-13 01:44:54 -04:00
protocol.rs Phase 2g: GroupKeyDistribute \u2192 encrypted post 2026-04-22 23:09:19 -04:00
storage.rs feat(fof-layer1): receive-path scan populates vouch_keys_received 2026-05-13 01:44:54 -04:00
stun.rs Our Info panel, hole punch race fix, NAT profiles in relay introduction 2026-04-05 17:57:41 -04:00
types.rs feat(fof-layer1): publish path embeds VouchGrantBatch 2026-05-13 01:39:09 -04:00
upnp.rs ItsGoin v0.3.2 — Decentralized social media network 2026-03-15 20:23:09 -04:00
web.rs Phase 2d (0.6.1-beta): route manifest + blob ops through file_holders 2026-04-21 21:09:45 -04:00