The SdJwt.present
method currently takes an array of indices. As the doc for the method already says, this is not the most convenient API.
What if we re-use the disclosure frame approach for the present method? This would allow for a much simpler interface, and we could then derive the disclosures that should be exposed based on the payload we want to disclose.
The method could take one option:
- Whether you it to automatically disclose everything that is required based on the disclosure frame, or only disclose exactly what is in the disclosure frame, and throw an error if that is not possible based on the disclosures.
Let's say I have the following SD-JWT payload (in pretty format):
{
"iss": "something",
"user": {
"firstName": "Timo",
"lastName": "Glastra"
},
"license": {
"number": 10,
"state": "CA"
}
}
I could make a present call like this:
sdJWt.present({
user: {
firstName: true
}
}, {
includeRequiredForDisclosureFrame: true
})
This will return the following object, as the license
and iss
fields MUST be disclosed.
{
"iss": "something",
"user": {
"firstName": "Timo",
},
"license": {
"number": 10,
"state": "CA"
}
}
If user
was not separately selectively disclosable, with the includeRequiredForDisclosureFrame
, it could return this:
{
"iss": "something",
"user": {
"firstName": "Timo",
"lastName": "Glastra"
},
"license": {
"number": 10,
"state": "CA"
}
}
with the includeRequiredForDisclosureFrame
set to false it would throw an error.
For the PEX implementation we could then just include only the properties that are requested in the presentation definition, and based on that we will get the minimally required disclosed values.