Skip to content

Commit 54a8ce1

Browse files
committed
add vc/vp-jwt envelopes
Signed-off-by: PatStLouis <[email protected]>
1 parent 3b8b589 commit 54a8ce1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/helpers.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ export function extractIfEnveloped(input) {
2121
) {
2222
input.should.have.property('id').that.does
2323
.include('data:', `Missing id field.`);
24-
const extractedCredential = atob(input.id.split(',')[1].split('.')[1]);
25-
return JSON.parse(extractedCredential);
24+
let extractedCredential = atob(input.id.split(',')[1].split('.')[1]);
25+
extractedCredential = JSON.parse(extractedCredential);
26+
return extractedCredential?.vc || extractedCredential;
2627
} else if(input.type == 'EnvelopedVerifiablePresentation' ||
2728
'EnvelopedVerifiablePresentation' in input.type
2829
) {
2930
input.should.have.property('id').that.does
3031
.include('data:', `Missing id field.`);
31-
const extractedPresentation = atob(input.id.split(',')[1].split('.')[1]);
32-
return JSON.parse(extractedPresentation);
32+
let extractedPresentation = atob(input.id.split(',')[1].split('.')[1]);
33+
extractedPresentation = JSON.parse(extractedPresentation);
34+
return extractedPresentation?.vp || extractedPresentation;
3335
} else {
3436
return input;
3537
}

0 commit comments

Comments
 (0)