COSEKey.deserialize constructor
COSEKey.deserialize(
- CborMapValue<
CborObject, CborObject> cbor
Implementation
factory COSEKey.deserialize(CborMapValue cbor) {
final data = cbor.value.clone()
..removeWhere((k, v) {
return k is CborIntValue && k.value > 0 && k.value < 6;
});
return COSEKey(
keyType: cbor
.getIntValueAs<CborObject?>(1)
?.convertTo<COSELabel, CborObject>((e) => COSELabel.deserialize(e)),
keyId: cbor
.getIntValueAs<CborBytesValue?>(2)
?.convertTo<List<int>, CborBytesValue>((e) => e.value),
algorithmId: cbor
.getIntValueAs<CborObject?>(3)
?.convertTo<COSELabel, CborObject>((e) => COSELabel.deserialize(e)),
keyOps: cbor
.getIntValueAs<CborObject?>(4)
?.convertTo<COSELabels, CborIterableObject>(
(e) => COSELabels.deserialize(e)),
baseInitVector: cbor
.getIntValueAs<CborBytesValue?>(5)
?.convertTo<List<int>, CborBytesValue>((e) => e.value),
otherHeaders: {
for (final i in data.entries) COSELabel.deserialize(i.key): i.value
});
}