ProtoRune. CID
(proto_rune v0.5.2)
Copy Markdown
CID (Content Identifier) values as they appear in the ATProto event stream.
Only CIDv1 is supported, which covers every CID produced by modern ATProto
relays and PDSes. The string representation uses the standard base32
multibase encoding (b prefix), so CIDs can be compared directly against
the CID strings returned by XRPC endpoints:
to_string(op.cid) == record["cid"]
Summary
Functions
Parses a binary CID from the head of the given binary.
Decodes a DAG-CBOR CID link ({:tag, 42, bytes}) into a CID.
Re-encodes the CID to its binary form.
Encodes the CID in its base32 multibase string form (b prefix).
Types
@type t() :: %ProtoRune.CID{codec: non_neg_integer(), multihash: binary(), version: 1}
A parsed CIDv1.
:version- always1.:codec- the multicodec code of the referenced data (0x71for DAG-CBOR,0x55for raw bytes).:multihash- the raw multihash bytes (function code varint, digest size varint and digest).
Functions
Parses a binary CID from the head of the given binary.
Returns the parsed CID along with the unconsumed rest of the input, which allows reading the CID-prefixed block entries of a CAR file.
Decodes a DAG-CBOR CID link ({:tag, 42, bytes}) into a CID.
DAG-CBOR prefixes the binary CID with a single 0x00 byte for historical
multibase reasons.
Re-encodes the CID to its binary form.
Encodes the CID in its base32 multibase string form (b prefix).