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

fix: do not use path nested for sd-jwt #140

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/evaluation/evaluationClientWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,14 @@ export class EvaluationClientWrapper {
if (descriptor.path_nested) {
return descriptor;
}
// sd-jwt doesn't use path_nested and format is the same for vc or vp
else if (descriptor.format === 'vc+sd-jwt') {
return descriptor;
}

const format = descriptor.format;
const nestedDescriptor = { ...descriptor };
nestedDescriptor.path_nested = { ...descriptor };
// todo: delete id?
nestedDescriptor.path = '$';
// todo: We really should also look at the context of the VP, to determine whether it is jwt_vp vs jwt_vp_json instead of relying on the VC type
if (format.startsWith('ldp_')) {
Expand Down
6 changes: 5 additions & 1 deletion test/SdJwt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,13 @@ describe('evaluate', () => {
).toString('base64url')}.signature`;
return `${presentation.compactSdJwtVc}${kbJwt}`;
},
{},
{
presentationSubmissionLocation: PresentationSubmissionLocation.EXTERNAL,
},
);

// path_nested should not be used for sd-jwt
expect(presentationResult.presentationSubmission.descriptor_map[0].path_nested).toBeUndefined();
expect(presentationResult.presentationSubmission).toEqual({
definition_id: '32f54163-7166-48f1-93d8-ff217bdb0653',
descriptor_map: [
Expand Down
Loading