MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / createKeyMac

Function createKeyMac

kms/createKeyMac.js:41–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39 const keyRingName = client.keyRingPath(projectId, locationId, keyRingId);
40
41 async function createKeyMac() {
42 const [key] = await client.createCryptoKey({
43 parent: keyRingName,
44 cryptoKeyId: id,
45 cryptoKey: {
46 purpose: 'MAC',
47 versionTemplate: {
48 algorithm: 'HMAC_SHA256',
49 },
50
51 // Optional: customize how long key versions should be kept before
52 // destroying.
53 destroyScheduledDuration: {seconds: 60 * 60 * 24},
54 },
55 });
56
57 console.log(`Created mac key: ${key.name}`);
58 return key;
59 }
60
61 return createKeyMac();
62 // [END kms_create_key_mac]

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected