@bedrock/kms-http 19.0.0 → 20.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.
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Copyright (c) 2019-2024 Digital Bazaar, Inc. All rights reserved.
3
+ */
4
+ import {didIo} from '@bedrock/did-io';
5
+ import {documentLoader} from '@bedrock/jsonld-document-loader';
6
+ import '@bedrock/did-context';
7
+ import '@bedrock/security-context';
8
+ import '@bedrock/veres-one-context';
9
+
10
+ // load config defaults
11
+ import './config.js';
12
+
13
+ async function defaultDocumentLoader(url) {
14
+ let document;
15
+ if(url.startsWith('did:')) {
16
+ document = await didIo.get({did: url});
17
+ return {
18
+ contextUrl: null,
19
+ documentUrl: url,
20
+ document
21
+ };
22
+ }
23
+
24
+ // finally, try the bedrock document loader
25
+ return documentLoader(url);
26
+ }
27
+
28
+ export {defaultDocumentLoader as documentLoader};
package/lib/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  /*!
2
- * Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
2
+ * Copyright (c) 2019-2024 Digital Bazaar, Inc. All rights reserved.
3
3
  */
4
4
  import '@bedrock/express';
5
5
 
6
+ import './documentLoader.js';
6
7
  import './http.js';
7
8
 
8
9
  // load config defaults
package/lib/middleware.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
2
+ * Copyright (c) 2019-2024 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';
@@ -8,20 +8,18 @@ import {
8
8
  authorizeZcapInvocation as _authorizeZcapInvocation,
9
9
  authorizeZcapRevocation as _authorizeZcapRevocation
10
10
  } from '@digitalbazaar/ezcap-express';
11
- import {
12
- defaultDocumentLoader as documentLoader,
13
- defaultModuleManager as moduleManager
14
- } from '@bedrock/kms';
15
11
  import {default as _cors} from 'cors';
16
12
  import {asyncHandler} from '@bedrock/express';
17
13
  import {BedrockKeystoreConfigStorage} from './BedrockKeystoreConfigStorage.js';
18
14
  import {createOperationMiddleware} from '@digitalbazaar/webkms-switch';
19
15
  import {CryptoLD} from 'crypto-ld';
16
+ import {documentLoader} from './documentLoader.js';
20
17
  import {Ed25519Signature2020} from '@digitalbazaar/ed25519-signature-2020';
21
18
  import {
22
19
  Ed25519VerificationKey2020
23
20
  } from '@digitalbazaar/ed25519-verification-key-2020';
24
21
  import {logger} from './logger.js';
22
+ import {defaultModuleManager as moduleManager} from '@bedrock/kms';
25
23
  import {reportOperationUsage} from './metering.js';
26
24
 
27
25
  const {config, util: {BedrockError}} = bedrock;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/kms-http",
3
- "version": "19.0.0",
3
+ "version": "20.0.0",
4
4
  "type": "module",
5
5
  "description": "Bedrock KMS HTTP API",
6
6
  "main": "./lib/index.js",
@@ -41,10 +41,15 @@
41
41
  "peerDependencies": {
42
42
  "@bedrock/app-identity": "^4.0.0",
43
43
  "@bedrock/core": "^6.0.1",
44
+ "@bedrock/did-context": "^5.0.0",
45
+ "@bedrock/did-io": "^10.1.0",
44
46
  "@bedrock/express": "^8.0.0",
45
- "@bedrock/kms": "^14.0.0",
47
+ "@bedrock/jsonld-document-loader": "^4.0.0",
48
+ "@bedrock/kms": "^15.0.0",
46
49
  "@bedrock/meter-usage-reporter": "^9.0.0",
50
+ "@bedrock/security-context": "^8.0.0",
47
51
  "@bedrock/validation": "^7.0.0",
52
+ "@bedrock/veres-one-context": "^15.0.0",
48
53
  "@bedrock/zcap-storage": "^8.0.0"
49
54
  },
50
55
  "directories": {
@@ -54,7 +59,7 @@
54
59
  "eslint": "^8.18.0",
55
60
  "eslint-config-digitalbazaar": "^5.0.1",
56
61
  "eslint-plugin-jsdoc": "^48.0.2",
57
- "eslint-plugin-unicorn": "^50.0.1",
62
+ "eslint-plugin-unicorn": "^52.0.0",
58
63
  "jsdoc-to-markdown": "^8.0.0"
59
64
  },
60
65
  "engines": {