Skip to main content

Module event_subject

Module event_subject 

Source
Expand description

Canonical at-record subject + keyed group-scoped routing leaf (EV3, epic #600).

Replaces the unkeyed 64-bit oid_hash/publication_broadcast_path (in crate::moq_event) with a construction that is:

  1. Canonical — a record addressed three ways (handle vs DID, NSID case, trailing fragment) hashes to exactly one value.
  2. Keyed — the routing leaf is a PRF of (K_group, subject, epoch), so knowing the at-uri is NOT enough to derive the topic (confidentiality of the subject against the relay). K_group is the PRF key.
  3. Epoch-rotated — rotating the group key (EV2’s GroupKeyRegistry) rotates every leaf, giving cross-time unlinkability.

The leaf is a MoQ-path-safe (hex) segment; the semantic topic name moves UNDER the payload AEAD (see crate::crypto::event_crypto), with the AAD binding the keyed leaf + epoch so cross-topic/cross-epoch ciphertext replay is rejected.

Lexicon: events address records by their atproto collection NSID. The formal ai.hyprstream.event.* lexicon is a separate follow-up; this module is NSID-agnostic (takes the NSID as a validated string).

Structs§

CanonicalSubject
A canonical at-record subject: the publishing/owning DID, the collection NSID, and the record key (rkey).

Functions§

keyed_broadcast_path
Full broadcast path: {prefix}/{topic_leaf}. Defaults to the publications prefix used by the per-OID firehose tier; pass a group-scoped prefix for the confidential profile.
keyed_broadcast_path_with
keyed_broadcast_path with an explicit prefix (e.g. a group-scoped path for the confidential profile, vs the public firehose prefix).
resolve_handle_to_did
Resolve a bare handle (e.g. alice.example.com) to a DID.
topic_leaf
The keyed routing leaf for a subject under a group key + epoch.