Skip to content

Commit

Permalink
fix: Create a issuer.id in a uniform credential in case the issuer is…
Browse files Browse the repository at this point in the history
… already an object and there is an iss claim in the JWT
  • Loading branch information
nklomp committed Aug 18, 2023
1 parent 990bad5 commit 706baff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/ssi-types/src/mapper/credential-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ export class CredentialMapper {
throw new Error(`Inconsistent issuers between JWT claim (${iss}) and VC value (${issuer})`)
}
} else {
if (!issuer.id && Object.keys(issuer).length > 0) {
// We have an issuer object with more than 1 property but without an issuer id. Set it,
// because the default behaviour of did-jwt-vc is to remove the id value when creating JWTs
issuer.id = iss
}
if (issuer.id !== iss) {
throw new Error(`Inconsistent issuers between JWT claim (${iss}) and VC value (${issuer.id})`)
}
Expand Down

0 comments on commit 706baff

Please sign in to comment.