@velocitycareerlabs/server-careerwallet 1.27.0-dev-build.163831870 → 1.27.0-dev-build.17b8f41df
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velocitycareerlabs/server-careerwallet",
|
|
3
|
-
"version": "1.27.0-dev-build.
|
|
3
|
+
"version": "1.27.0-dev-build.17b8f41df",
|
|
4
4
|
"description": "Career Wallet application",
|
|
5
5
|
"repository": "https://github.com/velocitycareerlabs/packages",
|
|
6
6
|
"engines": {
|
|
@@ -34,24 +34,24 @@
|
|
|
34
34
|
"@fastify/swagger-ui": "^5.0.0",
|
|
35
35
|
"@getyoti/sdk-sandbox": "1.7.0",
|
|
36
36
|
"@spencejs/spence-mongo-repos": "^0.10.2",
|
|
37
|
-
"@velocitycareerlabs/migrations": "1.27.0-dev-build.
|
|
38
|
-
"@velocitycareerlabs/yoti-integration-plugin": "1.27.0-dev-build.
|
|
39
|
-
"@verii/auth": "1.0.
|
|
40
|
-
"@verii/aws-clients": "1.0.
|
|
41
|
-
"@verii/common-fetchers": "1.0.
|
|
42
|
-
"@verii/common-functions": "1.0.
|
|
43
|
-
"@verii/common-schemas": "1.0.
|
|
44
|
-
"@verii/config": "1.0.
|
|
45
|
-
"@verii/country-data": "1.0.
|
|
46
|
-
"@verii/crypto": "1.0.
|
|
47
|
-
"@verii/did-doc": "1.0.
|
|
48
|
-
"@verii/fastify-plugins": "1.0.
|
|
49
|
-
"@verii/
|
|
50
|
-
"@verii/
|
|
51
|
-
"@verii/
|
|
52
|
-
"@verii/server-provider": "1.0.
|
|
53
|
-
"@verii/spencer-mongo-extensions": "1.0.
|
|
54
|
-
"@verii/verii-verification": "1.0.
|
|
37
|
+
"@velocitycareerlabs/migrations": "1.27.0-dev-build.17b8f41df",
|
|
38
|
+
"@velocitycareerlabs/yoti-integration-plugin": "1.27.0-dev-build.17b8f41df",
|
|
39
|
+
"@verii/auth": "1.1.0-pre.1763452964",
|
|
40
|
+
"@verii/aws-clients": "1.1.0-pre.1763452964",
|
|
41
|
+
"@verii/common-fetchers": "1.1.0-pre.1763452964",
|
|
42
|
+
"@verii/common-functions": "1.1.0-pre.1763452964",
|
|
43
|
+
"@verii/common-schemas": "1.1.0-pre.1763452964",
|
|
44
|
+
"@verii/config": "1.1.0-pre.1763452964",
|
|
45
|
+
"@verii/country-data": "1.1.0-pre.1763452964",
|
|
46
|
+
"@verii/crypto": "1.1.0-pre.1763452964",
|
|
47
|
+
"@verii/did-doc": "1.1.0-pre.1763452964",
|
|
48
|
+
"@verii/fastify-plugins": "1.1.0-pre.1763452964",
|
|
49
|
+
"@verii/http-client": "1.1.0-pre.1763452964",
|
|
50
|
+
"@verii/jwt": "1.1.0-pre.1763452964",
|
|
51
|
+
"@verii/organizations-registry": "1.1.0-pre.1763452964",
|
|
52
|
+
"@verii/server-provider": "1.1.0-pre.1763452964",
|
|
53
|
+
"@verii/spencer-mongo-extensions": "1.1.0-pre.1763452964",
|
|
54
|
+
"@verii/verii-verification": "1.1.0-pre.1763452964",
|
|
55
55
|
"aws-sdk": "2.1692.0",
|
|
56
56
|
"canonicalize": "^2.0.0",
|
|
57
57
|
"date-fns": "^3.0.0",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@aws-sdk/client-ses": "3.921.0",
|
|
73
73
|
"@aws-sdk/client-sns": "3.921.0",
|
|
74
74
|
"@spencejs/spence-factories": "0.10.2",
|
|
75
|
-
"@verii/test-regexes": "1.0.
|
|
76
|
-
"@verii/tests-helpers": "1.0.
|
|
75
|
+
"@verii/test-regexes": "1.1.0-pre.1763452964",
|
|
76
|
+
"@verii/tests-helpers": "1.1.0-pre.1763452964",
|
|
77
77
|
"dotenv": "16.6.1",
|
|
78
78
|
"eslint": "8.57.1",
|
|
79
79
|
"eslint-config-airbnb-base": "14.2.1",
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"eslint-plugin-prettier": "4.2.5",
|
|
86
86
|
"eslint-watch": "7.0.0",
|
|
87
87
|
"expect": "30.2.0",
|
|
88
|
-
"nock": "
|
|
88
|
+
"nock": "v15.0.0-beta.6",
|
|
89
89
|
"nodemon": "3.1.10",
|
|
90
90
|
"prettier": "2.8.8"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "c9d4aa06c8f27df3ed4c9f54437a6f65c2726035"
|
|
93
93
|
}
|
|
@@ -58,7 +58,7 @@ const loadKey = async (kid, context) => {
|
|
|
58
58
|
try {
|
|
59
59
|
return await resolveKid({ kid }, context);
|
|
60
60
|
} catch (error) {
|
|
61
|
-
if (error
|
|
61
|
+
if (error?.statusCode === 404) {
|
|
62
62
|
throw newError.Unauthorized('kid_not_found');
|
|
63
63
|
}
|
|
64
64
|
throw newError.Unauthorized('kid_resolution_error');
|
|
@@ -69,7 +69,7 @@ const loadOrganizationVerifiedProfile = async (did, context) => {
|
|
|
69
69
|
try {
|
|
70
70
|
return await getOrganizationVerifiedProfile(did, context);
|
|
71
71
|
} catch (error) {
|
|
72
|
-
if (error
|
|
72
|
+
if (error?.statusCode === 404) {
|
|
73
73
|
throw newError.Unauthorized('issuer_not_found');
|
|
74
74
|
}
|
|
75
75
|
throw newError.Unauthorized('issuer_resolution_error');
|
package/src/init-server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { corsPlugin } = require('@verii/fastify-plugins');
|
|
2
2
|
const { sendEmailPlugin, sendSmsPlugin } = require('@verii/aws-clients');
|
|
3
|
-
const
|
|
3
|
+
const { httpClientPlugin } = require('@verii/fastify-plugins');
|
|
4
4
|
const Static = require('@fastify/static');
|
|
5
5
|
const AutoLoad = require('@fastify/autoload');
|
|
6
6
|
const path = require('path');
|
|
@@ -35,38 +35,29 @@ const initServer = (server) => {
|
|
|
35
35
|
autoHooks: true,
|
|
36
36
|
cascadeHooks: true,
|
|
37
37
|
})
|
|
38
|
-
.
|
|
39
|
-
'
|
|
40
|
-
|
|
38
|
+
.register(httpClientPlugin, {
|
|
39
|
+
name: 'agentFetch',
|
|
40
|
+
options: {
|
|
41
41
|
...server.config,
|
|
42
42
|
prefixUrl: server.config.agentUrl,
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
.decorateRequest('agentFetch', null)
|
|
46
|
-
.addHook('preValidation', async (req) => {
|
|
47
|
-
req.agentFetch = server.baseAgentFetch(req);
|
|
43
|
+
},
|
|
48
44
|
})
|
|
49
|
-
.
|
|
50
|
-
'
|
|
51
|
-
|
|
45
|
+
.register(httpClientPlugin, {
|
|
46
|
+
name: 'registrarFetch',
|
|
47
|
+
options: {
|
|
52
48
|
...server.config,
|
|
53
49
|
prefixUrl: server.config.registrarUrl,
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
.decorateRequest('registrarFetch', null)
|
|
57
|
-
.addHook('preValidation', async (req) => {
|
|
58
|
-
req.registrarFetch = server.baseRegistrarFetch(req);
|
|
50
|
+
},
|
|
59
51
|
})
|
|
60
|
-
.
|
|
61
|
-
'
|
|
62
|
-
|
|
63
|
-
...pick(
|
|
52
|
+
.register(httpClientPlugin, {
|
|
53
|
+
name: 'libFetch',
|
|
54
|
+
options: {
|
|
55
|
+
...pick(
|
|
56
|
+
['nodeEnv', 'requestTimeout', 'traceIdHeader', 'isTest'],
|
|
57
|
+
server.config
|
|
58
|
+
),
|
|
64
59
|
prefixUrl: server.config.libUrl,
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
.decorateRequest('libFetch', null)
|
|
68
|
-
.addHook('preValidation', async (req) => {
|
|
69
|
-
req.libFetch = server.baseLibFetch(req);
|
|
60
|
+
},
|
|
70
61
|
})
|
|
71
62
|
.register(Static, {
|
|
72
63
|
root: path.join(__dirname, 'assets'),
|
|
@@ -5,7 +5,7 @@ const { expect } = require('expect');
|
|
|
5
5
|
const { generateKeyPair, createCommitment } = require('@verii/crypto');
|
|
6
6
|
const nock = require('nock');
|
|
7
7
|
const { generateDocJwt } = require('@verii/jwt');
|
|
8
|
-
const
|
|
8
|
+
const { initHttpClient } = require('@verii/http-client');
|
|
9
9
|
const canonicalize = require('canonicalize');
|
|
10
10
|
const { CredentialCheckResultValue } = require('@verii/verii-verification');
|
|
11
11
|
const {
|
|
@@ -20,6 +20,8 @@ describe('Validate authorization token for the push gateway', () => {
|
|
|
20
20
|
const did = 'did:velocity:123';
|
|
21
21
|
const kid = `${did}#key-1`;
|
|
22
22
|
|
|
23
|
+
const prefixUrl = 'http://registrar.localhost.test';
|
|
24
|
+
|
|
23
25
|
const verifiedProfile = ({
|
|
24
26
|
permittedVelocityServiceCategory = ['Issuer'],
|
|
25
27
|
credentialChecks = {},
|
|
@@ -70,17 +72,18 @@ describe('Validate authorization token for the push gateway', () => {
|
|
|
70
72
|
config: { hostUrl, rootPrivateKey },
|
|
71
73
|
body,
|
|
72
74
|
headers: { authorization: authHeader },
|
|
73
|
-
registrarFetch:
|
|
74
|
-
prefixUrl
|
|
75
|
-
|
|
75
|
+
registrarFetch: initHttpClient({
|
|
76
|
+
prefixUrl,
|
|
77
|
+
isTest: true,
|
|
78
|
+
})(prefixUrl, { log: console }),
|
|
76
79
|
};
|
|
77
80
|
});
|
|
78
81
|
|
|
79
82
|
it('Should confirm a valid auth token', async () => {
|
|
80
|
-
nock(
|
|
83
|
+
nock(prefixUrl)
|
|
81
84
|
.get(`/api/v0.6/resolve-kid/${encodeURIComponent(kid)}?format=jwk`)
|
|
82
85
|
.reply(200, publicKey);
|
|
83
|
-
nock(
|
|
86
|
+
nock(prefixUrl)
|
|
84
87
|
.get(
|
|
85
88
|
`/api/v0.6/organizations/${encodeURIComponent(did)}/verified-profile`
|
|
86
89
|
)
|
|
@@ -89,7 +92,7 @@ describe('Validate authorization token for the push gateway', () => {
|
|
|
89
92
|
});
|
|
90
93
|
|
|
91
94
|
it('Should throw an error if invalid hash', async () => {
|
|
92
|
-
nock(
|
|
95
|
+
nock(prefixUrl)
|
|
93
96
|
.get(`/api/v0.6/resolve-kid/${encodeURIComponent(kid)}?format=jwk`)
|
|
94
97
|
.reply(200, publicKey);
|
|
95
98
|
|
|
@@ -104,7 +107,7 @@ describe('Validate authorization token for the push gateway', () => {
|
|
|
104
107
|
});
|
|
105
108
|
|
|
106
109
|
it('Should throw an error if kid cannot be resolved', async () => {
|
|
107
|
-
nock(
|
|
110
|
+
nock(prefixUrl)
|
|
108
111
|
.get(`/api/v0.6/resolve-kid/${encodeURIComponent(kid)}?format=jwk`)
|
|
109
112
|
.reply(404, publicKey);
|
|
110
113
|
|
|
@@ -114,7 +117,7 @@ describe('Validate authorization token for the push gateway', () => {
|
|
|
114
117
|
});
|
|
115
118
|
|
|
116
119
|
it('Should throw an error if kid resolution encounters an error', async () => {
|
|
117
|
-
nock(
|
|
120
|
+
nock(prefixUrl)
|
|
118
121
|
.get(`/api/v0.6/resolve-kid/${encodeURIComponent(kid)}?format=jwk`)
|
|
119
122
|
.reply(500);
|
|
120
123
|
|
|
@@ -124,10 +127,10 @@ describe('Validate authorization token for the push gateway', () => {
|
|
|
124
127
|
});
|
|
125
128
|
|
|
126
129
|
it('Should throw an error if did cannot be found', async () => {
|
|
127
|
-
nock(
|
|
130
|
+
nock(prefixUrl)
|
|
128
131
|
.get(`/api/v0.6/resolve-kid/${encodeURIComponent(kid)}?format=jwk`)
|
|
129
132
|
.reply(200, publicKey);
|
|
130
|
-
nock(
|
|
133
|
+
nock(prefixUrl)
|
|
131
134
|
.get(
|
|
132
135
|
`/api/v0.6/organizations/${encodeURIComponent(did)}/verified-profile`
|
|
133
136
|
)
|
|
@@ -139,10 +142,10 @@ describe('Validate authorization token for the push gateway', () => {
|
|
|
139
142
|
});
|
|
140
143
|
|
|
141
144
|
it('Should throw an error if did cannot be resolved', async () => {
|
|
142
|
-
nock(
|
|
145
|
+
nock(prefixUrl)
|
|
143
146
|
.get(`/api/v0.6/resolve-kid/${encodeURIComponent(kid)}?format=jwk`)
|
|
144
147
|
.reply(200, publicKey);
|
|
145
|
-
nock(
|
|
148
|
+
nock(prefixUrl)
|
|
146
149
|
.get(
|
|
147
150
|
`/api/v0.6/organizations/${encodeURIComponent(did)}/verified-profile`
|
|
148
151
|
)
|
|
@@ -153,10 +156,10 @@ describe('Validate authorization token for the push gateway', () => {
|
|
|
153
156
|
});
|
|
154
157
|
});
|
|
155
158
|
it('Should throw an error if invalid permittedVelocityServiceCategory', async () => {
|
|
156
|
-
nock(
|
|
159
|
+
nock(prefixUrl)
|
|
157
160
|
.get(`/api/v0.6/resolve-kid/${encodeURIComponent(kid)}?format=jwk`)
|
|
158
161
|
.reply(200, publicKey);
|
|
159
|
-
nock(
|
|
162
|
+
nock(prefixUrl)
|
|
160
163
|
.get(
|
|
161
164
|
`/api/v0.6/organizations/${encodeURIComponent(did)}/verified-profile`
|
|
162
165
|
)
|
|
@@ -190,10 +193,10 @@ describe('Validate authorization token for the push gateway', () => {
|
|
|
190
193
|
];
|
|
191
194
|
|
|
192
195
|
for (const { check, message } of failedChecks) {
|
|
193
|
-
nock(
|
|
196
|
+
nock(prefixUrl)
|
|
194
197
|
.get(`/api/v0.6/resolve-kid/${encodeURIComponent(kid)}?format=jwk`)
|
|
195
198
|
.reply(200, publicKey);
|
|
196
|
-
nock(
|
|
199
|
+
nock(prefixUrl)
|
|
197
200
|
.get(
|
|
198
201
|
`/api/v0.6/organizations/${encodeURIComponent(did)}/verified-profile`
|
|
199
202
|
)
|