File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments