@bedrock/vc-verifier 9.0.0 → 12.0.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 +4 -4
- package/lib/challenges.js +1 -3
- package/lib/documentLoader.js +8 -8
- package/lib/http.js +8 -12
- package/lib/index.js +1 -1
- package/lib/status.js +8 -10
- package/package.json +28 -23
- package/.eslintrc.cjs +0 -12
- package/.github/workflows/main.yml +0 -77
- package/CHANGELOG.md +0 -162
- package/test/mocha/.eslintrc.cjs +0 -9
- package/test/mocha/10-provision.js +0 -868
- package/test/mocha/20-verify.js +0 -390
- package/test/mocha/30-credential-status.js +0 -488
- package/test/mocha/cert.pem +0 -18
- package/test/mocha/helpers.js +0 -230
- package/test/mocha/key.pem +0 -28
- package/test/mocha/mock-credential.json +0 -39
- package/test/mocha/mock.data.js +0 -21
- package/test/package.json +0 -72
- package/test/test.config.js +0 -40
- package/test/test.js +0 -40
package/test/mocha/helpers.js
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as bedrock from '@bedrock/core';
|
|
5
|
-
import {httpsAgent} from '@bedrock/https-agent';
|
|
6
|
-
import {createRequire} from 'module';
|
|
7
|
-
import {didIo} from '@bedrock/did-io';
|
|
8
|
-
import {getAppIdentity} from '@bedrock/app-identity';
|
|
9
|
-
import {mockData} from './mock.data.js';
|
|
10
|
-
const require = createRequire(import.meta.url);
|
|
11
|
-
const {Ed25519Signature2020} = require('@digitalbazaar/ed25519-signature-2020');
|
|
12
|
-
const {EdvClient} = require('@digitalbazaar/edv-client');
|
|
13
|
-
const {httpClient} = require('@digitalbazaar/http-client');
|
|
14
|
-
const {KeystoreAgent, KmsClient} = require('@digitalbazaar/webkms-client');
|
|
15
|
-
const {ZcapClient} = require('@digitalbazaar/ezcap');
|
|
16
|
-
|
|
17
|
-
const edvBaseUrl = `${mockData.baseUrl}/edvs`;
|
|
18
|
-
const kmsBaseUrl = `${mockData.baseUrl}/kms`;
|
|
19
|
-
|
|
20
|
-
export async function createMeter({capabilityAgent, serviceType} = {}) {
|
|
21
|
-
// create signer using the application's capability invocation key
|
|
22
|
-
const {keys: {capabilityInvocationKey}} = getAppIdentity();
|
|
23
|
-
|
|
24
|
-
const zcapClient = new ZcapClient({
|
|
25
|
-
agent: httpsAgent,
|
|
26
|
-
invocationSigner: capabilityInvocationKey.signer(),
|
|
27
|
-
SuiteClass: Ed25519Signature2020
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// create a meter
|
|
31
|
-
const meterService = `${bedrock.config.server.baseUri}/meters`;
|
|
32
|
-
let meter = {
|
|
33
|
-
controller: capabilityAgent.id,
|
|
34
|
-
product: {
|
|
35
|
-
// mock ID for service type
|
|
36
|
-
id: mockData.productIdMap.get(serviceType)
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
({data: {meter}} = await zcapClient.write({url: meterService, json: meter}));
|
|
40
|
-
|
|
41
|
-
// return full meter ID
|
|
42
|
-
const {id} = meter;
|
|
43
|
-
return {id: `${meterService}/${id}`};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export async function createConfig({
|
|
47
|
-
capabilityAgent, ipAllowList, meterId, zcaps
|
|
48
|
-
} = {}) {
|
|
49
|
-
if(!meterId) {
|
|
50
|
-
// create a meter for the keystore
|
|
51
|
-
({id: meterId} = await createMeter({
|
|
52
|
-
capabilityAgent, serviceType: 'vc-verifier'
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// create service object
|
|
57
|
-
const config = {
|
|
58
|
-
sequence: 0,
|
|
59
|
-
controller: capabilityAgent.id,
|
|
60
|
-
meterId
|
|
61
|
-
};
|
|
62
|
-
if(ipAllowList) {
|
|
63
|
-
config.ipAllowList = ipAllowList;
|
|
64
|
-
}
|
|
65
|
-
if(zcaps) {
|
|
66
|
-
config.zcaps = zcaps;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const zcapClient = createZcapClient({capabilityAgent});
|
|
70
|
-
const url = `${mockData.baseUrl}/verifiers`;
|
|
71
|
-
const response = await zcapClient.write({url, json: config});
|
|
72
|
-
return response.data;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export async function getConfig({id, capabilityAgent}) {
|
|
76
|
-
const zcapClient = createZcapClient({capabilityAgent});
|
|
77
|
-
const {data} = await zcapClient.read({url: id});
|
|
78
|
-
return data;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export async function createChallenge({
|
|
82
|
-
capabilityAgent, capability, verifierId
|
|
83
|
-
}) {
|
|
84
|
-
const zcapClient = createZcapClient({capabilityAgent});
|
|
85
|
-
return zcapClient.write({
|
|
86
|
-
url: `${verifierId}/challenges`,
|
|
87
|
-
capability: capability ||
|
|
88
|
-
`urn:zcap:root:${encodeURIComponent(verifierId)}`,
|
|
89
|
-
json: {}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export async function createEdv({
|
|
94
|
-
capabilityAgent, keystoreAgent, keyAgreementKey, hmac, meterId
|
|
95
|
-
}) {
|
|
96
|
-
if(!meterId) {
|
|
97
|
-
// create a meter for the keystore
|
|
98
|
-
({id: meterId} = await createMeter({
|
|
99
|
-
capabilityAgent, serviceType: 'edv'
|
|
100
|
-
}));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if(!(keyAgreementKey && hmac) && keystoreAgent) {
|
|
104
|
-
// create KAK and HMAC keys for edv config
|
|
105
|
-
([keyAgreementKey, hmac] = await Promise.all([
|
|
106
|
-
keystoreAgent.generateKey({type: 'keyAgreement'}),
|
|
107
|
-
keystoreAgent.generateKey({type: 'hmac'})
|
|
108
|
-
]));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// create edv
|
|
112
|
-
const newEdvConfig = {
|
|
113
|
-
sequence: 0,
|
|
114
|
-
controller: capabilityAgent.id,
|
|
115
|
-
keyAgreementKey: {id: keyAgreementKey.id, type: keyAgreementKey.type},
|
|
116
|
-
hmac: {id: hmac.id, type: hmac.type},
|
|
117
|
-
meterId
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const edvConfig = await EdvClient.createEdv({
|
|
121
|
-
config: newEdvConfig,
|
|
122
|
-
httpsAgent,
|
|
123
|
-
invocationSigner: capabilityAgent.getSigner(),
|
|
124
|
-
url: edvBaseUrl
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const edvClient = new EdvClient({
|
|
128
|
-
id: edvConfig.id,
|
|
129
|
-
keyResolver,
|
|
130
|
-
keyAgreementKey,
|
|
131
|
-
hmac,
|
|
132
|
-
httpsAgent
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
return {edvClient, edvConfig, hmac, keyAgreementKey};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export async function createKeystore({
|
|
139
|
-
capabilityAgent, ipAllowList, meterId,
|
|
140
|
-
kmsModule = 'ssm-v1'
|
|
141
|
-
}) {
|
|
142
|
-
if(!meterId) {
|
|
143
|
-
// create a meter for the keystore
|
|
144
|
-
({id: meterId} = await createMeter(
|
|
145
|
-
{capabilityAgent, serviceType: 'webkms'}));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// create keystore
|
|
149
|
-
const config = {
|
|
150
|
-
sequence: 0,
|
|
151
|
-
controller: capabilityAgent.id,
|
|
152
|
-
meterId,
|
|
153
|
-
kmsModule
|
|
154
|
-
};
|
|
155
|
-
if(ipAllowList) {
|
|
156
|
-
config.ipAllowList = ipAllowList;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return KmsClient.createKeystore({
|
|
160
|
-
url: `${kmsBaseUrl}/keystores`,
|
|
161
|
-
config,
|
|
162
|
-
invocationSigner: capabilityAgent.getSigner(),
|
|
163
|
-
httpsAgent
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export async function createKeystoreAgent({capabilityAgent, ipAllowList}) {
|
|
168
|
-
let err;
|
|
169
|
-
let keystore;
|
|
170
|
-
try {
|
|
171
|
-
keystore = await createKeystore({capabilityAgent, ipAllowList});
|
|
172
|
-
} catch(e) {
|
|
173
|
-
err = e;
|
|
174
|
-
}
|
|
175
|
-
assertNoError(err);
|
|
176
|
-
|
|
177
|
-
// create kmsClient only required because we need to use httpsAgent
|
|
178
|
-
// that accepts self-signed certs used in test suite
|
|
179
|
-
const kmsClient = new KmsClient({httpsAgent});
|
|
180
|
-
const keystoreAgent = new KeystoreAgent({
|
|
181
|
-
capabilityAgent,
|
|
182
|
-
keystoreId: keystore.id,
|
|
183
|
-
kmsClient
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
return keystoreAgent;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export function createZcapClient({
|
|
190
|
-
capabilityAgent, delegationSigner, invocationSigner
|
|
191
|
-
}) {
|
|
192
|
-
const signer = capabilityAgent && capabilityAgent.getSigner();
|
|
193
|
-
return new ZcapClient({
|
|
194
|
-
agent: httpsAgent,
|
|
195
|
-
invocationSigner: invocationSigner || signer,
|
|
196
|
-
delegationSigner: delegationSigner || signer,
|
|
197
|
-
SuiteClass: Ed25519Signature2020
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export async function delegate({
|
|
202
|
-
capability, controller, invocationTarget, expires, allowedActions,
|
|
203
|
-
delegator
|
|
204
|
-
}) {
|
|
205
|
-
const zcapClient = createZcapClient({capabilityAgent: delegator});
|
|
206
|
-
expires = expires || (capability && capability.expires) ||
|
|
207
|
-
new Date(Date.now() + 5000).toISOString().slice(0, -5) + 'Z';
|
|
208
|
-
return zcapClient.delegate({
|
|
209
|
-
capability, controller, expires, invocationTarget, allowedActions
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export async function revokeDelegatedCapability({
|
|
214
|
-
serviceObjectId, capabilityToRevoke, invocationSigner
|
|
215
|
-
}) {
|
|
216
|
-
const url = `${serviceObjectId}/zcaps/revocations/` +
|
|
217
|
-
encodeURIComponent(capabilityToRevoke.id);
|
|
218
|
-
const zcapClient = createZcapClient({invocationSigner});
|
|
219
|
-
return zcapClient.write({url, json: capabilityToRevoke});
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
async function keyResolver({id}) {
|
|
223
|
-
// support DID-based keys only
|
|
224
|
-
if(id.startsWith('did:')) {
|
|
225
|
-
return didIo.get({url: id});
|
|
226
|
-
}
|
|
227
|
-
// support HTTP-based keys; currently a requirement for WebKMS
|
|
228
|
-
const {data} = await httpClient.get(id, {agent: httpsAgent});
|
|
229
|
-
return data;
|
|
230
|
-
}
|
package/test/mocha/key.pem
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
-----BEGIN PRIVATE KEY-----
|
|
2
|
-
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5egV0Yz8iZziL
|
|
3
|
-
p5HNSiIfMISiDd/wqArJKJjr9aY96Sa9cVLSBt+4xJrAxKpCVlgAl/6ZNnVrftZ+
|
|
4
|
-
SwqBvQ9I2WlodQhu4Gs1ImrSj44P+SooyGO6IT1mhZMt++0oUj/ZjdaIoFaNjzKo
|
|
5
|
-
D1N0RLdI5l6lSSbO/E86sXMX9tHGrjSElMO0EF5dXPLMLrRFjRQ4md819aKpH8Ob
|
|
6
|
-
yCI02wRK8j2LI8Cfqka0kxdxQSLQ4z5yDsb3ajd5avJzgCEprOOvwy36dvtuT11X
|
|
7
|
-
pstS0Sqgwk1BRhYvYn99H4euSwx9BpoA6GiVM2OaI4SctpvfGxbnhh0Z5SU+JaxJ
|
|
8
|
-
xPAnQe9JAgMBAAECggEBAJmBQ8Jv4XC3vTTYGvOsx1DI9vyoPw8OBN83mlivlkbn
|
|
9
|
-
EAj6IXFx/vcMwIeKPN9qVqsnIK/tQoEVGLCtqqR1tJC2X2b0dWZOlmwDcCWUah8O
|
|
10
|
-
OLZII0GJASg4pPcJ6d3VNML5gPTSvs+qFGLDTG6N8KOFBhAF2vi0GV6aPoc236du
|
|
11
|
-
W7r45/2uawN2k+M+5EiHDy+E96bMkN+urI9PUbrcEySqgKtdLZJLKvzQXMCT4gAN
|
|
12
|
-
2bR2CltO/3j/lMC2MRXtrDt0rc7NDTABBer9qGzd1YPDGghlW1/I2EsSLPxiF0lA
|
|
13
|
-
ChuwJaZIAJhra0izGN63rh5NyVKzIE6EJmS/OClmIAECgYEA8TZNuGKQor9rcFVX
|
|
14
|
-
bFgv/LU9i6ZrPQ1krVTGrTZGYSZSXdON13EGsmVx/y7IQtTom+fy7XatnPiL7ANc
|
|
15
|
-
bNor+XPDNTHWgVsCgXB6177PitdTNN7EaL6yJFych2chBgxzX6iyjivUCqsbKLjF
|
|
16
|
-
svnREQdTlI/Jyo/LeZSMIExEYekCgYEAxNj6m5lI3ffM2Xzx07+MGiAJhtswHmoL
|
|
17
|
-
E5F78H2vTc5lZi8P+npXK3R0zA8xk1EWJvvptmGnySJ6+g1QBhzp31Ej37IltNdF
|
|
18
|
-
9YWWfR55OwppqyJSFaDZLA/ZRzHMJCO9k5/6Vw79mNGGTXKF+KuEQsoD1A2sQXNt
|
|
19
|
-
u82ppdPmZmECgYEA0EZfXXJeCOjX0CsgTYDoDoBAIDEWL6U85R1qX22Z35DDVhix
|
|
20
|
-
RPFnIurNP9YZPPuxzcy9yaTLy9ogly1fxO2tQrteNrRNz2vSAgopR9iORAgg5Gnl
|
|
21
|
-
lbvy/cqprZCyxxJBHLwBURkvAfc0gDjrG9rxVo7I8GInjywSOWy2gbzY3uECgYA7
|
|
22
|
-
3vbSLpwQDxd6KttumPrm00myf6YyCfTWfdBhhAi2tIj4vGWyvFUY/XGsww5EDUyc
|
|
23
|
-
jNA3zZn3vgoDVds6EL89UfOETS3UxAkeNQRhh8w9ndwn1ed7dpG3Khbe5ZF+iHRX
|
|
24
|
-
mzfMFN4jBc9AbQ28ZYZzvffOHl5/BbmhflsT+dBA4QKBgDO+i82xY/athz2caAve
|
|
25
|
-
8ZN+66/O4sesjLVrEgSNiwCNmxJK01dk7dpH0Yu1RNbCWTrcejrOX6oH0Xc2cU2t
|
|
26
|
-
9riivDJkPvOe6AhrzGGQqbGdL4EOCBKEEHQZP4WSwHZwTvEn0arQfzvz9MecT5WU
|
|
27
|
-
X+bA8m6q9sVohy1RtvGNzZBu
|
|
28
|
-
-----END PRIVATE KEY-----
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"@context": [
|
|
3
|
-
"https://www.w3.org/2018/credentials/v1",
|
|
4
|
-
{
|
|
5
|
-
"ex": "https://example.org/examples#",
|
|
6
|
-
"schema": "http://schema.org/",
|
|
7
|
-
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
8
|
-
"BachelorDegree": "ex:BachelorDegree",
|
|
9
|
-
"UniversityDegreeCredential": "ex:UniversityDegreeCredential",
|
|
10
|
-
"degree": "ex:degree",
|
|
11
|
-
"name": {
|
|
12
|
-
"@id": "schema:name",
|
|
13
|
-
"@type": "rdf:HTML"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"https://w3id.org/security/suites/ed25519-2020/v1"
|
|
17
|
-
],
|
|
18
|
-
"id": "http://example.gov/credentials/3732",
|
|
19
|
-
"type": [
|
|
20
|
-
"VerifiableCredential",
|
|
21
|
-
"UniversityDegreeCredential"
|
|
22
|
-
],
|
|
23
|
-
"issuer": "did:key:z6MkmHipNuE35C6ona8Hkgpq3mpn4C3rX5kp1SjwcZ7HCWnH",
|
|
24
|
-
"issuanceDate": "2020-03-11T23:09:06.803Z",
|
|
25
|
-
"credentialSubject": {
|
|
26
|
-
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
|
|
27
|
-
"degree": {
|
|
28
|
-
"type": "BachelorDegree",
|
|
29
|
-
"name": "Bachelor of Science and Arts"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"proof": {
|
|
33
|
-
"type": "Ed25519Signature2020",
|
|
34
|
-
"created": "2021-05-11T18:44:41Z",
|
|
35
|
-
"verificationMethod": "did:key:z6MkmHipNuE35C6ona8Hkgpq3mpn4C3rX5kp1SjwcZ7HCWnH#z6MkmHipNuE35C6ona8Hkgpq3mpn4C3rX5kp1SjwcZ7HCWnH",
|
|
36
|
-
"proofPurpose": "assertionMethod",
|
|
37
|
-
"proofValue": "zqvrFELnqNYWBEsqkHPhqxXuQaNf3dpsQ3s6dLgkS1jAtAwXfwxf2TirW4kyPAUHNU3TXbS7JT38aF4jtnXGwiBT"
|
|
38
|
-
}
|
|
39
|
-
}
|
package/test/mocha/mock.data.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import {config} from '@bedrock/core';
|
|
5
|
-
|
|
6
|
-
export const mockData = {};
|
|
7
|
-
|
|
8
|
-
// mock product IDs and reverse lookup for service products
|
|
9
|
-
mockData.productIdMap = new Map([
|
|
10
|
-
// edv service
|
|
11
|
-
['edv', 'urn:uuid:dbd15f08-ff67-11eb-893b-10bf48838a41'],
|
|
12
|
-
['urn:uuid:dbd15f08-ff67-11eb-893b-10bf48838a41', 'edv'],
|
|
13
|
-
// vc-verifier service
|
|
14
|
-
['vc-verifier', 'urn:uuid:66aad4d0-8ac1-11ec-856f-10bf48838a41'],
|
|
15
|
-
['urn:uuid:66aad4d0-8ac1-11ec-856f-10bf48838a41', 'vc-verifier'],
|
|
16
|
-
// webkms service
|
|
17
|
-
['webkms', 'urn:uuid:80a82316-e8c2-11eb-9570-10bf48838a41'],
|
|
18
|
-
['urn:uuid:80a82316-e8c2-11eb-9570-10bf48838a41', 'webkms']
|
|
19
|
-
]);
|
|
20
|
-
|
|
21
|
-
mockData.baseUrl = config.server.baseUri;
|
package/test/package.json
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "bedrock-vc-verifier-test",
|
|
3
|
-
"version": "0.0.1-0",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "Bedrock VC Verifier Test",
|
|
6
|
-
"private": true,
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "node --preserve-symlinks test.js test",
|
|
9
|
-
"coverage": "cross-env NODE_ENV=test c8 --reporter=lcov --reporter=text-summary npm test",
|
|
10
|
-
"coverage-ci": "cross-env NODE_ENV=test c8 --reporter=lcovonly npm test",
|
|
11
|
-
"coverage-report": "c8 report"
|
|
12
|
-
},
|
|
13
|
-
"author": {
|
|
14
|
-
"name": "Digital Bazaar, Inc.",
|
|
15
|
-
"email": "support@digitalbazaar.com",
|
|
16
|
-
"url": "http://digitalbazaar.com"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"@bedrock/app-identity": "^3.0.0",
|
|
20
|
-
"@bedrock/core": "^6.0.0",
|
|
21
|
-
"@bedrock/credentials-context": "^3.0.0",
|
|
22
|
-
"@bedrock/did-context": "^4.0.0",
|
|
23
|
-
"@bedrock/did-io": "^8.0.0",
|
|
24
|
-
"@bedrock/edv-storage": "^15.0.0",
|
|
25
|
-
"@bedrock/express": "^8.0.0",
|
|
26
|
-
"@bedrock/https-agent": "^4.0.0",
|
|
27
|
-
"@bedrock/jsonld-document-loader": "^3.0.0",
|
|
28
|
-
"@bedrock/kms": "^10.0.0",
|
|
29
|
-
"@bedrock/kms-http": "^14.0.0",
|
|
30
|
-
"@bedrock/ledger-context": "^23.0.0",
|
|
31
|
-
"@bedrock/meter": "^3.0.0",
|
|
32
|
-
"@bedrock/meter-http": "^8.0.0",
|
|
33
|
-
"@bedrock/meter-usage-reporter": "^7.0.0",
|
|
34
|
-
"@bedrock/mongodb": "^10.0.0",
|
|
35
|
-
"@bedrock/package-manager": "^3.0.0",
|
|
36
|
-
"@bedrock/security-context": "^7.0.0",
|
|
37
|
-
"@bedrock/server": "^5.0.0",
|
|
38
|
-
"@bedrock/service-agent": "^5.0.0",
|
|
39
|
-
"@bedrock/service-context-store": "^6.0.0",
|
|
40
|
-
"@bedrock/service-core": "5.0.0",
|
|
41
|
-
"@bedrock/ssm-mongodb": "^9.0.0",
|
|
42
|
-
"@bedrock/test": "^8.0.0",
|
|
43
|
-
"@bedrock/validation": "^7.0.0",
|
|
44
|
-
"@bedrock/vc-revocation-list-context": "^3.0.0",
|
|
45
|
-
"@bedrock/vc-status-list-context": "^4.0.0",
|
|
46
|
-
"@bedrock/vc-verifier": "file:..",
|
|
47
|
-
"@bedrock/veres-one-context": "^14.0.0",
|
|
48
|
-
"@bedrock/zcap-storage": "^7.0.0",
|
|
49
|
-
"@digitalbazaar/did-method-key": "^2.0.0",
|
|
50
|
-
"@digitalbazaar/ed25519-signature-2020": "^3.0.0",
|
|
51
|
-
"@digitalbazaar/ed25519-verification-key-2020": "^3.2.0",
|
|
52
|
-
"@digitalbazaar/edv-client": "^14.0.0",
|
|
53
|
-
"@digitalbazaar/ezcap": "^2.0.2",
|
|
54
|
-
"@digitalbazaar/http-client": "^3.0.1",
|
|
55
|
-
"@digitalbazaar/vc": "^2.1.0",
|
|
56
|
-
"@digitalbazaar/vc-status-list-context": "^3.0.0",
|
|
57
|
-
"@digitalbazaar/webkms-client": "^10.0.0",
|
|
58
|
-
"c8": "^7.11.0",
|
|
59
|
-
"cross-env": "^7.0.3",
|
|
60
|
-
"express": "^4.17.2",
|
|
61
|
-
"vc-revocation-list-context": "^1.0.0"
|
|
62
|
-
},
|
|
63
|
-
"c8": {
|
|
64
|
-
"excludeNodeModules": false,
|
|
65
|
-
"include": [
|
|
66
|
-
"node_modules/@bedrock/vc-verifier/**"
|
|
67
|
-
],
|
|
68
|
-
"exclude": [
|
|
69
|
-
"node_modules/@bedrock/vc-verifier/node_modules/**"
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
}
|
package/test/test.config.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2012-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import {config} from '@bedrock/core';
|
|
5
|
-
import {fileURLToPath} from 'url';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import '@bedrock/app-identity';
|
|
8
|
-
import '@bedrock/https-agent';
|
|
9
|
-
import '@bedrock/mongodb';
|
|
10
|
-
import '@bedrock/service-agent';
|
|
11
|
-
import '@bedrock/vc-verifier';
|
|
12
|
-
|
|
13
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
|
|
15
|
-
config.mocha.options.fullTrace = true;
|
|
16
|
-
config.mocha.tests.push(path.join(__dirname, 'mocha'));
|
|
17
|
-
|
|
18
|
-
// MongoDB
|
|
19
|
-
config.mongodb.name = 'bedrock_vc_verifier_test';
|
|
20
|
-
config.mongodb.dropCollections.onInit = true;
|
|
21
|
-
config.mongodb.dropCollections.collections = [];
|
|
22
|
-
// drop all collections on initialization
|
|
23
|
-
config.mongodb.dropCollections = {};
|
|
24
|
-
config.mongodb.dropCollections.onInit = true;
|
|
25
|
-
config.mongodb.dropCollections.collections = [];
|
|
26
|
-
|
|
27
|
-
// allow self-signed certs in test framework
|
|
28
|
-
config['https-agent'].rejectUnauthorized = false;
|
|
29
|
-
|
|
30
|
-
// create test application identity
|
|
31
|
-
// ...and `ensureConfigOverride` has already been set via
|
|
32
|
-
// `bedrock-app-identity` so it doesn't have to be set here
|
|
33
|
-
config['app-identity'].seeds.services['vc-verifier'] = {
|
|
34
|
-
id: 'did:key:z6MkrH839XwPCUQ2TkA6ifehciWnEvzuQ2njc6J19fpuP5oN',
|
|
35
|
-
seedMultibase: 'z1AgvAGfbairK3AV6GqbeF8gSpYZXftQsGb5DTjptgawNyn',
|
|
36
|
-
serviceType: 'vc-verifier'
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// use local KMS for testing
|
|
40
|
-
config['service-agent'].kms.baseUrl = 'https://localhost:18443/kms';
|
package/test/test.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
import * as bedrock from '@bedrock/core';
|
|
5
|
-
import '@bedrock/ssm-mongodb';
|
|
6
|
-
import '@bedrock/kms';
|
|
7
|
-
import '@bedrock/https-agent';
|
|
8
|
-
import '@bedrock/meter';
|
|
9
|
-
import '@bedrock/meter-usage-reporter';
|
|
10
|
-
import {getServiceIdentities} from '@bedrock/app-identity';
|
|
11
|
-
import {handlers} from '@bedrock/meter-http';
|
|
12
|
-
import '@bedrock/server';
|
|
13
|
-
import '@bedrock/kms-http';
|
|
14
|
-
import '@bedrock/edv-storage';
|
|
15
|
-
import '@bedrock/vc-verifier';
|
|
16
|
-
import {mockData} from './mocha/mock.data.js';
|
|
17
|
-
|
|
18
|
-
bedrock.events.on('bedrock.init', async () => {
|
|
19
|
-
/* Handlers need to be added before `bedrock.start` is called. These are
|
|
20
|
-
no-op handlers to enable meter usage without restriction */
|
|
21
|
-
handlers.setCreateHandler({
|
|
22
|
-
handler({meter} = {}) {
|
|
23
|
-
// use configured meter usage reporter as service ID for tests
|
|
24
|
-
const clientName = mockData.productIdMap.get(meter.product.id);
|
|
25
|
-
const serviceIdentites = getServiceIdentities();
|
|
26
|
-
const serviceIdentity = serviceIdentites.get(clientName);
|
|
27
|
-
if(!serviceIdentity) {
|
|
28
|
-
throw new Error(`Could not find identity "${clientName}".`);
|
|
29
|
-
}
|
|
30
|
-
meter.serviceId = serviceIdentity.id;
|
|
31
|
-
return {meter};
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
handlers.setUpdateHandler({handler: ({meter} = {}) => ({meter})});
|
|
35
|
-
handlers.setRemoveHandler({handler: ({meter} = {}) => ({meter})});
|
|
36
|
-
handlers.setUseHandler({handler: ({meter} = {}) => ({meter})});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
import '@bedrock/test';
|
|
40
|
-
bedrock.start();
|