Beispiel #1
0
async def pack(wallet_handle: int, my_vk: str, their_vk: str, msg: Message) -> bytes:
    return await crypto.pack_message(
        wallet_handle,
        Serializer.pack(msg),
        [their_vk],
        my_vk
    )
Beispiel #2
0
async def handle_send_message(msg: Message, **kwargs):
    """ Message handler for send_message_command.
    """
    transport = kwargs['transport']
    if is_valid_send_message(msg):
        await transport.send(msg.to, Serializer.pack(msg.content))
        return
    print('invalid send message command dropped')
Beispiel #3
0
        def build(label: str, connection_key: str, endpoint: str) -> str:
            msg = Message({
                '@type': Connection.Message.INVITE,
                'label': label,
                'recipientKeys': [connection_key],
                'serviceEndpoint': endpoint,
                # routing_keys not specified, but here is where they would be put in the invite.
            })

            b64_invite = base64.urlsafe_b64encode(
                bytes(Serializer.pack(msg), 'ascii')).decode('ascii')

            return '{}?c_i={}'.format(endpoint, b64_invite)
Beispiel #4
0
async def test_got_hello_world(config, transport):
    msg = Message({
        'type': TESTING_MESSAGE.SEND_MESSAGE,
        'to': 'http://localhost:3000/indy',
        'content': {
            'type': 'hello_world',
            'message': 'Hello, world!'
        }
    })

    await transport.send(config.tested_agent, Serializer.pack(msg))
    msg_bytes = await expect_message(transport, 5)
    msg = Serializer.unpack(msg_bytes)

    assert msg.type == 'hello_world'
    assert msg.message == 'Hello, world!'