Ejemplo n.º 1
0
    async def revoke(self, password, community):
        """
        Revoke self-identity on server, not in blockchain

        :param str password: The account SigningKey password
        :param sakia.core.community.Community community: The community target of the revokation
        """
        revoked = await self._identities_registry.future_find(self.pubkey, community)

        revokation = Revocation(PROTOCOL_VERSION, community.currency, None)
        selfcert = await revoked.selfcert(community)

        key = SigningKey(self.salt, password)
        revokation.sign(selfcert, [key])

        logging.debug("Self-Revokation Document : \n{0}".format(revokation.raw(selfcert)))
        logging.debug("Signature : \n{0}".format(revokation.signatures[0]))

        data = {
            'pubkey': revoked.pubkey,
            'self_': selfcert.signed_raw(),
            'sig': revokation.signatures[0]
        }
        logging.debug("Posted data : {0}".format(data))
        responses = await community.bma_access.broadcast(bma.wot.Revoke, {}, data)
        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
Ejemplo n.º 2
0
    async def revoke(self, currency, identity, salt, password):
        """
        Revoke self-identity on server, not in blockchain

        :param str currency: The currency of the identity
        :param sakia.data.entities.IdentityDoc identity: The certified identity
        :param str salt: The account SigningKey salt
        :param str password: The account SigningKey password
        """
        revocation = Revocation(10, currency, None)
        self_cert = identity.document()

        key = SigningKey(salt, password)
        revocation.sign(self_cert, [key])

        self._logger.debug("Self-Revokation Document : \n{0}".format(revocation.raw(self_cert)))
        self._logger.debug("Signature : \n{0}".format(revocation.signatures[0]))

        data = {
            'pubkey': identity.pubkey,
            'self_': self_cert.signed_raw(),
            'sig': revocation.signatures[0]
        }
        self._logger.debug("Posted data : {0}".format(data))
        responses = await self._bma_connector.broadcast(currency, bma.wot.Revoke, {}, data)
        result = await parse_bma_responses(responses)
        return result
Ejemplo n.º 3
0
    async def revoke(self, currency, identity, salt, password):
        """
        Revoke self-identity on server, not in blockchain

        :param str currency: The currency of the identity
        :param sakia.data.entities.IdentityDoc identity: The certified identity
        :param str salt: The account SigningKey salt
        :param str password: The account SigningKey password
        """
        revocation = Revocation(10, currency, None)
        self_cert = identity.document()

        key = SigningKey(salt, password)
        revocation.sign(self_cert, [key])

        self._logger.debug("Self-Revokation Document : \n{0}".format(
            revocation.raw(self_cert)))
        self._logger.debug("Signature : \n{0}".format(
            revocation.signatures[0]))

        data = {
            'pubkey': identity.pubkey,
            'self_': self_cert.signed_raw(),
            'sig': revocation.signatures[0]
        }
        self._logger.debug("Posted data : {0}".format(data))
        responses = await self._bma_connector.broadcast(
            currency, bma.wot.Revoke, {}, data)
        result = await parse_bma_responses(responses)
        return result
Ejemplo n.º 4
0
    async def revoke(self, password, community):
        """
        Revoke self-identity on server, not in blockchain

        :param str password: The account SigningKey password
        :param sakia.core.community.Community community: The community target of the revokation
        """
        revoked = await self._identities_registry.future_find(self.pubkey, community)

        revokation = Revocation(PROTOCOL_VERSION, community.currency, None)
        selfcert = await revoked.selfcert(community)

        key = SigningKey(self.salt, password)
        revokation.sign(selfcert, [key])

        logging.debug("Self-Revokation Document : \n{0}".format(revokation.raw(selfcert)))
        logging.debug("Signature : \n{0}".format(revokation.signatures[0]))

        data = {
            'pubkey': revoked.pubkey,
            'self_': selfcert.signed_raw(),
            'sig': revokation.signatures[0]
        }
        logging.debug("Posted data : {0}".format(data))
        responses = await community.bma_access.broadcast(bma.wot.Revoke, {}, data)
        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