hyperledger-indy

Is it possible to have multiple restrictions on the same attribute on proof request on Indy?


We currently have a proof request like this:

{
    "name": "pr",
    "version": "1.0",
    "nonce": "0994650939",
    "requested_attributes": {
        "attr0_referent": {
            "name": "first_name",
            "restrictions": [{
                "cred_def_id": "credDefIdShareGlobal"
            }]
        }
    },
    "requested_predicates": {},
    "non_revoked": {}
}

As you can see, on the restricton fields now we have only one restriction. Is it possible to have multiple restrictions on the same attribute (like the example beneath)?

{
    "name": "pr",
    "version": "1.0",
    "nonce": "0994650939",
    "requested_attributes": {
        "attr0_referent": {
            "name": "first_name",
            "restrictions": [{
                "cred_def_id": "credDefIdShareGlobal1"
            }, {
                "cred_def_id": "credDefIdShareGlobal2" // <-- Is this possible?
            }]
        }
    },
    "requested_predicates": {},
    "non_revoked": {}
}

Solution

  • Well, to give some closure to this question, yeah. It works exactly like that.

    To give more context, the attribute can be present in different schemas or different credentials and by adding the restrictions as shown they'll be dealt with as an "OR" so, the first one matching will be returned.

    If you want to see an test example, I'll advise looking here: https://github.com/eduelias/indy-sdk/blob/MultipleReq/samples/nodejs/src/gettingStarted.js#L470