Skip to content

Commit

Permalink
refine credential parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
balanza committed Dec 7, 2023
1 parent a1eaab2 commit b759b8f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/credential/issuance/07-verify-and-parse-credential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ const parseCredentialSdJwt = (
): ParsedCredential => {
// find the definition that matches the received credential's type
// warning: if more then a defintion is found, the first is retrieved
const credentialSubject = credentials_supported.find((c) =>
c.credential_definition.type.includes(sdJwt.payload.type)
const credentialSubject = credentials_supported.find(
(c) =>
c.format === "vc+sd-jwt" &&
c.credential_definition.type.includes(sdJwt.payload.type)
)?.credential_definition.credentialSubject;

// the received credential matches no supported credential, throw an exception
Expand Down

0 comments on commit b759b8f

Please sign in to comment.