From 706baffee81c1a6993bf1573a083696c45cb3ab9 Mon Sep 17 00:00:00 2001 From: Niels Klomp Date: Fri, 18 Aug 2023 22:44:41 +0200 Subject: [PATCH] fix: Create a issuer.id in a uniform credential in case the issuer is already an object and there is an iss claim in the JWT --- packages/ssi-types/src/mapper/credential-mapper.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/ssi-types/src/mapper/credential-mapper.ts b/packages/ssi-types/src/mapper/credential-mapper.ts index 29f535409..edb9e9e6f 100644 --- a/packages/ssi-types/src/mapper/credential-mapper.ts +++ b/packages/ssi-types/src/mapper/credential-mapper.ts @@ -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})`) }