| 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] |