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)
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)
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)
def testProofInputFromToDict(): proofInput = ProofInput(['name', 'age'], [PredicateGE('age', 18), PredicateGE('age', 25)]) assert proofInput == ProofInput.fromStrDict(proofInput.toStrDict())