@bedrock/kms-http 20.0.0 → 21.0.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/middleware.js +3 -9
- package/package.json +21 -23
package/lib/middleware.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as bedrock from '@bedrock/core';
|
|
5
5
|
import * as brZCapStorage from '@bedrock/zcap-storage';
|
|
6
|
+
import * as Ed25519Multikey from '@digitalbazaar/ed25519-multikey';
|
|
6
7
|
import * as helpers from './helpers.js';
|
|
7
8
|
import {
|
|
8
9
|
authorizeZcapInvocation as _authorizeZcapInvocation,
|
|
@@ -12,12 +13,8 @@ import {default as _cors} from 'cors';
|
|
|
12
13
|
import {asyncHandler} from '@bedrock/express';
|
|
13
14
|
import {BedrockKeystoreConfigStorage} from './BedrockKeystoreConfigStorage.js';
|
|
14
15
|
import {createOperationMiddleware} from '@digitalbazaar/webkms-switch';
|
|
15
|
-
import {CryptoLD} from 'crypto-ld';
|
|
16
16
|
import {documentLoader} from './documentLoader.js';
|
|
17
17
|
import {Ed25519Signature2020} from '@digitalbazaar/ed25519-signature-2020';
|
|
18
|
-
import {
|
|
19
|
-
Ed25519VerificationKey2020
|
|
20
|
-
} from '@digitalbazaar/ed25519-verification-key-2020';
|
|
21
18
|
import {logger} from './logger.js';
|
|
22
19
|
import {defaultModuleManager as moduleManager} from '@bedrock/kms';
|
|
23
20
|
import {reportOperationUsage} from './metering.js';
|
|
@@ -28,10 +25,6 @@ const FIVE_MINUTES = 1000 * 60 * 5;
|
|
|
28
25
|
|
|
29
26
|
const storage = new BedrockKeystoreConfigStorage();
|
|
30
27
|
|
|
31
|
-
// create `getVerifier` hook for verifying zcap invocation HTTP signatures
|
|
32
|
-
const cryptoLd = new CryptoLD();
|
|
33
|
-
cryptoLd.use(Ed25519VerificationKey2020);
|
|
34
|
-
|
|
35
28
|
// creates middleware to get the keystore config for the current request and
|
|
36
29
|
// caches it in `req.webkms.keystore`
|
|
37
30
|
export function createGetKeystoreConfig({routes}) {
|
|
@@ -199,7 +192,8 @@ async function getKeystoreController({req}) {
|
|
|
199
192
|
|
|
200
193
|
// hook used to verify zcap invocation HTTP signatures
|
|
201
194
|
async function getVerifier({keyId, documentLoader}) {
|
|
202
|
-
const
|
|
195
|
+
const {document} = await documentLoader(keyId);
|
|
196
|
+
const key = await Ed25519Multikey.from(document);
|
|
203
197
|
const verificationMethod = await key.export(
|
|
204
198
|
{publicKey: true, includeContext: true});
|
|
205
199
|
const verifier = key.verifier();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrock/kms-http",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Bedrock KMS HTTP API",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"schemas/**/*.js"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"lint": "eslint ."
|
|
12
|
+
"lint": "eslint --ext .cjs,.js ."
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
@@ -28,39 +28,37 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/digitalbazaar/bedrock-kms-http",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@digitalbazaar/ed25519-
|
|
32
|
-
"@digitalbazaar/ed25519-
|
|
33
|
-
"@digitalbazaar/ezcap-express": "^7.
|
|
31
|
+
"@digitalbazaar/ed25519-multikey": "^1.1.0",
|
|
32
|
+
"@digitalbazaar/ed25519-signature-2020": "^5.4.0",
|
|
33
|
+
"@digitalbazaar/ezcap-express": "^7.1.0",
|
|
34
34
|
"@digitalbazaar/webkms-switch": "^12.0.0",
|
|
35
|
-
"cidr-regex": "^4.
|
|
35
|
+
"cidr-regex": "^4.1.1",
|
|
36
36
|
"cors": "^2.8.5",
|
|
37
|
-
"crypto-ld": "^7.0.0",
|
|
38
37
|
"forwarded": "^0.2.0",
|
|
39
|
-
"ipaddr.js": "^2.0
|
|
38
|
+
"ipaddr.js": "^2.2.0"
|
|
40
39
|
},
|
|
41
40
|
"peerDependencies": {
|
|
42
41
|
"@bedrock/app-identity": "^4.0.0",
|
|
43
|
-
"@bedrock/core": "^6.
|
|
44
|
-
"@bedrock/did-context": "^
|
|
45
|
-
"@bedrock/did-io": "^10.1
|
|
46
|
-
"@bedrock/express": "^8.
|
|
47
|
-
"@bedrock/jsonld-document-loader": "^
|
|
42
|
+
"@bedrock/core": "^6.1.3",
|
|
43
|
+
"@bedrock/did-context": "^6.0.0",
|
|
44
|
+
"@bedrock/did-io": "^10.3.1",
|
|
45
|
+
"@bedrock/express": "^8.3.1",
|
|
46
|
+
"@bedrock/jsonld-document-loader": "^5.1.0",
|
|
48
47
|
"@bedrock/kms": "^15.0.0",
|
|
49
|
-
"@bedrock/meter-usage-reporter": "^9.0.
|
|
50
|
-
"@bedrock/security-context": "^
|
|
51
|
-
"@bedrock/validation": "^7.
|
|
52
|
-
"@bedrock/veres-one-context": "^
|
|
53
|
-
"@bedrock/zcap-storage": "^8.0.
|
|
48
|
+
"@bedrock/meter-usage-reporter": "^9.0.1",
|
|
49
|
+
"@bedrock/security-context": "^9.0.0",
|
|
50
|
+
"@bedrock/validation": "^7.1.0",
|
|
51
|
+
"@bedrock/veres-one-context": "^16.0.0",
|
|
52
|
+
"@bedrock/zcap-storage": "^8.0.1"
|
|
54
53
|
},
|
|
55
54
|
"directories": {
|
|
56
55
|
"lib": "./lib"
|
|
57
56
|
},
|
|
58
57
|
"devDependencies": {
|
|
59
|
-
"eslint": "^8.
|
|
60
|
-
"eslint-config-digitalbazaar": "^5.0
|
|
61
|
-
"eslint-plugin-jsdoc": "^48.0
|
|
62
|
-
"eslint-plugin-unicorn": "^
|
|
63
|
-
"jsdoc-to-markdown": "^8.0.0"
|
|
58
|
+
"eslint": "^8.57.0",
|
|
59
|
+
"eslint-config-digitalbazaar": "^5.2.0",
|
|
60
|
+
"eslint-plugin-jsdoc": "^48.11.0",
|
|
61
|
+
"eslint-plugin-unicorn": "^55.0.0"
|
|
64
62
|
},
|
|
65
63
|
"engines": {
|
|
66
64
|
"node": ">=18"
|