From ebe3f8285618138e81231a9398dcb0b7127076cb Mon Sep 17 00:00:00 2001 From: aufarhmn Date: Sat, 12 Apr 2025 15:27:53 +0700 Subject: [PATCH] fix: sending signed vp as jwt --- bindings/wasm/examples/src/0_basic/6_create_vp.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bindings/wasm/examples/src/0_basic/6_create_vp.ts b/bindings/wasm/examples/src/0_basic/6_create_vp.ts index f78f19dd1b..13ab7d2c72 100644 --- a/bindings/wasm/examples/src/0_basic/6_create_vp.ts +++ b/bindings/wasm/examples/src/0_basic/6_create_vp.ts @@ -148,9 +148,10 @@ export async function createVP() { // =========================================================================== // Step 6: Holder sends a verifiable presentation to the verifier. // =========================================================================== + const presentationJwtToVerifier = presentationJwt.toString(); console.log( `Sending presentation (as JWT) to the verifier`, - unsignedVp.toJSON(), + presentationJwtToVerifier, ); // =========================================================================== @@ -173,14 +174,15 @@ export async function createVP() { client: didClient, }); // Resolve the presentation holder. - const presentationHolderDID: CoreDID = JwtPresentationValidator.extractHolder(presentationJwt); + const receivedVpJwt = new Jwt(presentationJwtToVerifier); + const presentationHolderDID: CoreDID = JwtPresentationValidator.extractHolder(receivedVpJwt); const resolvedHolder = await resolver.resolve( presentationHolderDID.toString(), ); // Validate presentation. Note that this doesn't validate the included credentials. let decodedPresentation = new JwtPresentationValidator(new EdDSAJwsVerifier()).validate( - presentationJwt, + receivedVpJwt, resolvedHolder, jwtPresentationValidationOptions, );