From 1a0c086d3b9a873fcabc17d97486a6b99fdb1b8d Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Mon, 25 Nov 2024 02:29:23 +0100 Subject: [PATCH] formatting Signed-off-by: Timo Glastra --- .../authorization-response/PresentationExchange.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/siop-oid4vp/lib/authorization-response/PresentationExchange.ts b/packages/siop-oid4vp/lib/authorization-response/PresentationExchange.ts index 18fef29f..66f717b2 100644 --- a/packages/siop-oid4vp/lib/authorization-response/PresentationExchange.ts +++ b/packages/siop-oid4vp/lib/authorization-response/PresentationExchange.ts @@ -393,13 +393,18 @@ export class PresentationExchange { // Verify the signature of all VPs await Promise.all( presentationsToVerify.map(async (presentation) => { - let verificationResult:PresentationVerificationResult + let verificationResult: PresentationVerificationResult try { - verificationResult= await verifyPresentationCallback(presentation as W3CVerifiablePresentation, evaluationResults.value!) - + verificationResult = await verifyPresentationCallback(presentation as W3CVerifiablePresentation, evaluationResults.value!) } catch (error: unknown) { throw new Error(SIOPErrors.VERIFIABLE_PRESENTATION_SIGNATURE_NOT_VALID) } + + if (!verificationResult.verified) { + throw new Error( + SIOPErrors.VERIFIABLE_PRESENTATION_SIGNATURE_NOT_VALID + (verificationResult.reason ? `. ${verificationResult.reason}` : ''), + ) + } }), ) }