Oxygène #
(n) Gaz incolore, inodore et sans saveur qui compose 1/5ème de l'air atmosphérique.
Various data decoding primitives for working with AT Protocol and the Atmosphere (including CAR, CID, CBOR). (Extracted from Skyfall, work in progress.)
Note
Part of ATProto Ruby SDK: ruby.sdk.blue
Pure Ruby DAG-CBOR decoder #
The decoding-only Oxygene::DAGCBOR proof of concept implements the ATProto
subset without depending on the cbor gem:
value = Oxygene::DAGCBOR.decode(cbor_bytes)
header, body = Oxygene::DAGCBOR.decode_sequence(event_frame)
It supports signed 64-bit integers, byte and text strings, arrays,
string-keyed maps, CID tag 42, booleans, and null. CID links are returned as
Oxygene::DAGCBOR::Tagged values with the same tag and value readers as
CBOR::Tagged. Floats, indefinite-length values, other tags, and other CBOR
simple values are rejected.
This is a specialized decoder, not a canonical-encoding validator: it assumes that text is valid UTF-8 and does not check preferred integer widths, map key order, or duplicate keys. It does reject truncated data, trailing data, non-string map keys, invalid CID tag shapes, excessive declared collection sizes, and nesting deeper than 128 levels.
Run benchmark/dag_cbor_decode.rb with and without --yjit to compare it to
the C extension on a real CAR corpus.
Credits #
Copyright © 2026 Kuba Suder (@mackuba.eu).
The code is available under the terms of the zlib license (permissive, similar to MIT).