コード例 #1
0
    async def sendProofAsync(self, link: Link, claimPrfReq: ClaimProofRequest):
        nonce = getNonceForProof(link.invitationNonce)

        revealedAttrNames = claimPrfReq.verifiableAttributes
        proofInput = ProofInput(revealedAttrs=revealedAttrNames)
        proof, revealedAttrs = await self.prover.presentProof(proofInput, nonce)

        op = {
            NAME: claimPrfReq.name,
            VERSION: claimPrfReq.version,
            NONCE: link.invitationNonce,
            TYPE: CLAIM_PROOF,
            PROOF_FIELD: proof.toStrDict(),
            PROOF_INPUT_FIELD: proofInput.toStrDict(),
            REVEALED_ATTRS_FIELD: toDictWithStrValues(revealedAttrs)
        }

        self.signAndSend(msg=op, linkName=link.name)
コード例 #2
0
    async def sendProofAsync(self, link: Link, proofRequest: ProofRequest):
        # TODO _F_ this nonce should be from the Proof Request, not from an
        # invitation
        nonce = getNonceForProof(link.invitationNonce)

        revealedAttrNames = proofRequest.verifiableAttributes
        proofInput = ProofInput(revealedAttrs=revealedAttrNames)
        # TODO rename presentProof to buildProof or generateProof
        proof, revealedAttrs = await self.prover.presentProof(proofInput, nonce)
        revealedAttrs.update(proofRequest.selfAttestedAttrs)
        op = OrderedDict([
            (TYPE, PROOF),
            (NAME, proofRequest.name),
            (VERSION, proofRequest.version),
            (NONCE, link.invitationNonce),
            (PROOF_FIELD, proof.toStrDict()),
            (PROOF_INPUT_FIELD, proofInput.toStrDict()),  # TODO _F_ why do we need to send this? isn't the same data passed as keys in 'proof'?
            (REVEALED_ATTRS_FIELD, toDictWithStrValues(revealedAttrs))])

        self.signAndSend(msg=op, linkName=link.name)
コード例 #3
0
ファイル: agent_prover.py プロジェクト: dhh1128/indy-client
    async def sendProofAsync(self, link: Link, proofRequest: ProofRequest):
        # TODO _F_ this nonce should be from the Proof Request, not from an
        # invitation
        nonce = getNonceForProof(link.invitationNonce)

        revealedAttrNames = proofRequest.verifiableAttributes
        proofInput = ProofInput(revealedAttrs=revealedAttrNames)
        # TODO rename presentProof to buildProof or generateProof
        proof, revealedAttrs = await self.prover.presentProof(proofInput, nonce)
        revealedAttrs.update(proofRequest.selfAttestedAttrs)
        op = OrderedDict([
            (TYPE, PROOF),
            (NAME, proofRequest.name),
            (VERSION, proofRequest.version),
            (NONCE, link.invitationNonce),
            (PROOF_FIELD, proof.toStrDict()),
            (PROOF_INPUT_FIELD, proofInput.toStrDict()),  # TODO _F_ why do we need to send this? isn't the same data passed as keys in 'proof'?
            (REVEALED_ATTRS_FIELD, toDictWithStrValues(revealedAttrs))])

        self.signAndSendToLink(msg=op, linkName=link.name)
コード例 #4
0
def testProofInputFromToDict():
    proofInput = ProofInput(['name', 'age'],
                            [PredicateGE('age', 18),
                             PredicateGE('age', 25)])
    assert proofInput == ProofInput.fromStrDict(proofInput.toStrDict())