toCbor method

  1. @override
CborObject toCbor()
override

Converts the object to a CBOR object.

Implementation

@override
CborObject toCbor() {
  return CborMapValue<CborObject, CborObject>.definite({
    if (keyType != null) CborIntValue(1): keyType!.toCbor(),
    if (keyId != null) CborIntValue(2): CborBytesValue(keyId!),
    if (algorithmId != null) CborIntValue(3): algorithmId!.toCbor(),
    if (keyOps != null) CborIntValue(4): keyOps!.toCbor(),
    if (baseInitVector != null)
      CborIntValue(5): CborBytesValue(baseInitVector!),
    if (otherHeaders != null)
      for (final i in otherHeaders!.entries) i.key.toCbor(): i.value
  });
}