moved hashapipath to reusable single helper

This commit is contained in:
2026-03-16 11:13:41 +00:00
parent 023a8e9e6d
commit 18dfc60754
74 changed files with 298 additions and 1149 deletions
+1 -14
View File
@@ -7,25 +7,12 @@ import { getToken } from "../../../actions/core/token";
import { getCaseBlob, createBlob } from "../../../actions/azurestorage";
import { getTempCaseRef } from "../../../components/utils";
import { v4 as uuidv4 } from "uuid";
const WORDKEY = process.env.HASHKEY;
import { hashAPIPath } from "../../../actions/core/hash";
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
//return "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var createCaseBody = req.body;
var contactid = req.query.contactid;