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 = req.gen_req_id() # req.digest = req.getDigest() # QUESTION: `self.ids[idr]` would be overwritten if same identifier # is used to send 2 requests, why is `IdData` persisted? # self.ids[idr] = IdData(idData.signer, req.reqId) req.signature = self.signMsg(msg=req.signingPayloadState(identifier=idr), identifier=idr, otherIdentifier=req.identifier) return req
def do_multi_sig_on_req(self, request: Request, identifier: str): idr = self.requiredIdr(idr=identifier) signature = self.signMsg(msg=request.signingPayloadState(), identifier=idr) request.add_signature(idr, signature)