@velocitycareerlabs/server-webwallet 1.25.0-dev-build.1c0807f72 → 1.25.0-dev-build.1253d0f86
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/package.json +23 -23
- package/src/plugins/vnf-sdk-plugin.js +1 -1
- package/test/credentials-controller.test.js +13 -8
- package/test/helpers/.env.test +1 -1
- package/test/issuing-controller/issuing-by-deeplink.test.js +7 -8
- package/test/mocks/{schema.js → display-descriptor.js} +2 -2
- package/test/mocks/index.js +1 -1
- package/test/helpers/mock-fetch.js +0 -12
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@velocitycareerlabs/server-webwallet",
|
3
|
-
"version": "1.25.0-dev-build.
|
3
|
+
"version": "1.25.0-dev-build.1253d0f86",
|
4
4
|
"description": "Web Wallet application",
|
5
5
|
"repository": "https://github.com/velocitycareerlabs/packages",
|
6
6
|
"engines": {
|
@@ -26,28 +26,28 @@
|
|
26
26
|
"access": "public"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@fastify/autoload": "^
|
30
|
-
"@fastify/helmet": "^
|
31
|
-
"@fastify/multipart": "^
|
32
|
-
"@fastify/sensible": "^
|
33
|
-
"@fastify/swagger": "^
|
34
|
-
"@fastify/swagger-ui": "^
|
29
|
+
"@fastify/autoload": "^6.0.0",
|
30
|
+
"@fastify/helmet": "^13.0.0",
|
31
|
+
"@fastify/multipart": "^9.0.0",
|
32
|
+
"@fastify/sensible": "^6.0.0",
|
33
|
+
"@fastify/swagger": "^9.0.0",
|
34
|
+
"@fastify/swagger-ui": "^5.0.0",
|
35
35
|
"@spencejs/spence-mongo-repos": "^0.10.2",
|
36
|
-
"@velocitycareerlabs/auth": "1.25.0-dev-build.
|
37
|
-
"@velocitycareerlabs/common-functions": "1.25.0-dev-build.
|
38
|
-
"@velocitycareerlabs/common-schemas": "1.25.0-dev-build.
|
39
|
-
"@velocitycareerlabs/config": "1.25.0-dev-build.
|
40
|
-
"@velocitycareerlabs/fastify-plugins": "1.25.0-dev-build.
|
41
|
-
"@velocitycareerlabs/jwt": "1.25.0-dev-build.
|
42
|
-
"@velocitycareerlabs/migrations": "1.25.0-dev-build.
|
43
|
-
"@velocitycareerlabs/request": "1.25.0-dev-build.
|
44
|
-
"@velocitycareerlabs/server-provider": "1.25.0-dev-build.
|
45
|
-
"@velocitycareerlabs/vc-checks": "1.25.0-dev-build.
|
46
|
-
"@velocitycareerlabs/vnf-nodejs-wallet-sdk": "1.25.0-dev-build.
|
36
|
+
"@velocitycareerlabs/auth": "1.25.0-dev-build.10fcae56a",
|
37
|
+
"@velocitycareerlabs/common-functions": "1.25.0-dev-build.10fcae56a",
|
38
|
+
"@velocitycareerlabs/common-schemas": "1.25.0-dev-build.10fcae56a",
|
39
|
+
"@velocitycareerlabs/config": "1.25.0-dev-build.10fcae56a",
|
40
|
+
"@velocitycareerlabs/fastify-plugins": "1.25.0-dev-build.10fcae56a",
|
41
|
+
"@velocitycareerlabs/jwt": "1.25.0-dev-build.10fcae56a",
|
42
|
+
"@velocitycareerlabs/migrations": "1.25.0-dev-build.1253d0f86",
|
43
|
+
"@velocitycareerlabs/request": "1.25.0-dev-build.10fcae56a",
|
44
|
+
"@velocitycareerlabs/server-provider": "1.25.0-dev-build.10fcae56a",
|
45
|
+
"@velocitycareerlabs/vc-checks": "1.25.0-dev-build.10fcae56a",
|
46
|
+
"@velocitycareerlabs/vnf-nodejs-wallet-sdk": "1.25.0-dev-build.10fcae56a",
|
47
47
|
"blueimp-md5": "2.19.0",
|
48
48
|
"env-var": "^7.0.0",
|
49
|
-
"fastify": "^
|
50
|
-
"fastify-plugin": "^
|
49
|
+
"fastify": "^5.0.0",
|
50
|
+
"fastify-plugin": "^5.0.0",
|
51
51
|
"got": "11.8.6",
|
52
52
|
"http-errors": "2.0.0",
|
53
53
|
"lodash": "^4.17.21",
|
@@ -56,8 +56,8 @@
|
|
56
56
|
},
|
57
57
|
"devDependencies": {
|
58
58
|
"@spencejs/spence-factories": "0.10.2",
|
59
|
-
"@velocitycareerlabs/crypto": "1.25.0-dev-build.
|
60
|
-
"@velocitycareerlabs/tests-helpers": "1.25.0-dev-build.
|
59
|
+
"@velocitycareerlabs/crypto": "1.25.0-dev-build.10fcae56a",
|
60
|
+
"@velocitycareerlabs/tests-helpers": "1.25.0-dev-build.10fcae56a",
|
61
61
|
"dotenv": "16.4.7",
|
62
62
|
"eslint": "8.57.1",
|
63
63
|
"eslint-config-airbnb-base": "14.2.1",
|
@@ -73,5 +73,5 @@
|
|
73
73
|
"nodemon": "3.1.10",
|
74
74
|
"prettier": "2.8.8"
|
75
75
|
},
|
76
|
-
"gitHead": "
|
76
|
+
"gitHead": "7f963613f230d1f27dfad8bbbe3d4bf1159618d3"
|
77
77
|
}
|
@@ -22,12 +22,12 @@ const vnfSdkPlugin = async (fastify) => {
|
|
22
22
|
config.vclSdkEnvironment || VCLEnvironment.Prod,
|
23
23
|
config.vclSdkProtocolVersion ||
|
24
24
|
VCLXVnfProtocolVersion.XVnfProtocolVersion2,
|
25
|
-
config.vclSdkIsDebugOn,
|
26
25
|
new VCLCryptoServicesDescriptor(
|
27
26
|
KeyServiceImpl(fastify),
|
28
27
|
JwtSignServiceImpl(fastify),
|
29
28
|
JwtVerifyServiceImpl()
|
30
29
|
),
|
30
|
+
config.vclSdkIsDebugOn,
|
31
31
|
log
|
32
32
|
);
|
33
33
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
const { mock } = require('node:test');
|
2
1
|
const { mongoDb } = require('@spencejs/spence-mongo-repos');
|
3
2
|
const { omit } = require('lodash/fp');
|
4
3
|
const nock = require('nock');
|
@@ -14,8 +13,10 @@ const {
|
|
14
13
|
mongoify,
|
15
14
|
} = require('@velocitycareerlabs/tests-helpers');
|
16
15
|
const buildFastify = require('./helpers/webwallet-build-fastify');
|
17
|
-
const {
|
18
|
-
|
16
|
+
const {
|
17
|
+
mockDisplayDescriptor,
|
18
|
+
mockedCredentialCategories,
|
19
|
+
} = require('./mocks');
|
19
20
|
const initCredentialsFactory = require('./factories/credentials');
|
20
21
|
const { WebWalletServerError } = require('../src/errors/error-codes');
|
21
22
|
|
@@ -48,7 +49,6 @@ describe('Test credentials controller', () => {
|
|
48
49
|
|
49
50
|
beforeAll(async () => {
|
50
51
|
fastify = buildFastify();
|
51
|
-
|
52
52
|
nock('https://localhost/').get('/.well-known/jwks.json').reply(200, jwks);
|
53
53
|
|
54
54
|
await fastify.ready();
|
@@ -77,8 +77,11 @@ describe('Test credentials controller', () => {
|
|
77
77
|
did: 'did:test:2',
|
78
78
|
}),
|
79
79
|
]);
|
80
|
+
nock('http://lib.localhost.test')
|
81
|
+
.get('/display-descriptors/open-badge-v2.0.descriptor.json')
|
82
|
+
.reply(200, mockDisplayDescriptor);
|
80
83
|
|
81
|
-
mock.method(global, 'fetch', () => mockFetch(200,
|
84
|
+
// mock.method(global, 'fetch', () => mockFetch(200, mockDisplayDescriptor));
|
82
85
|
const response = await fastify.injectJson({
|
83
86
|
method: 'GET',
|
84
87
|
url: '/credentials',
|
@@ -95,7 +98,7 @@ describe('Test credentials controller', () => {
|
|
95
98
|
new VCLFilter(currentUserCredential.issuer.id)
|
96
99
|
)
|
97
100
|
);
|
98
|
-
expect(global.fetch.mock.calls).toHaveLength(1);
|
101
|
+
// expect(global.fetch.mock.calls).toHaveLength(1);
|
99
102
|
|
100
103
|
expect(response.json).toEqual({
|
101
104
|
credentials: [
|
@@ -122,7 +125,9 @@ describe('Test credentials controller', () => {
|
|
122
125
|
}),
|
123
126
|
]);
|
124
127
|
|
125
|
-
|
128
|
+
nock('http://lib.localhost.test')
|
129
|
+
.get('/display-descriptors/open-badge-v2.0.descriptor.json')
|
130
|
+
.reply(500);
|
126
131
|
const response = await fastify.injectJson({
|
127
132
|
method: 'GET',
|
128
133
|
url: '/credentials',
|
@@ -137,7 +142,7 @@ describe('Test credentials controller', () => {
|
|
137
142
|
'Failed to fetch descriptor from http://lib.localhost.test/display-descriptors/open-badge-v2.0.descriptor.json'
|
138
143
|
);
|
139
144
|
|
140
|
-
expect(global.fetch.mock.calls).toHaveLength(1);
|
145
|
+
// expect(global.fetch.mock.calls).toHaveLength(1);
|
141
146
|
});
|
142
147
|
|
143
148
|
it('should return empty array of credentials if there are no items in DB for user Id', async () => {
|
package/test/helpers/.env.test
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
const { mock } = require('node:test');
|
2
1
|
const nock = require('nock');
|
3
2
|
const { mongoDb } = require('@spencejs/spence-mongo-repos');
|
4
3
|
const { omit } = require('lodash/fp');
|
@@ -14,7 +13,6 @@ const {
|
|
14
13
|
VCLVerifiableCredential,
|
15
14
|
} = require('@velocitycareerlabs/vnf-nodejs-wallet-sdk');
|
16
15
|
const { deepLink } = require('./mocks');
|
17
|
-
const { mockFetch } = require('../helpers/mock-fetch');
|
18
16
|
|
19
17
|
jest.mock('@velocitycareerlabs/vnf-nodejs-wallet-sdk', () => {
|
20
18
|
const originalModule = jest.requireActual(
|
@@ -48,7 +46,7 @@ const vclSdk = VCLProvider.getInstance();
|
|
48
46
|
const initAccountsFactory = require('../factories/accounts');
|
49
47
|
const initCredentialsFactory = require('../factories/credentials');
|
50
48
|
|
51
|
-
const {
|
49
|
+
const { mockDisplayDescriptor } = require('../mocks');
|
52
50
|
|
53
51
|
const { mockOffers, mockParsedResponse } = require('./mocks');
|
54
52
|
|
@@ -138,7 +136,9 @@ describe('Test Deep Link issuing controller', () => {
|
|
138
136
|
|
139
137
|
describe('GET /issuing/deep-link/offers - get offers by deep link', () => {
|
140
138
|
it('should return offers by pre-auth token (vendorOriginContext) successfully', async () => {
|
141
|
-
|
139
|
+
nock('http://lib.localhost.test')
|
140
|
+
.get('/display-descriptors/open-badge-v2.0.descriptor.json')
|
141
|
+
.reply(200, mockDisplayDescriptor);
|
142
142
|
|
143
143
|
const response = await fastify.injectJson({
|
144
144
|
method: 'POST',
|
@@ -173,7 +173,6 @@ describe('Test Deep Link issuing controller', () => {
|
|
173
173
|
)
|
174
174
|
);
|
175
175
|
|
176
|
-
expect(global.fetch.mock.calls).toHaveLength(1);
|
177
176
|
const { offers, credentialManifest } = response.json;
|
178
177
|
expect(credentialManifest.jwt).toBe(
|
179
178
|
vclMockCredentialManifest.jwt.encodedJwt
|
@@ -182,7 +181,9 @@ describe('Test Deep Link issuing controller', () => {
|
|
182
181
|
});
|
183
182
|
|
184
183
|
it('should return offers by Input Credentials successfully', async () => {
|
185
|
-
|
184
|
+
nock('http://lib.localhost.test')
|
185
|
+
.get('/display-descriptors/open-badge-v2.0.descriptor.json')
|
186
|
+
.reply(200, mockDisplayDescriptor);
|
186
187
|
const inputCredential = await persistCredentials({
|
187
188
|
encodedCredential: 'InputCredentialForOffers',
|
188
189
|
});
|
@@ -231,8 +232,6 @@ describe('Test Deep Link issuing controller', () => {
|
|
231
232
|
)
|
232
233
|
);
|
233
234
|
|
234
|
-
expect(global.fetch.mock.calls).toHaveLength(1);
|
235
|
-
|
236
235
|
const { offers, credentialManifest } = response.json;
|
237
236
|
expect(credentialManifest.jwt).toBe(
|
238
237
|
vclMockCredentialManifest.jwt.encodedJwt
|
package/test/mocks/index.js
CHANGED