def evilCreatePropagate(self, request: Request, identifier: str) -> Propagate: logger.debug( "EVIL: Creating propagate request for client request {}".format( request)) request.operation["amount"] += random.random() request.digest = request.getDigest() if isinstance(identifier, bytes): identifier = identifier.decode() return Propagate(request.__getstate__(), identifier)
def signRequest(self, req: Request, identifier: Identifier = None) -> Request: """ Signs request. Modifies reqId and signature. May modify identifier. :param req: request :param requestIdStore: request id generator :param identifier: signer identifier :return: signed request """ idr = self.requiredIdr(idr=identifier or req.identifier) idData = self._getIdData(idr) req.identifier = idr req.reqId = getTimeBasedId() req.digest = req.getDigest() self.ids[idr] = IdData(idData.signer, req.reqId) req.signature = self.signMsg(msg=req.signingState, identifier=idr, otherIdentifier=req.identifier) return req