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)
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': [] })