ProtoRune. CBOR
(proto_rune v0.3.0)
Copy Markdown
Minimal CBOR (RFC 8949) decoder.
Covers the DAG-CBOR subset used by the ATProto event stream: unsigned and negative integers, byte and text strings, arrays, maps, semantic tags, booleans, null and 32/64-bit floats. Indefinite-length items, half floats and simple values are not valid DAG-CBOR and are rejected.
Semantic tags are returned as {:tag, number, value} tuples. The tag 42
(CID link) can be turned into a ProtoRune.CID with ProtoRune.CID.from_link/1.
Decoding returns the value together with the unconsumed rest of the input,
which allows decoding the concatenated header/payload pairs used by
com.atproto.sync.subscribeRepos frames.
Summary
Functions
Decodes a single CBOR item from the head of the given binary.
Types
@type tag() :: {:tag, non_neg_integer(), term()}
A CBOR semantic tag, e.g. {:tag, 42, bytes} for a CID link.