COSEKey.fromJson constructor

COSEKey.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory COSEKey.fromJson(Map<String, dynamic> json) {
  return COSEKey(
      algorithmId: json["algorithm_id"] == null
          ? null
          : COSELabel.fromJson(json["algorithm_id"]),
      baseInitVector: BytesUtils.tryFromHexString(json["base_init_vector"]),
      keyId: BytesUtils.tryFromHexString(json["key_id"]),
      keyOps: json["key_ops"] == null
          ? null
          : COSELabels.fromJson(json["key_ops"]),
      keyType: json["key_type"] == null
          ? null
          : COSELabel.fromJson(json["key_type"]),
      otherHeaders: (json["other_headers"] as Map?)?.map((k, v) =>
          MapEntry(COSELabel.fromJson(k), CborObject.fromCborHex(v))));
}