@bedrock/vc-verifier 24.0.0 → 24.1.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/lib/config.js +20 -0
- package/lib/http.js +0 -11
- package/package.json +2 -3
package/lib/config.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {config} from '@bedrock/core';
|
|
5
5
|
import '@bedrock/app-identity';
|
|
6
|
+
import '@bedrock/express';
|
|
6
7
|
|
|
7
8
|
const cfg = config['vc-verifier'] = {};
|
|
8
9
|
|
|
@@ -43,6 +44,25 @@ cfg.routes = {
|
|
|
43
44
|
presentationsVerify: '/presentations/verify'
|
|
44
45
|
};
|
|
45
46
|
|
|
47
|
+
// enable larger payloads for certain routes
|
|
48
|
+
const createBodyParserOptions = ({limit}) => ({
|
|
49
|
+
json: {
|
|
50
|
+
strict: false,
|
|
51
|
+
limit,
|
|
52
|
+
type: ['json', '+json']
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const bodyParserRoutes = config.express.bodyParser.routes;
|
|
56
|
+
// max VC size is 10 MiB, allow for some overhead
|
|
57
|
+
bodyParserRoutes['/verifiers/:instanceId/credentials/verify'] =
|
|
58
|
+
createBodyParserOptions({limit: '11MB'});
|
|
59
|
+
// allow for large VPs
|
|
60
|
+
bodyParserRoutes['/verifiers/:instanceId/presentations/verify'] =
|
|
61
|
+
createBodyParserOptions({limit: '50MB'});
|
|
62
|
+
// allow for large mDL CA stores
|
|
63
|
+
bodyParserRoutes['/verifiers/:instanceId/mdl/*'] =
|
|
64
|
+
createBodyParserOptions({limit: '10MB'});
|
|
65
|
+
|
|
46
66
|
// create dev application identity for vc-verifier (must be overridden in
|
|
47
67
|
// deployments) ...and `ensureConfigOverride` has already been set via
|
|
48
68
|
// `bedrock-app-identity` so it doesn't have to be set here
|
package/lib/http.js
CHANGED
|
@@ -11,23 +11,12 @@ import {
|
|
|
11
11
|
import {metering, middleware} from '@bedrock/service-core';
|
|
12
12
|
import {verifyCredential, verifyPresentation} from './verify.js';
|
|
13
13
|
import {asyncHandler} from '@bedrock/express';
|
|
14
|
-
import bodyParser from 'body-parser';
|
|
15
14
|
import cors from 'cors';
|
|
16
15
|
import {serializeError} from 'serialize-error';
|
|
17
16
|
import {createValidateMiddleware as validate} from '@bedrock/validation';
|
|
18
17
|
|
|
19
18
|
const {util: {BedrockError}} = bedrock;
|
|
20
19
|
|
|
21
|
-
// FIXME: remove and apply at top-level application
|
|
22
|
-
bedrock.events.on('bedrock-express.configure.bodyParser', app => {
|
|
23
|
-
app.use(bodyParser.json({
|
|
24
|
-
// allow json that is not just arrays or objects
|
|
25
|
-
strict: false,
|
|
26
|
-
limit: '10MB',
|
|
27
|
-
type: ['json', '+json']
|
|
28
|
-
}));
|
|
29
|
-
});
|
|
30
|
-
|
|
31
20
|
export async function addRoutes({app, service} = {}) {
|
|
32
21
|
const {routePrefix} = service;
|
|
33
22
|
const cfg = bedrock.config['vc-verifier'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrock/vc-verifier",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Bedrock VC Verifier",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"@digitalbazaar/vpqr": "^6.0.0",
|
|
48
48
|
"assert-plus": "^1.0.0",
|
|
49
49
|
"bnid": "^3.0.0",
|
|
50
|
-
"body-parser": "^1.20.5",
|
|
51
50
|
"cors": "^2.8.6",
|
|
52
51
|
"jose": "^6.2.3",
|
|
53
52
|
"serialize-error": "^13.0.1"
|
|
@@ -59,7 +58,7 @@
|
|
|
59
58
|
"@bedrock/data-integrity-context": "^4.0.3",
|
|
60
59
|
"@bedrock/did-context": "^6.0.0",
|
|
61
60
|
"@bedrock/did-io": "^10.4.0",
|
|
62
|
-
"@bedrock/express": "^8.6.
|
|
61
|
+
"@bedrock/express": "^8.6.4",
|
|
63
62
|
"@bedrock/https-agent": "^4.1.0",
|
|
64
63
|
"@bedrock/jsonld-document-loader": "^5.2.1",
|
|
65
64
|
"@bedrock/mongodb": "^11.0.1",
|