def data(self) -> Optional[bytes]: if self.__attachment is None: base64 = self.get('data') if base64 is not None: self.__attachment = base64_decode(base64) return self.__attachment
def snapshot(self) -> Optional[bytes]: if self.__snapshot is None: base64 = self.get('snapshot') if base64 is not None: self.__snapshot = base64_decode(base64) return self.__snapshot
def thumbnail(self) -> Optional[bytes]: if self.__thumbnail is None: base64 = self.get('thumbnail') if base64 is not None: self.__thumbnail = base64_decode(base64) return self.__thumbnail
def decode_signature(self, signature: str, msg: ReliableMessage) -> Optional[bytes]: return base64_decode(string=signature)
def decode_data(self, data: str, msg: SecureMessage) -> Optional[bytes]: if is_broadcast(msg=msg): # broadcast message content will not be encrypted (just encoded to JsON), # so return the string data directly return utf8_encode(string=data) return base64_decode(string=data)
def decode_key(self, key: str, msg: SecureMessage) -> Optional[bytes]: assert not is_broadcast(msg=msg), 'broadcast message has no key' return base64_decode(string=key)