Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for when credentials in presentation dont match requirements #109

Open
cykoder opened this issue Feb 6, 2023 · 2 comments

Comments

@cykoder
Copy link

cykoder commented Feb 6, 2023

Lets say I have the PD of:

{
  "id": "81857b3f-5977-442e-9eae-225ca158d1a5",
  "input_descriptors": [
    {
      "id": "Credential 1",
      "name": "test PD",
      "purpose": "verify",
      "constraints": {
        "fields": [
          {
            "path": [
              "$.credentialSubject.email"
            ]
          }
        ]
      }
    }
  ]
}

And I submit a presentation with a subject like:

{"notEmail": "blah"}

I will get these error messages:

{
  "errors": [
    {
      "tag": "FilterEvaluation",
      "status": "error",
      "message": "Input candidate does not contain property: $.input_descriptors[0]: $.verifiableCredential[0]"
    },
    {
      "tag": "MarkForSubmissionEvaluation",
      "status": "error",
      "message": "The input candidate is not eligible for submission: $.input_descriptors[0]: $.verifiableCredential[0]"
    }
  ]
}

It would be beneficial to be told which field is missing and ideally not to have the Input candidate does not contain property message at all - unless that message is reffering to the email property. The reading of it is that its referring to the path $.input_descriptors[0]: $.verifiableCredential[0].

@nklomp
Copy link
Contributor

nklomp commented Feb 7, 2023

Hi @samhellawell Thanks for the issue.

Although I do agree that messages should be more clear, they almost certainly come from a combinatorics problem. Your example is a really simply one, with one VC versus a simple definition. PEX also needs to handle the case, where you have let's say 50 credentials in your wallet and where 3 VCs need to be presented, which are part of multiple requirements grouped together with filters and other predicates.

We have however identified several enhancements which will go into a new major release, and the error handling is also in this list.

@cykoder
Copy link
Author

cykoder commented Feb 8, 2023

Thanks for responding.

Although I do agree that messages should be more clear, they almost certainly come from a combinatorics problem. Your example is a really simply one, with one VC versus a simple definition. PEX also needs to handle the case, where you have let's say 50 credentials in your wallet and where 3 VCs need to be presented, which are part of multiple requirements grouped together with filters and other predicates.

I'm aware of this use case too and its one we're also working with - what I was thinking is along the lines of:

{
  "message": "Input candidate does not contain property: $.input_descriptors[0]: $.verifiableCredential[0].email"
}

whereby the 0 index can be changed for whatever is needed

As an error thats returned. Of course, when you have multiple credentials you may get multiple errors, or it may be possible to tie them up into one long message somehow. Either way - good to hear that error handling is being thought of - its workable for now as we can write a solution around this case.

Btw, thanks for the library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants