diff --git a/wallet-enterprise-configurations/ehic-issuer/src/configuration/SupportedCredentialsConfiguration/EHICSupportedCredentialSdJwt.ts b/wallet-enterprise-configurations/ehic-issuer/src/configuration/SupportedCredentialsConfiguration/EHICSupportedCredentialSdJwt.ts index a352937..104ee82 100644 --- a/wallet-enterprise-configurations/ehic-issuer/src/configuration/SupportedCredentialsConfiguration/EHICSupportedCredentialSdJwt.ts +++ b/wallet-enterprise-configurations/ehic-issuer/src/configuration/SupportedCredentialsConfiguration/EHICSupportedCredentialSdJwt.ts @@ -70,7 +70,7 @@ export class EHICSupportedCredentialSdJwt implements SupportedCredentialProtocol throw new Error("Cannot generate credential: personalIdentifier is missing"); } this.dataset = JSON.parse(fs.readFileSync('/datasets/dataset.json', 'utf-8').toString()) as any - const { claims } = this.dataset.users.filter((user: any) => user.authentication.personalIdentifier == userSession.personalIdentifier)[0]; + const { claims, authentication } = this.dataset.users.filter((user: any) => user.authentication.personalIdentifier == userSession.personalIdentifier)[0]; const payload = { "@context": ["https://www.w3.org/2018/credentials/v1"], @@ -83,7 +83,7 @@ export class EHICSupportedCredentialSdJwt implements SupportedCredentialProtocol "id": holderDID, }, "credentialStatus": { - "id": `${config.crl.url}#${(await CredentialStatusList.insert(claims.personalIdentifier, "ehic")).id}`, + "id": `${config.crl.url}#${(await CredentialStatusList.insert(authentication.username, claims.personalIdentifier, "ehic")).id}`, "type": "CertificateRevocationList" }, "credentialBranding": { diff --git a/wallet-enterprise-configurations/pda1-issuer/src/configuration/SupportedCredentialsConfiguration/PDA1SupportedCredentialSdJwt.ts b/wallet-enterprise-configurations/pda1-issuer/src/configuration/SupportedCredentialsConfiguration/PDA1SupportedCredentialSdJwt.ts index 4153ae8..55a8a0c 100644 --- a/wallet-enterprise-configurations/pda1-issuer/src/configuration/SupportedCredentialsConfiguration/PDA1SupportedCredentialSdJwt.ts +++ b/wallet-enterprise-configurations/pda1-issuer/src/configuration/SupportedCredentialsConfiguration/PDA1SupportedCredentialSdJwt.ts @@ -35,6 +35,11 @@ privateKeyContent = fs.readFileSync(privateKeyFilePath, 'utf8'); const credentialIssuerPrivateKeyJWK = JSON.parse(privateKeyContent) as crypto.JsonWebKey; const credentialIssuerPrivateKey = crypto.createPrivateKey({ key: credentialIssuerPrivateKeyJWK, format: 'jwk' }); + + +const dataset = JSON.parse(fs.readFileSync('/datasets/dataset.json', 'utf-8').toString()) as any; + + export class PDA1SupportedCredentialSdJwt implements SupportedCredentialProtocol { @@ -160,6 +165,8 @@ export class PDA1SupportedCredentialSdJwt implements SupportedCredentialProtocol console.log("Claims = ", claims) + // use the dataset to retrieve only the username based on personalIdentifier + const username = dataset.users.filter((u) => u.authentication.personalIdentifier == userSession.personalIdentifier)[0].username; const payload = { "@context": ["https://www.w3.org/2018/credentials/v1"], "type": this.getTypes(), @@ -171,7 +178,7 @@ export class PDA1SupportedCredentialSdJwt implements SupportedCredentialProtocol "id": holderDID, }, "credentialStatus": { - "id": `${config.crl.url}#${(await CredentialStatusList.insert(claims.personalIdentifier, 'pda1')).id}`, + "id": `${config.crl.url}#${(await CredentialStatusList.insert(username, claims.personalIdentifier, "pda1")).id}`, "type": "CertificateRevocationList" }, "credentialBranding": { diff --git a/wallet-enterprise-configurations/vid-issuer/src/configuration/SupportedCredentialsConfiguration/VIDSupportedCredentialSdJwt.ts b/wallet-enterprise-configurations/vid-issuer/src/configuration/SupportedCredentialsConfiguration/VIDSupportedCredentialSdJwt.ts index 6622925..bd55e7f 100644 --- a/wallet-enterprise-configurations/vid-issuer/src/configuration/SupportedCredentialsConfiguration/VIDSupportedCredentialSdJwt.ts +++ b/wallet-enterprise-configurations/vid-issuer/src/configuration/SupportedCredentialsConfiguration/VIDSupportedCredentialSdJwt.ts @@ -73,7 +73,7 @@ export class VIDSupportedCredentialSdJwt implements SupportedCredentialProtocol this.dataset = JSON.parse(fs.readFileSync('/datasets/dataset.json', 'utf-8').toString()) as any; - const { claims } = this.dataset.users.filter((user: any) => user.authentication.personalIdentifier == userSession.personalIdentifier)[0]; + const { claims, authentication } = this.dataset.users.filter((user: any) => user.authentication.personalIdentifier == userSession.personalIdentifier)[0]; console.log("Vid claims = ", claims) const payload = { "@context": ["https://www.w3.org/2018/credentials/v1"], @@ -86,7 +86,7 @@ export class VIDSupportedCredentialSdJwt implements SupportedCredentialProtocol "id": holderDID, }, "credentialStatus": { - "id": `${config.crl.url}#${(await CredentialStatusList.insert(claims.personalIdentifier, 'pid')).id}`, + "id": `${config.crl.url}#${(await CredentialStatusList.insert(authentication.username, claims.personalIdentifier, "pid")).id}`, "type": "CertificateRevocationList" }, "credentialBranding": {