Skip to main content

encode_dag_cbor

Function encode_dag_cbor 

Source
pub fn encode_dag_cbor(value: &CborValue) -> Result<Vec<u8>, CborError>
Expand description

Encode a value using canonical DAG-CBOR.

This encoding:

  • uses definite-length, shortest-form (canonical) integer headers only
  • orders map keys by RFC 8949 core deterministic rules: shorter encoded key first, then bytewise lexical order among equal lengths
  • contains no floats, tags, or indefinite-length items
  • is deterministic and cryptographically stable, so equal values always encode to identical bytes (a prerequisite for stable content IDs)