COSEHeaderMap.deserialize constructor
COSEHeaderMap.deserialize(
- CborMapValue<
CborObject, CborObject> cbor
Implementation
factory COSEHeaderMap.deserialize(CborMapValue cbor) {
final data = cbor.value.clone()
..removeWhere((k, v) {
return k is CborIntValue && k.value > 0 && k.value < 8;
});
return COSEHeaderMap(
algorithmId: cbor
.getIntValueAs<CborObject?>(1)
?.convertTo<COSELabel, CborObject>((e) => COSELabel.deserialize(e)),
criticality: cbor
.getIntValueAs<CborObject?>(2)
?.convertTo<COSELabels, CborIterableObject>(
(e) => COSELabels.deserialize(e)),
contentType: cbor
.getIntValueAs<CborObject?>(3)
?.convertTo<COSELabel, CborObject>((e) => COSELabel.deserialize(e)),
keyId: cbor
.getIntValueAs<CborBytesValue?>(4)
?.convertTo<List<int>, CborBytesValue>((e) => e.value),
initVector: cbor
.getIntValueAs<CborBytesValue?>(5)
?.convertTo<List<int>, CborBytesValue>((e) => e.value),
partialInitVector: cbor
.getIntValueAs<CborBytesValue?>(6)
?.convertTo<List<int>, CborBytesValue>((e) => e.value),
counterSignature: cbor
.getIntValueAs<CborListValue?>(7)
?.convertTo<COSECounterSignature, CborListValue>(
(e) => COSECounterSignature.deserialize(e)),
otherHeaders: {
for (final i in data.entries) COSELabel.deserialize(i.key): i.value
});
}