From 21b664b2281f8a946a1edd6639da7f64426f3b15 Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Thu, 31 Oct 2024 19:23:54 +0530 Subject: [PATCH] fix: support generating submission for mdoc Signed-off-by: Timo Glastra --- lib/utils/formatMap.ts | 1 + test/Mdoc.spec.ts | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/lib/utils/formatMap.ts b/lib/utils/formatMap.ts index de7e3824..f5775223 100644 --- a/lib/utils/formatMap.ts +++ b/lib/utils/formatMap.ts @@ -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; diff --git a/test/Mdoc.spec.ts b/test/Mdoc.spec.ts index 595bb62d..7ee8c60d 100644 --- a/test/Mdoc.spec.ts +++ b/test/Mdoc.spec.ts @@ -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 = {