예제 #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)
예제 #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()
예제 #3
0
def pack(msg: Message) -> str:
    """
    Serialize from Message to json string or from dictionary to json string.
    """
    return msg.as_json()
예제 #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')