Signed URL

Generate images on demand with credentials stored on your backend

var CryptoJS = require("crypto-js");
const fetch = require("node-fetch");

const signedURL = "https://cdn.dynapik.com/signed/images/60c4d598225837023457d.jpg"; // Replace with your Signed URL in Console
const apiKey = "REPLACE_WITH_YOUR_KEY";
const templateId = signedURL.split('/').pop().split('.').shift();
const values = {
    price_1: "$123"
}

const d = Buffer.from(JSON.stringify(values), 'utf8').toString('base64')
const signed = CryptoJS.HmacSHA256(`${templateId}.${d}`,apiKey)

const s = signed.toString(CryptoJS.enc.Base64);

const serveURL = `${signedURL}?s=${s}&d=${d}`;

Last updated

Was this helpful?