Skip to content

Non-matching vc_paths included in the matches array returned by selectFrom for pick requirements #161

@DJHunn39

Description

@DJHunn39
  • I'm submitting a ...

    • bug report
    • feature request
    • question about the decisions made in the repository
    • question about how to use this project
  • Summary

When credentials are selected with PEX.selectFrom, with a presentationDefinition with one pick submission requirement where each input_descriptor in the from group is satisfied by a different credential, selectFrom returns an object with a matches array containing only 1 element with the name of the last input_descriptor, and the vc_path of every credential that matches each input_descriptor (not just the last one), so the name of srm ends up not corresponding to every credential under each vc_path in the srm.

This issue means that, if the first "matching" verifiableCredential is used to submit a presentation, the credential used for submission does not match the requirements of the input_descriptor, so a Could not get evaluation results from presentationResult error is thrown after PEX.evaluatePresentation fails to produce an object with a value property.

  • Other information

I'd expect the matches array returned by selectFrom to contain 1 element per input_descriptor with a match, with each element having the name of the input_descriptor it's describing a match for, and only the vc_path of the credential(s) that match that input_descriptor.

Here's a more thorough explanation of the issue from our perspective:

  • A presentation request is made to our digital wallet (which is essentially a Credo holder agent, holding exclusively SD-JWT VCs, where presentation is performed using OID4VP). The presentation definition for this request is as follows:
{
  id: `OverAgeCheck`,
  purpose: 'Age check',
  submission_requirements: [
    {
      name: 'Proof of age and photo',
      rule: 'pick',
      count: 1,
      from: 'validAgeCheckInputDescriptor'
    }
  ],
  input_descriptors: [
    {
      name: 'ID date of birth and photo',
      id: 'IDDoB',
      group: ['validAgeCheckInputDescriptor'],
      constraints: {
        limit_disclosure: 'required',
        fields: [
          {
            path: ['$.vc.type.*', '$.vct', '$.type'],
            filter: {
              type: 'string',
              const: 'ID'
            }
          },
          {
            path: ['$.Photo']
          },
          {
            path: ['$.BirthDate']
          }
        ]
      }
    },
    {
      name: 'Driving licence date of birth and photo',
      id: 'DrivingLicenceDoB',
      group: ['validAgeCheckInputDescriptor'],
      constraints: {
        limit_disclosure: 'required',
        fields: [
          {
            path: ['$.vc.type.*', '$.vct', '$.type'],
            filter: {
              type: 'string',
              const: 'DRIVING_LICENCE'
            }
          },
          {
            path: ['$.Driver_Photo']
          },
          {
            path: ['$.Driver_Dob']
          }
        ]
      }
    }
  ]
}

Basically, we're trying to verify the age of the wallet holder, and we'll accept relevant data from either an ID credential or a Driving Licence

  • The wallet holds an ID, so it can meet the requirements of the IDDoB input_descriptor, and it also holds a Driving Licence, so it can also meet the requirements of the DrivingLicenceDoB input_descriptor
  • However, when the presentation request is resolved, we see that resolvedPresentationRequest.presentationExchange.credentialsForRequest.requirements[0].submissionEntry array contains one object, with an inputDescriptorId of DrivingLicenceDoB, but a verifiableCredentials array that contains both the ID credential as well as the Driving Licence, which doesn't align with the more specific inputDescriptorID.
  • The wallet automatically selects the first entry in the verifiableCredentials array to use for the submission. If the first entry is the ID credential, and we attempt to call the Credo holder agent's acceptSiopAuthorizationRequest method with it, we get the Could not get evaluation results from presentationResult error from PEX, so the request cannot be accepted, because an ID can't be used to satisfy a DrivingLicenceDoB input.

In the above scenario, submissionEntry.verifiableCredentials is built by:

  • Finding the correct match from the matches array returned by PEX.selectFrom for a given input_descriptor based on said input_descriptor's name, or id if it had no name.
  • Finding each matching verifiableCredential in the verifiableCredential array returned by PEX.selectFrom based on the vc_paths in the match for this input_descriptor

Possibly relevant links to code:

Happy to try and provide more info/apply any changes.

For now, we have a workaround where the wallet always selects the last element in submissionEntry.verifiableCredentials for use in a submission, instead of the first, but this isn't a true solution given the presence of the underlying problem.

@TimoGlastra tagging you after our chat about this this morning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions