Skip to content

Commit

Permalink
fix: support generating submission for mdoc
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Oct 31, 2024
1 parent 24e93ea commit 21b664b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/utils/formatMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ const vcVpFormatMap = {
ldp_vc: 'ldp_vp',
jwt_vc: 'jwt_vp',
'vc+sd-jwt': 'vc+sd-jwt',
mso_mdoc: 'mso_mdoc',
} as const;
25 changes: 25 additions & 0 deletions test/Mdoc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,31 @@ describe('evaluate mdoc', () => {
});
});

it('evaluatePresentation with mso_mdoc format generating a submission', async () => {
const presentationDefinition = getPresentationDefinitionV2();
const evaluateResults = pex.evaluatePresentation(presentationDefinition, [mdocBase64UrlUniversityPresentation], {
generatePresentationSubmission: true,
});

expect(evaluateResults).toEqual({
presentations: [mdocBase64UrlUniversityPresentation],
areRequiredCredentialsPresent: Status.INFO,
warnings: [],
errors: [],
value: {
definition_id: presentationDefinition.id,
descriptor_map: [
{
format: 'mso_mdoc',
id: 'org.eu.university',
path: '$[0]',
},
],
id: expect.any(String),
},
});
});

it('evaluatePresentation with both mso_mdoc and vc+sd-jwt format', async () => {
const presentationDefinition = getPresentationDefinitionV2(true);
const submission = {
Expand Down

0 comments on commit 21b664b

Please sign in to comment.