von_anchor/anchor/verifier.py
async def verify_proof(self, proof_req: dict, proof: dict) -> str:
        """
        Verify proof as Verifier. Raise AbsentRevReg if a proof cites a revocation registry
        that does not exist on the distributed ledger.

        :param proof_req: proof request as Verifier creates, as per proof_req_json above
        :param proof: proof as HolderProver creates
        :return: json encoded True if proof is valid; False if not
        """

        LOGGER.debug('Verifier.verify_proof >>> proof_req: %s, proof: %s', proof_req, proof)

        s_id2schema = {}
        cd_id2cred_def = {}
        rr_id2rr_def = {}
        rr_id2rr = {}
        proof_ids = proof['identifiers']

        for proof_id in proof_ids:
            # schema
            s_id = proof_id['schema_id']
            if not ok_schema_id(s_id):
                LOGGER.debug('Verifier.verify_proof <!< Bad schema id %s', s_id)
                raise BadIdentifier('Bad schema id {}'.format(s_id))

            if s_id not in s_id2schema:
                schema = json.loads(await self.get_schema(s_id))  # add to cache en passant
                if not schema:
                    LOGGER.debug(
                        'Verifier.verify_proof <!< absent schema %s, proof req may be for another ledger',
                        s_id)
                    raise AbsentSchema('Absent schema {}, proof req may be for another ledger'.format(s_id))
                s_id2schema[s_id] = schema

            # cred def
            cd_id = proof_id['cred_def_id']
            if not ok_cred_def_id(cd_id):
                LOGGER.debug('Verifier.verify_proof <!< Bad cred def id %s', cd_id)
                raise BadIdentifier('Bad cred def id {}'.format(cd_id))

            if cd_id not in cd_id2cred_def:
                cred_def = json.loads(await self.get_cred_def(cd_id))  # add to cache en passant
                cd_id2cred_def[cd_id] = cred_def

            # rev reg def
            rr_id = proof_id['rev_reg_id']
            if not rr_id:
                continue
            if not ok_rev_reg_id(rr_id):
                LOGGER.debug('Verifier.verify_proof <!< Bad rev reg id %s', rr_id)
                raise BadIdentifier('Bad rev reg id {}'.format(rr_id))

            rr_def_json = await self.get_rev_reg_def(rr_id)
            rr_id2rr_def[rr_id] = json.loads(rr_def_json)

            # timestamp
            timestamp = proof_id['timestamp']
            with REVO_CACHE.lock:
                revo_cache_entry = REVO_CACHE.get(rr_id, None)
                (rr_json, _) = await revo_cache_entry.get_state_json(self._build_rr_state_json, timestamp, timestamp)
                if rr_id not in rr_id2rr:
                    rr_id2rr[rr_id] = {}
                rr_id2rr[rr_id][timestamp] = json.loads(rr_json)

        rv = json.dumps(await anoncreds.verifier_verify_proof(
            json.dumps(proof_req),
            json.dumps(proof),
            json.dumps(s_id2schema),
            json.dumps(cd_id2cred_def),
            json.dumps(rr_id2rr_def),
            json.dumps(rr_id2rr)))

        LOGGER.debug('Verifier.verify_proof <<< %s', rv)
        return rv

        Verify proof as Verifier. Raise AbsentRevReg if a proof cites a revocation registry
        that does not exist on the distributed ledger.

        :param proof_req: proof request as Verifier creates, as per proof_req_json above
        :param proof: proof as HolderProver creates
        :return: json encoded True if proof is valid; False if not
        
Verify proof as Verifier. Raise AbsentRevReg if a proof cites a revocation registry
that does not exist on the distributed ledger.
Verify proof as Verifier . Raise AbsentRevReg if a proof cites a revocation registry that does not exist on the distributed ledger .
async def verify_proof(self, proof_req: dict, proof: dict) -> str:
        LOGGER.debug('Verifier.verify_proof >>> proof_req: %s, proof: %s', proof_req, proof)
        s_id2schema = {}
        cd_id2cred_def = {}
        rr_id2rr_def = {}
        rr_id2rr = {}
        proof_ids = proof['identifiers']
        for proof_id in proof_ids:
            s_id = proof_id['schema_id']
            if not ok_schema_id(s_id):
                LOGGER.debug('Verifier.verify_proof <!< Bad schema id %s', s_id)
                raise BadIdentifier('Bad schema id {}'.format(s_id))
            if s_id not in s_id2schema:
                schema = json.loads(await self.get_schema(s_id))  
                if not schema:
                    LOGGER.debug(
                        'Verifier.verify_proof <!< absent schema %s, proof req may be for another ledger',
                        s_id)
                    raise AbsentSchema('Absent schema {}, proof req may be for another ledger'.format(s_id))
                s_id2schema[s_id] = schema
            cd_id = proof_id['cred_def_id']
            if not ok_cred_def_id(cd_id):
                LOGGER.debug('Verifier.verify_proof <!< Bad cred def id %s', cd_id)
                raise BadIdentifier('Bad cred def id {}'.format(cd_id))
            if cd_id not in cd_id2cred_def:
                cred_def = json.loads(await self.get_cred_def(cd_id))  
                cd_id2cred_def[cd_id] = cred_def
            rr_id = proof_id['rev_reg_id']
            if not rr_id:
                continue
            if not ok_rev_reg_id(rr_id):
                LOGGER.debug('Verifier.verify_proof <!< Bad rev reg id %s', rr_id)
                raise BadIdentifier('Bad rev reg id {}'.format(rr_id))
            rr_def_json = await self.get_rev_reg_def(rr_id)
            rr_id2rr_def[rr_id] = json.loads(rr_def_json)
            timestamp = proof_id['timestamp']
            with REVO_CACHE.lock:
                revo_cache_entry = REVO_CACHE.get(rr_id, None)
                (rr_json, _) = await revo_cache_entry.get_state_json(self._build_rr_state_json, timestamp, timestamp)
                if rr_id not in rr_id2rr:
                    rr_id2rr[rr_id] = {}
                rr_id2rr[rr_id][timestamp] = json.loads(rr_json)
        rv = json.dumps(await anoncreds.verifier_verify_proof(
            json.dumps(proof_req),
            json.dumps(proof),
            json.dumps(s_id2schema),
            json.dumps(cd_id2cred_def),
            json.dumps(rr_id2rr_def),
            json.dumps(rr_id2rr)))
        LOGGER.debug('Verifier.verify_proof <<< %s', rv)
        return rv
async def verify_proof ( self , proof_req : dict , proof : dict ) -> str : LOGGER . debug ( 'Verifier.verify_proof >>> proof_req: %s, proof: %s' , proof_req , proof ) s_id2schema = { } cd_id2cred_def = { } rr_id2rr_def = { } rr_id2rr = { } proof_ids = proof [ 'identifiers' ] for proof_id in proof_ids : s_id = proof_id [ 'schema_id' ] if not ok_schema_id ( s_id ) : LOGGER . debug ( 'Verifier.verify_proof <!< Bad schema id %s' , s_id ) raise BadIdentifier ( 'Bad schema id {}' . format ( s_id ) ) if s_id not in s_id2schema : schema = json . loads ( await self . get_schema ( s_id ) ) if not schema : LOGGER . debug ( 'Verifier.verify_proof <!< absent schema %s, proof req may be for another ledger' , s_id ) raise AbsentSchema ( 'Absent schema {}, proof req may be for another ledger' . format ( s_id ) ) s_id2schema [ s_id ] = schema cd_id = proof_id [ 'cred_def_id' ] if not ok_cred_def_id ( cd_id ) : LOGGER . debug ( 'Verifier.verify_proof <!< Bad cred def id %s' , cd_id ) raise BadIdentifier ( 'Bad cred def id {}' . format ( cd_id ) ) if cd_id not in cd_id2cred_def : cred_def = json . loads ( await self . get_cred_def ( cd_id ) ) cd_id2cred_def [ cd_id ] = cred_def rr_id = proof_id [ 'rev_reg_id' ] if not rr_id : continue if not ok_rev_reg_id ( rr_id ) : LOGGER . debug ( 'Verifier.verify_proof <!< Bad rev reg id %s' , rr_id ) raise BadIdentifier ( 'Bad rev reg id {}' . format ( rr_id ) ) rr_def_json = await self . get_rev_reg_def ( rr_id ) rr_id2rr_def [ rr_id ] = json . loads ( rr_def_json ) timestamp = proof_id [ 'timestamp' ] with REVO_CACHE . lock : revo_cache_entry = REVO_CACHE . get ( rr_id , None ) ( rr_json , _ ) = await revo_cache_entry . get_state_json ( self . _build_rr_state_json , timestamp , timestamp ) if rr_id not in rr_id2rr : rr_id2rr [ rr_id ] = { } rr_id2rr [ rr_id ] [ timestamp ] = json . loads ( rr_json ) rv = json . dumps ( await anoncreds . verifier_verify_proof ( json . dumps ( proof_req ) , json . dumps ( proof ) , json . dumps ( s_id2schema ) , json . dumps ( cd_id2cred_def ) , json . dumps ( rr_id2rr_def ) , json . dumps ( rr_id2rr ) ) ) LOGGER . debug ( 'Verifier.verify_proof <<< %s' , rv ) return rv
Verify proof as Verifier.
Verify proof as Verifier .
"""
        Verify proof as Verifier. Raise AbsentRevReg if a proof cites a revocation registry
        that does not exist on the distributed ledger.

        :param proof_req: proof request as Verifier creates, as per proof_req_json above
        :param proof: proof as HolderProver creates
        :return: json encoded True if proof is valid; False if not
        """ # schema # add to cache en passant # cred def # add to cache en passant # rev reg def # timestamp
json encoded True if proof is valid; False if not
json encoded True if proof is valid ; False if not
self
proof_req
dict
proof request as Verifier creates, as per proof_req_json above
proof request as Verifier creates as per proof_req_json above
proof
dict
proof as HolderProver creates
proof as HolderProver creates