@verii/server-credentialagent 1.1.0-pre.1764065131 → 1.1.0-pre.1764142377
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 +30 -30
- package/src/fetchers/operator/identify-fetcher.js +2 -6
- package/src/fetchers/operator/inspection-fetcher.js +2 -8
- package/src/fetchers/operator/issuing-fetcher.js +4 -12
- package/src/init-holder-server.js +4 -0
- package/src/init-operator-server.js +4 -0
- package/src/init-server.js +4 -0
- package/src/plugins/validate-cao-plugin.js +1 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/server-credentialagent",
|
|
3
|
-
"version": "1.1.0-pre.
|
|
3
|
+
"version": "1.1.0-pre.1764142377",
|
|
4
4
|
"description": "Credential Agent application",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
@@ -40,31 +40,31 @@
|
|
|
40
40
|
"@fastify/view": "^11.0.0",
|
|
41
41
|
"@spencejs/spence-factories": "^0.10.2",
|
|
42
42
|
"@spencejs/spence-mongo-repos": "^0.10.2",
|
|
43
|
-
"@verii/auth": "1.1.0-pre.
|
|
44
|
-
"@verii/base-contract-io": "1.1.0-pre.
|
|
45
|
-
"@verii/blockchain-functions": "1.1.0-pre.
|
|
46
|
-
"@verii/common-fetchers": "1.1.0-pre.
|
|
47
|
-
"@verii/common-functions": "1.1.0-pre.
|
|
48
|
-
"@verii/common-schemas": "1.1.0-pre.
|
|
49
|
-
"@verii/config": "1.1.0-pre.
|
|
50
|
-
"@verii/contract-permissions": "1.1.0-pre.
|
|
51
|
-
"@verii/crypto": "1.1.0-pre.
|
|
52
|
-
"@verii/csv-parser": "1.1.0-pre.
|
|
53
|
-
"@verii/db-kms": "1.1.0-pre.
|
|
54
|
-
"@verii/did-doc": "1.1.0-pre.
|
|
55
|
-
"@verii/fastify-plugins": "1.1.0-pre.
|
|
56
|
-
"@verii/http-client": "1.1.0-pre.
|
|
57
|
-
"@verii/jwt": "1.1.0-pre.
|
|
58
|
-
"@verii/metadata-registration": "1.1.0-pre.
|
|
59
|
-
"@verii/organizations-registry": "1.1.0-pre.
|
|
60
|
-
"@verii/rest-queries": "1.1.0-pre.
|
|
61
|
-
"@verii/server-provider": "1.1.0-pre.
|
|
62
|
-
"@verii/spencer-mongo-extensions": "1.1.0-pre.
|
|
63
|
-
"@verii/test-regexes": "1.1.0-pre.
|
|
64
|
-
"@verii/validation": "1.1.0-pre.
|
|
65
|
-
"@verii/vc-checks": "1.1.0-pre.
|
|
66
|
-
"@verii/verii-issuing": "1.1.0-pre.
|
|
67
|
-
"@verii/verii-verification": "1.1.0-pre.
|
|
43
|
+
"@verii/auth": "1.1.0-pre.1764142377",
|
|
44
|
+
"@verii/base-contract-io": "1.1.0-pre.1764142377",
|
|
45
|
+
"@verii/blockchain-functions": "1.1.0-pre.1764142377",
|
|
46
|
+
"@verii/common-fetchers": "1.1.0-pre.1764142377",
|
|
47
|
+
"@verii/common-functions": "1.1.0-pre.1764142377",
|
|
48
|
+
"@verii/common-schemas": "1.1.0-pre.1764142377",
|
|
49
|
+
"@verii/config": "1.1.0-pre.1764142377",
|
|
50
|
+
"@verii/contract-permissions": "1.1.0-pre.1764142377",
|
|
51
|
+
"@verii/crypto": "1.1.0-pre.1764142377",
|
|
52
|
+
"@verii/csv-parser": "1.1.0-pre.1764142377",
|
|
53
|
+
"@verii/db-kms": "1.1.0-pre.1764142377",
|
|
54
|
+
"@verii/did-doc": "1.1.0-pre.1764142377",
|
|
55
|
+
"@verii/fastify-plugins": "1.1.0-pre.1764142377",
|
|
56
|
+
"@verii/http-client": "1.1.0-pre.1764142377",
|
|
57
|
+
"@verii/jwt": "1.1.0-pre.1764142377",
|
|
58
|
+
"@verii/metadata-registration": "1.1.0-pre.1764142377",
|
|
59
|
+
"@verii/organizations-registry": "1.1.0-pre.1764142377",
|
|
60
|
+
"@verii/rest-queries": "1.1.0-pre.1764142377",
|
|
61
|
+
"@verii/server-provider": "1.1.0-pre.1764142377",
|
|
62
|
+
"@verii/spencer-mongo-extensions": "1.1.0-pre.1764142377",
|
|
63
|
+
"@verii/test-regexes": "1.1.0-pre.1764142377",
|
|
64
|
+
"@verii/validation": "1.1.0-pre.1764142377",
|
|
65
|
+
"@verii/vc-checks": "1.1.0-pre.1764142377",
|
|
66
|
+
"@verii/verii-issuing": "1.1.0-pre.1764142377",
|
|
67
|
+
"@verii/verii-verification": "1.1.0-pre.1764142377",
|
|
68
68
|
"ajv": "8.17.1",
|
|
69
69
|
"canonicalize": "^2.1.0",
|
|
70
70
|
"date-fns": "~4.1.0",
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@spencejs/spence-config": "0.10.2",
|
|
86
|
-
"@verii/endpoints-organizations-registrar": "1.1.0-pre.
|
|
87
|
-
"@verii/sample-data": "1.1.0-pre.
|
|
86
|
+
"@verii/endpoints-organizations-registrar": "1.1.0-pre.1764142377",
|
|
87
|
+
"@verii/sample-data": "1.1.0-pre.1764142377",
|
|
88
88
|
"@verii/test-regexes": "0.5.0-build",
|
|
89
|
-
"@verii/tests-helpers": "1.1.0-pre.
|
|
89
|
+
"@verii/tests-helpers": "1.1.0-pre.1764142377",
|
|
90
90
|
"cheerio": "1.1.2",
|
|
91
91
|
"dotenv": "16.6.1",
|
|
92
92
|
"eslint": "8.57.1",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"prettier": "2.8.8",
|
|
108
108
|
"qs": "6.14.0"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "39d0123fb7911d1a2814777ad0e0a25e35bc13c8"
|
|
111
111
|
}
|
|
@@ -18,15 +18,11 @@ const { setAuthHeader } = require('./webhook-auth-header');
|
|
|
18
18
|
const { handleVendorError } = require('./vendor-errors-handler');
|
|
19
19
|
|
|
20
20
|
const identifyUserOnVendor = async (payload, context) => {
|
|
21
|
-
const {
|
|
22
|
-
const { webhookUrl } = tenant;
|
|
21
|
+
const { vendorFetch } = context;
|
|
23
22
|
|
|
24
23
|
try {
|
|
25
24
|
const response = await vendorFetch.post('issuing/identify', payload, {
|
|
26
|
-
|
|
27
|
-
headers: {
|
|
28
|
-
...setAuthHeader(context),
|
|
29
|
-
},
|
|
25
|
+
headers: setAuthHeader(context),
|
|
30
26
|
});
|
|
31
27
|
|
|
32
28
|
return response.json();
|
|
@@ -18,19 +18,13 @@ const { setAuthHeader } = require('./webhook-auth-header');
|
|
|
18
18
|
const { handleVendorError } = require('./vendor-errors-handler');
|
|
19
19
|
|
|
20
20
|
const sendCredentials = async (vendorEndpoint, payload, context) => {
|
|
21
|
-
const {
|
|
22
|
-
const { webhookUrl } = tenant;
|
|
21
|
+
const { vendorFetch } = context;
|
|
23
22
|
|
|
24
23
|
try {
|
|
25
24
|
const response = await vendorFetch.post(
|
|
26
25
|
`inspection/${vendorEndpoint}`,
|
|
27
26
|
payload,
|
|
28
|
-
{
|
|
29
|
-
...(webhookUrl ? { prefixUrl: webhookUrl } : {}),
|
|
30
|
-
headers: {
|
|
31
|
-
...setAuthHeader(context),
|
|
32
|
-
},
|
|
33
|
-
}
|
|
27
|
+
{ headers: setAuthHeader(context) }
|
|
34
28
|
);
|
|
35
29
|
|
|
36
30
|
const { numProcessed } = await response.json();
|
|
@@ -18,16 +18,12 @@ const { setAuthHeader } = require('./webhook-auth-header');
|
|
|
18
18
|
const { handleVendorError } = require('./vendor-errors-handler');
|
|
19
19
|
|
|
20
20
|
const requestOffersFromVendor = async (payload, context) => {
|
|
21
|
-
const {
|
|
22
|
-
const { webhookUrl } = tenant;
|
|
21
|
+
const { vendorFetch } = context;
|
|
23
22
|
|
|
24
23
|
try {
|
|
25
24
|
return vendorFetch.post('issuing/generate-offers', payload, {
|
|
26
25
|
responseType: 'json',
|
|
27
|
-
|
|
28
|
-
headers: {
|
|
29
|
-
...setAuthHeader(context),
|
|
30
|
-
},
|
|
26
|
+
headers: setAuthHeader(context),
|
|
31
27
|
});
|
|
32
28
|
} catch (error) {
|
|
33
29
|
handleVendorError(error);
|
|
@@ -37,16 +33,12 @@ const requestOffersFromVendor = async (payload, context) => {
|
|
|
37
33
|
};
|
|
38
34
|
|
|
39
35
|
const issuedCredentialsNotificationCallback = async (payload, context) => {
|
|
40
|
-
const {
|
|
41
|
-
const { webhookUrl } = tenant;
|
|
36
|
+
const { vendorFetch } = context;
|
|
42
37
|
|
|
43
38
|
try {
|
|
44
39
|
return vendorFetch.post('issuing/receive-issued-credentials', payload, {
|
|
45
40
|
responseType: 'json',
|
|
46
|
-
|
|
47
|
-
headers: {
|
|
48
|
-
...setAuthHeader(context),
|
|
49
|
-
},
|
|
41
|
+
headers: setAuthHeader(context),
|
|
50
42
|
});
|
|
51
43
|
} catch (error) {
|
|
52
44
|
handleVendorError(error);
|
|
@@ -73,6 +73,10 @@ const initHolderServer = (fastify) => {
|
|
|
73
73
|
cache: fastify.cache,
|
|
74
74
|
isTest: fastify.config.isTest,
|
|
75
75
|
},
|
|
76
|
+
requestDecorator: (req) =>
|
|
77
|
+
req.tenant?.webhookUrl
|
|
78
|
+
? fastify.baseVendorFetch(req.tenant.webhookUrl, req)
|
|
79
|
+
: fastify.baseVendorFetch(req),
|
|
76
80
|
})
|
|
77
81
|
.register(httpClientPlugin, {
|
|
78
82
|
name: 'registrarFetch',
|
|
@@ -66,6 +66,10 @@ const initOperatorServer = (fastify) => {
|
|
|
66
66
|
cache: fastify.cache,
|
|
67
67
|
isTest: fastify.config.isTest,
|
|
68
68
|
},
|
|
69
|
+
requestDecorator: (req) =>
|
|
70
|
+
req.tenant?.webhookUrl
|
|
71
|
+
? fastify.baseVendorFetch(req.tenant.webhookUrl, req)
|
|
72
|
+
: fastify.baseVendorFetch(req),
|
|
69
73
|
})
|
|
70
74
|
.register(httpClientPlugin, {
|
|
71
75
|
name: 'registrarFetch',
|
package/src/init-server.js
CHANGED
|
@@ -85,6 +85,10 @@ const initServer = (server) => {
|
|
|
85
85
|
cache: server.cache,
|
|
86
86
|
isTest: server.config.isTest,
|
|
87
87
|
},
|
|
88
|
+
requestDecorator: (req) =>
|
|
89
|
+
req.tenant?.webhookUrl
|
|
90
|
+
? server.baseVendorFetch(req.tenant.webhookUrl, req)
|
|
91
|
+
: server.baseVendorFetch(req),
|
|
88
92
|
})
|
|
89
93
|
.register(httpClientPlugin, {
|
|
90
94
|
name: 'registrarFetch',
|
|
@@ -34,10 +34,7 @@ async function validateCao() {
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const registrarFetch = context.baseRegistrarFetch()
|
|
38
|
-
context.config.oracleUrl,
|
|
39
|
-
context
|
|
40
|
-
);
|
|
37
|
+
const registrarFetch = context.baseRegistrarFetch(context);
|
|
41
38
|
const caoErrorMessage =
|
|
42
39
|
// eslint-disable-next-line max-len
|
|
43
40
|
'The provided CAO is not permitted to operator on the network. Make sure the organization exists on the registrar and is approved for Credential Agent Operation';
|