@bedrock/kms 14.0.0 → 15.0.1

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/index.js CHANGED
@@ -1,34 +1,12 @@
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 keystores from './keystores.js';
5
5
  import {BedrockKmsModuleManager} from './BedrockKmsModuleManager.js';
6
- import {didIo} from '@bedrock/did-io';
7
- import {documentLoader} from '@bedrock/jsonld-document-loader';
8
- import '@bedrock/did-context';
9
- import '@bedrock/security-context';
10
- import '@bedrock/veres-one-context';
11
6
 
12
7
  // load config defaults
13
8
  import './config.js';
14
9
 
15
- async function defaultDocumentLoader(url) {
16
- let document;
17
- if(url.startsWith('did:')) {
18
- document = await didIo.get({did: url});
19
- return {
20
- contextUrl: null,
21
- documentUrl: url,
22
- document
23
- };
24
- }
25
-
26
- // finally, try the bedrock document loader
27
- return documentLoader(url);
28
- }
29
10
  const defaultModuleManager = new BedrockKmsModuleManager();
30
11
 
31
- export {
32
- BedrockKmsModuleManager, keystores,
33
- defaultDocumentLoader, defaultModuleManager
34
- };
12
+ export {BedrockKmsModuleManager, keystores, defaultModuleManager};
package/lib/keystores.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright (c) 2019-2022 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 database from '@bedrock/mongodb';
@@ -34,12 +34,12 @@ bedrock.events.on('bedrock-mongodb.ready', async () => {
34
34
  // cover queries keystore by ID
35
35
  collection: 'kms-keystore',
36
36
  fields: {'config.id': 1},
37
- options: {unique: true, background: false}
37
+ options: {unique: true}
38
38
  }, {
39
39
  // cover config queries by controller
40
40
  collection: 'kms-keystore',
41
41
  fields: {'config.controller': 1},
42
- options: {unique: false, background: false}
42
+ options: {unique: false}
43
43
  }, {
44
44
  // cover counting keystores in use by meter ID, if present
45
45
  collection: 'kms-keystore',
@@ -48,7 +48,7 @@ bedrock.events.on('bedrock-mongodb.ready', async () => {
48
48
  partialFilterExpression: {
49
49
  'config.meterId': {$exists: true}
50
50
  },
51
- unique: false, background: false
51
+ unique: false
52
52
  }
53
53
  }]);
54
54
  });
@@ -91,8 +91,8 @@ export async function insert({config} = {}) {
91
91
  config
92
92
  };
93
93
  try {
94
- const result = await database.collections['kms-keystore'].insertOne(record);
95
- return result.ops[0];
94
+ await database.collections['kms-keystore'].insertOne(record);
95
+ return record;
96
96
  } catch(e) {
97
97
  if(!database.isDuplicateError(e)) {
98
98
  throw e;
@@ -172,7 +172,7 @@ export async function update({config, explain = false} = {}) {
172
172
  }
173
173
  });
174
174
 
175
- if(result.result.n === 0) {
175
+ if(result.modifiedCount === 0) {
176
176
  // no records changed...
177
177
  throw new BedrockError(
178
178
  'Could not update keystore configuration. ' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/kms",
3
- "version": "14.0.0",
3
+ "version": "15.0.1",
4
4
  "type": "module",
5
5
  "description": "Key management for Bedrock applications",
6
6
  "main": "./lib/index.js",
@@ -35,22 +35,17 @@
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@bedrock/core": "^6.0.1",
38
- "@bedrock/did-context": "^5.0.0",
39
- "@bedrock/did-io": "^10.1.0",
40
- "@bedrock/jsonld-document-loader": "^4.0.0",
41
38
  "@bedrock/mongodb": "^10.0.0",
42
- "@bedrock/package-manager": "^3.0.0",
43
- "@bedrock/security-context": "^8.0.0",
44
- "@bedrock/veres-one-context": "^15.0.0"
39
+ "@bedrock/package-manager": "^3.0.0"
45
40
  },
46
41
  "directories": {
47
42
  "lib": "./lib"
48
43
  },
49
44
  "devDependencies": {
50
45
  "eslint": "^8.18.0",
51
- "eslint-config-digitalbazaar": "^4.0.1",
52
- "eslint-plugin-jsdoc": "^39.3.3",
53
- "eslint-plugin-unicorn": "^43.0.0",
54
- "jsdoc-to-markdown": "^7.1.1"
46
+ "eslint-config-digitalbazaar": "^5.0.1",
47
+ "eslint-plugin-jsdoc": "^48.0.2",
48
+ "eslint-plugin-unicorn": "^50.0.1",
49
+ "jsdoc-to-markdown": "^8.0.0"
55
50
  }
56
51
  }