Skip to content

Commit

Permalink
simplify extract enveloped credential function
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick <[email protected]>
  • Loading branch information
PatStLouis committed Aug 26, 2024
1 parent 780bd96 commit b67ce19
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit b67ce19

Please sign in to comment.