-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
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
According to https://identity.foundation/presentation-exchange/#input-descriptor-object:
The fields object MAY contain an optional property. The value of this property MUST be a boolean, wherein true indicates the field is optional, and false or non-presence of the property indicates the field is required.
The library is not able to handle the optional property in the fields object. Filtering or presentation evalutation fails with an InvalidPresentation error.
Other information
Code snippet:
// PEX "version": "3.3.1"
const { PEX } = require("@sphereon/pex");
const pex = new PEX();
const presentationDefinition = {
id: "test",
input_descriptors: [
{
id: "Test1",
name: "Testing the optional attribute in the fields object",
purpose: "Testing purposes",
constraints: {
fields: [
{
path: ["$.credentialSubject.id"],
},
{
path: ["$.expirationDate"],
optional: true,
},
],
},
},
],
};
const result = pex.selectFrom(presentationDefinition, [], []);
Output:
/Users/mzm/test-pex/node_modules/@sphereon/pex/dist/main/lib/types/SSITypesBuilder.js:35
throw versionResult.error;
^
This is not a valid PresentationDefinition
(Use `node --trace-uncaught ...` to show where the exception was thrown)
Node.js v18.17.1
Metadata
Metadata
Assignees
Labels
No labels