ERIS defines an encoding of arbitrary content into a set of uniformly sized, encrypted and content-addressed blocks as well as a short identifier that can be encoded as an URN. The content can be reassembled from the blocks only with this identifier. ERIS allows a form of content-addressing that is optimized for transport over networks and allows content to be made available robustly.
ERIS is application and transport agnostic. A very similar encoding (ECRS) is used in GNUNet for file-sharing. Applications include transporting small pieces of RDF data or distributing Guix substitutes. Possible transports include HTTP, IPFS, CoAP and Sneakernets.
ERIS is formally specified and implementations for other language exist (and are being developed).
The OCaml ERIS implementation allows:
- Streaming encoding: Allows large content to be encoded while only keeping a minimal amount in memory.
- Random-access decoding: Decode small pieces of large content while de-referencing a minimal amount of blocks.
- Cross-platform support: See section below.
ERIS requires two cryptographic functions:
- Blake2b (with keying support)
- ChaCha20 (IETF variant as defined by RFC 8439)
Multiple implementations are provided for various platforms. Users can choose the implementation by using one of following packages (same trick as used by
eris.crypto-monocypher: Uses the Monocypher cryptographic library via the ocaml-monocypher bindings. This implementation works well on the Unix platform and is selected by default.
eris.crypto-zig: Uses the cryptographic primitives provided in the Zig standard library. This implementation works on the Unix platform and requires the Zig compiler installed.
eris.crypto-wasm: Uses the cryptographic primitives provided by the Zig standard library compiled to WebAssembly. This implementation can be used with js_of_ocaml and requires the Zig compiler installed. The WASM code is bundled using Crunch so users do not need to worry about provisioning or loading WASM.
eris.crypto-zig is an example of how Zig code can be used from OCaml.
eris.crypto-wasm is an example of how Zig code compiled to WebAssembly can be used from OCaml.
One large appeal of using Zig is that the entire build infrastructure is much smaller than compared to using something like Emscripten. it is also possible to guarantee reproducible and boot-strappable builds (using Guix).