示例#1
0
    async def handleReqClaimResponse(self, msg):
        body, _ = msg
        issuerId = body.get(IDENTIFIER)
        claim = body[DATA]
        li = self._getLinkByTarget(getCryptonym(issuerId))
        if li:
            schemaId = ID(schemaId=claim[SCHEMA_SEQ_NO])
            schema = await self.prover.wallet.getSchema(schemaId)

            self.notifyResponseFromMsg(li.name, body.get(f.REQ_ID.nm))
            self.notifyMsgListener('    Received claim "{}".\n'.format(schema.name))

            pk = await self.prover.wallet.getPublicKey(schemaId)

            claim_attributes = {k: ClaimAttributeValues.from_str_dict(v) for k, v in json.loads(claim[CLAIM_FIELD]).items()}
            claim_signature = Claims.from_str_dict(claim[f.SIG.nm], pk.N)

            await self.prover.processClaim(schemaId, claim_attributes, claim_signature)
        else:
            self.notifyMsgListener("No matching link found")
示例#2
0
    async def handleReqClaimResponse(self, msg):
        body, _ = msg
        issuerId = body.get(IDENTIFIER)
        claim = body[DATA]
        li = self._getLinkByTarget(getCryptonym(issuerId))
        if li:
            self.notifyResponseFromMsg(li.name, body.get(f.REQ_ID.nm))
            self.notifyMsgListener('    Received claim "{}".\n'.format(
                claim[NAME]))
            name, version, claimAuthor = \
                claim[NAME], claim[VERSION], claim[f.IDENTIFIER.nm]

            schemaKey = SchemaKey(name, version, claimAuthor)
            schema = await self.prover.wallet.getSchema(ID(schemaKey))
            schemaId = ID(schemaKey=schemaKey, schemaId=schema.seqId)

            claim = Claims.fromStrDict(claim[CLAIM_FIELD])

            await self.prover.processClaim(schemaId, claim)
        else:
            self.notifyMsgListener("No matching link found")
示例#3
0
def testClaimsFromToDict(claimsProver1Gvt):
    assert claimsProver1Gvt == Claims.fromStrDict(claimsProver1Gvt.toStrDict())
示例#4
0
def testClaimsFromToDictPrimaryOnly(claimsProver1Gvt):
    claims = Claims(primaryClaim=claimsProver1Gvt.primaryClaim)
    assert claims == Claims.fromStrDict(claims.toStrDict())
 async def getClaimSignature(self, schemaId: ID) -> Claims:
     c1 = await self._getValueForId(self._c1s, schemaId)
     c2 = None if not self._c2s else await self._getValueForId(self._c2s,
                                                               schemaId)
     return Claims(c1, c2)