Skip to content

Commit

Permalink
chore: sdJwtDecodedCredentialToUniformCredential fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Oct 31, 2024
1 parent ed76a55 commit a98cbf9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/ssi-types/src/types/sd-jwt-vc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,13 @@ export const sdJwtDecodedCredentialToUniformCredential = (
return acc
}, {} as Record<string, any>)

// Add id to credentialSubject if applicable
if (!credentialSubject.id && (sub || jti)) {
credentialSubject.id = sub ?? jti
}

const credential: Omit<IVerifiableCredential, 'issuer' | 'issuanceDate'> = {
type: [vct], // SDJwt is not a W3C VC, so no VerifiableCredential
'@context': [], // SDJwt has no JSON-LD by default. Certainly not the VC DM1 default context for JSON-LD
credentialSubject,
credentialSubject: {
...credentialSubject,
id: credentialSubject.id ?? sub ?? jti,
},
issuanceDate,
expirationDate,
issuer: iss,
Expand Down

0 comments on commit a98cbf9

Please sign in to comment.