async def doTestAnonCredsPrimaryOnly(): # 1. Create a Schema schema = await issuer.genSchema('GVT', '1.0', GVT.attribNames()) schemaId = ID(schemaKey=schema.getKey(), schemaId=schema.seqId) # 2. Create keys for the Schema await issuer.genKeys(schemaId, **primes1) # 3. Issue accumulator #TODO: Not implemented yet #await issuer.issueAccumulator(schemaId=schemaId, iA='110', L=5) # 4. set attributes for user1 attrs = GVT.attribs(name='Alex', age=28, height=175, sex='male') proverId = str(prover.proverId) attrRepo.addAttributes(schema.getKey(), proverId, attrs) # 5. request Claims claimsReq = await prover.createClaimRequest(schemaId, proverId, False) claims = await issuer.issueClaim(schemaId, claimsReq) await prover.processClaim(schemaId, claims) # 6. proof Claims proofInput = ProofInput( ['name'], [PredicateGE('age', 18)]) nonce = verifier.generateNonce() proof, revealedAttrs = await prover.presentProof(proofInput, nonce) assert await verifier.verify(proofInput, proof, revealedAttrs, nonce)
async def doTestAnonCredsPrimaryOnly(): # 1. Create a Schema schema = await issuer.genSchema('GVT', '1.0', GVT.attribNames()) schemaId = ID(schemaKey=schema.getKey(), schemaId=schema.seqId) # 2. Create keys for the Schema await issuer.genKeys(schemaId, **primes1) # 3. Issue accumulator #TODO: Not implemented yet #await issuer.issueAccumulator(schemaId=schemaId, iA='110', L=5) # 4. set attributes for user1 attrs = GVT.attribs(name='Alex', age=28, height=175, sex='male') proverId = str(prover.proverId) attrRepo.addAttributes(schema.getKey(), proverId, attrs) # 5. request Claims claimsReq = await prover.createClaimRequest(schemaId, proverId, False) (claim_signature, claim_attributes) = await issuer.issueClaim(schemaId, claimsReq) await prover.processClaim(schemaId, claim_attributes, claim_signature) # 6. proof Claims proofRequest = ProofRequest("proof1", "1.0", verifier.generateNonce(), verifiableAttributes={'attr_uuid': AttributeInfo('name', schema.seqId)}, predicates={'predicate_uuid': PredicateGE('age', 18)}) proof = await prover.presentProof(proofRequest) assert proof.requestedProof.revealed_attrs['attr_uuid'][1] == 'Alex' assert await verifier.verify(proofRequest, proof)
async def doTestAnonCredsPrimaryOnly(): # 1. Create a Schema schema = await issuer.genSchema('GVT', '1.0', GVT.attribNames()) schemaId = ID(schemaKey=schema.getKey(), schemaId=schema.seqId) # 2. Create keys for the Schema await issuer.genKeys(schemaId, **primes1) # 3. Issue accumulator #TODO: Not implemented yet #await issuer.issueAccumulator(schemaId=schemaId, iA='110', L=5) # 4. set attributes for user1 attrs = GVT.attribs(name='Alex', age=28, height=175, sex='male') proverId = str(prover.proverId) attrRepo.addAttributes(schema.getKey(), proverId, attrs) # 5. request Claims claimsReq = await prover.createClaimRequest(schemaId, proverId, False) (claim_signature, claim_attributes) = await issuer.issueClaim(schemaId, claimsReq) await prover.processClaim(schemaId, claim_attributes, claim_signature) # 6. proof Claims proofRequest = ProofRequest( "proof1", "1.0", verifier.generateNonce(), verifiableAttributes={ 'attr_uuid': AttributeInfo('name', schema.seqId) }, predicates={'predicate_uuid': PredicateGE('age', 18)}) proof = await prover.presentProof(proofRequest) assert proof.requestedProof.revealed_attrs['attr_uuid'][1] == 'Alex' assert await verifier.verify(proofRequest, proof)
def schemaDefGvt(stewardWallet): return Schema('GVT', '1.0', GVT.attribNames(), 'CL', stewardWallet.defaultId)
def schemaDefGvt(stewardWallet): return Schema(name='GVT', version='1.0', attrNames=GVT.attribNames(), issuerId=stewardWallet.defaultId, seqId=None)
def claimDefGvt(stewardWallet): return ClaimDefinition('GVT', '1.0', GVT.attribNames(), 'CL', stewardWallet.defaultId)