Skip to content

Commit

Permalink
Fix conflicts after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatrakazas committed Jun 27, 2024
2 parents c12d157 + 6026ee1 commit 30ec254
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {


Expand Down Expand Up @@ -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(),
Expand All @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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": {
Expand Down

0 comments on commit 30ec254

Please sign in to comment.