예제 #1
0
파일: account.py 프로젝트: c-geek/sakia
    async def send_selfcert(self, password, community):
        """
        Send our self certification to a target community

        :param str password: The account SigningKey password
        :param community: The community target of the self certification
        """
        selfcert = SelfCertification(PROTOCOL_VERSION,
                                     community.currency,
                                     self.pubkey,
                                     int(time.time()),
                                     self.name,
                                     None)
        key = SigningKey(self.salt, password)
        selfcert.sign([key])
        logging.debug("Key publish : {0}".format(selfcert.signed_raw()))

        responses = await community.bma_access.broadcast(bma.wot.Add, {}, {'pubkey': self.pubkey,
                                              'self_': selfcert.signed_raw(),
                                              'other': {}})
        result = (False, "")
        for r in responses:
            if r.status == 200:
                result = (True, (await r.json()))
            elif not result[0]:
                result = (False, (await r.text()))
            else:
                await r.release()
        return result
예제 #2
0
파일: person.py 프로젝트: Insoleet/cutecoin
    def selfcert(self, community):
        '''
        Get the person self certification.
        This request is not cached in the person object.

        :param community: The community target to request the self certification
        :return: A SelfCertification ucoinpy object
        '''
        data = community.request(bma.wot.Lookup,
                                 req_args={'search': self.pubkey})
        logging.debug(data)
        timestamp = 0

        for result in data['results']:
            if result["pubkey"] == self.pubkey:
                uids = result['uids']
                for uid_data in uids:
                    if uid_data["meta"]["timestamp"] > timestamp:
                        timestamp = uid_data["meta"]["timestamp"]
                        uid = uid_data["uid"]
                        signature = uid_data["self"]

                return SelfCertification(PROTOCOL_VERSION, community.currency,
                                         self.pubkey, timestamp, uid,
                                         signature)
        raise PersonNotFoundError(self.pubkey, community.name)
예제 #3
0
    def send_selfcert(self, password, community):
        '''
        Send our self certification to a target community

        :param str password: The account SigningKey password
        :param community: The community target of the self certification
        '''
        selfcert = SelfCertification(PROTOCOL_VERSION,
                                     community.currency,
                                     self.pubkey,
                                     int(time.time()),
                                     self.name,
                                     None)
        key = SigningKey(self.salt, password)
        selfcert.sign([key])
        logging.debug("Key publish : {0}".format(selfcert.signed_raw()))
        community.broadcast(bma.wot.Add, {}, {'pubkey': self.pubkey,
                                              'self_': selfcert.signed_raw(),
                                              'other': []})
예제 #4
0
    def send_selfcert(self, password, community):
        '''
        Send our self certification to a target community

        :param str password: The account SigningKey password
        :param community: The community target of the self certification
        '''
        selfcert = SelfCertification(PROTOCOL_VERSION,
                                     community.currency, self.pubkey,
                                     int(time.time()), self.name, None)
        key = SigningKey(self.salt, password)
        selfcert.sign([key])
        logging.debug("Key publish : {0}".format(selfcert.signed_raw()))
        community.broadcast(bma.wot.Add, {}, {
            'pubkey': self.pubkey,
            'self_': selfcert.signed_raw(),
            'other': []
        })