Skip to content

Commit 3840c10

Browse files
Benjamin E. CoeAce Nassri
authored andcommitted
chore: update UUID to latest (#328)
1 parent 33d955a commit 3840c10

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

kms/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
"c8": "^7.0.0",
2121
"chai": "^4.2.0",
2222
"mocha": "^7.0.0",
23-
"uuid": "^3.3.3"
23+
"uuid": "^8.0.0"
2424
}
2525
}

kms/test/kms.test.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
const {describe, it, before, after, beforeEach, afterEach} = require('mocha');
1818
const {assert} = require('chai');
1919
const crypto = require('crypto');
20-
const uuidv4 = require('uuid/v4');
20+
const {v4} = require('uuid');
2121

2222
const {KeyManagementServiceClient} = require('@google-cloud/kms');
2323
const client = new KeyManagementServiceClient();
2424

2525
const projectId = process.env.GCLOUD_PROJECT;
2626
const locationId = 'us-east1';
27-
const keyRingId = uuidv4();
28-
const asymmetricDecryptKeyId = uuidv4();
29-
const asymmetricSignEcKeyId = uuidv4();
30-
const asymmetricSignRsaKeyId = uuidv4();
31-
const hsmKeyId = uuidv4();
32-
const symmetricKeyId = uuidv4();
27+
const keyRingId = v4();
28+
const asymmetricDecryptKeyId = v4();
29+
const asymmetricSignEcKeyId = v4();
30+
const asymmetricSignRsaKeyId = v4();
31+
const hsmKeyId = v4();
32+
const symmetricKeyId = v4();
3333

3434
const nodeMajorVersion = parseInt(process.version.match(/v?(\d+).*/)[1]);
3535

@@ -230,47 +230,47 @@ describe('Cloud KMS samples', () => {
230230

231231
it('creates asymmetric decryption keys', async () => {
232232
const sample = require('../createKeyAsymmetricDecrypt');
233-
const key = await sample.main(projectId, locationId, keyRingId, uuidv4());
233+
const key = await sample.main(projectId, locationId, keyRingId, v4());
234234
assert.equal(key.purpose, 'ASYMMETRIC_DECRYPT');
235235
assert.equal(key.versionTemplate.algorithm, 'RSA_DECRYPT_OAEP_2048_SHA256');
236236
});
237237

238238
it('creates asymmetric signing keys', async () => {
239239
const sample = require('../createKeyAsymmetricSign');
240-
const key = await sample.main(projectId, locationId, keyRingId, uuidv4());
240+
const key = await sample.main(projectId, locationId, keyRingId, v4());
241241
assert.equal(key.purpose, 'ASYMMETRIC_SIGN');
242242
assert.equal(key.versionTemplate.algorithm, 'RSA_SIGN_PKCS1_2048_SHA256');
243243
});
244244

245245
it('creates hsm keys', async () => {
246246
const sample = require('../createKeyHsm');
247-
const key = await sample.main(projectId, locationId, keyRingId, uuidv4());
247+
const key = await sample.main(projectId, locationId, keyRingId, v4());
248248
assert.equal(key.versionTemplate.protectionLevel, 'HSM');
249249
});
250250

251251
it('creates labeled keys', async () => {
252252
const sample = require('../createKeyLabels');
253-
const key = await sample.main(projectId, locationId, keyRingId, uuidv4());
253+
const key = await sample.main(projectId, locationId, keyRingId, v4());
254254
assert.equal(key.labels.team, 'alpha');
255255
assert.equal(key.labels.cost_center, 'cc1234');
256256
});
257257

258258
it('creates key rings', async () => {
259259
const sample = require('../createKeyRing');
260-
const keyRing = await sample.main(projectId, locationId, uuidv4());
260+
const keyRing = await sample.main(projectId, locationId, v4());
261261
assert.match(keyRing.name, new RegExp(`${locationId}`));
262262
});
263263

264264
it('creates rotating keys', async () => {
265265
const sample = require('../createKeyRotationSchedule');
266-
const key = await sample.main(projectId, locationId, keyRingId, uuidv4());
266+
const key = await sample.main(projectId, locationId, keyRingId, v4());
267267
assert.exists(key.rotationPeriod);
268268
assert.exists(key.nextRotationTime);
269269
});
270270

271271
it('creates symmetric keys', async () => {
272272
const sample = require('../createKeySymmetricEncryptDecrypt');
273-
const key = await sample.main(projectId, locationId, keyRingId, uuidv4());
273+
const key = await sample.main(projectId, locationId, keyRingId, v4());
274274
assert.equal(key.purpose, 'ENCRYPT_DECRYPT');
275275
assert.equal(key.versionTemplate.algorithm, 'GOOGLE_SYMMETRIC_ENCRYPTION');
276276
});

0 commit comments

Comments
 (0)