feature/IO-2282-VSSTA-Integration: - doc blocks / cleanup

This commit is contained in:
Dave Richer
2025-04-15 13:05:42 -04:00
parent 0b7a23d555
commit 6035d94404
3 changed files with 32 additions and 0 deletions

View File

@@ -1,3 +1,8 @@
/**
* @description Converts a string to a base64url encoded string.
* @param str
* @returns {string}
*/
const base64UrlEncode = (str) =>
Buffer.from(str).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");

View File

@@ -2,6 +2,11 @@ const crypto = require("crypto");
const imgproxyKey = process.env.IMGPROXY_KEY;
/**
* @description Creates a HMAC SHA-256 hash of the given data.
* @param data
* @returns {string}
*/
const createHmacSha256 = (data) => crypto.createHmac("sha256", imgproxyKey).update(data).digest("base64url");
module.exports = createHmacSha256;