hyperledger / anoncreds-rs

anoncreds-rs
https://wiki.hyperledger.org/display/anoncreds
Apache License 2.0
73 stars 51 forks source link

W3C: Reworked predicates representation - no mapping #303

Closed Artemkaaas closed 6 months ago

Artemkaaas commented 6 months ago

@TimoGlastra @andrewwhitehead @swcurran

This is an alternative implementation for w3c predicate representation as boolean values to using explicit mapping like was done in PR: https://github.com/hyperledger/anoncreds-rs/pull/302

I feel like it should work and we can close another PR.

anoncreds-clsignatures requires passing of predicate name, type, value for doing verification of each cl sub-proof. If we pass a different predicate value, verification will fail. It can cause an issue when a request contains multiple predicates with the same attribute name. Due to this, we used an explicit mapping.

In proper way, this information (predicate name /type/value) should be taken from the proof request. But as we do verification for each request attribute/predicate that presentation contains a verifiable credential providing requested data, we can just take attributes/predicates from inside of sub proof itself at the sub proof verification step .

The function to verify requested predicate check the following:

  1. w3c credential contains a predicate attribute in credential subject
  2. cl sub_proof contains sub_proof for the requested predicate (same name, value, type)
  3. credential matches to restrictions

This PR: depends on this change in CL AnonCreds library: https://github.com/hyperledger/anoncreds-clsignatures-rs/pull/38

TimoGlastra commented 6 months ago

Merging for now so we can create a pre-release. @andrewwhitehead if you have any comments, we can addreess them in a follow up pr