コード例 #1
0
    def _updateLinkWithLatestInfo(self, link: Connection, reply):
        if DATA in reply and reply[DATA]:
            data = json.loads(reply[DATA])

            verkey = data.get(VERKEY)
            if verkey is not None:
                link.remoteVerkey = data[VERKEY]

            ep = data.get(ENDPOINT)
            if isinstance(ep, dict):
                # TODO: Validate its an IP port pair or a malicious entity
                # can crash the code
                if 'ha' in ep:
                    ip, port = ep['ha'].split(":")
                    link.remoteEndPoint = (ip, int(port))
                if PUBKEY in ep:
                    link.remotePubkey = ep[PUBKEY]
                else:
                    link.remotePubkey = friendlyVerkeyToPubkey(
                        link.full_remote_verkey
                    ) if link.full_remote_verkey else None

            link.connection_last_synced = datetime.now()
            self.notifyMsgListener("    Connection {} synced".format(
                link.name))
コード例 #2
0
    def _updateLinkWithLatestInfo(self, link: Link, reply):
        link.remoteVerkey = DidVerifier(
            reply[VERKEY], identifier=link.remoteIdentifier).verkey
        if DATA in reply and reply[DATA]:
            data = json.loads(reply[DATA])
            ep = data.get(ENDPOINT)
            if ep:
                # TODO: Validate its an IP port pair or a malicious entity
                # can crash the code
                if 'ha' in ep:
                    ip, port = ep['ha'].split(":")
                    link.remoteEndPoint = (ip, int(port))
                if PUBKEY in ep:
                    link.remotePubkey = ep[PUBKEY]
                else:
                    link.remotePubkey = friendlyVerkeyToPubkey(
                        link.remoteVerkey) if link.remoteVerkey else None

        link.linkLastSynced = datetime.now()
        self.notifyMsgListener("    Link {} synced".format(link.name))
コード例 #3
0
ファイル: walleted.py プロジェクト: Artemkaaas/sovrin-node
    def _updateLinkWithLatestInfo(self, link: Link, reply):
        if DATA in reply and reply[DATA]:
            data = json.loads(reply[DATA])

            verkey = data.get(VERKEY)
            if verkey is not None:
                link.remoteVerkey = data[VERKEY]

            ep = data.get(ENDPOINT)
            if isinstance(ep, dict):
                # TODO: Validate its an IP port pair or a malicious entity
                # can crash the code
                if 'ha' in ep:
                    ip, port = ep['ha'].split(":")
                    link.remoteEndPoint = (ip, int(port))
                if PUBKEY in ep:
                    link.remotePubkey = ep[PUBKEY]
                else:
                    link.remotePubkey = friendlyVerkeyToPubkey(
                        link.full_remote_verkey) if link.full_remote_verkey else None

            link.linkLastSynced = datetime.now()
            self.notifyMsgListener("    Link {} synced".format(link.name))