13 lines
335 B
JavaScript
13 lines
335 B
JavaScript
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;
|