From 0885a0f77db7a32bd91fcee4fb350fa287587059 Mon Sep 17 00:00:00 2001 From: F-Node-Karlsruhe Date: Mon, 9 Oct 2023 15:57:26 +0200 Subject: [PATCH 1/7] fix empty presentation fails Signed-off-by: F-Node-Karlsruhe --- CHANGELOG.md | 6 ++++++ api/package.json | 2 +- api/src/services/verifier/index.ts | 2 ++ frontend/package.json | 2 +- frontend/src/store/index.js | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27fa5b5..4e5d354 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ WIP --- +1.7.3 (2023-10-09) +--- + +- support empty presentations for proof of possession + + 1.7.2 (2023-09-11) --- diff --git a/api/package.json b/api/package.json index 77767ba..43e9691 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "vc-verifier", - "version": "1.7.2", + "version": "1.7.3", "description": "The EECC verifier for verifiable credentials which provides an verification API as well as the corresponding UI.", "main": "index.js", "type": "module", diff --git a/api/src/services/verifier/index.ts b/api/src/services/verifier/index.ts index 00a40c8..9e032fa 100644 --- a/api/src/services/verifier/index.ts +++ b/api/src/services/verifier/index.ts @@ -53,6 +53,8 @@ function getSuites(proof: Proof | Proof[]): unknown[] { function getPresentationStatus(presentation: VerifiablePresentation): CredentialStatus[] | CredentialStatus | undefined { + if (!presentation.verifiableCredential) return undefined; + const credentials = ( Array.isArray(presentation.verifiableCredential) ? presentation.verifiableCredential diff --git a/frontend/package.json b/frontend/package.json index f797ea6..f7584d9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "verifier_frontend", - "version": "1.7.2", + "version": "1.7.3", "description": "Vue frontend for the EECC vc verifier API", "scripts": { "build": "vue-cli-service build", diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 999f77c..a364f95 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -5,7 +5,7 @@ import api from '../api' export default createStore({ state: { - version: '1.7.2', + version: '1.7.3', authentication: undefined, verifiables: [], disclosedCredentials: [], From 819b23902dcfbbd833a69cbce67eb46b4bbda8ef Mon Sep 17 00:00:00 2001 From: F-Node-Karlsruhe Date: Tue, 10 Oct 2023 09:00:47 +0200 Subject: [PATCH 2/7] fix build node version Signed-off-by: F-Node-Karlsruhe --- frontend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index e50d419..7673733 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,5 +1,5 @@ # develop stage -FROM node:lts-alpine as develop-stage +FROM node:18.17-alpine as develop-stage WORKDIR /app COPY package*.json ./ RUN npm install From 547d624f353f7793caab96ee9b8f3f0f96f0b8bc Mon Sep 17 00:00:00 2001 From: F-Node-Karlsruhe Date: Tue, 10 Oct 2023 09:04:20 +0200 Subject: [PATCH 3/7] release 1.7.4 Signed-off-by: F-Node-Karlsruhe --- CHANGELOG.md | 5 +++++ api/package.json | 2 +- frontend/package.json | 2 +- frontend/src/store/index.js | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e5d354..3ddb089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ VC Verifier Changelog WIP --- +1.7.4 (2023-10-10) +--- + +- fix build node version + 1.7.3 (2023-10-09) --- diff --git a/api/package.json b/api/package.json index 43e9691..e4b73d3 100644 --- a/api/package.json +++ b/api/package.json @@ -1,6 +1,6 @@ { "name": "vc-verifier", - "version": "1.7.3", + "version": "1.7.4", "description": "The EECC verifier for verifiable credentials which provides an verification API as well as the corresponding UI.", "main": "index.js", "type": "module", diff --git a/frontend/package.json b/frontend/package.json index f7584d9..3466c86 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "verifier_frontend", - "version": "1.7.3", + "version": "1.7.4", "description": "Vue frontend for the EECC vc verifier API", "scripts": { "build": "vue-cli-service build", diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index a364f95..bf2de32 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -5,7 +5,7 @@ import api from '../api' export default createStore({ state: { - version: '1.7.3', + version: '1.7.4', authentication: undefined, verifiables: [], disclosedCredentials: [], From d684a19312311ac244136a15eb9011da8a77ce30 Mon Sep 17 00:00:00 2001 From: F-Node-Karlsruhe Date: Tue, 10 Oct 2023 09:36:25 +0200 Subject: [PATCH 4/7] fix jest open handles Signed-off-by: F-Node-Karlsruhe --- api/__tests__/credential.test.ts | 23 ++++++++++++++--------- api/__tests__/presentation.test.ts | 15 ++++++++++----- api/jest.config.ts | 1 + api/src/index.ts | 12 ++++++------ 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/api/__tests__/credential.test.ts b/api/__tests__/credential.test.ts index aabd0dc..95be1b6 100644 --- a/api/__tests__/credential.test.ts +++ b/api/__tests__/credential.test.ts @@ -1,6 +1,11 @@ import request from "supertest"; -import app from "../src/index"; +import server from "../src/index"; + +afterAll(done => { + server.close(); + done(); +}); const revoked2020Credential: any = { "@context": [ @@ -192,14 +197,14 @@ const manipulatedCredential = Object.assign({ ...GS1LicenceCredential }, { issua describe("Verifier API Test for Credentials", () => { test("Verify vc by id", async () => { - const res = await request(app).get("/api/verifier/vc/https%253A%252F%252Fid.gs1.org%252Fvc%252Flicence%252Fgs1_prefix%252F05"); + const res = await request(server).get("/api/verifier/vc/https%253A%252F%252Fid.gs1.org%252Fvc%252Flicence%252Fgs1_prefix%252F05"); expect(res.statusCode).toEqual(200); expect(res.body).toHaveProperty('verified'); expect(res.body.verified).toBe(true); }); test("Verify single credential", async () => { - const res = await request(app).post("/api/verifier").send([GS1LicenceCredential]); + const res = await request(server).post("/api/verifier").send([GS1LicenceCredential]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(true); @@ -209,14 +214,14 @@ describe("Verifier API Test for Credentials", () => { * Test selective disclosure DataIntegrityProof credential */ test("Verify single DataIntegrityProof credential", async () => { - const res = await request(app).post("/api/verifier").send([SDCredential]); + const res = await request(server).post("/api/verifier").send([SDCredential]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(true); }); test("Verify multiple credentials", async () => { - const res = await request(app).post("/api/verifier").send([GS1LicenceCredential, GS1LicenceCredential]); + const res = await request(server).post("/api/verifier").send([GS1LicenceCredential, GS1LicenceCredential]); expect(res.statusCode).toEqual(200); res.body.forEach((el: any) => { expect(el).toHaveProperty('verified'); @@ -228,7 +233,7 @@ describe("Verifier API Test for Credentials", () => { * Test StatusList2020 revoked credential */ test("Verify revoked credential", async () => { - const res = await request(app).post("/api/verifier").send([revoked2020Credential]); + const res = await request(server).post("/api/verifier").send([revoked2020Credential]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(false); @@ -240,7 +245,7 @@ describe("Verifier API Test for Credentials", () => { * Test StatusList2021 revoked credential */ test("Verify revoked credential", async () => { - const res = await request(app).post("/api/verifier").send([revoked2021Credential]); + const res = await request(server).post("/api/verifier").send([revoked2021Credential]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(false); @@ -252,7 +257,7 @@ describe("Verifier API Test for Credentials", () => { * Test StatusList2021 suspended credential */ test("Verify suspended credential", async () => { - const res = await request(app).post("/api/verifier").send([suspended2021Credential]); + const res = await request(server).post("/api/verifier").send([suspended2021Credential]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(false); @@ -261,7 +266,7 @@ describe("Verifier API Test for Credentials", () => { }); test("Falsify single credential", async () => { - const res = await request(app).post("/api/verifier").send([manipulatedCredential]); + const res = await request(server).post("/api/verifier").send([manipulatedCredential]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(false); diff --git a/api/__tests__/presentation.test.ts b/api/__tests__/presentation.test.ts index e85dfa5..13ddabf 100644 --- a/api/__tests__/presentation.test.ts +++ b/api/__tests__/presentation.test.ts @@ -1,6 +1,11 @@ import request from "supertest"; -import app from "../src/index"; +import server from "../src/index"; + +afterAll(done => { + server.close(); + done(); +}); const multiPresentation: any = { "@context": [ @@ -198,7 +203,7 @@ const statusPresentation: any = { describe("Verifier API Test for Presentations", () => { test("Verify presentation with status", async () => { - const res = await request(app).post("/api/verifier").send([statusPresentation]); + const res = await request(server).post("/api/verifier").send([statusPresentation]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(true); @@ -210,7 +215,7 @@ describe("Verifier API Test for Presentations", () => { }); test("Verify single presentation with challenge", async () => { - const res = await request(app).post("/api/verifier").query({ challenge: '12345' }).send([multiPresentation]); + const res = await request(server).post("/api/verifier").query({ challenge: '12345' }).send([multiPresentation]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(true); @@ -222,7 +227,7 @@ describe("Verifier API Test for Presentations", () => { }); test("Verify single presentation with challenge & domain", async () => { - const res = await request(app).post("/api/verifier").query({ challenge: '12345', domain: 'ssi.eecc.de/verifier' }).send([domainPresentation]); + const res = await request(server).post("/api/verifier").query({ challenge: '12345', domain: 'ssi.eecc.de/verifier' }).send([domainPresentation]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(true); @@ -234,7 +239,7 @@ describe("Verifier API Test for Presentations", () => { }); test("Falsify single presentation with wrong challenge", async () => { - const res = await request(app).post("/api/verifier").query({ challenge: 'falseChallenge', domain: 'ssi.eecc.de/verifier' }).send([domainPresentation]); + const res = await request(server).post("/api/verifier").query({ challenge: 'falseChallenge', domain: 'ssi.eecc.de/verifier' }).send([domainPresentation]); expect(res.statusCode).toEqual(200); expect(res.body[0]).toHaveProperty('verified'); expect(res.body[0].verified).toBe(false); diff --git a/api/jest.config.ts b/api/jest.config.ts index 8da1179..826ede8 100644 --- a/api/jest.config.ts +++ b/api/jest.config.ts @@ -16,4 +16,5 @@ module.exports = { }, ], }, + testTimeout: 15000 }; \ No newline at end of file diff --git a/api/src/index.ts b/api/src/index.ts index 3cb30fb..cb587bb 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -30,10 +30,10 @@ app.use('/api/verifier', verifyRouter); const port = process.env.PORT ? Number.parseInt(process.env.PORT) : 3000 -if (process.env.NODE_ENV !== 'test') { - const server = app.listen(port, async () => { - console.log(`Started API Server on port ${port}`); - }); -} -export default app; \ No newline at end of file +const server = app.listen(port, async () => { + console.log(`Started API Server on port ${port}`); +}); + + +export default server; \ No newline at end of file From 3b128a32204669e4f015b1d328c530202d079c78 Mon Sep 17 00:00:00 2001 From: F-Node-Karlsruhe Date: Tue, 10 Oct 2023 09:41:25 +0200 Subject: [PATCH 5/7] increase jest timeout for github actions Signed-off-by: F-Node-Karlsruhe --- api/jest.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/jest.config.ts b/api/jest.config.ts index 826ede8..ce1a4ca 100644 --- a/api/jest.config.ts +++ b/api/jest.config.ts @@ -16,5 +16,5 @@ module.exports = { }, ], }, - testTimeout: 15000 + testTimeout: 30000 }; \ No newline at end of file From 9b26df061fc8ac19c492d01219412f39faf64554 Mon Sep 17 00:00:00 2001 From: F-Node-Karlsruhe Date: Tue, 10 Oct 2023 09:47:13 +0200 Subject: [PATCH 6/7] more timeout Signed-off-by: F-Node-Karlsruhe --- api/jest.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/jest.config.ts b/api/jest.config.ts index ce1a4ca..da0284c 100644 --- a/api/jest.config.ts +++ b/api/jest.config.ts @@ -16,5 +16,5 @@ module.exports = { }, ], }, - testTimeout: 30000 + testTimeout: 60000 }; \ No newline at end of file From a6681cb64626d6917bb51b47ea9c7e7f16638e11 Mon Sep 17 00:00:00 2001 From: F-Node-Karlsruhe Date: Thu, 12 Oct 2023 16:09:32 +0200 Subject: [PATCH 7/7] make cred id and pres holder not required in API Signed-off-by: F-Node-Karlsruhe --- api/src/routers/verify/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/routers/verify/index.ts b/api/src/routers/verify/index.ts index ec31767..eaf3cac 100644 --- a/api/src/routers/verify/index.ts +++ b/api/src/routers/verify/index.ts @@ -21,7 +21,7 @@ export const verifyRouter = Router(); * @summary Refers to W3C Credential * @typedef {object} SignedCredential * @property {array} context.required - The JSON-LD context URIs of the credential - * @property {string} id.required - The id of the the credential as an IRI + * @property {string} id - The id of the the credential as an IRI * @property {array} type.required - The types of the credential * @property {string} issuer.required - The DID of the issuer of the credential * @property {string} issuanceDate.required - The issuance date of the credential in ISO format 2022-09-26T09:01:07.437Z @@ -36,7 +36,7 @@ export const verifyRouter = Router(); * @typedef {object} SignedPresentation * @property {array} context.required - The JSON-LD context URIs of the presentation * @property {array} type.required - The types of the presentation. Should be 'VerifiablePresentation' - * @property {string} holder.required - The DID of the holder of the credentials, i.e. the presenter + * @property {string} holder - The DID of the holder of the credentials, i.e. the presenter * @property {array} verifiableCredential - Array of included credentials * @property {object} proof.required - The cryptographic signature of the holder over the presentation */