toCbor method

  1. @override
CborObject toCbor()
override

Converts the object to a CBOR object.

Implementation

@override
CborObject toCbor() {
  return CborMapValue<CborObject, CborObject>.definite({
    if (algorithmId != null) CborIntValue(1): algorithmId!.toCbor(),
    if (criticality != null) CborIntValue(2): criticality!.toCbor(),
    if (contentType != null) CborIntValue(3): contentType!.toCbor(),
    if (keyId != null) CborIntValue(4): CborBytesValue(keyId!),
    if (initVector != null) CborIntValue(5): CborBytesValue(initVector!),
    if (partialInitVector != null)
      CborIntValue(6): CborBytesValue(partialInitVector!),
    if (counterSignature != null) CborIntValue(7): counterSignature!.toCbor(),
    if (otherHeaders != null)
      for (final i in otherHeaders!.entries) i.key.toCbor(): i.value
  });
}