-
Notifications
You must be signed in to change notification settings - Fork 16
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
selectFrom - unknown exception occurred: Cannot read property 'value' of undefined #50
Comments
I’m now getting the following errors back from my call to selectFrom which I’m scatching my head over. Could you please help me interpret the errors?
WRT the 1st error, it appears from the code that it is searching for the string The presentation definition that I’m passing is
The credentials are:
and the holder DID is:
|
Hi Keith, We seem to have identified the issue. My colleague gave an answer earlier today, that is removed because it was not totally correct. We need to create a fix for it first, which another colleague is looking into right now. We hope to have another version ready today or tomorrow. Sorry for the inconvenience. |
We have opened a ticket with DIF for the PE spec to get some clarification, because it sparked some discussion here internally. decentralized-identity/presentation-exchange#250 The fix we are creating will interpret the evaluation of the contexts against the schemas in the Input Descriptor as the first matching singular intersection to proceed. Which would also mean that in the new version we will be releasing your example needs to remove "https://www.w3.org/2018/credentials/v1" from the schema array in the input descriptor as otherwise almost all VCs would match the schema |
Okay, we have the fix and adjusted our tests and test-vectors. Currently we will go into the review process, but we expect to have a release today, which is working for your example. The interesting outcome of the above DIF discussion is that the schema array will be removed altogether because it could be interpreted in multiple ways and the path/constraints can already be used to also restrict the outcome to one or more VC contexts. So the next version will still support the schema array, but probably the version after that will start emitting warning if you use the schemas array. We will adjust your example to how it should look like in the future as well. I will let you know when we do the actual release. |
Thanks Niels and team |
Hi @smithbk, We just released v0.2.3 to NPMJS. It contains the fix for your example. There are however a few remarks. As you might have noticed in the DIF discussion and as I mentioned above the concept of the schema arrays will be removed in the future PE specification, because of the ambiguity. This also means that in a future release we will start ignoring these values and emitting a warning whenever we do encounter them in the input descriptors. In your current example you are using "schema": [
{
"uri": "https://www.w3.org/2018/credentials/v1"
},
{
"uri": "https://w3id.org/citizenship/v1"
}
] Since the first schema is the generic VC schema, it means that the end result will be that any VC you will pass in to be checked will be accepted, as the current implementation does an intersection between the input descriptor schemas and the VC contexts. The first match between those is accepted. So for v0.2.3 you might want to remove the first schema. Once we remove the support for schemas you will see the warnings mentioned above. From that point on you will need to check for the correct context in the path of the constraint. Below you will find an example how to do that. I guess you could already add it now, so all you have to do in the future is remove the schemas from the Input Descriptor. {
"presentation_definition": {
"id": "31e2f0f1-6b70-411d-b239-56aed5321884",
"purpose": "To see Inspection details of Heavy Sour Dilbit..",
"input_descriptors": [
{
"id": "867bfe7a-5b91-46b2-9ba4-70028b8d9cc8",
"purpose": "To see Inspection details of Heavy Sour Dilbit..",
"constraints": {
"fields": [
{
"path": [
"$.issuer.id",
"$.vc.issuer.id",
"$.iss.id",
"$.issuer",
"$.vc.issuer",
"$.iss"
],
"filter": {
"type": "string",
"pattern": "did:v1:test:nym:z6MkhdmzFu659ZJ4XKj31vtEDmjvsi5yDZG5L7Caz63oP39k"
}
},
{
"path": [
"$['@context']"
],
"filter": {
"type": "string",
"pattern": "https://www.w3.org/2018/credentials/v1"
}
}
]
}
}
]
}
} Please let us know if this fixes your problem. Thx |
Hi @nklomp, First, I agree with your comments that it would be nice to provide an easy-to-use syntax for the common use-case in which someone wants to match credentials which match ALL of a set of contexts. This will be very common. If the spec does not support that and pe-js does not support that, then I think I will extend the language and just convert it myself on behalf of users. Next, I updated to the latest packages and the selectFrom no longer returns an error; however, it does not work as I had expected. Here is the return value from selectFrom:
There are two things I did not expect.
Thanks |
Hi @smithbk , The 'easy-to-use syntax for matching ALL of a set of contexts' is not part of the DIF spec, but we agree that this is a common use case. It should be possible to explicitly select one, or ALL contexts. We will therefore also propose to keep this as part of the Spec. Additionally, if they do move forward with the removal from the spec in a next version we will make sure to have methods available to easily convey this and to convert it this so it will work using the submission requirements. The duplicate entry is fixed and will be in the next patch release. My colleague @hrehman-sphereon is looking into it your second issue. To answer your questions it is a JSON path result string, but it could be that the container verifiableCredential is off. We will create an example for you to work with and expect that soon. |
Hi @smithbk , We are creating some additional tests today. We expect to have the release with the fixes out today as well. I will inform you when that has happend. Niels |
Hi @nklomp, is there any progress on this? |
I thought I updated you elsewhere if not, sorry for that. The above was fixed in the latest release, but I suggest to wait a bit for the next release, which contains fixes for strict-mode not being enabled and introduces interfaces for VCs and VPs instead of using unknowns. We will hopefully release that today and otherwise on monday |
In 0.3.0 we handled this issue, worked on better test cases to make sure that it won't show up again. |
I'm submitting a ...
[ X] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
I am getting the following exception on my call to selectFrom:
"unknown exception occurred: Cannot read property 'value' of undefined"
The error passed to my exception handler does not contain a stack trace, so I don't know where this is occurring.
The arguments that I am passing to selectFrom are as follows:
First arg
Second arg
Third arg:
The text was updated successfully, but these errors were encountered: