Skip to content

Commit

Permalink
included username on crl record
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmanos committed Jun 27, 2024
1 parent 0290e6a commit 6026ee1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion credential-status-list
2 changes: 1 addition & 1 deletion resources-vault
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)).id}`,
"id": `${config.crl.url}#${(await CredentialStatusList.insert(authentication.username, claims.personalIdentifier)).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)).id}`,
"id": `${config.crl.url}#${(await CredentialStatusList.insert(username, claims.personalIdentifier)).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)).id}`,
"id": `${config.crl.url}#${(await CredentialStatusList.insert(authentication.username, claims.personalIdentifier)).id}`,
"type": "CertificateRevocationList"
},
"credentialBranding": {
Expand Down
2 changes: 1 addition & 1 deletion wallet-frontend

0 comments on commit 6026ee1

Please sign in to comment.