@bedrock/kms 9.0.0 → 10.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/.github/workflows/main.yml +5 -5
- package/CHANGELOG.md +13 -0
- package/lib/keystores.js +1 -1
- package/package.json +9 -9
- package/test/mocha/13-keystores-update-api.js +6 -7
- package/test/mocha/20-key-operations.js +13 -14
- package/test/mocha/30-bulk-operations.js +4 -5
- package/test/mocha/cryptoLd.js +1 -1
- package/test/mocha/helpers.js +3 -5
- package/test/package.json +15 -13
- package/test/test.config.js +2 -2
|
@@ -8,7 +8,7 @@ jobs:
|
|
|
8
8
|
timeout-minutes: 10
|
|
9
9
|
strategy:
|
|
10
10
|
matrix:
|
|
11
|
-
node-version: [
|
|
11
|
+
node-version: [16.x]
|
|
12
12
|
steps:
|
|
13
13
|
- uses: actions/checkout@v2
|
|
14
14
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
@@ -24,12 +24,12 @@ jobs:
|
|
|
24
24
|
timeout-minutes: 10
|
|
25
25
|
services:
|
|
26
26
|
mongodb:
|
|
27
|
-
image: mongo:4.
|
|
27
|
+
image: mongo:4.4
|
|
28
28
|
ports:
|
|
29
29
|
- 27017:27017
|
|
30
30
|
strategy:
|
|
31
31
|
matrix:
|
|
32
|
-
node-version: [14.x]
|
|
32
|
+
node-version: [14.x, 16.x]
|
|
33
33
|
steps:
|
|
34
34
|
- uses: actions/checkout@v2
|
|
35
35
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
@@ -50,12 +50,12 @@ jobs:
|
|
|
50
50
|
timeout-minutes: 10
|
|
51
51
|
services:
|
|
52
52
|
mongodb:
|
|
53
|
-
image: mongo:4.
|
|
53
|
+
image: mongo:4.4
|
|
54
54
|
ports:
|
|
55
55
|
- 27017:27017
|
|
56
56
|
strategy:
|
|
57
57
|
matrix:
|
|
58
|
-
node-version: [
|
|
58
|
+
node-version: [16.x]
|
|
59
59
|
steps:
|
|
60
60
|
- uses: actions/checkout@v2
|
|
61
61
|
- name: Use Node.js ${{ matrix.node-version }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# bedrock-kms ChangeLog
|
|
2
2
|
|
|
3
|
+
## 10.0.0 - 2022-04-29
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- **BREAKING**: Update peer deps:
|
|
7
|
+
- `@bedrock/core@6`.
|
|
8
|
+
- `@bedrock/did-context@4`
|
|
9
|
+
- `@bedrock/did-io@8`
|
|
10
|
+
- `@bedrock/jsonld-document-loader@3`
|
|
11
|
+
- `@bedrock/mongodb@10`
|
|
12
|
+
- `@bedrock/package-manager@3`
|
|
13
|
+
- `@bedrock/security-context@7`
|
|
14
|
+
- `@bedrock/veres-one-context@14`.
|
|
15
|
+
|
|
3
16
|
## 9.0.0 - 2022-04-05
|
|
4
17
|
|
|
5
18
|
### Changed
|
package/lib/keystores.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as bedrock from '@bedrock/core';
|
|
|
5
5
|
import * as database from '@bedrock/mongodb';
|
|
6
6
|
import assert from 'assert-plus';
|
|
7
7
|
import pAll from 'p-all';
|
|
8
|
-
import {createRequire} from 'module';
|
|
8
|
+
import {createRequire} from 'node:module';
|
|
9
9
|
const require = createRequire(import.meta.url);
|
|
10
10
|
const {LruCache} = require('@digitalbazaar/lru-memoize');
|
|
11
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrock/kms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Key management for Bedrock applications",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"p-all": "^4.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@bedrock/core": "^
|
|
35
|
-
"@bedrock/did-context": "^
|
|
36
|
-
"@bedrock/did-io": "^
|
|
37
|
-
"@bedrock/jsonld-document-loader": "^
|
|
38
|
-
"@bedrock/mongodb": "^
|
|
39
|
-
"@bedrock/package-manager": "^
|
|
40
|
-
"@bedrock/security-context": "^
|
|
41
|
-
"@bedrock/veres-one-context": "^
|
|
34
|
+
"@bedrock/core": "^6.0.0",
|
|
35
|
+
"@bedrock/did-context": "^4.0.0",
|
|
36
|
+
"@bedrock/did-io": "^8.0.0",
|
|
37
|
+
"@bedrock/jsonld-document-loader": "^3.0.0",
|
|
38
|
+
"@bedrock/mongodb": "^10.0.0",
|
|
39
|
+
"@bedrock/package-manager": "^3.0.0",
|
|
40
|
+
"@bedrock/security-context": "^7.0.0",
|
|
41
|
+
"@bedrock/veres-one-context": "^14.0.0"
|
|
42
42
|
},
|
|
43
43
|
"directories": {
|
|
44
44
|
"lib": "./lib"
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import * as bedrock from '@bedrock/core';
|
|
5
4
|
import {keystores} from '@bedrock/kms';
|
|
6
|
-
|
|
5
|
+
import {klona} from 'klona';
|
|
7
6
|
|
|
8
7
|
describe('keystores APIs', () => {
|
|
9
8
|
const mockConfigAlpha = {
|
|
@@ -53,7 +52,7 @@ describe('keystores APIs', () => {
|
|
|
53
52
|
it('successfully updates a keystore', async () => {
|
|
54
53
|
let err;
|
|
55
54
|
let result;
|
|
56
|
-
const config =
|
|
55
|
+
const config = klona(mockConfigAlpha);
|
|
57
56
|
config.sequence++;
|
|
58
57
|
config.controller = 'someOtherController';
|
|
59
58
|
try {
|
|
@@ -68,7 +67,7 @@ describe('keystores APIs', () => {
|
|
|
68
67
|
it('successfully updates a keystore twice', async () => {
|
|
69
68
|
let err;
|
|
70
69
|
let result;
|
|
71
|
-
const config =
|
|
70
|
+
const config = klona(mockConfigBeta);
|
|
72
71
|
config.sequence++;
|
|
73
72
|
config.controller = 'someOtherController';
|
|
74
73
|
try {
|
|
@@ -97,7 +96,7 @@ describe('keystores APIs', () => {
|
|
|
97
96
|
it('fails to updates a keystore using wrong sequence number', async () => {
|
|
98
97
|
let err;
|
|
99
98
|
let result;
|
|
100
|
-
const config =
|
|
99
|
+
const config = klona(mockConfigGamma);
|
|
101
100
|
config.sequence++;
|
|
102
101
|
config.controller = 'someOtherController';
|
|
103
102
|
try {
|
|
@@ -129,7 +128,7 @@ describe('keystores APIs', () => {
|
|
|
129
128
|
it('successfully updates a keystore and invalidates cache', async () => {
|
|
130
129
|
let err;
|
|
131
130
|
let result;
|
|
132
|
-
const config =
|
|
131
|
+
const config = klona(mockConfigBeta);
|
|
133
132
|
config.sequence = 3;
|
|
134
133
|
config.controller = 'someOtherController';
|
|
135
134
|
try {
|
|
@@ -147,7 +146,7 @@ describe('keystores APIs', () => {
|
|
|
147
146
|
it('throws error on unknown keystore id', async () => {
|
|
148
147
|
let err;
|
|
149
148
|
let result;
|
|
150
|
-
const config =
|
|
149
|
+
const config = klona(mockConfigBeta);
|
|
151
150
|
config.sequence++;
|
|
152
151
|
config.id = 'someOtherId';
|
|
153
152
|
try {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import * as bedrock from '@bedrock/core';
|
|
5
4
|
import * as helpers from './helpers.js';
|
|
6
|
-
import {createRequire} from 'module';
|
|
5
|
+
import {createRequire} from 'node:module';
|
|
7
6
|
import {defaultModuleManager as moduleManager} from '@bedrock/kms';
|
|
7
|
+
import {klona} from 'klona';
|
|
8
8
|
import {mockData} from './mock.data.js';
|
|
9
|
+
import {v4 as uuid} from 'uuid';
|
|
9
10
|
const require = createRequire(import.meta.url);
|
|
10
11
|
const {runOperation} = require('@digitalbazaar/webkms-switch');
|
|
11
12
|
|
|
12
|
-
const {util: {clone, uuid}} = bedrock;
|
|
13
|
-
|
|
14
13
|
describe('bedrock-kms', () => {
|
|
15
14
|
describe('integration with runOperation API', () => {
|
|
16
15
|
describe('GenerateKeyOperation', () => {
|
|
@@ -20,7 +19,7 @@ describe('bedrock-kms', () => {
|
|
|
20
19
|
controller: 'urn:uuid:baa943d2-7338-11ec-b1c4-10bf48838a41',
|
|
21
20
|
kmsModule: 'ssm-v1'
|
|
22
21
|
};
|
|
23
|
-
const operation =
|
|
22
|
+
const operation = klona(
|
|
24
23
|
mockData.operations.generate({type: 'Ed25519VerificationKey2018'}));
|
|
25
24
|
operation.invocationTarget.type = 'Ed25519VerificationKey2018';
|
|
26
25
|
let error;
|
|
@@ -46,7 +45,7 @@ describe('bedrock-kms', () => {
|
|
|
46
45
|
controller: 'urn:uuid:baa943d2-7338-11ec-b1c4-10bf48838a41',
|
|
47
46
|
kmsModule: 'ssm-v1'
|
|
48
47
|
};
|
|
49
|
-
const operation =
|
|
48
|
+
const operation = klona(
|
|
50
49
|
mockData.operations.generate({type: 'Ed25519VerificationKey2020'}));
|
|
51
50
|
operation.invocationTarget.type = 'Ed25519VerificationKey2020';
|
|
52
51
|
let error;
|
|
@@ -72,7 +71,7 @@ describe('bedrock-kms', () => {
|
|
|
72
71
|
controller: 'urn:uuid:baa943d2-7338-11ec-b1c4-10bf48838a41',
|
|
73
72
|
kmsModule: 'ssm-v1'
|
|
74
73
|
};
|
|
75
|
-
const operation =
|
|
74
|
+
const operation = klona(
|
|
76
75
|
mockData.operations.generate({type: 'Sha256HmacKey2019'}));
|
|
77
76
|
operation.invocationTarget.type = 'Sha256HmacKey2019';
|
|
78
77
|
let error;
|
|
@@ -97,7 +96,7 @@ describe('bedrock-kms', () => {
|
|
|
97
96
|
controller: 'urn:uuid:baa943d2-7338-11ec-b1c4-10bf48838a41',
|
|
98
97
|
kmsModule: 'ssm-v1'
|
|
99
98
|
};
|
|
100
|
-
const operation =
|
|
99
|
+
const operation = klona(
|
|
101
100
|
mockData.operations.generate({type: 'AesKeyWrappingKey2019'}));
|
|
102
101
|
operation.invocationTarget.type = 'AesKeyWrappingKey2019';
|
|
103
102
|
let error;
|
|
@@ -122,7 +121,7 @@ describe('bedrock-kms', () => {
|
|
|
122
121
|
controller: 'urn:uuid:baa943d2-7338-11ec-b1c4-10bf48838a41',
|
|
123
122
|
kmsModule: 'ssm-v1'
|
|
124
123
|
};
|
|
125
|
-
const operation =
|
|
124
|
+
const operation = klona(
|
|
126
125
|
mockData.operations.generate({type: 'AesKeyWrappingKey2019'}));
|
|
127
126
|
operation.invocationTarget.type = 'UnknownKeyType';
|
|
128
127
|
let error;
|
|
@@ -142,7 +141,7 @@ describe('bedrock-kms', () => {
|
|
|
142
141
|
it('signs a string using Ed25519VerificationKey2018', async () => {
|
|
143
142
|
const {keystore, key: {id: keyId}} = await helpers.generateKey(
|
|
144
143
|
{mockData, type: 'Ed25519VerificationKey2018'});
|
|
145
|
-
const operation =
|
|
144
|
+
const operation = klona(mockData.operations.sign);
|
|
146
145
|
operation.invocationTarget = keyId;
|
|
147
146
|
operation.verifyData = uuid();
|
|
148
147
|
let result;
|
|
@@ -164,7 +163,7 @@ describe('bedrock-kms', () => {
|
|
|
164
163
|
it('signs a string using Ed25519VerificationKey2020', async () => {
|
|
165
164
|
const {keystore, key: {id: keyId}} = await helpers.generateKey(
|
|
166
165
|
{mockData, type: 'Ed25519VerificationKey2020'});
|
|
167
|
-
const operation =
|
|
166
|
+
const operation = klona(mockData.operations.sign);
|
|
168
167
|
operation.invocationTarget = keyId;
|
|
169
168
|
operation.verifyData = uuid();
|
|
170
169
|
let result;
|
|
@@ -186,7 +185,7 @@ describe('bedrock-kms', () => {
|
|
|
186
185
|
it('signs a string using Sha256HmacKey2019', async () => {
|
|
187
186
|
const {keystore, key: {id: keyId}} = await helpers.generateKey(
|
|
188
187
|
{mockData, type: 'Sha256HmacKey2019'});
|
|
189
|
-
const operation =
|
|
188
|
+
const operation = klona(mockData.operations.sign);
|
|
190
189
|
operation.invocationTarget = keyId;
|
|
191
190
|
operation.verifyData = uuid();
|
|
192
191
|
let result;
|
|
@@ -212,12 +211,12 @@ describe('bedrock-kms', () => {
|
|
|
212
211
|
const verifyData = uuid();
|
|
213
212
|
const {keystore, key: {id: keyId}} = await helpers.generateKey(
|
|
214
213
|
{mockData, type: 'Sha256HmacKey2019'});
|
|
215
|
-
const signOperation =
|
|
214
|
+
const signOperation = klona(mockData.operations.sign);
|
|
216
215
|
signOperation.invocationTarget = keyId;
|
|
217
216
|
signOperation.verifyData = verifyData;
|
|
218
217
|
const {result: {signatureValue}} = await runOperation(
|
|
219
218
|
{operation: signOperation, keystore, moduleManager});
|
|
220
|
-
const verifyOperation =
|
|
219
|
+
const verifyOperation = klona(mockData.operations.verify);
|
|
221
220
|
verifyOperation.invocationTarget = keyId;
|
|
222
221
|
verifyOperation.verifyData = verifyData;
|
|
223
222
|
verifyOperation.signatureValue = signatureValue;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import * as bedrock from '@bedrock/core';
|
|
5
4
|
import * as helpers from './helpers.js';
|
|
6
5
|
import {createRequire} from 'module';
|
|
7
6
|
import {defaultModuleManager as moduleManager} from '@bedrock/kms';
|
|
7
|
+
import {klona} from 'klona';
|
|
8
8
|
import {mockData} from './mock.data.js';
|
|
9
|
+
import {v4 as uuid} from 'uuid';
|
|
9
10
|
const require = createRequire(import.meta.url);
|
|
10
11
|
const {runOperation} = require('@digitalbazaar/webkms-switch');
|
|
11
12
|
|
|
12
|
-
const {util: {clone, uuid}} = bedrock;
|
|
13
|
-
|
|
14
13
|
describe('bulk operations', () => {
|
|
15
14
|
describe('Ed25519VerificationKey2020', () => {
|
|
16
15
|
let mockKeyId;
|
|
@@ -40,7 +39,7 @@ describe('bulk operations', () => {
|
|
|
40
39
|
this.timeout(0);
|
|
41
40
|
const promises = [];
|
|
42
41
|
for(let i = 0; i < operationCount; ++i) {
|
|
43
|
-
const operation =
|
|
42
|
+
const operation = klona(mockData.operations.sign);
|
|
44
43
|
operation.invocationTarget = mockKeyId;
|
|
45
44
|
operation.verifyData = vData[i];
|
|
46
45
|
promises.push(runOperation({
|
|
@@ -88,7 +87,7 @@ describe('bulk operations', () => {
|
|
|
88
87
|
this.timeout(0);
|
|
89
88
|
const promises = [];
|
|
90
89
|
for(let i = 0; i < operationCount; ++i) {
|
|
91
|
-
const operation =
|
|
90
|
+
const operation = klona(mockData.operations.sign);
|
|
92
91
|
operation.invocationTarget = mockKeyId;
|
|
93
92
|
operation.verifyData = vData[i];
|
|
94
93
|
promises.push(runOperation({
|
package/test/mocha/cryptoLd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2021-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import {createRequire} from 'module';
|
|
4
|
+
import {createRequire} from 'node:module';
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
6
6
|
const {CryptoLD} = require('crypto-ld');
|
|
7
7
|
const {Ed25519VerificationKey2018} =
|
package/test/mocha/helpers.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import * as bedrock from '@bedrock/core';
|
|
5
4
|
import * as brKms from '@bedrock/kms';
|
|
6
5
|
import * as database from '@bedrock/mongodb';
|
|
7
|
-
import {createRequire} from 'module';
|
|
6
|
+
import {createRequire} from 'node:module';
|
|
7
|
+
import {klona} from 'klona';
|
|
8
8
|
const require = createRequire(import.meta.url);
|
|
9
9
|
const {runOperation} = require('@digitalbazaar/webkms-switch');
|
|
10
10
|
const {generateId} = require('bnid');
|
|
11
11
|
|
|
12
|
-
const {util: {clone}} = bedrock;
|
|
13
|
-
|
|
14
12
|
export async function generateKey({mockData, type}) {
|
|
15
13
|
// create a keystore
|
|
16
14
|
const mockKeystoreId = `https://example.com/keystore/${await generateId()}`;
|
|
@@ -23,7 +21,7 @@ export async function generateKey({mockData, type}) {
|
|
|
23
21
|
await brKms.keystores.insert({config: keystore});
|
|
24
22
|
|
|
25
23
|
const keyId = `${mockKeystoreId}/keys/${await generateId()}`;
|
|
26
|
-
const operation =
|
|
24
|
+
const operation = klona(mockData.operations.generate({type}));
|
|
27
25
|
operation.invocationTarget.id = keyId;
|
|
28
26
|
operation.invocationTarget.type = type;
|
|
29
27
|
const moduleManager = brKms.defaultModuleManager;
|
package/test/package.json
CHANGED
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
"coverage-report": "c8 report"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@bedrock/core": "^
|
|
15
|
-
"@bedrock/did-context": "^
|
|
16
|
-
"@bedrock/did-io": "^
|
|
17
|
-
"@bedrock/https-agent": "^
|
|
18
|
-
"@bedrock/jsonld-document-loader": "^
|
|
14
|
+
"@bedrock/core": "^6.0.0",
|
|
15
|
+
"@bedrock/did-context": "^4.0.0",
|
|
16
|
+
"@bedrock/did-io": "^8.0.0",
|
|
17
|
+
"@bedrock/https-agent": "^4.0.0",
|
|
18
|
+
"@bedrock/jsonld-document-loader": "^3.0.0",
|
|
19
19
|
"@bedrock/kms": "file:..",
|
|
20
|
-
"@bedrock/ledger-context": "^
|
|
21
|
-
"@bedrock/mongodb": "^
|
|
22
|
-
"@bedrock/package-manager": "^
|
|
23
|
-
"@bedrock/security-context": "^
|
|
24
|
-
"@bedrock/ssm-mongodb": "^
|
|
25
|
-
"@bedrock/test": "^
|
|
26
|
-
"@bedrock/veres-one-context": "^
|
|
20
|
+
"@bedrock/ledger-context": "^23.0.0",
|
|
21
|
+
"@bedrock/mongodb": "^10.0.0",
|
|
22
|
+
"@bedrock/package-manager": "^3.0.0",
|
|
23
|
+
"@bedrock/security-context": "^7.0.0",
|
|
24
|
+
"@bedrock/ssm-mongodb": "^9.0.0",
|
|
25
|
+
"@bedrock/test": "^8.0.0",
|
|
26
|
+
"@bedrock/veres-one-context": "^14.0.0",
|
|
27
27
|
"@digitalbazaar/ed25519-verification-key-2018": "^3.1.1",
|
|
28
28
|
"@digitalbazaar/ed25519-verification-key-2020": "^3.1.0",
|
|
29
29
|
"@digitalbazaar/webkms-context": "^2.0.0",
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
"c8": "^7.11.0",
|
|
36
36
|
"cross-env": "^7.0.3",
|
|
37
37
|
"crypto-ld": "^6.0.0",
|
|
38
|
-
"
|
|
38
|
+
"klona": "^2.0.5",
|
|
39
|
+
"sha256-hmac-key-2019-context": "^1.0.3",
|
|
40
|
+
"uuid": "^8.3.2"
|
|
39
41
|
},
|
|
40
42
|
"c8": {
|
|
41
43
|
"excludeNodeModules": false,
|
package/test/test.config.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2019-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import {config} from '@bedrock/core';
|
|
5
|
-
import {fileURLToPath} from 'url';
|
|
6
|
-
import path from 'path';
|
|
5
|
+
import {fileURLToPath} from 'node:url';
|
|
6
|
+
import path from 'node:path';
|
|
7
7
|
import '@bedrock/mongodb';
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|