COSEPasswordEncryption.deserialize constructor

COSEPasswordEncryption.deserialize(
  1. CborTagValue<CborObject> cbor
)

Implementation

factory COSEPasswordEncryption.deserialize(CborTagValue cbor) {
  if (!BytesUtils.bytesEqual(tags, cbor.tags)) {
    throw ADAPluginException("Invalid COSEPasswordEncryption CBOR tag.",
        details: {"expected": tags, "tags": cbor.tags});
  }
  final values = cbor.valueAs<CborIterableObject>('COSEPasswordEncryption');
  return COSEPasswordEncryption(
      headers: COSEHeaders(
          protected: COSEProtectedHeaderMap.deserialize(
              values.elementAt<CborBytesValue>(0)),
          unprotected:
              COSEHeaderMap.deserialize(values.elementAt<CborMapValue>(1))),
      ciphertext: values.elementAtBytes<List<int>?>(2),
      serializationConfig:
          COSESerializationConfig(encoding: values.encoding));
}