toCbor method

  1. @override
CborObject toCbor()
override

Converts the object to a CBOR object.

Implementation

@override
CborObject toCbor() {
  final obj = switch (serializationConfig.encoding) {
    CborIterableEncodingType.inDefinite =>
      CborListValue.inDefinite(certificates.map((e) => e.toCbor()).toList()),
    CborIterableEncodingType.definite =>
      CborListValue.definite(certificates.map((e) => e.toCbor()).toList()),
    CborIterableEncodingType.set =>
      CborSetValue(certificates.map((e) => e.toCbor())),
  } as CborObject;
  final tags = serializationConfig.tags;
  if (tags != null) {
    return CborTagValue(obj, tags);
  }
  return obj;
}