<?xml version="1.0"?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr"><head><title>EER - CBOR Serialization of ERIS Encoded Content</title><style type="text/css">body {max-width: 900px; margin-top: 3em; margin-bottom: 2em; margin-left: auto; margin-right: auto; text-align: left; line-height: 1.6; font-family: sans-serif; font-size: 12pt;}
#logo {margin: auto; width: 70px; display: block;}
figure {width: 80%; display: block; margin: auto; padding: 2.0rem;}
h1 {text-align: center;}
h2 {margin-top: 3em;}
table {border-collapse: collapse; width: 100%; margin: 1.5rem 0;}
td, th {border: 1px solid black; text-align: left; padding: 0.5rem;}
th {background: goldenrod; font-weight: bold;}
pre { max-width: 100%; overflow: auto; background:#f0f0f0; padding: 10px;}
img { margin: auto; max-width: 70%; }
footer { text-align: right; font-weight: 200; padding-top: 5em; }
footer span { padding: 0 0.5em 0 0.5em; }
</style></head><body><svg id="logo" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32"><defs><clipPath id="inside"><circle cx="16" cy="16" r="12" /></clipPath></defs><circle cx="16" cy="16" r="14" fill="goldenrod" stroke="black" stroke-width="2" /><path id="symbol" d="M 6,6 A 8,8 0 0,1 6,26 M 16,1 V 31 M 26,6 A 8,8 0 0,0 26,26" fill="none" stroke="black" stroke-width="2" clip-path="url(#inside)" /></svg><nav><a href="index.html">back to index</a></nav><article><h1>CBOR Serialization of ERIS Encoded Content</h1><p>This document specifies a CBOR (<a href="https://www.rfc-editor.org/rfc/rfc8949.html">RFC 8949</a>) based serialization of content-addressed blocks, references to blocks as well as ERIS read capabilities.</p><p>The serialization can be used to transport ERIS encoded content. The serialization is easy to implement and is well-suited for constrained environments such as embedded devices or web applications.</p><p>In order to decode content, all encoded blocks might have to be first read. This makes the serialization inefficient for direct decoding. See <a href="https://eris.codeberg.page/eer/sqlite.xml">SQLite for ERIS block storge</a> for a portable format that allows random-access to blocks.</p><h2>CBOR Serialization</h2><p>The serialization is a CBOR array or a CBOR sequence (<a href="https://www.rfc-editor.org/rfc/rfc8742.html">RFC 8742</a>) where the elements are either blocks, blocks with a reference, references to blocks or read capabilities.</p><p>The array MAY be encoded as CBOR indefinite length arrays.</p><p>The CBOR tag <code>1701996915</code> MAY be used to tag the array containing blocks and read capabilities and SHOULD be present in contexts where the semantics of the array might be ambiguous. Furthermore this tag MAY be preceded by the self-describing CBOR tag <code>55799</code> to establish that the content following it is in fact a CBOR tagged array. This would as an example identify blocks serialized into a file-system as such. For a complete description of this tagging convention see <a href="https://datatracker.ietf.org/doc/rfc9277/">RFC 9277</a>.</p><p>The serialization is specified in CDDL (<a href="https://datatracker.ietf.org/doc/html/rfc8610">RFC 8610</a>):</p><pre><code class="language-cddl">
block = bstr . size 1024 / bstr . size 32768
reference = bstr . size 32
block-map = { * reference =&gt; block }
read-capability = #6.276(bstr)

eris-cbor-element = block / reference / block-map / read-capability

eris-cbor = [ * eris-cbor-element ]
tagged-eris-cbor = #6.1701996915(eris-cbor)</code></pre><p>Note that blocks and references are only differentiated by size.</p><h3>CBOR Sequence</h3><p>The term <code>eris-cbor</code> may be encoded as a CBOR Sequence (<a href="https://www.rfc-editor.org/rfc/rfc8742.html">RFC 8742</a>).</p><p>This means that <code>eris-cbor-element</code> terms are concatenated instead of packed into a CBOR array. This allows the serialization to be appendable.</p><p>In order to tag a CBOR sequence the initial item should a CBOR null element tagged using <code>1701996915</code>:</p><pre><code class="language-cddl">tagged-eris-cbor-sequence = [ #6.1701996915(null), * eris-cbor-element ]</code></pre><p>This allows CBOR Sequences of ERIS encoded content to be detected.</p><h2>IANA Considerations</h2><h3>CBOR Tags Registry</h3><p>This specification requires the assignment of a CBOR tag:</p><ul><li>Tag: <code>1701996915</code></li><li>Data Item: <code>array</code></li><li>Semantics: Array of content-addressed blocks and ERIS read capabilities</li></ul><p>The tags is added to the CBOR Tags Registry as defined in <a href="https://www.rfc-editor.org/rfc/rfc8949.html">RFC 8949</a>.</p></article><footer><span><a href="https://codeberg.org/eris/eer/" title="Git repository from which this site is generated">Git</a></span><span><a href="https://creativecommons.org/licenses/by-sa/4.0/" title="Content licensed as CC-BY-SA-4.0">CC-BY-SA-4.0</a></span></footer></body></html>