Exemplo n.º 1
0
    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.signingState(identifier=idr),
                                     identifier=idr,
                                     otherIdentifier=req.identifier)

        return req
Exemplo n.º 2
0
    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.signingState(identifier=idr),
                                     identifier=idr,
                                     otherIdentifier=req.identifier)

        return req
Exemplo n.º 3
0
    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()
        self.ids[idr] = IdData(idData.signer, req.reqId)
        req.signature = self.signMsg(msg=req.getSigningState(),
                                     identifier=idr,
                                     otherIdentifier=req.identifier)

        return req