From 639f8ee5a68cca9d2f7601a568c5eb7381836f6b Mon Sep 17 00:00:00 2001 From: Fabio Pinheiro Date: Wed, 8 Mar 2023 20:31:25 +0000 Subject: [PATCH] DidCommV2 doesn't specify 'typ' --- didcomm/message.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/didcomm/message.py b/didcomm/message.py index 74ea438..1791809 100644 --- a/didcomm/message.py +++ b/didcomm/message.py @@ -102,7 +102,7 @@ def as_dict(self) -> dict: d["from"] = d["frm"] del d["frm"] - d["typ"] = DIDCommMessageTypes.PLAINTEXT.value + d["typ"] = DIDCommMessageTypes.PLAINTEXT.value # this is not part of the official specification if self.attachments: d["attachments"] = [a.as_dict() for a in self.attachments] @@ -130,14 +130,10 @@ def from_dict(cls, d: dict) -> Message: raise MalformedMessageError(MalformedMessageCode.INVALID_PLAINTEXT) # TODO TEST missed fields - for f in ("id", "type", "body", "typ"): + for f in ("id", "type", "body"): if f not in d: raise MalformedMessageError(MalformedMessageCode.INVALID_PLAINTEXT) - if d["typ"] != DIDCommMessageTypes.PLAINTEXT.value: - raise MalformedMessageError(MalformedMessageCode.INVALID_PLAINTEXT) - del d["typ"] - if "from" in d: d["frm"] = d["from"] del d["from"]