From eb857222232e74dcf339bf00927a304a735d6ffa Mon Sep 17 00:00:00 2001 From: Benjamin Young Date: Mon, 10 Feb 2025 16:41:45 -0500 Subject: [PATCH 1/7] Rename main workflow. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 40aa34c..f871b94 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Node.js CI +name: Lint and Test on: [push] From 699fd5e4f57bb00282b39b23ab583dd6643310f0 Mon Sep 17 00:00:00 2001 From: Benjamin Young Date: Mon, 10 Feb 2025 16:55:11 -0500 Subject: [PATCH 2/7] Match copyright headers from W3C VC repo. https://github.com/w3c/vc-test-suite-implementations/ --- .eslintrc.cjs | 6 ++++++ CHANGELOG.md | 6 ++++++ LICENSE | 3 +-- README.md | 2 +- lib/Endpoint.js | 7 +++++-- lib/Implementation.js | 7 +++++-- lib/constants.js | 7 +++++-- lib/main.js | 7 +++++-- lib/oauth2.js | 7 +++++-- lib/requests.js | 7 +++++-- test/.eslintrc.cjs | 6 ++++++ 11 files changed, 50 insertions(+), 15 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 15e76e0..05133ae 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,3 +1,9 @@ +/* + * Copyright 2024 Digital Bazaar, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + module.exports = { root: true, extends: [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 47f3806..4d32dad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ + + # vc-test-suite-implementations Changelog ## 4.0.0 - 2024-01-TBD diff --git a/LICENSE b/LICENSE index 652af85..f7d4750 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,6 @@ BSD 3-Clause License -Copyright (c) 2022, Digital Bazaar, Inc. -All rights reserved. +Copyright (c) 2023-2024, World Wide Web Consortium Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 8ce5268..efdceb5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ diff --git a/lib/Endpoint.js b/lib/Endpoint.js index 22bf82b..851793b 100644 --- a/lib/Endpoint.js +++ b/lib/Endpoint.js @@ -1,6 +1,9 @@ -/*! - * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved. +/* + * Copyright 2022-2024 Digital Bazaar, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause */ + import {makeHttpsRequest, zcapRequest} from './requests.js'; /** diff --git a/lib/Implementation.js b/lib/Implementation.js index f7fa076..84dd8b5 100644 --- a/lib/Implementation.js +++ b/lib/Implementation.js @@ -1,6 +1,9 @@ -/*! - * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved. +/* + * Copyright 2022-2024 Digital Bazaar, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause */ + import {Endpoint} from './Endpoint.js'; export class Implementation { diff --git a/lib/constants.js b/lib/constants.js index 24be2bd..f2bbae3 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -1,6 +1,9 @@ -/*! - * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved. +/* + * Copyright 2022-2024 Digital Bazaar, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause */ + import * as didKey from '@digitalbazaar/did-method-key'; import https from 'https'; diff --git a/lib/main.js b/lib/main.js index 0b6f4eb..f00cb3e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -1,6 +1,9 @@ -/*! - * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved. +/* + * Copyright 2022-2024 Digital Bazaar, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause */ + import {Implementation} from './Implementation.js'; import {implementerFiles} from '../implementations/index.js'; export {Endpoint} from './Endpoint.js'; diff --git a/lib/oauth2.js b/lib/oauth2.js index dffa877..bfb5ca0 100644 --- a/lib/oauth2.js +++ b/lib/oauth2.js @@ -1,6 +1,9 @@ -/*! - * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved. +/* + * Copyright 2022-2024 Digital Bazaar, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause */ + import LruCache from 'lru-cache'; import {makeHttpsRequest} from './requests.js'; diff --git a/lib/requests.js b/lib/requests.js index 794b2e7..ff57426 100644 --- a/lib/requests.js +++ b/lib/requests.js @@ -1,6 +1,9 @@ -/*! - * Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved. +/* + * Copyright 2022-2024 Digital Bazaar, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause */ + import { agent, defaultHeaders, diff --git a/test/.eslintrc.cjs b/test/.eslintrc.cjs index bf3479f..182931b 100644 --- a/test/.eslintrc.cjs +++ b/test/.eslintrc.cjs @@ -1,3 +1,9 @@ +/* + * Copyright 2024 Digital Bazaar, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + module.exports = { env: { mocha: true From c2f5d3462e72bd964995be59384b47e448538ea9 Mon Sep 17 00:00:00 2001 From: Benjamin Young Date: Mon, 10 Feb 2025 16:56:41 -0500 Subject: [PATCH 3/7] Use simpler .gitignore. --- .gitignore | 107 ----------------------------------------------------- 1 file changed, 107 deletions(-) diff --git a/.gitignore b/.gitignore index 74c12ad..c2658d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,108 +1 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Editor files -*~ -*.sw[nop] From 824b59cf583227e7ead269ab14956faae7787112 Mon Sep 17 00:00:00 2001 From: Benjamin Young Date: Mon, 10 Feb 2025 16:57:46 -0500 Subject: [PATCH 4/7] Update package.json metadata. --- package.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index e45c8f3..4648569 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,18 @@ { "name": "vc-test-suite-implementations", "version": "0.0.1", - "description": "", + "description": "W3C Credentials Community Group test suite implementations", "homepage": "https://github.com/w3c-ccg/vc-test-suite-implementations", "author": { + "name": "W3C Verifiable Credentials Working Group", + "email": "public-vc-wg@w3.org", + "url": "https://www.w3.org/groups/wg/vc/" + }, + "contributors": [{ "name": "Digital Bazaar, Inc.", "email": "support@digitalbazaar.com", "url": "https://digitalbazaar.com/" - }, + }], "type": "module", "main": "./lib/main.js", "repository": { @@ -16,7 +21,7 @@ }, "bugs": { "url": "https://github.com/w3c-ccg/vc-test-suite-implementations/issues", - "email": "support@digitalbazaar.com" + "email": "public-credentials@w3.org" }, "license": "BSD-3-Clause", "files": [ @@ -61,8 +66,8 @@ "node": ">=18" }, "keywords": [ - "Decentralized", - "Linked Data" + "W3C", + "Verifiable Credentials" ], "scripts": { "test": "npm run test-node && npm run lint", From 73f2b4f716fdc1c646b3f68d16e2cc9a492a3809 Mon Sep 17 00:00:00 2001 From: Benjamin Young Date: Mon, 10 Feb 2025 17:08:42 -0500 Subject: [PATCH 5/7] Match upstream code from W3C VC WG repo. Not much variation. Mostly comments. Key change is adding `localSettings` export. --- lib/main.js | 16 +++++++++------- lib/requests.js | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/lib/main.js b/lib/main.js index f00cb3e..389d1c6 100644 --- a/lib/main.js +++ b/lib/main.js @@ -6,11 +6,11 @@ import {Implementation} from './Implementation.js'; import {implementerFiles} from '../implementations/index.js'; -export {Endpoint} from './Endpoint.js'; const keyValues = implementerFiles.map( implementation => [implementation.name, new Implementation(implementation)]); +export {localSettings} from '../implementations/index.js'; export const implementations = new Map(keyValues); export const allImplementations = implementations; @@ -25,9 +25,9 @@ export const allImplementations = implementations; * @param {Map} [options.implementations=allImplementations] - A Map of * implementations. * @param {Function} options.filter - A function to - * filter the map's entries on that returns true or false. + * filter the map's entries on that returns true or false. * - * @returns {{match: Map, nonMatch: Map}} Returns an object with matching + * @returns {Object} Returns an object with matching * and non-matching maps. */ export const filterImplementations = ({ @@ -50,7 +50,7 @@ export const filterImplementations = ({ /** * Filters implementations by tags on a property in the settings. * - * @example filterByTag({property: 'issuers', tags: ['VC-HTTP-API']}) + * @example filterByTag({property: 'issuers', tags: ['ecdsa-rdfc-2019']}) * * @param {object} options - Options to use. * @param {Map} [options.implementations=allImplementations] - @@ -59,7 +59,7 @@ export const filterImplementations = ({ * @param {string} [options.property='issuers'] - The property to search for on * an implementation. * - * @returns {{match: Map, nonMatch: Map}} Returns an object with matching + * @returns {Object} Returns an object with matching * and non-matching maps. */ export const filterByTag = ({ @@ -87,7 +87,7 @@ export const endpoints = { * @param {Map} [options.implementations=allImplementations] - A Map of * implementations. * @param {Function} options.filter - A function to - * filter the map's entries that returns true or false. + * filter the map's entries that returns true or false. * * @returns {{match: Map, nonMatch: Map}} Returns an object with matching * and non-matching Maps with respective endpoints. @@ -111,7 +111,9 @@ export const endpoints = { /** * Filters endpoints by tags on a property in the settings. * - * @example endpoints.filterByTag({property: 'issuers', tags: ['vc-api']}) + * @example endpoints.filterByTag({ + * property: 'issuers', tags: ['ecdsa-rdfc-2019'] + * }) * * @param {object} options - Options to use. * @param {Map} [options.implementations=allImplementations] - diff --git a/lib/requests.js b/lib/requests.js index ff57426..ba84c69 100644 --- a/lib/requests.js +++ b/lib/requests.js @@ -50,12 +50,12 @@ export async function makeHttpsRequest({ body, method, json, headers, agent, searchParams }); } catch(e) { - error = _sanitizeErrorHeaders({error: e}); + error = _sanitizeError({error: e}); } const {data, statusCode} = _getDataAndStatus({result, error}); // if a result is returned sanitize it if(result) { - result = _sanitizeResponseHeaders({response: result, data}); + result = _sanitizeResponse({response: result, data}); } return {result, error, data, statusCode}; } @@ -91,12 +91,12 @@ export async function zcapRequest({ capability }); } catch(e) { - error = _sanitizeErrorHeaders({error: e}); + error = _sanitizeError({error: e}); } const {data, statusCode} = _getDataAndStatus({result, error}); // if a result is returned sanitize it if(result) { - result = _sanitizeResponseHeaders({response: result, data}); + result = _sanitizeResponse({response: result, data}); } return {result, error, data, statusCode}; } @@ -114,7 +114,7 @@ async function _getZcapClient({secretKeySeed}) { function _getDataAndStatus({result = {}, error = {}}) { let data = result.data || error.data; - // FIXME remove this once VC-API returns from the issuer + // FIXME remove this once data returned from the issuers // are finalized. if(data && data.verifiableCredential) { data = data.verifiableCredential; @@ -123,22 +123,20 @@ function _getDataAndStatus({result = {}, error = {}}) { return {data, statusCode}; } -function _sanitizeErrorHeaders({error}) { +function _sanitizeError({error}) { if(error.response) { - error.response = _sanitizeResponseHeaders({ + error.response = _sanitizeResponse({ response: error.response, data: error.data }); } if(error.request) { - error.request = new global.Request(error.request, { - headers: _sanitizeHeaders({httpMessage: error.request}) - }); + error.request = _sanitizeRequest({request: error.request}); } return error; } -function _sanitizeResponseHeaders({response, data}) { +function _sanitizeResponse({response, data}) { const newResponse = new global.Response(JSON.stringify(data), { headers: _sanitizeHeaders({httpMessage: response}), status: response.status, @@ -152,6 +150,25 @@ function _sanitizeResponseHeaders({response, data}) { return newResponse; } +function _sanitizeRequest({request}) { + // get the url and the remaining properties from the request + const {url, ...props} = request; + // create an options object to pass to the new request + const options = {}; + // do not copy these properties from the request + const skipKeys = new Set(['body', 'headers']); + for(const key in props) { + if(skipKeys.has(key)) { + continue; + } + options[key] = request[key]; + } + return new global.Request(url, { + ...options, + headers: _sanitizeHeaders({httpMessage: request}) + }); +} + /** * Takes in either a response or request & sanitizes the headers. * @@ -174,7 +191,7 @@ function _sanitizeHeaders({httpMessage, headers = sanitizeHeaders}) { for(const header of headers) { // sanitize the headers to prevent // authn tokens / information potentially in logs - newHeaders.set(header, '** SANITIZED TO PREVENT EXPOSING OF SECRETS ***'); + newHeaders.set(header, 'sanitized to prevent exposure of secrets'); } return newHeaders; } From 9c8e6f2f604f6bff4cc8ae461f1415baf7aafc99 Mon Sep 17 00:00:00 2001 From: BigBlueHat Date: Tue, 11 Feb 2025 16:04:57 -0500 Subject: [PATCH 6/7] Improve text in comments. Thanks @TallTed Co-authored-by: Ted Thibodeau Jr --- lib/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/main.js b/lib/main.js index 389d1c6..acfeff2 100644 --- a/lib/main.js +++ b/lib/main.js @@ -25,7 +25,7 @@ export const allImplementations = implementations; * @param {Map} [options.implementations=allImplementations] - A Map of * implementations. * @param {Function} options.filter - A function to - * filter the map's entries on that returns true or false. + * filter the map's entries, that returns true or false. * * @returns {Object} Returns an object with matching * and non-matching maps. @@ -87,7 +87,7 @@ export const endpoints = { * @param {Map} [options.implementations=allImplementations] - A Map of * implementations. * @param {Function} options.filter - A function to - * filter the map's entries that returns true or false. + * filter the map's entries, that returns true or false. * * @returns {{match: Map, nonMatch: Map}} Returns an object with matching * and non-matching Maps with respective endpoints. From 8ade0f7770195d3b326cdba69ec0d1e81c6fd305 Mon Sep 17 00:00:00 2001 From: BigBlueHat Date: Thu, 13 Feb 2025 11:55:26 -0500 Subject: [PATCH 7/7] Bump copyright to 2025. Thanks @PatStLouis and @davidlehn Co-authored-by: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> Co-authored-by: David I. Lehn --- .eslintrc.cjs | 2 +- CHANGELOG.md | 2 +- LICENSE | 2 +- README.md | 2 +- lib/Endpoint.js | 2 +- lib/Implementation.js | 2 +- lib/constants.js | 2 +- lib/main.js | 2 +- lib/oauth2.js | 2 +- lib/requests.js | 2 +- test/.eslintrc.cjs | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 05133ae..3ed2d30 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,5 +1,5 @@ /* - * Copyright 2024 Digital Bazaar, Inc. + * Copyright 2025 Digital Bazaar, Inc. * * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d32dad..a1fc702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ diff --git a/LICENSE b/LICENSE index f7d4750..d2a5251 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2023-2024, World Wide Web Consortium +Copyright (c) 2023-2025, World Wide Web Consortium Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index efdceb5..8ce5268 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ diff --git a/lib/Endpoint.js b/lib/Endpoint.js index 851793b..f5a5b60 100644 --- a/lib/Endpoint.js +++ b/lib/Endpoint.js @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 Digital Bazaar, Inc. + * Copyright 2022-2025 Digital Bazaar, Inc. * * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/lib/Implementation.js b/lib/Implementation.js index 84dd8b5..ba15529 100644 --- a/lib/Implementation.js +++ b/lib/Implementation.js @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 Digital Bazaar, Inc. + * Copyright 2022-2025 Digital Bazaar, Inc. * * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/lib/constants.js b/lib/constants.js index f2bbae3..b27395e 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 Digital Bazaar, Inc. + * Copyright 2022-2025 Digital Bazaar, Inc. * * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/lib/main.js b/lib/main.js index acfeff2..e7338de 100644 --- a/lib/main.js +++ b/lib/main.js @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 Digital Bazaar, Inc. + * Copyright 2022-2025 Digital Bazaar, Inc. * * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/lib/oauth2.js b/lib/oauth2.js index bfb5ca0..9f1bef8 100644 --- a/lib/oauth2.js +++ b/lib/oauth2.js @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 Digital Bazaar, Inc. + * Copyright 2022-2025 Digital Bazaar, Inc. * * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/lib/requests.js b/lib/requests.js index ba84c69..aa737ed 100644 --- a/lib/requests.js +++ b/lib/requests.js @@ -1,5 +1,5 @@ /* - * Copyright 2022-2024 Digital Bazaar, Inc. + * Copyright 2022-2025 Digital Bazaar, Inc. * * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/test/.eslintrc.cjs b/test/.eslintrc.cjs index 182931b..9abd4d4 100644 --- a/test/.eslintrc.cjs +++ b/test/.eslintrc.cjs @@ -1,5 +1,5 @@ /* - * Copyright 2024 Digital Bazaar, Inc. + * Copyright 2025 Digital Bazaar, Inc. * * SPDX-License-Identifier: BSD-3-Clause */