@bedrock/kms 16.0.0 → 16.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 CHANGED
@@ -1,12 +1,12 @@
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 {config} from '@bedrock/core';
5
5
 
6
6
  const cfg = config.kms = {};
7
7
  cfg.keystoreConfigCache = {
8
- maxSize: 1000,
9
- maxAge: 5 * 60 * 1000
8
+ max: 1000,
9
+ ttl: 5 * 60 * 1000
10
10
  };
11
11
 
12
12
  // storage size to report to meter service
package/lib/keystores.js CHANGED
@@ -21,10 +21,22 @@ export {KEYSTORE_CONFIG_CACHE as _KEYSTORE_CONFIG_CACHE};
21
21
 
22
22
  bedrock.events.on('bedrock.init', async () => {
23
23
  const cfg = bedrock.config.kms;
24
- KEYSTORE_CONFIG_CACHE = new LruCache({
25
- max: cfg.keystoreConfigCache.maxSize,
26
- maxAge: cfg.keystoreConfigCache.maxAge
27
- });
24
+
25
+ // coerce `maxSize` w/o `sizeCalculation` to `max`
26
+ let cacheConfig = cfg.keystoreConfigCache;
27
+ if(cacheConfig.maxSize !== undefined &&
28
+ cacheConfig.sizeCalculation === undefined) {
29
+ cacheConfig = {...cacheConfig, max: cacheConfig.maxSize};
30
+ delete cacheConfig.maxSize;
31
+ }
32
+
33
+ // coerce `maxAge` to `ttl` in `cacheConfig`
34
+ if(cacheConfig.maxAge !== undefined) {
35
+ cacheConfig = {...cacheConfig, ttl: cacheConfig.maxAge};
36
+ delete cacheConfig.maxAge;
37
+ }
38
+
39
+ KEYSTORE_CONFIG_CACHE = new LruCache(cacheConfig);
28
40
  });
29
41
 
30
42
  bedrock.events.on('bedrock-mongodb.ready', async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/kms",
3
- "version": "16.0.0",
3
+ "version": "16.1.0",
4
4
  "type": "module",
5
5
  "description": "Key management for Bedrock applications",
6
6
  "main": "./lib/index.js",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "homepage": "https://github.com/digitalbazaar/bedrock-kms",
32
32
  "dependencies": {
33
- "@digitalbazaar/lru-memoize": "^3.0.2",
33
+ "@digitalbazaar/lru-memoize": "^4.0.0",
34
34
  "p-all": "^5.0.0"
35
35
  },
36
36
  "peerDependencies": {