From 16b026f6c6a9cbdeaaaa7c0148f16d35c19ac617 Mon Sep 17 00:00:00 2001 From: Nikos Triantafyllou Date: Tue, 28 May 2024 14:08:31 +0300 Subject: [PATCH] erua-id verification --- ..._definition_alliance_and_education_Id.json | 75 +++++++++++++++++++ routes/verifierRoutes.js | 9 +++ 2 files changed, 84 insertions(+) create mode 100644 data/presentation_definition_alliance_and_education_Id.json diff --git a/data/presentation_definition_alliance_and_education_Id.json b/data/presentation_definition_alliance_and_education_Id.json new file mode 100644 index 0000000..06ef615 --- /dev/null +++ b/data/presentation_definition_alliance_and_education_Id.json @@ -0,0 +1,75 @@ +{ + "id": "multi-credential-request", + "name": "Multi-Credential Request", + "format": { + "jwt_vc": { + "alg": ["ES256", "ES384"] + } + }, + "input_descriptors": [ + { + "id": "alliance-id-credential", + "name": "Alliance ID Credential", + "format": { + "jwt_vc": { + "alg": ["ES256", "ES384"] + } + }, + "constraints": { + "fields": [ + { + "path": ["$.credentialSubject.identifier.id", "$.vc.credentialSubject.identifier.id"], + "purpose": "We need to verify your Alliance ID credential." + } + ] + }, + "limit_disclosure": "required" + }, + { + "id": "educational-id-credential", + "name": "Educational ID Credential", + "format": { + "jwt_vc": { + "alg": ["ES256", "ES384"] + } + }, + "constraints": { + "fields": [ + { + "path": ["$.credentialSubject.schacPersonalUniqueID", "$.vc.credentialSubject.schacPersonalUniqueID"], + "purpose": "We need to verify your Educational ID credential." + }, + { + "path": ["$.credentialSubject.schacHomeOrganization", "$.vc.credentialSubject.schacHomeOrganization"], + "purpose": "We need to verify your Educational ID credential." + }, + { + "path": ["$.credentialSubject.familyName", "$.vc.credentialSubject.familyName"], + "purpose": "We need to verify your Educational ID credential." + }, + { + "path": ["$.credentialSubject.firstName", "$.vc.credentialSubject.firstName"], + "purpose": "We need to verify your Educational ID credential." + }, + { + "path": ["$.credentialSubject.dateOfBirth", "$.vc.credentialSubject.dateOfBirth"], + "purpose": "We need to verify your Educational ID credential." + }, + { + "path": ["$.credentialSubject.eduPersonPrincipalName", "$.vc.credentialSubject.eduPersonPrincipalName"], + "purpose": "We need to verify your Educational ID credential." + }, + { + "path": ["$.credentialSubject.eduPersonPrimaryAffiliation", "$.vc.credentialSubject.eduPersonPrimaryAffiliation"], + "purpose": "We need to verify your Educational ID credential." + }, + { + "path": ["$.credentialSubject.eduPersonAffiliation", "$.vc.credentialSubject.eduPersonAffiliation"], + "purpose": "We need to verify your Educational ID credential." + } + ] + }, + "limit_disclosure": "required" + } + ] +} diff --git a/routes/verifierRoutes.js b/routes/verifierRoutes.js index 29afbf0..ac9eac9 100644 --- a/routes/verifierRoutes.js +++ b/routes/verifierRoutes.js @@ -48,6 +48,13 @@ const presentation_definition_ferryboardingpass = JSON.parse( "utf-8" ) ); + +const presentation_definition_alliance_and_education_Id = JSON.parse( + fs.readFileSync( + "./data/presentation_definition_alliance_and_education_Id.json", + "utf-8" + ) +); // const jwks = pemToJWK(publicKeyPem, "public"); @@ -273,6 +280,8 @@ verifierRouter.get("/vpRequest/:type/:id", async (req, res) => { presentationDefinition = presentation_definition_alliance_id; } else if (type === "ferryboardingpass") { presentationDefinition = presentation_definition_ferryboardingpass; + } else if (type === "erua-id") { + presentationDefinition = presentation_definition_alliance_and_education_Id; } else { return res.status(400).type("text/plain").send("Invalid type parameter"); }