encodeAsCbor

Encodes the given NameSpacedData as CBOR.

The encoding uses the following CDDL:

NameSpacedCbor = {
+ NameSpaceName => DataElements
}

NameSpaceName = tstr

DataElements = [
+ DataElementName => DataElementValueBytes
]

DataElementName = tstr
DataElementValue = any
DataElementValueBytes = #6.24(bstr .cbor DataElementValue)

Here's an example of CBOR conforming to the above CDDL printed in diagnostic form:

{
"org.iso.18013.5.1" : {
"given_name" : 24(<< "Erika" >>),
"family_name" : 24(<< "Mustermann" >>),
},
"org.iso.18013.5.1.aamva" : {
"organ_donor" : 24(<< 1 >>)
}
}

Name spaces and data elements will be in the order they were inserted using at construction time, either using the .Builder or .fromEncodedCbor.

Return

the bytes of the encoding describe above.