COSEHeaderMap.fomJson constructor

COSEHeaderMap.fomJson(
  1. Map<String, dynamic> json
)

Implementation

factory COSEHeaderMap.fomJson(Map<String, dynamic> json) {
  return COSEHeaderMap(
    algorithmId:
        json["algorithm_id"] == null
            ? null
            : COSELabel.fromJson(json["algorithm_id"]),
    criticality:
        json["criticality"] == null
            ? null
            : COSELabels.fromJson(json["criticality"]),
    contentType:
        json["content_type"] == null
            ? null
            : COSELabel.fromJson(json["content_type"]),
    keyId: BytesUtils.tryFromHexString(json["key_id"]),
    initVector: BytesUtils.tryFromHexString(json["init_vector"]),
    partialInitVector: BytesUtils.tryFromHexString(
      json["partial_init_vector"],
    ),
    counterSignature:
        json["counter_signature"] == null
            ? null
            : COSECounterSignature.fromJson(json["counter_signature"]),
    otherHeaders: (json["other_headers"] as Map?)?.map(
      (k, v) => MapEntry(COSELabel.fromJson(k), CborObject.fromCborHex(v)),
    ),
  );
}