Skip to content

Commit

Permalink
changed educationId to studentID for demo clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
endimion committed Sep 16, 2024
1 parent 6135dd1 commit 6e0d7ff
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions data/issuer-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,14 +702,14 @@
}
},

"EducationalID": {
"StudentID": {
"format": "jwt_vc_json",
"scope": "EducationalID",
"scope": "StudentID",
"cryptographic_binding_methods_supported": ["jwk"],
"cryptographic_suites_supported": ["ES256"],
"display": [
{
"name": "EducationalID",
"name": "StudentID",
"locale": "en-GB",
"background_color": "#12107c",
"text_color": "#FFFFFF",
Expand All @@ -721,7 +721,7 @@
}
],
"credential_definition": {
"type": ["EducationalID"],
"type": ["StudentID"],
"claims": {
"identifier": {
"display": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

{
"id": "alliance-id-credential",
"name": "Alliance ID Credential",
"name": "allianceIDCredential",
"format": {
"jwt_vc_json": {
"alg": ["ES256", "ES384"]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "SERVER_URL=https://53d6-2a02-587-870d-e900-2f53-2882-9444-e8a3.ngrok-free.app node server.js"
"dev": "SERVER_URL=https://442b-2a02-587-870d-e900-1bc9-d886-85a8-9109.ngrok-free.app node server.js"
},
"author": "",
"license": "ISC",
Expand Down
4 changes: 2 additions & 2 deletions routes/educationalRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ educationalRouter.get(["/credential-offer-pre-jwt-edu/:id"], (req, res) => {
if (!persona) {
res.json({
credential_issuer: serverURL,
credentials: ["EducationalID"],
credentials: ["StudentID"],
grants: {
"urn:ietf:params:oauth:grant-type:pre-authorized_code": {
"pre-authorized_code": req.params.id,
Expand All @@ -91,7 +91,7 @@ educationalRouter.get(["/credential-offer-pre-jwt-edu/:id"], (req, res) => {
} else {
res.json({
credential_issuer: serverURL,
credentials: ["EducationalID"],
credentials: ["StudentID"],
grants: {
"urn:ietf:params:oauth:grant-type:pre-authorized_code": {
"pre-authorized_code": req.params.id + "-persona=" + persona,
Expand Down
50 changes: 25 additions & 25 deletions routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,14 @@ router.post("/credential", async (req, res) => {
payload = {
iss: serverURL,
sub: decodedHeaderSubjectDID || "",
exp: Math.floor(Date.now() / 1000) + 60 * 60, // Token expiration time (1 hour from now)
exp: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30, // Token expiration time (1 hour from now)
iat: Math.floor(Date.now() / 1000), // Token issued at time
// nbf: Math.floor(Date.now() / 1000),
jti: "urn:did:1904a925-38bd-4eda-b682-4b5e3ca9d4bc",
vc: {
credentialSubject: credentialSubject,
expirationDate: new Date(
(Math.floor(Date.now() / 1000) + 60 * 60) * 1000
(Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30) * 1000
).toISOString(),
id: decodedHeaderSubjectDID,
issuanceDate: new Date(
Expand Down Expand Up @@ -429,8 +429,9 @@ router.post("/credential", async (req, res) => {
};
} else {
if (
requestedCredentials != null &&
requestedCredentials[0] === "EducationalID"
(requestedCredentials != null &&
requestedCredentials[0] === "EducationalID") ||
requestedCredentials[0] === "StudentID"
) {
const preSessions = getPreCodeSessions();
let persona = getPersonaFromAccessToken(
Expand All @@ -443,10 +444,10 @@ router.post("/credential", async (req, res) => {
iss: serverURL,
sub: decodedHeaderSubjectDID || "",
iat: Math.floor(Date.now() / 1000), // Token issued at time
exp: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30, // Token expiration time (1 hour from now)
exp: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30, // Token expiration time (1 hour from now)
jti: "urn:did:1904a925-38bd-4eda-b682-4b5e3ca9d4bc",
vc: {
type: ["StudentID"],//["EducationalID"],
type: ["StudentID"], //["EducationalID"],
"@context": ["https://www.w3.org/2018/credentials/v1"],
issuer: serverURL,
credentialSubject: {
Expand Down Expand Up @@ -475,7 +476,7 @@ router.post("/credential", async (req, res) => {
Math.floor(Date.now() / 1000) * 1000
).toISOString(),
expirationDate: new Date(
(Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30) * 1000
(Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30) * 1000
).toISOString(),
validFrom: new Date(
Math.floor(Date.now() / 1000) * 1000
Expand Down Expand Up @@ -562,7 +563,7 @@ router.post("/credential", async (req, res) => {
iss: serverURL,
sub: decodedHeaderSubjectDID || "",
iat: Math.floor(Date.now() / 1000), // Token issued at time
exp: Math.floor(Date.now() / 1000) + 60 * 60, // Token expiration time (1 hour from now)
exp: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30, // Token expiration time (1 hour from now)
jti: "urn:did:1904a925-38bd-4eda-b682-4b5e3ca9d4bc",
vc: {
type: ["allianceIDCredential"],
Expand All @@ -581,7 +582,7 @@ router.post("/credential", async (req, res) => {
Math.floor(Date.now() / 1000) * 1000
).toISOString(),
expirationDate: new Date(
(Math.floor(Date.now() / 1000) + 60 * 60) * 1000
(Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30) * 1000
).toISOString(),
validFrom: new Date(
Math.floor(Date.now() / 1000) * 1000
Expand All @@ -603,7 +604,7 @@ router.post("/credential", async (req, res) => {
iss: serverURL,
sub: decodedHeaderSubjectDID || "",
iat: Math.floor(Date.now() / 1000), // Token issued at time
exp: Math.floor(Date.now() / 1000) + 60 * 60, // Token expiration time (1 hour from now)
exp: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30, // Token expiration time (1 hour from now)
jti: "urn:did:1904a925-38bd-4eda-b682-4b5e3ca9d4bc",
vc: {
type: ["VerifiableCredential", "ferryBoardingPassCredential"],
Expand All @@ -613,7 +614,7 @@ router.post("/credential", async (req, res) => {
Math.floor(Date.now() / 1000) * 1000
).toISOString(),
expirationDate: new Date(
(Math.floor(Date.now() / 1000) + 60 * 60) * 1000
(Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30) * 1000
).toISOString(),
validFrom: new Date(
Math.floor(Date.now() / 1000) * 1000
Expand All @@ -636,12 +637,11 @@ router.post("/credential", async (req, res) => {
arrivalPort: "NYC",
vesselDescription: "Ferry XYZ",
},

},
};

if (persona === "1") {
payload.vc.credentialSubject ={
payload.vc.credentialSubject = {
id: decodedHeaderSubjectDID || "", // Replace with the actual subject DID
identifier: "Mario Conti",
ticketQR:
Expand All @@ -658,9 +658,9 @@ router.post("/credential", async (req, res) => {
arrivalTime: "15:30:00",
arrivalPort: "MYKONOS TEST",
vesselDescription: "MYKONOS TEST",
}
}else if(persona === "2"){
payload.vc.credentialSubject ={
};
} else if (persona === "2") {
payload.vc.credentialSubject = {
id: decodedHeaderSubjectDID || "", // Replace with the actual subject DID
identifier: "Hannah Matkalainen",
ticketQR:
Expand All @@ -677,9 +677,9 @@ router.post("/credential", async (req, res) => {
arrivalTime: "15:30:00",
arrivalPort: "MYKONOS TEST",
vesselDescription: "MYKONOS TEST",
}
}else if(persona ==="3"){
payload.vc.credentialSubject ={
};
} else if (persona === "3") {
payload.vc.credentialSubject = {
id: decodedHeaderSubjectDID || "", // Replace with the actual subject DID
identifier: "Felix Fischer",
ticketQR:
Expand All @@ -696,14 +696,14 @@ router.post("/credential", async (req, res) => {
arrivalTime: "15:30:00",
arrivalPort: "MYKONOS TEST",
vesselDescription: "MYKONOS TEST",
}
}
};
}
} else {
//sign as jwt
payload = {
iss: serverURL,
sub: decodedHeaderSubjectDID || "",
exp: Math.floor(Date.now() / 1000) + 60 * 60, // Token expiration time (1 hour from now)
exp: Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30, // Token expiration time (1 hour from now)
iat: Math.floor(Date.now() / 1000), // Token issued at time
// nbf: Math.floor(Date.now() / 1000),
jti: "urn:did:1904a925-38bd-4eda-b682-4b5e3ca9d4bc",
Expand All @@ -714,7 +714,7 @@ router.post("/credential", async (req, res) => {
last_name: "Doe",
},
expirationDate: new Date(
(Math.floor(Date.now() / 1000) + 60 * 60) * 1000
(Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 30) * 1000
).toISOString(),
id: "urn:did:1904a925-38bd-4eda-b682-4b5e3ca9d4bc",
issuanceDate: new Date(
Expand Down Expand Up @@ -826,7 +826,7 @@ router.get(["/issueStatus"], (req, res) => {
console.log({
status: result,
reason: "ok",
sessionId: sessionId,
sessionId: sessionId,
});
res.json({
status: result,
Expand Down

0 comments on commit 6e0d7ff

Please sign in to comment.