@verii/server-credentialagent 1.0.0-pre.1752076816 → 1.0.0-pre.1754289942
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/migrate-mongo.config.js +1 -0
- package/package.json +36 -35
- package/src/controllers/holder/issue/get-credential-manifest/controller.js +2 -0
- package/src/controllers/operator/tenants/_tenantId/controller-v0.8.js +1 -5
- package/src/controllers/operator/tenants/_tenantId/keys/controller-v0.8.js +1 -2
- package/src/entities/allocations/index.js +19 -0
- package/src/entities/allocations/repos/index.js +19 -0
- package/src/entities/allocations/repos/repo.js +41 -0
- package/src/entities/index.js +1 -2
- package/src/entities/keys/domains/constants.js +1 -14
- package/src/entities/keys/domains/validate-key.js +2 -6
- package/src/entities/keys/factories/key-factory.js +6 -2
- package/src/entities/offers/orchestrators/create-verifiable-credentials.js +4 -1
- package/test/holder/credential-manifest-controller.test.js +4 -0
- package/test/holder/e2e-issuing-controller.test.js +19 -14
- package/test/holder/issuing-controller.test.js +4 -1
- package/test/operator/keys-controller-v0.8.test.js +1 -4
- package/test/operator/offers-controller-v0.8.test.js +10 -20
- package/test/operator/vc-api-credentials.test.js +9 -3
package/migrate-mongo.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/server-credentialagent",
|
|
3
|
-
"version": "1.0.0-pre.
|
|
3
|
+
"version": "1.0.0-pre.1754289942",
|
|
4
4
|
"description": "Credential Agent application",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"node": ">=22.11.0"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "jest ./test --config ./jest.config.js --runInBand --coverage",
|
|
12
|
-
"test:e2e": "jest ./e2e/org-registration-and-issuing.e2e.test.js --config ./jest.config.js --runInBand",
|
|
11
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest ./test --config ./jest.config.js --runInBand --coverage",
|
|
12
|
+
"test:e2e": "NODE_OPTIONS=--experimental-vm-modules jest ./e2e/org-registration-and-issuing.e2e.test.js --config ./jest.config.js --runInBand",
|
|
13
13
|
"start": "node src/main.js",
|
|
14
14
|
"start:dev": "node --throw-deprecation src/standalone.js",
|
|
15
15
|
"start-operator": "node src/main-operator.js",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@fastify/autoload": "^6.0.0",
|
|
31
|
+
"@fastify/cors": "^11.0.1",
|
|
31
32
|
"@fastify/helmet": "^13.0.0",
|
|
32
33
|
"@fastify/routes": "^6.0.0",
|
|
33
34
|
"@fastify/sensible": "^6.0.0",
|
|
@@ -37,33 +38,33 @@
|
|
|
37
38
|
"@fastify/view": "^11.0.0",
|
|
38
39
|
"@spencejs/spence-factories": "^0.10.2",
|
|
39
40
|
"@spencejs/spence-mongo-repos": "^0.10.2",
|
|
40
|
-
"@verii/auth": "1.0.0-pre.
|
|
41
|
-
"@verii/base-contract-io": "1.0.0-pre.
|
|
42
|
-
"@verii/blockchain-functions": "1.0.0-pre.
|
|
43
|
-
"@verii/common-fetchers": "1.0.0-pre.
|
|
44
|
-
"@verii/common-functions": "1.0.0-pre.
|
|
45
|
-
"@verii/common-schemas": "1.0.0-pre.
|
|
46
|
-
"@verii/config": "1.0.0-pre.
|
|
47
|
-
"@verii/contract-permissions": "1.0.0-pre.
|
|
48
|
-
"@verii/crypto": "1.0.0-pre.
|
|
49
|
-
"@verii/csv-parser": "1.0.0-pre.
|
|
50
|
-
"@verii/db-kms": "1.0.0-pre.
|
|
51
|
-
"@verii/did-doc": "1.0.0-pre.
|
|
52
|
-
"@verii/fastify-plugins": "1.0.0-pre.
|
|
53
|
-
"@verii/jwt": "1.0.0-pre.
|
|
54
|
-
"@verii/metadata-registration": "1.0.0-pre.
|
|
55
|
-
"@verii/organizations-registry": "1.0.0-pre.
|
|
56
|
-
"@verii/request": "1.0.0-pre.
|
|
57
|
-
"@verii/rest-queries": "1.0.0-pre.
|
|
58
|
-
"@verii/server-provider": "1.0.0-pre.
|
|
59
|
-
"@verii/spencer-mongo-extensions": "1.0.0-pre.
|
|
60
|
-
"@verii/test-regexes": "1.0.0-pre.
|
|
61
|
-
"@verii/validation": "1.0.0-pre.
|
|
62
|
-
"@verii/vc-checks": "1.0.0-pre.
|
|
63
|
-
"@verii/velocity-issuing": "1.0.0-pre.
|
|
64
|
-
"@verii/verifiable-credentials": "1.0.0-pre.
|
|
41
|
+
"@verii/auth": "1.0.0-pre.1754289942",
|
|
42
|
+
"@verii/base-contract-io": "1.0.0-pre.1754289942",
|
|
43
|
+
"@verii/blockchain-functions": "1.0.0-pre.1754289942",
|
|
44
|
+
"@verii/common-fetchers": "1.0.0-pre.1754289942",
|
|
45
|
+
"@verii/common-functions": "1.0.0-pre.1754289942",
|
|
46
|
+
"@verii/common-schemas": "1.0.0-pre.1754289942",
|
|
47
|
+
"@verii/config": "1.0.0-pre.1754289942",
|
|
48
|
+
"@verii/contract-permissions": "1.0.0-pre.1754289942",
|
|
49
|
+
"@verii/crypto": "1.0.0-pre.1754289942",
|
|
50
|
+
"@verii/csv-parser": "1.0.0-pre.1754289942",
|
|
51
|
+
"@verii/db-kms": "1.0.0-pre.1754289942",
|
|
52
|
+
"@verii/did-doc": "1.0.0-pre.1754289942",
|
|
53
|
+
"@verii/fastify-plugins": "1.0.0-pre.1754289942",
|
|
54
|
+
"@verii/jwt": "1.0.0-pre.1754289942",
|
|
55
|
+
"@verii/metadata-registration": "1.0.0-pre.1754289942",
|
|
56
|
+
"@verii/organizations-registry": "1.0.0-pre.1754289942",
|
|
57
|
+
"@verii/request": "1.0.0-pre.1754289942",
|
|
58
|
+
"@verii/rest-queries": "1.0.0-pre.1754289942",
|
|
59
|
+
"@verii/server-provider": "1.0.0-pre.1754289942",
|
|
60
|
+
"@verii/spencer-mongo-extensions": "1.0.0-pre.1754289942",
|
|
61
|
+
"@verii/test-regexes": "1.0.0-pre.1754289942",
|
|
62
|
+
"@verii/validation": "1.0.0-pre.1754289942",
|
|
63
|
+
"@verii/vc-checks": "1.0.0-pre.1754289942",
|
|
64
|
+
"@verii/velocity-issuing": "1.0.0-pre.1754289942",
|
|
65
|
+
"@verii/verifiable-credentials": "1.0.0-pre.1754289942",
|
|
65
66
|
"ajv": "8.17.1",
|
|
66
|
-
"canonicalize": "^2.
|
|
67
|
+
"canonicalize": "^2.1.0",
|
|
67
68
|
"date-fns": "~3.6.0",
|
|
68
69
|
"env-var": "~7.5.0",
|
|
69
70
|
"eth-url-parser": "~1.0.3",
|
|
@@ -73,19 +74,19 @@
|
|
|
73
74
|
"http-errors": "~2.0.0",
|
|
74
75
|
"jsonpath-plus": "^10.3.0",
|
|
75
76
|
"lodash": "^4.17.21",
|
|
76
|
-
"mongodb": "~6.
|
|
77
|
+
"mongodb": "~6.17.0",
|
|
77
78
|
"nanoid": "~3.3.1",
|
|
78
79
|
"nock": "14.0.5",
|
|
79
80
|
"qr-image": "~3.2.0"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
83
|
"@spencejs/spence-config": "0.10.2",
|
|
83
|
-
"@verii/endpoints-organizations-registrar": "1.0.0-pre.
|
|
84
|
-
"@verii/sample-data": "1.0.0-pre.
|
|
84
|
+
"@verii/endpoints-organizations-registrar": "1.0.0-pre.1754289942",
|
|
85
|
+
"@verii/sample-data": "1.0.0-pre.1754289942",
|
|
85
86
|
"@verii/test-regexes": "0.5.0-build",
|
|
86
|
-
"@verii/tests-helpers": "1.0.0-pre.
|
|
87
|
+
"@verii/tests-helpers": "1.0.0-pre.1754289942",
|
|
87
88
|
"cheerio": "1.1.0",
|
|
88
|
-
"dotenv": "16.
|
|
89
|
+
"dotenv": "16.6.1",
|
|
89
90
|
"eslint": "8.57.1",
|
|
90
91
|
"eslint-config-airbnb-base": "14.2.1",
|
|
91
92
|
"eslint-config-prettier": "8.10.0",
|
|
@@ -104,5 +105,5 @@
|
|
|
104
105
|
"prettier": "2.8.8",
|
|
105
106
|
"qs": "6.14.0"
|
|
106
107
|
},
|
|
107
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "772b121fb3eb2ee0077a1b5c9eec3281215e9e9f"
|
|
108
109
|
}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
/* eslint-disable camelcase */
|
|
18
|
+
const cors = require('@fastify/cors');
|
|
18
19
|
const { isEmpty, map, compact } = require('lodash/fp');
|
|
19
20
|
const newError = require('http-errors');
|
|
20
21
|
const { getCredentialTypeDescriptor } = require('@verii/common-fetchers');
|
|
@@ -38,6 +39,7 @@ const {
|
|
|
38
39
|
|
|
39
40
|
const credentialManifestController = async (fastify) => {
|
|
40
41
|
fastify
|
|
42
|
+
.register(cors, { origin: true })
|
|
41
43
|
.register(ensureTenantDefaultIssuingDisclosureIdPlugin)
|
|
42
44
|
.register(ensureDisclosureConfigurationTypePlugin)
|
|
43
45
|
.register(ensureDisclosureActivePlugin)
|
|
@@ -153,13 +153,9 @@ const tenantController = async (fastify) => {
|
|
|
153
153
|
await repos.vendorUserIdMappings
|
|
154
154
|
.collection()
|
|
155
155
|
.deleteMany({ tenantId: tenant._id });
|
|
156
|
-
await repos.
|
|
157
|
-
tenantId: tenant._id,
|
|
158
|
-
});
|
|
156
|
+
await repos.allocations.collection().deleteMany({ tenantId: tenant._id });
|
|
159
157
|
await repos.offers.collection().deleteMany({ 'issuer.id': tenant.did });
|
|
160
|
-
|
|
161
158
|
await repos.tenants.delUsingFilter({ filter: { did: tenant.did } });
|
|
162
|
-
|
|
163
159
|
await repos.groups.deleteTenant(tenant.did);
|
|
164
160
|
|
|
165
161
|
reply.code(204);
|
|
@@ -16,12 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
const { isEmpty, some, map } = require('lodash/fp');
|
|
18
18
|
const newError = require('http-errors');
|
|
19
|
-
const { KeyPurposes } = require('@verii/crypto');
|
|
19
|
+
const { KeyEncodings, KeyPurposes } = require('@verii/crypto');
|
|
20
20
|
const { resolveDid } = require('@verii/common-fetchers');
|
|
21
21
|
|
|
22
22
|
const {
|
|
23
23
|
addPrimaryAddressToTenant,
|
|
24
|
-
KeyEncodings,
|
|
25
24
|
validateDidDocKeys,
|
|
26
25
|
} = require('../../../../../entities');
|
|
27
26
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
...require('./repos'),
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
metadataListAllocationPlugin: require('./repo'),
|
|
19
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Velocity Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
repoFactory,
|
|
19
|
+
autoboxIdsExtension,
|
|
20
|
+
} = require('@spencejs/spence-mongo-repos');
|
|
21
|
+
const { multitenantExtension } = require('@verii/spencer-mongo-extensions');
|
|
22
|
+
|
|
23
|
+
module.exports = (app, options, next = () => {}) => {
|
|
24
|
+
next();
|
|
25
|
+
return repoFactory(
|
|
26
|
+
{
|
|
27
|
+
name: 'allocations',
|
|
28
|
+
entityName: 'allocation',
|
|
29
|
+
defaultProjection: {
|
|
30
|
+
_id: 1,
|
|
31
|
+
currentListId: 1,
|
|
32
|
+
freeIndexes: 1,
|
|
33
|
+
entityName: 1,
|
|
34
|
+
createdAt: 1,
|
|
35
|
+
updatedAt: 1,
|
|
36
|
+
},
|
|
37
|
+
extensions: [autoboxIdsExtension, multitenantExtension()],
|
|
38
|
+
},
|
|
39
|
+
app
|
|
40
|
+
);
|
|
41
|
+
};
|
package/src/entities/index.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
module.exports = {
|
|
18
|
+
...require('./allocations'),
|
|
18
19
|
...require('./common'),
|
|
19
20
|
...require('./credentials'),
|
|
20
21
|
...require('./deep-links'),
|
|
@@ -23,11 +24,9 @@ module.exports = {
|
|
|
23
24
|
...require('./feeds'),
|
|
24
25
|
...require('./keys'),
|
|
25
26
|
...require('./notifications'),
|
|
26
|
-
...require('./metadata-list-allocations'),
|
|
27
27
|
...require('./offers'),
|
|
28
28
|
...require('./presentations'),
|
|
29
29
|
...require('./groups'),
|
|
30
|
-
...require('./revocation-list-allocations'),
|
|
31
30
|
...require('./schemas'),
|
|
32
31
|
...require('./tenants'),
|
|
33
32
|
...require('./tokens'),
|
|
@@ -14,15 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const KeyAlgorithms = {
|
|
18
|
-
SECP256K1: 'SECP256K1',
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const KeyEncodings = {
|
|
22
|
-
HEX: 'hex',
|
|
23
|
-
JWK: 'jwk',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
17
|
const KeyErrorMessages = {
|
|
27
18
|
UNRECOGNIZED_PURPOSE_DETECTED: 'Unrecognized purpose detected',
|
|
28
19
|
DUPLICATE_PURPOSE_DETECTED: 'Duplicate key purposes detected',
|
|
@@ -30,8 +21,4 @@ const KeyErrorMessages = {
|
|
|
30
21
|
UNRECOGNIZED_ENCODING: 'Unrecognized encoding',
|
|
31
22
|
};
|
|
32
23
|
|
|
33
|
-
module.exports = {
|
|
34
|
-
KeyAlgorithms,
|
|
35
|
-
KeyEncodings,
|
|
36
|
-
KeyErrorMessages,
|
|
37
|
-
};
|
|
24
|
+
module.exports = { KeyErrorMessages };
|
|
@@ -16,12 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
const { all, includes, values, uniq } = require('lodash/fp');
|
|
18
18
|
const newError = require('http-errors');
|
|
19
|
-
const { KeyPurposes } = require('@verii/crypto');
|
|
20
|
-
const {
|
|
21
|
-
KeyErrorMessages,
|
|
22
|
-
KeyAlgorithms,
|
|
23
|
-
KeyEncodings,
|
|
24
|
-
} = require('./constants');
|
|
19
|
+
const { KeyPurposes, KeyAlgorithms, KeyEncodings } = require('@verii/crypto');
|
|
20
|
+
const { KeyErrorMessages } = require('./constants');
|
|
25
21
|
|
|
26
22
|
const validKeyPurposes = values(KeyPurposes);
|
|
27
23
|
|
|
@@ -15,11 +15,15 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
const { register } = require('@spencejs/spence-factories');
|
|
18
|
-
const {
|
|
18
|
+
const {
|
|
19
|
+
KeyPurposes,
|
|
20
|
+
KeyAlgorithms,
|
|
21
|
+
KeyEncodings,
|
|
22
|
+
generateKeyPair,
|
|
23
|
+
} = require('@verii/crypto');
|
|
19
24
|
const { ObjectId } = require('mongodb');
|
|
20
25
|
const { defaultRepoOptions, kmsRepo } = require('@verii/db-kms');
|
|
21
26
|
const { initTenantFactory } = require('../../tenants');
|
|
22
|
-
const { KeyAlgorithms, KeyEncodings } = require('../domains');
|
|
23
27
|
const { agentKmsOptions } = require('../../../plugins/kms-plugin');
|
|
24
28
|
|
|
25
29
|
const initKeysFactory = (app) => {
|
|
@@ -91,7 +91,10 @@ const doIssueVerifiableCredentials = async (
|
|
|
91
91
|
const credentialTypesMap = await loadCredentialTypesMap(offers, context);
|
|
92
92
|
|
|
93
93
|
// eslint-disable-next-line better-mutation/no-mutation
|
|
94
|
-
context.allocationListQueries = mongoAllocationListQueries(
|
|
94
|
+
context.allocationListQueries = mongoAllocationListQueries(
|
|
95
|
+
mongoDb(),
|
|
96
|
+
'allocations'
|
|
97
|
+
);
|
|
95
98
|
|
|
96
99
|
return issueVelocityVerifiableCredentials(
|
|
97
100
|
offers,
|
|
@@ -586,9 +586,13 @@ describe('get credential manifests', () => {
|
|
|
586
586
|
'CurrentEmploymentPosition',
|
|
587
587
|
],
|
|
588
588
|
}),
|
|
589
|
+
headers: {
|
|
590
|
+
origin: 'foo',
|
|
591
|
+
},
|
|
589
592
|
});
|
|
590
593
|
|
|
591
594
|
expect(response.statusCode).toEqual(200);
|
|
595
|
+
expect(response.headers['access-control-allow-origin']).toEqual('foo');
|
|
592
596
|
expect(response.json).toEqual({
|
|
593
597
|
issuing_request: expect.any(String),
|
|
594
598
|
});
|
|
@@ -198,8 +198,7 @@ describe('e2e issuing tests', () => {
|
|
|
198
198
|
await mongoDb().collection('exchanges').deleteMany({});
|
|
199
199
|
await mongoDb().collection('offers').deleteMany({});
|
|
200
200
|
await mongoDb().collection('vendorUserIdMappings').deleteMany({});
|
|
201
|
-
await mongoDb().collection('
|
|
202
|
-
await mongoDb().collection('revocationListAllocations').deleteMany({});
|
|
201
|
+
await mongoDb().collection('allocations').deleteMany({});
|
|
203
202
|
|
|
204
203
|
disclosure = await persistDisclosure({
|
|
205
204
|
tenant,
|
|
@@ -276,24 +275,26 @@ describe('e2e issuing tests', () => {
|
|
|
276
275
|
);
|
|
277
276
|
|
|
278
277
|
const metadataListAllocation = await mongoDb()
|
|
279
|
-
.collection('
|
|
280
|
-
.findOne();
|
|
278
|
+
.collection('allocations')
|
|
279
|
+
.findOne({ entityName: 'metadataListAllocations' });
|
|
281
280
|
expect(metadataListAllocation).toEqual({
|
|
282
281
|
_id: expect.any(ObjectId),
|
|
283
282
|
createdAt: expect.any(Date),
|
|
284
283
|
currentListId: expect.any(Number),
|
|
284
|
+
entityName: 'metadataListAllocations',
|
|
285
285
|
freeIndexes: expect.any(Array),
|
|
286
286
|
operatorAddress: toEthereumAddress(operatorKeyPair.publicKey),
|
|
287
287
|
tenantId: new ObjectId(tenant._id),
|
|
288
288
|
updatedAt: expect.any(Date),
|
|
289
289
|
});
|
|
290
290
|
const revocationListAllocation = await mongoDb()
|
|
291
|
-
.collection('
|
|
292
|
-
.findOne();
|
|
291
|
+
.collection('allocations')
|
|
292
|
+
.findOne({ entityName: 'revocationListAllocations' });
|
|
293
293
|
expect(revocationListAllocation).toEqual({
|
|
294
294
|
_id: expect.any(ObjectId),
|
|
295
295
|
createdAt: expect.any(Date),
|
|
296
296
|
currentListId: expect.any(Number),
|
|
297
|
+
entityName: 'revocationListAllocations',
|
|
297
298
|
freeIndexes: expect.any(Array),
|
|
298
299
|
operatorAddress: toEthereumAddress(operatorKeyPair.publicKey),
|
|
299
300
|
tenantId: new ObjectId(tenant._id),
|
|
@@ -329,24 +330,26 @@ describe('e2e issuing tests', () => {
|
|
|
329
330
|
);
|
|
330
331
|
|
|
331
332
|
const metadataListAllocation = await mongoDb()
|
|
332
|
-
.collection('
|
|
333
|
-
.findOne();
|
|
333
|
+
.collection('allocations')
|
|
334
|
+
.findOne({ entityName: 'metadataListAllocations' });
|
|
334
335
|
expect(metadataListAllocation).toEqual({
|
|
335
336
|
_id: expect.any(ObjectId),
|
|
336
337
|
createdAt: expect.any(Date),
|
|
337
338
|
currentListId: expect.any(Number),
|
|
339
|
+
entityName: 'metadataListAllocations',
|
|
338
340
|
freeIndexes: expect.any(Array),
|
|
339
341
|
operatorAddress: toEthereumAddress(operatorKeyPair.publicKey),
|
|
340
342
|
tenantId: new ObjectId(tenant._id),
|
|
341
343
|
updatedAt: expect.any(Date),
|
|
342
344
|
});
|
|
343
345
|
const revocationListAllocation = await mongoDb()
|
|
344
|
-
.collection('
|
|
345
|
-
.findOne();
|
|
346
|
+
.collection('allocations')
|
|
347
|
+
.findOne({ entityName: 'revocationListAllocations' });
|
|
346
348
|
expect(revocationListAllocation).toEqual({
|
|
347
349
|
_id: expect.any(ObjectId),
|
|
348
350
|
createdAt: expect.any(Date),
|
|
349
351
|
currentListId: expect.any(Number),
|
|
352
|
+
entityName: 'revocationListAllocations',
|
|
350
353
|
freeIndexes: expect.any(Array),
|
|
351
354
|
operatorAddress: toEthereumAddress(operatorKeyPair.publicKey),
|
|
352
355
|
tenantId: new ObjectId(tenant._id),
|
|
@@ -382,24 +385,26 @@ describe('e2e issuing tests', () => {
|
|
|
382
385
|
);
|
|
383
386
|
|
|
384
387
|
const metadataListAllocation = await mongoDb()
|
|
385
|
-
.collection('
|
|
386
|
-
.findOne();
|
|
388
|
+
.collection('allocations')
|
|
389
|
+
.findOne({ entityName: 'metadataListAllocations' });
|
|
387
390
|
expect(metadataListAllocation).toEqual({
|
|
388
391
|
_id: expect.any(ObjectId),
|
|
389
392
|
createdAt: expect.any(Date),
|
|
390
393
|
currentListId: expect.any(Number),
|
|
394
|
+
entityName: 'metadataListAllocations',
|
|
391
395
|
freeIndexes: expect.any(Array),
|
|
392
396
|
operatorAddress: toEthereumAddress(operatorKeyPair.publicKey),
|
|
393
397
|
tenantId: new ObjectId(tenant._id),
|
|
394
398
|
updatedAt: expect.any(Date),
|
|
395
399
|
});
|
|
396
400
|
const revocationListAllocation = await mongoDb()
|
|
397
|
-
.collection('
|
|
398
|
-
.findOne();
|
|
401
|
+
.collection('allocations')
|
|
402
|
+
.findOne({ entityName: 'revocationListAllocations' });
|
|
399
403
|
expect(revocationListAllocation).toEqual({
|
|
400
404
|
_id: expect.any(ObjectId),
|
|
401
405
|
createdAt: expect.any(Date),
|
|
402
406
|
currentListId: expect.any(Number),
|
|
407
|
+
entityName: 'revocationListAllocations',
|
|
403
408
|
freeIndexes: expect.any(Array),
|
|
404
409
|
operatorAddress: toEthereumAddress(operatorKeyPair.publicKey),
|
|
405
410
|
tenantId: new ObjectId(tenant._id),
|
|
@@ -91,6 +91,7 @@ const mockAddRevocationListSigned = jest.fn();
|
|
|
91
91
|
const mockLookupPrimary = jest.fn();
|
|
92
92
|
const mockInitPermissions = jest.fn();
|
|
93
93
|
jest.mock('@verii/metadata-registration', () => ({
|
|
94
|
+
...jest.requireActual('@verii/metadata-registration'),
|
|
94
95
|
initRevocationRegistry: () => ({
|
|
95
96
|
addRevocationListSigned: mockAddRevocationListSigned,
|
|
96
97
|
}),
|
|
@@ -3035,6 +3036,7 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
3035
3036
|
},
|
|
3036
3037
|
issuer: {
|
|
3037
3038
|
id: tenant.did,
|
|
3039
|
+
type: ['Issuer'],
|
|
3038
3040
|
name: 'mock',
|
|
3039
3041
|
image: 'mock',
|
|
3040
3042
|
badProperty: 'should be ignored',
|
|
@@ -4128,7 +4130,7 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
4128
4130
|
tenant,
|
|
4129
4131
|
exchange,
|
|
4130
4132
|
user,
|
|
4131
|
-
issuer: { image: 'image', name: 'name' },
|
|
4133
|
+
issuer: { type: 'Brand', image: 'image', name: 'name' },
|
|
4132
4134
|
})
|
|
4133
4135
|
);
|
|
4134
4136
|
nock(mockVendorUrl)
|
|
@@ -4160,6 +4162,7 @@ describe('Holder Issuing Test Suite', () => {
|
|
|
4160
4162
|
tenant,
|
|
4161
4163
|
}),
|
|
4162
4164
|
issuer: {
|
|
4165
|
+
type: 'Brand',
|
|
4163
4166
|
image: 'image',
|
|
4164
4167
|
name: 'name',
|
|
4165
4168
|
id: tenant.did,
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
// eslint-disable-next-line import/order
|
|
18
16
|
const nock = require('nock');
|
|
19
17
|
const { mongoDb } = require('@spencejs/spence-mongo-repos');
|
|
20
18
|
const { ObjectId } = require('mongodb');
|
|
@@ -27,7 +25,7 @@ const { errorResponseMatcher, mongoify } = require('@verii/tests-helpers');
|
|
|
27
25
|
const { hexFromJwk, jwkFromSecp256k1Key } = require('@verii/jwt');
|
|
28
26
|
const { rootPrivateKey } = require('@verii/sample-data');
|
|
29
27
|
const { toEthereumAddress } = require('@verii/blockchain-functions');
|
|
30
|
-
const { KeyPurposes, generateKeyPair } = require('@verii/crypto');
|
|
28
|
+
const { KeyPurposes, KeyEncodings, generateKeyPair } = require('@verii/crypto');
|
|
31
29
|
const {
|
|
32
30
|
deployTestPermissionsContract,
|
|
33
31
|
} = require('@verii/contract-permissions/test/helpers/deploy-test-permissions-contract');
|
|
@@ -40,7 +38,6 @@ const {
|
|
|
40
38
|
initTenantFactory,
|
|
41
39
|
initKeysFactory,
|
|
42
40
|
tenantRepoPlugin,
|
|
43
|
-
KeyEncodings,
|
|
44
41
|
} = require('../../src/entities');
|
|
45
42
|
const {
|
|
46
43
|
generatePrimaryAndAddOperatorToPrimary,
|
|
@@ -1052,7 +1052,7 @@ describe('vendor offer management', () => {
|
|
|
1052
1052
|
);
|
|
1053
1053
|
});
|
|
1054
1054
|
|
|
1055
|
-
it('/offers should 200 and have issuer with
|
|
1055
|
+
it('/offers should 200 and have issuer with additional property in the issuer', async () => {
|
|
1056
1056
|
await nockRegistrarAppSchemaName({
|
|
1057
1057
|
schemaName: 'past-employment-position',
|
|
1058
1058
|
credentialType: 'PastEmploymentPosition',
|
|
@@ -1060,18 +1060,16 @@ describe('vendor offer management', () => {
|
|
|
1060
1060
|
});
|
|
1061
1061
|
|
|
1062
1062
|
const offer = await newVendorOffer({ tenant, exchange });
|
|
1063
|
+
const issuer = {
|
|
1064
|
+
id: tenant.did,
|
|
1065
|
+
name: 'image',
|
|
1066
|
+
image: 'http://image.com',
|
|
1067
|
+
additionalProperty: 'additionalProperty',
|
|
1068
|
+
};
|
|
1063
1069
|
const response = await fastify.injectJson({
|
|
1064
1070
|
method: 'POST',
|
|
1065
1071
|
url: exchangeOffersUrl({ tenant, exchange }, ''),
|
|
1066
|
-
payload: {
|
|
1067
|
-
...offer,
|
|
1068
|
-
issuer: {
|
|
1069
|
-
id: tenant.did,
|
|
1070
|
-
name: 'image',
|
|
1071
|
-
image: 'http://image.com',
|
|
1072
|
-
badProperty: 'badProperty',
|
|
1073
|
-
},
|
|
1074
|
-
},
|
|
1072
|
+
payload: { ...offer, issuer },
|
|
1075
1073
|
});
|
|
1076
1074
|
|
|
1077
1075
|
expect(response.statusCode).toEqual(200);
|
|
@@ -1083,11 +1081,7 @@ describe('vendor offer management', () => {
|
|
|
1083
1081
|
},
|
|
1084
1082
|
exchangeId,
|
|
1085
1083
|
id: expect.stringMatching(OBJECT_ID_FORMAT),
|
|
1086
|
-
issuer
|
|
1087
|
-
id: tenant.did,
|
|
1088
|
-
name: 'image',
|
|
1089
|
-
image: 'http://image.com',
|
|
1090
|
-
},
|
|
1084
|
+
issuer,
|
|
1091
1085
|
updatedAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
1092
1086
|
createdAt: expect.stringMatching(ISO_DATETIME_FORMAT),
|
|
1093
1087
|
});
|
|
@@ -1140,11 +1134,7 @@ describe('vendor offer management', () => {
|
|
|
1140
1134
|
createdAt: expect.any(Date),
|
|
1141
1135
|
updatedAt: expect.any(Date),
|
|
1142
1136
|
exchangeId,
|
|
1143
|
-
issuer
|
|
1144
|
-
id: tenant.did,
|
|
1145
|
-
name: 'image',
|
|
1146
|
-
image: 'http://image.com',
|
|
1147
|
-
},
|
|
1137
|
+
issuer,
|
|
1148
1138
|
})
|
|
1149
1139
|
);
|
|
1150
1140
|
});
|
|
@@ -60,6 +60,7 @@ const mockAddRevocationListSigned = jest.fn();
|
|
|
60
60
|
const mockGetRevokeUrl = jest.fn();
|
|
61
61
|
|
|
62
62
|
jest.mock('@verii/metadata-registration', () => ({
|
|
63
|
+
...jest.requireActual('@verii/metadata-registration'),
|
|
63
64
|
initRevocationRegistry: () => ({
|
|
64
65
|
addRevocationListSigned: mockAddRevocationListSigned,
|
|
65
66
|
}),
|
|
@@ -329,7 +330,12 @@ describe('vc-api credentials endpoints', () => {
|
|
|
329
330
|
})
|
|
330
331
|
);
|
|
331
332
|
expect(mockAddCredentialMetadataEntry.mock.calls).toEqual([
|
|
332
|
-
[
|
|
333
|
+
[
|
|
334
|
+
expect.any(Object),
|
|
335
|
+
expect.any(String),
|
|
336
|
+
'did:ion:cao',
|
|
337
|
+
'cosekey:aes-256-gcm',
|
|
338
|
+
],
|
|
333
339
|
]);
|
|
334
340
|
});
|
|
335
341
|
|
|
@@ -724,8 +730,8 @@ describe('vc-api credentials endpoints', () => {
|
|
|
724
730
|
'payload.vc.credentialSubject.type': 'AchievementSubject',
|
|
725
731
|
'payload.vc.credentialSubject.@context': undefined,
|
|
726
732
|
'payload.vc.credentialSchema': {
|
|
727
|
-
|
|
728
|
-
|
|
733
|
+
type: '1EdTechJsonSchemaValidator2019',
|
|
734
|
+
id: 'http://example.com/schema.json',
|
|
729
735
|
},
|
|
730
736
|
},
|
|
731
737
|
})
|