Skip to main content

Module name_record

Module name_record 

Source
Expand description

ai.hyprstream.name — the NameRecord: the trusted, PQ-signed name → DID URL layer (#908, design #905 §1/§3/§6; #879 §Name-resolution).

This is the thin naming layer that sits on top of ai.hyprstream.model (#387 D1). A NameRecord binds a human-chosen label to a subject DID URL and a content pin. It is the trusted complement the DHT must never answer: the DHT is an untrusted locator; the authoritative name → DID-URL mapping lives here, in a PQ-signed atproto record served from a PDS.

The confirmed 4-field lexicon:

{
  "lexicon": 1,
  "id": "ai.hyprstream.name",
  "defs": { "main": { "type": "record", "key": "tid", "record": {
    "type": "object",
    "required": ["subject", "pin", "label", "createdAt"],
    "properties": {
      "subject":   { "type": "string" },               // a DID URL, opaque
      "pin":       { "type": "string", "format": "cid" },
      "label":     { "type": "string" },               // human label
      "createdAt": { "type": "string", "format": "datetime" }
    }
}}}

§subject carries a DID URL, not an at-uri, and never a 9P path

The subject field is a DID URL carried as an opaque string (a standard lexicon extension: unmodified Bluesky/Tangled can store, sync, and serve these records without understanding the field). The acceptance contract is that this DID URL dereferences via the G1 (#906) resolution path.

Crucially, the value is a did:-scheme DID URL — never a raw 9P path and never an at:// URI. at:// addresses this record; the record’s body resolves onward to a DID URL. Keeping 9P paths out of the at:// / record layer is the #879 name-resolution non-goal made structural: paths live below the DID, reached only after the DID URL dereferences.

§Encoding

Records are canonical DAG-CBOR: map keys in pure lexicographic byte order (RFC 7049 §4.2.1 “core determinism”), matching the rest of this crate. For these four keys that order is createdAt, label, pin, subject. Same record → same bytes → same CID.

pin is a format: "cid" string (not a DAG-CBOR link): it references external content addressed outside this repo’s MST, so it is carried as text and validated as a CID string — the same treatment currentOid gets in crate::record.

Structs§

NameRecord
An ai.hyprstream.name record: the trusted name → DID-URL binding.

Constants§

COLLECTION_NSID
The NSID of this record type — the collection portion of an at-uri that addresses a NameRecord (at://<repo>/ai.hyprstream.name/<rkey>).