@bedrock/vc-verifier 10.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Bedrock VC Verifier API module _(bedrock-vc-verifier)_
1
+ # Bedrock VC Verifier API module _(@bedrock/vc-verifier)_
2
2
 
3
3
  [![Build Status](https://img.shields.io/github/workflow/status/digitalbazaar/bedrock-vc-verifier/Bedrock%20Node.js%20CI)](https://github.com/digitalbazaar/bedrock-vc-verifier/actions?query=workflow%3A%22Bedrock+Node.js+CI%22)
4
4
  [![NPM Version](https://img.shields.io/npm/v/bedrock-vc-verifier.svg)](https://npm.im/bedrock-vc-verifier)
@@ -25,7 +25,7 @@ TBD
25
25
 
26
26
  ## Install
27
27
 
28
- - Node.js 14+ is required.
28
+ - Node.js 16+ is required.
29
29
 
30
30
  ### NPM
31
31
 
@@ -73,8 +73,8 @@ Example request:
73
73
 
74
74
  Alias: `/instances/:instanceId/credentials/verify`
75
75
 
76
- Optionally performs status checks using the `vc-revocation-list` or
77
- `vc-status-list` library.
76
+ Optionally performs status checks using the `@digitalbazaar/vc-revocation-list`
77
+ or `@digitalbazaar/vc-status-list` library.
78
78
 
79
79
  Example request:
80
80
 
package/lib/challenges.js CHANGED
@@ -3,10 +3,8 @@
3
3
  */
4
4
  import * as bedrock from '@bedrock/core';
5
5
  import * as database from '@bedrock/mongodb';
6
+ import {decodeId, generateId} from 'bnid';
6
7
  import assert from 'assert-plus';
7
- import {createRequire} from 'node:module';
8
- const require = createRequire(import.meta.url);
9
- const {generateId, decodeId} = require('bnid');
10
8
 
11
9
  const {util: {BedrockError}} = bedrock;
12
10
 
@@ -2,20 +2,20 @@
2
2
  * Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
3
3
  */
4
4
  import * as bedrock from '@bedrock/core';
5
+ import {
6
+ documentLoader as brDocLoader,
7
+ httpClientHandler,
8
+ JsonLdDocumentLoader
9
+ } from '@bedrock/jsonld-document-loader';
10
+ import {createContextDocumentLoader} from '@bedrock/service-context-store';
11
+ import {didIo} from '@bedrock/did-io';
5
12
  import '@bedrock/credentials-context';
6
13
  import '@bedrock/did-context';
7
14
  import '@bedrock/did-io';
8
15
  import '@bedrock/security-context';
9
- import '@bedrock/vc-status-list-context';
10
16
  import '@bedrock/vc-revocation-list-context';
17
+ import '@bedrock/vc-status-list-context';
11
18
  import '@bedrock/veres-one-context';
12
- import {createContextDocumentLoader} from '@bedrock/service-context-store';
13
- import {didIo} from '@bedrock/did-io';
14
- import {
15
- documentLoader as brDocLoader,
16
- httpClientHandler,
17
- JsonLdDocumentLoader
18
- } from '@bedrock/jsonld-document-loader';
19
19
 
20
20
  const serviceType = 'vc-verifier';
21
21
  let webLoader;
package/lib/http.js CHANGED
@@ -2,26 +2,22 @@
2
2
  * Copyright (c) 2018-2022 Digital Bazaar, Inc. All rights reserved.
3
3
  */
4
4
  import * as bedrock from '@bedrock/core';
5
+ import * as vc from '@digitalbazaar/vc';
5
6
  import {createChallenge, verifyChallenge} from './challenges.js';
6
- import {asyncHandler} from '@bedrock/express';
7
- import bodyParser from 'body-parser';
8
- import {checkStatus} from './status.js';
9
- import cors from 'cors';
10
7
  import {
11
8
  createChallengeBody,
12
9
  verifyCredentialBody,
13
10
  verifyPresentationBody
14
11
  } from '../schemas/bedrock-vc-verifier.js';
12
+ import {metering, middleware} from '@bedrock/service-core';
13
+ import {asyncHandler} from '@bedrock/express';
14
+ import bodyParser from 'body-parser';
15
+ import {checkStatus} from './status.js';
16
+ import cors from 'cors';
15
17
  import {createDocumentLoader} from './documentLoader.js';
16
- import {createRequire} from 'node:module';
18
+ import {Ed25519Signature2018} from '@digitalbazaar/ed25519-signature-2018';
19
+ import {Ed25519Signature2020} from '@digitalbazaar/ed25519-signature-2020';
17
20
  import {createValidateMiddleware as validate} from '@bedrock/validation';
18
- import {metering, middleware} from '@bedrock/service-core';
19
- const require = createRequire(import.meta.url);
20
- const {Ed25519Signature2020} =
21
- require('@digitalbazaar/ed25519-signature-2020');
22
- const {Ed25519Signature2018} =
23
- require('@digitalbazaar/ed25519-signature-2018');
24
- const vc = require('@digitalbazaar/vc');
25
21
 
26
22
  const {util: {BedrockError}} = bedrock;
27
23
 
@@ -63,8 +59,7 @@ export async function addRoutes({app, service} = {}) {
63
59
  cors(),
64
60
  validate({bodySchema: createChallengeBody}),
65
61
  getConfigMiddleware,
66
- // FIXME: add middleware to switch between oauth2 / zcap based on headers
67
- middleware.authorizeConfigZcapInvocation(),
62
+ middleware.authorizeServiceObjectRequest(),
68
63
  asyncHandler(async (req, res) => {
69
64
  const {config} = req.serviceObject;
70
65
  const challenge = await createChallenge({verifierId: config.id});
@@ -81,8 +76,7 @@ export async function addRoutes({app, service} = {}) {
81
76
  cors(),
82
77
  validate({bodySchema: verifyCredentialBody}),
83
78
  getConfigMiddleware,
84
- // FIXME: add middleware to switch between oauth2 / zcap based on headers
85
- middleware.authorizeConfigZcapInvocation(),
79
+ middleware.authorizeServiceObjectRequest(),
86
80
  asyncHandler(async (req, res) => {
87
81
  const {config} = req.serviceObject;
88
82
  const documentLoader = await createDocumentLoader({config});
@@ -139,8 +133,7 @@ export async function addRoutes({app, service} = {}) {
139
133
  cors(),
140
134
  validate({bodySchema: verifyPresentationBody}),
141
135
  getConfigMiddleware,
142
- // FIXME: add middleware to switch between oauth2 / zcap based on headers
143
- middleware.authorizeConfigZcapInvocation(),
136
+ middleware.authorizeServiceObjectRequest(),
144
137
  asyncHandler(async (req, res) => {
145
138
  const {config} = req.serviceObject;
146
139
  const documentLoader = await createDocumentLoader({config});
package/lib/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) 2021-2022 Digital Bazaar, Inc. All rights reserved.
3
3
  */
4
4
  import * as bedrock from '@bedrock/core';
5
- import {addRoutes} from './http.js';
6
5
  import {
7
6
  addRoutes as addContextStoreRoutes
8
7
  } from '@bedrock/service-context-store';
8
+ import {addRoutes} from './http.js';
9
9
  import {createService} from '@bedrock/service-core';
10
10
  import {initializeServiceAgent} from '@bedrock/service-agent';
11
11
 
package/lib/status.js CHANGED
@@ -1,17 +1,15 @@
1
1
  /*!
2
2
  * Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
3
3
  */
4
+ import {
5
+ checkStatus as revocationListCheckStatus,
6
+ statusTypeMatches as revocationListStatusTypeMatches
7
+ } from '@digitalbazaar/vc-revocation-list';
8
+ import {
9
+ checkStatus as statusListCheckStatus,
10
+ statusTypeMatches as statusListStatusTypeMatches
11
+ } from '@digitalbazaar/vc-status-list';
4
12
  import assert from 'assert-plus';
5
- import {createRequire} from 'node:module';
6
- const require = createRequire(import.meta.url);
7
- const {
8
- checkStatus: statusListCheckStatus,
9
- statusTypeMatches: statusListStatusTypeMatches
10
- } = require('@digitalbazaar/vc-status-list');
11
- const {
12
- checkStatus: revocationListCheckStatus,
13
- statusTypeMatches: revocationListStatusTypeMatches
14
- } = require('vc-revocation-list');
15
13
 
16
14
  const handlerMap = new Map();
17
15
  handlerMap.set('RevocationList2020Status', {
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@bedrock/vc-verifier",
3
- "version": "10.0.0",
3
+ "version": "12.1.0",
4
4
  "type": "module",
5
5
  "description": "Bedrock VC Verifier",
6
6
  "main": "./lib/index.js",
7
+ "files": [
8
+ "lib/**/*.js",
9
+ "schemas/**/*.js"
10
+ ],
7
11
  "scripts": {
8
12
  "lint": "eslint ."
9
13
  },
@@ -21,42 +25,43 @@
21
25
  },
22
26
  "homepage": "https://github.com/digitalbazaar/bedrock-vc-verifier",
23
27
  "dependencies": {
24
- "@digitalbazaar/ed25519-signature-2018": "^2.1.0",
25
- "@digitalbazaar/ed25519-signature-2020": "^3.0.0",
26
- "@digitalbazaar/vc": "^2.1.0",
27
- "@digitalbazaar/vc-status-list": "^3.0.0",
28
+ "@digitalbazaar/ed25519-signature-2018": "^3.0.0",
29
+ "@digitalbazaar/ed25519-signature-2020": "^4.0.1",
30
+ "@digitalbazaar/vc": "^4.0.0",
31
+ "@digitalbazaar/vc-revocation-list": "^4.0.0",
32
+ "@digitalbazaar/vc-status-list": "^5.0.0",
28
33
  "assert-plus": "^1.0.0",
29
- "bnid": "^2.1.0",
30
- "body-parser": "^1.19.0",
31
- "cors": "^2.8.5",
32
- "vc-revocation-list": "^3.0.0"
34
+ "bnid": "^3.0.0",
35
+ "body-parser": "^1.20.0",
36
+ "cors": "^2.8.5"
33
37
  },
34
38
  "peerDependencies": {
35
- "@bedrock/core": "^6.0.0",
39
+ "@bedrock/core": "^6.0.1",
36
40
  "@bedrock/credentials-context": "^3.0.0",
37
41
  "@bedrock/did-context": "^4.0.0",
38
- "@bedrock/did-io": "^8.0.0",
42
+ "@bedrock/did-io": "^9.0.1",
39
43
  "@bedrock/express": "^8.0.0",
40
44
  "@bedrock/https-agent": "^4.0.0",
41
45
  "@bedrock/jsonld-document-loader": "^3.0.0",
42
46
  "@bedrock/mongodb": "^10.0.0",
43
47
  "@bedrock/security-context": "^7.0.0",
44
- "@bedrock/service-agent": "^5.0.0",
45
- "@bedrock/service-context-store": "^7.0.0",
46
- "@bedrock/service-core": "^5.0.0",
47
- "@bedrock/vc-status-list-context": "^4.0.0",
48
- "@bedrock/vc-revocation-list-context": "^3.0.0",
49
- "@bedrock/veres-one-context": "^14.0.0",
50
- "@bedrock/validation": "^7.0.0"
48
+ "@bedrock/service-agent": "^6.0.0",
49
+ "@bedrock/service-context-store": "^8.1.0",
50
+ "@bedrock/service-core": "^6.1.2",
51
+ "@bedrock/validation": "^7.0.0",
52
+ "@bedrock/vc-revocation-list-context": "^3.1.0",
53
+ "@bedrock/vc-status-list-context": "^4.1.0",
54
+ "@bedrock/veres-one-context": "^14.0.1"
51
55
  },
52
56
  "devDependencies": {
53
- "eslint": "^7.32.0",
54
- "eslint-config-digitalbazaar": "^2.8.0",
55
- "eslint-plugin-jsdoc": "^28.6.1",
56
- "jsdoc": "^3.6.4",
57
+ "eslint": "^8.18.0",
58
+ "eslint-config-digitalbazaar": "^4.0.1",
59
+ "eslint-plugin-jsdoc": "^39.3.3",
60
+ "eslint-plugin-unicorn": "^43.0.0",
61
+ "jsdoc": "^3.6.10",
57
62
  "jsdoc-to-markdown": "^7.1.1"
58
63
  },
59
64
  "engines": {
60
- "node": ">=14"
65
+ "node": ">=16"
61
66
  }
62
67
  }
package/.eslintrc.cjs DELETED
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- parserOptions: {
4
- // this is required for dynamic import()
5
- ecmaVersion: 2020
6
- },
7
- env: {
8
- node: true
9
- },
10
- extends: ['digitalbazaar', 'digitalbazaar/jsdoc'],
11
- ignorePatterns: ['node_modules/']
12
- };
@@ -1,77 +0,0 @@
1
- name: Bedrock Node.js CI
2
-
3
- on: [push]
4
-
5
- jobs:
6
- lint:
7
- runs-on: ubuntu-latest
8
- timeout-minutes: 10
9
- strategy:
10
- matrix:
11
- node-version: [16.x]
12
- steps:
13
- - uses: actions/checkout@v2
14
- - name: Use Node.js ${{ matrix.node-version }}
15
- uses: actions/setup-node@v1
16
- with:
17
- node-version: ${{ matrix.node-version }}
18
- - run: npm install
19
- - name: Run eslint
20
- run: npm run lint
21
- test-node:
22
- needs: [lint]
23
- runs-on: ubuntu-latest
24
- timeout-minutes: 10
25
- services:
26
- mongodb:
27
- image: mongo:4.4
28
- ports:
29
- - 27017:27017
30
- strategy:
31
- matrix:
32
- node-version: [14.x, 16.x]
33
- steps:
34
- - uses: actions/checkout@v2
35
- - name: Use Node.js ${{ matrix.node-version }}
36
- uses: actions/setup-node@v1
37
- with:
38
- node-version: ${{ matrix.node-version }}
39
- - run: |
40
- npm install
41
- cd test
42
- npm install
43
- - name: Run test with Node.js ${{ matrix.node-version }}
44
- run: |
45
- cd test
46
- npm test
47
- coverage:
48
- needs: [test-node]
49
- runs-on: ubuntu-latest
50
- timeout-minutes: 10
51
- services:
52
- mongodb:
53
- image: mongo:4.4
54
- ports:
55
- - 27017:27017
56
- strategy:
57
- matrix:
58
- node-version: [16.x]
59
- steps:
60
- - uses: actions/checkout@v2
61
- - name: Use Node.js ${{ matrix.node-version }}
62
- uses: actions/setup-node@v1
63
- with:
64
- node-version: ${{ matrix.node-version }}
65
- - run: |
66
- npm install
67
- cd test
68
- npm install
69
- - name: Generate coverage report
70
- run: |
71
- cd test
72
- npm run coverage-ci
73
- - name: Upload coverage to Codecov
74
- uses: codecov/codecov-action@v2
75
- with:
76
- file: ./test/coverage/lcov.info
77
- fail_ci_if_error: true
package/CHANGELOG.md DELETED
@@ -1,168 +0,0 @@
1
- # bedrock-vc-verifier ChangeLog
2
-
3
- ## 10.0.0 - 2022-05-17
4
-
5
- ### Changed
6
- - **BREAKING**: Use `@bedrock-service-context-store@7` to cause migration of
7
- old EDV context documents to the new EDV attribute version.
8
-
9
- ## 9.0.0 - 2022-05-05
10
-
11
- ### Changed
12
- - **BREAKING**: Update peer deps:
13
- - `@bedrock/service-agent@5`
14
- - `@bedrock/service-context-store@6`.
15
- - **BREAKING**: The updated peer dependencies use a new EDV client with a
16
- new blind attribute version. This version is incompatible with previous
17
- versions and a manual migration must be performed to update all
18
- EDV documents to use the new blind attribute version -- or a new
19
- deployment is required.
20
-
21
- ## 8.0.0 - 2022-04-29
22
-
23
- ### Changed
24
- - **BREAKING**: Update peer deps:
25
- - `@bedrock/core@6`
26
- - `@bedrock/credentials-context@3`
27
- - `@bedrock/did-context@4`
28
- - `@bedrock/did-io@8`
29
- - `@bedrock/express@8`
30
- - `@bedrock/https-agent@4`
31
- - `@bedrock/jsonld-document-loader@3`
32
- - `@bedrock/mongodb@10`
33
- - `@bedrock/security-context@7`
34
- - `@bedrock/service-agent@4`
35
- - `@bedrock/service-context-store@5`
36
- - `@bedrock/service-core@5`
37
- - `@bedrock/validation@7`
38
- - `@bedrock/vc-status-list-context@3`
39
- - `@bedrock/vc-revocation-list-context@3`
40
- - `@bedrock/veres-one-context@14`.
41
-
42
- ## 7.0.0 - 2022-04-23
43
-
44
- ### Changed
45
- - **BREAKING**: Update `@digitalbazaar/vc-status-list` and
46
- `@bedrock/vc-status-list-context` to v3.0.
47
-
48
- ## 6.0.0 - 2022-04-06
49
-
50
- ### Changed
51
- - **BREAKING**: Rename package to `@bedrock/vc-verifier`.
52
- - **BREAKING**: Convert to module (ESM).
53
- - **BREAKING**: Remove default export.
54
- - **BREAKING**: Require node 14.x.
55
-
56
- ## 5.2.0 - 2022-03-14
57
-
58
- ### Added
59
- - Add missing dependencies `@digitalbazaar/webkms-client@10.0` and
60
- `@digitalbazaar/edv-client@13.0` in test.
61
- - Add coverage action in github workflows.
62
-
63
- ### Removed
64
- - Remove unused dependency `crypto-ld@6.0`.
65
- - Remove unused dependencies `veres-one-context`, `did-veres-one`, `crypto-ld`,
66
- `did-context` and `bedrock-views` from test.
67
-
68
- ## 5.1.0 - 2022-03-12
69
-
70
- ### Changed
71
- - Update dependencies:
72
- - `@digitalbazaar/vc-status-list@2.1`.
73
-
74
- ## 5.0.0 - 2022-03-11
75
-
76
- ### Changed
77
- - **BREAKING**: Update peer dependencies:
78
- - `bedrock-service-core@3`
79
- - `bedrock-service-context-store@3`
80
- - `bedrock-did-io@6.1`.
81
-
82
- ## 4.0.0 - 2022-03-01
83
-
84
- ### Changed
85
- - **BREAKING**: Move zcap revocations to `/zcaps/revocations` to better
86
- future proof.
87
- - **BREAKING**: Require `bedrock-service-core@2`, `bedrock-service-agent@2`,
88
- and `bedrock-service-context-store@2` peer dependencies.
89
-
90
- ## 3.1.0 - 2022-02-23
91
-
92
- ### Added
93
- - Add default (dev mode) `app-identity` entry for `vc-verifier` service.
94
-
95
- ## 3.0.1 - 2022-02-21
96
-
97
- ### Changed
98
- - Use `@digitalbazaar/vc-status-list-context` and updated bedrock-vc-status-list-context.
99
- These dependencies have no changes other than moved package locations.
100
-
101
- ## 3.0.0 - 2022-02-20
102
-
103
- ### Changed
104
- - **BREAKING**: Complete refactor to run on top of `bedrock-service*` modules. While
105
- this version has similar functionality, its APIs and implementation are a clean
106
- break from previous versions.
107
-
108
- ## 2.3.0 - 2022-02-15
109
-
110
- ### Changed
111
- - Refactor documentLoader.
112
-
113
- ## 2.2.0 - 2022-02-09
114
-
115
- ### Added
116
- - Add support for "StatusList2021Credential" status checks using
117
- `vc-status-list@1.0`
118
- - Add tests.
119
-
120
- ## 2.1.0 - 2021-09-14
121
-
122
- ### Added
123
- - Add support for unsigned VPs.
124
-
125
- ## 2.0.2 - 2021-08-23
126
-
127
- ### Changed
128
- - Update deps to fix multicodec bugs and set `verificationSuite` for `v1` to
129
- `Ed25519VerificationKey2020` in config.
130
-
131
- ## 2.0.1 - 2021-05-28
132
-
133
- ### Fixed
134
- - Fix bedrock peer dependencies.
135
-
136
- ## 2.0.0 - 2021-05-28
137
-
138
- ### Changed
139
- - **BREAKING**: Remove `axios` and use `@digitalbazaar/http-client@1.1.0`.
140
- Errors surfaced from `http-client` do not have the same signature as `axios`.
141
- - **BREAKING**: Remove `cfg.ledgerHostname` and `cfg.mode` from `config.js`.
142
- - **BREAKING**: Use [vc-revocation-list@3](https://github.com/digitalbazaar/vc-revocation-list/blob/main/CHANGELOG.md).
143
- Revocation list credentials must have the same issuer value as the credential
144
- to be revoked.
145
- - **BREAKING**: Use [bedrock-did-io@3.0](https://github.com/digitalbazaar/bedrock-did-io/blob/main/CHANGELOG.md).
146
- - Replace `vc-js` with `@digitalbazaar/vc`.
147
- - Update to support ed25519 2020 signature suite.
148
- - Update peerDeps and testDeps.
149
-
150
- ## 1.2.0 - 2021-03-03
151
-
152
- ### Fixed
153
-
154
- - Only verify based on `options.checks`.
155
-
156
- ## 1.1.0 - 2020-05-18
157
-
158
- ### Added
159
-
160
- - Implement W3C CCG VC Verification HTTP API.
161
-
162
- ## 1.0.0 - 2020-02-27
163
-
164
- ### Added
165
- - API endpoint /vc/verify which can verify a presentation.
166
- - Mock API endpoint /verifiers/:verifierId/verifications/:referenceId
167
- - Positive tests for both endpoints.
168
- - Utils to serialize errors in verification reports.
@@ -1,9 +0,0 @@
1
- module.exports = {
2
- env: {
3
- mocha: true
4
- },
5
- globals: {
6
- assertNoError: true,
7
- should: true
8
- }
9
- };