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

Function signMac

kms/signMac.js:51–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49 );
50
51 async function signMac() {
52 // Sign the data with Cloud KMS
53 const [signResponse] = await client.macSign({
54 name: versionName,
55 data: data,
56 });
57
58 // Example of how to display signature. Because the signature is in a binary
59 // format, you need to encode the output before printing it to a console or
60 // displaying it on a screen.
61 const encoded = signResponse.mac.toString('base64');
62 console.log(`Signature: ${encoded}`);
63
64 return signResponse;
65 }
66
67 return signMac();
68 // [END kms_sign_mac]

Callers 1

mainFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected