Esempio n. 1
0
    async def send_admin_message(self, msg: Message):
        if self.agent_admin_key and self.admin_key:
            msg = await crypto.pack_message(self.wallet_handle,
                                            Serializer.pack(msg),
                                            [self.admin_key],
                                            self.agent_admin_key)
            msg = msg.decode('ascii')
        else:
            msg = msg.as_json()

        await self.outbound_admin_message_queue.put(msg)
Esempio n. 2
0
 def pack(msg: Message) -> bytes:
     """ Serialize from Message to json string or from dictionary to json string.
     """
     # TODO: Should return bytes and not string
     # return msg.as_json().encode()
     return msg.as_json()
Esempio n. 3
0
def pack(msg: Message) -> str:
    """
    Serialize from Message to json string or from dictionary to json string.
    """
    return msg.as_json()
Esempio n. 4
0
    def serialize(msg: Message) -> bytes:
        """ Serialize from Message to json string or from dictionary to json string.
        """

        return msg.as_json().encode('utf-8')