I am trying to generate a signature value which involved encoding a XML file, convert it into base64 string and url encode it using Node JS. The XML file will be present in the code repository and will be same for all cases.
So far, I have tried below option but the signature getting generated in not valid:
const xmlData = fs.readFileSync('./File.xml', 'utf8');
var gen_hmac = crypto.createHmac("sha256", {shared-key}).update(xmlData).digest("hex");
var signature = Buffer.from(gen_hmac, 'utf8').toString('base64');