Пример #1
0
        def validate(response: Message, req_id: str):
            response.check_for_attrs(
                [
                    ('@type', DIDExchange.RESPONSE),
                    '~thread',
                    'connection'
                ]
            )

            Message.check_for_attrs_in_message(
                [
                    (Message.THREAD_ID, req_id)
                ],
                response['~thread']
            )

            Message.check_for_attrs_in_message(
                [
                    DIDDoc.DID,
                    DIDDoc.DID_DOC
                ],
                response[DIDExchange.CONNECTION]
            )

            DIDDoc.validate(response[DIDExchange.CONNECTION][DIDDoc.DID_DOC])
Пример #2
0
 def validate(msg: Message):
     msg.check_for_attrs(
         [
             ('@type', AckMessage.ACK),
             'status',
             '~thread',
         ]
     )
Пример #3
0
 def validate_pre_sig(response: Message):
     response.check_for_attrs(
         [
             ('@type', DIDExchange.RESPONSE),
             '~thread',
             'connection~sig'
         ]
     )
Пример #4
0
 def validate(msg: Message):
     msg.check_for_attrs(
         [
             ('@type', RoutingMessage.FORWARD),
             'to',
             'msg',
         ]
     )
Пример #5
0
    def validate(msg: Message):
        msg.check_for_attrs([
            ('@type', BasicMessage.MESSAGE),
            '~l10n',
            'sent_time',
            'content',
        ])

        Message.check_for_attrs_in_message([('locale', 'en')], msg['~l10n'])