From ee67e5764cb584fa6d0bdc281edf08bf50b9f748 Mon Sep 17 00:00:00 2001 From: F-Node-Karlsruhe Date: Tue, 3 Jan 2023 15:57:28 +0100 Subject: [PATCH] allow revocation verification --- api/package-lock.json | 53 ++++++++++++++++++++++++ api/package.json | 1 + api/src/services/documentLoader/index.ts | 5 ++- api/src/services/verifier/index.ts | 4 +- frontend/src/store/index.js | 2 +- 5 files changed, 61 insertions(+), 4 deletions(-) diff --git a/api/package-lock.json b/api/package-lock.json index 10e0f33..87f8bdc 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@digitalbazaar/ed25519-signature-2020": "^5.0.0", "@digitalbazaar/vc": "^5.0.0", + "@digitalbazaar/vc-revocation-list": "^5.0.0", "cors": "^2.8.5", "did-resolver": "^4.0.1", "dotenv": "^16.0.1", @@ -30,6 +31,18 @@ "typescript": "^4.7.4" } }, + "node_modules/@digitalbazaar/bitstring": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@digitalbazaar/bitstring/-/bitstring-2.0.0.tgz", + "integrity": "sha512-zMgKVe1HdgljOby//rcbNKioXkkqB7OUkbK5ni5GcqfEOaHQNC+dy8+T4fnmhgAZj5kS4Ib/k3C6+2/G4sGcGA==", + "dependencies": { + "base64url-universal": "^2.0.0", + "pako": "^2.0.4" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@digitalbazaar/ed25519-signature-2020": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@digitalbazaar/ed25519-signature-2020/-/ed25519-signature-2020-5.0.0.tgz", @@ -85,6 +98,18 @@ "node": ">=14" } }, + "node_modules/@digitalbazaar/vc-revocation-list": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@digitalbazaar/vc-revocation-list/-/vc-revocation-list-5.0.0.tgz", + "integrity": "sha512-T9d3HJPSxSYa7hlMUL8VpFou8gbRj2cil7J8DzLlf2gIV/t3olgErerQD++0nDerHwkoiwVek+pV+gvZI/fKwQ==", + "dependencies": { + "@digitalbazaar/bitstring": "^2.0.0", + "@digitalbazaar/vc": "^5.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -1339,6 +1364,11 @@ "wrappy": "1" } }, + "node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -1929,6 +1959,15 @@ } }, "dependencies": { + "@digitalbazaar/bitstring": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@digitalbazaar/bitstring/-/bitstring-2.0.0.tgz", + "integrity": "sha512-zMgKVe1HdgljOby//rcbNKioXkkqB7OUkbK5ni5GcqfEOaHQNC+dy8+T4fnmhgAZj5kS4Ib/k3C6+2/G4sGcGA==", + "requires": { + "base64url-universal": "^2.0.0", + "pako": "^2.0.4" + } + }, "@digitalbazaar/ed25519-signature-2020": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@digitalbazaar/ed25519-signature-2020/-/ed25519-signature-2020-5.0.0.tgz", @@ -1972,6 +2011,15 @@ "jsonld-signatures": "^11.0.0" } }, + "@digitalbazaar/vc-revocation-list": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@digitalbazaar/vc-revocation-list/-/vc-revocation-list-5.0.0.tgz", + "integrity": "sha512-T9d3HJPSxSYa7hlMUL8VpFou8gbRj2cil7J8DzLlf2gIV/t3olgErerQD++0nDerHwkoiwVek+pV+gvZI/fKwQ==", + "requires": { + "@digitalbazaar/bitstring": "^2.0.0", + "@digitalbazaar/vc": "^5.0.0" + } + }, "@noble/ed25519": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.1.tgz", @@ -2905,6 +2953,11 @@ "wrappy": "1" } }, + "pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", diff --git a/api/package.json b/api/package.json index a3bbc5b..4fb726e 100644 --- a/api/package.json +++ b/api/package.json @@ -28,6 +28,7 @@ "dependencies": { "@digitalbazaar/ed25519-signature-2020": "^5.0.0", "@digitalbazaar/vc": "^5.0.0", + "@digitalbazaar/vc-revocation-list": "^5.0.0", "cors": "^2.8.5", "did-resolver": "^4.0.1", "dotenv": "^16.0.1", diff --git a/api/src/services/documentLoader/index.ts b/api/src/services/documentLoader/index.ts index 503251d..0e3a7a2 100644 --- a/api/src/services/documentLoader/index.ts +++ b/api/src/services/documentLoader/index.ts @@ -1,6 +1,7 @@ // @ts-ignore import jsonldSignatures from 'jsonld-signatures'; -import { getResolver } from './didresolver.js' +import { getResolver } from './didresolver.js'; +import { fetch_get } from '../fetch/index.js'; const TRUSTED_CONTEXT_DOMAINS: [string] = ['https://ssi.eecc.de'] @@ -49,7 +50,7 @@ const documentLoader: Promise = jsonldSignatures.extendContextLoader(async // fetch if not in cache if (!document) { - document = await(await fetch(url)).json(); + document = await(await fetch_get(url)).json(); // cache and warn if external if (!TRUSTED_CONTEXT_DOMAINS.some((trusted) => url.startsWith(trusted))) { diff --git a/api/src/services/verifier/index.ts b/api/src/services/verifier/index.ts index 309a83b..f73465b 100644 --- a/api/src/services/verifier/index.ts +++ b/api/src/services/verifier/index.ts @@ -2,6 +2,8 @@ import { verifyCredential } from '@digitalbazaar/vc'; // @ts-ignore import { Ed25519Signature2020 } from '@digitalbazaar/ed25519-signature-2020'; +// @ts-ignore +import { checkStatus } from '@digitalbazaar/vc-revocation-list'; import { documentLoader } from '../documentLoader/index.js'; @@ -12,7 +14,7 @@ export class VCVerifier { // TODO choose suite based on proofType const suite = new Ed25519Signature2020(); - const result = await verifyCredential({credential, suite, documentLoader}); + const result = await verifyCredential({credential, suite, documentLoader, checkStatus}); return result } diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index a38faa1..5a55403 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -3,7 +3,7 @@ import { createStore } from 'vuex' export default createStore({ state: { - version: '0.3.5', + version: '0.4.0', credentials: [], VC_REGISTRY: process.env.VC_REGISTRY || 'https://ssi.eecc.de/api/registry/vcs/', showQRModal: false