gose/cbor

CBOR encoding and decoding (RFC 8949).

Used by the COSE layer for binary serialization. The Value type represents CBOR data items and is needed for CWT custom claims.

Indefinite-length encoding is not supported and will return a parse error.

Types

A CBOR data item (RFC 8949).

pub type Value {
  Int(Int)
  Bytes(BitArray)
  Text(String)
  Array(List(Value))
  Map(List(#(Value, Value)))
  Tag(Int, Value)
  Bool(Bool)
  Float(Float)
  Null
}

Constructors

  • Int(Int)

    An integer, positive or negative.

  • Bytes(BitArray)

    A byte string.

  • Text(String)

    A UTF-8 text string.

  • Array(List(Value))

    An ordered array of data items.

  • Map(List(#(Value, Value)))

    A map of key-value pairs. On encoding, pairs are sorted in bytewise lexicographic order of their encoded keys (core deterministic encoding).

  • Tag(Int, Value)

    A tagged data item (tag number and content).

  • Bool(Bool)

    A boolean.

  • Float(Float)

    A floating-point number.

  • Null

    Null.

Search Document