cardano-api
Safe HaskellNone
LanguageHaskell2010

Cardano.Api.Internal.Serialise.Cbor.Canonical

Synopsis

Documentation

canonicaliseCborBs :: ByteString -> Either DecoderError ByteString Source #

This function implements CBOR canonicalisation (RFC 7049):

  • Map keys are sorted lexicographically
  • Indefinite-length mapslists are converted to finite-length mapslists
  • The representation of the CBOR major types is as small as possible (provided by "cborg" package)

This function implements only CBOR canonicalisation from CIP-21. Other requirements from CIP-21 are not implemented.

  1. CBOR RFC 7049, Canonicalisation description: https://datatracker.ietf.org/doc/html/rfc7049#section-3.9
  2. CIP-21: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0021/README.md#canonical-cbor-serialization-format

canonicaliseTerm :: Term -> Term Source #

This function implements CBOR canonicalisation at the Term level:

  • Map keys are sorted lexicographically
  • Indefinite-length mapslists are converted to finite-length mapslists

Orphan instances