@bedrock/kms-http 21.0.0 → 22.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.
Files changed (2) hide show
  1. package/lib/middleware.js +2 -39
  2. package/package.json +13 -13
package/lib/middleware.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright (c) 2019-2024 Digital Bazaar, Inc. All rights reserved.
2
+ * Copyright (c) 2019-2025 Digital Bazaar, Inc. All rights reserved.
3
3
  */
4
4
  import * as bedrock from '@bedrock/core';
5
5
  import * as brZCapStorage from '@bedrock/zcap-storage';
@@ -20,6 +20,7 @@ import {defaultModuleManager as moduleManager} from '@bedrock/kms';
20
20
  import {reportOperationUsage} from './metering.js';
21
21
 
22
22
  const {config, util: {BedrockError}} = bedrock;
23
+ const {helpers: {inspectCapabilityChain}} = brZCapStorage;
23
24
 
24
25
  const FIVE_MINUTES = 1000 * 60 * 5;
25
26
 
@@ -200,44 +201,6 @@ async function getVerifier({keyId, documentLoader}) {
200
201
  return {verifier, verificationMethod};
201
202
  }
202
203
 
203
- async function inspectCapabilityChain({
204
- capabilityChain, capabilityChainMeta
205
- }) {
206
- // if capability chain has only root, there's nothing to check as root
207
- // zcaps cannot be revoked
208
- if(capabilityChain.length === 1) {
209
- return {valid: true};
210
- }
211
-
212
- // collect capability IDs and delegators for all delegated capabilities in
213
- // chain (skip root) so they can be checked for revocation
214
- const capabilities = [];
215
- for(const [i, capability] of capabilityChain.entries()) {
216
- // skip root zcap, it cannot be revoked
217
- if(i === 0) {
218
- continue;
219
- }
220
- const [{purposeResult}] = capabilityChainMeta[i].verifyResult.results;
221
- if(purposeResult && purposeResult.delegator) {
222
- capabilities.push({
223
- capabilityId: capability.id,
224
- delegator: purposeResult.delegator.id,
225
- });
226
- }
227
- }
228
-
229
- const revoked = await brZCapStorage.revocations.isRevoked({capabilities});
230
- if(revoked) {
231
- return {
232
- valid: false,
233
- error: new Error(
234
- 'One or more capabilities in the chain have been revoked.')
235
- };
236
- }
237
-
238
- return {valid: true};
239
- }
240
-
241
204
  function onError({error}) {
242
205
  if(!(error instanceof BedrockError)) {
243
206
  // always expose cause message and name; expose cause details as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/kms-http",
3
- "version": "21.0.0",
3
+ "version": "22.1.0",
4
4
  "type": "module",
5
5
  "description": "Bedrock KMS HTTP API",
6
6
  "main": "./lib/index.js",
@@ -28,37 +28,37 @@
28
28
  },
29
29
  "homepage": "https://github.com/digitalbazaar/bedrock-kms-http",
30
30
  "dependencies": {
31
- "@digitalbazaar/ed25519-multikey": "^1.1.0",
31
+ "@digitalbazaar/ed25519-multikey": "^1.3.1",
32
32
  "@digitalbazaar/ed25519-signature-2020": "^5.4.0",
33
33
  "@digitalbazaar/ezcap-express": "^7.1.0",
34
34
  "@digitalbazaar/webkms-switch": "^12.0.0",
35
- "cidr-regex": "^4.1.1",
35
+ "cidr-regex": "^4.1.3",
36
36
  "cors": "^2.8.5",
37
37
  "forwarded": "^0.2.0",
38
38
  "ipaddr.js": "^2.2.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@bedrock/app-identity": "^4.0.0",
42
- "@bedrock/core": "^6.1.3",
42
+ "@bedrock/core": "^6.3.0",
43
43
  "@bedrock/did-context": "^6.0.0",
44
- "@bedrock/did-io": "^10.3.1",
44
+ "@bedrock/did-io": "^10.4.0",
45
45
  "@bedrock/express": "^8.3.1",
46
- "@bedrock/jsonld-document-loader": "^5.1.0",
47
- "@bedrock/kms": "^15.0.0",
48
- "@bedrock/meter-usage-reporter": "^9.0.1",
46
+ "@bedrock/jsonld-document-loader": "^5.2.0",
47
+ "@bedrock/kms": "^16.0.0",
48
+ "@bedrock/meter-usage-reporter": "^10.0.0",
49
49
  "@bedrock/security-context": "^9.0.0",
50
- "@bedrock/validation": "^7.1.0",
50
+ "@bedrock/validation": "^7.1.1",
51
51
  "@bedrock/veres-one-context": "^16.0.0",
52
- "@bedrock/zcap-storage": "^8.0.1"
52
+ "@bedrock/zcap-storage": "^9.3.0"
53
53
  },
54
54
  "directories": {
55
55
  "lib": "./lib"
56
56
  },
57
57
  "devDependencies": {
58
- "eslint": "^8.57.0",
58
+ "eslint": "^8.57.1",
59
59
  "eslint-config-digitalbazaar": "^5.2.0",
60
- "eslint-plugin-jsdoc": "^48.11.0",
61
- "eslint-plugin-unicorn": "^55.0.0"
60
+ "eslint-plugin-jsdoc": "^50.6.3",
61
+ "eslint-plugin-unicorn": "^56.0.1"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=18"