From b67ce19fc894cae00b131deba11716e4d9398fd1 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 26 Aug 2024 14:20:49 +0000 Subject: [PATCH] simplify extract enveloped credential function Signed-off-by: Patrick --- tests/helpers.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/helpers.js b/tests/helpers.js index 10908c4..4bb7b77 100644 --- a/tests/helpers.js +++ b/tests/helpers.js @@ -21,10 +21,7 @@ export function trimText(string) { export function extractEnvelopedCredential(issuedVc) { issuedVc.should.have.property('id').that.does .include('data:application/vc+jwt', `Missing id field.`); - const vcId = issuedVc.id; - const jwt = vcId.split(',')[1]; - const payload = jwt.split('.')[1]; - const credential = atob(payload); + const credential = atob(issuedVc.id.split(',')[1].split('.')[1]); // TODO: needs more error handling return JSON.parse(credential); }