Signature
The "Signature" header is a body converted from JSON to a string and then HMAC SHA256 signed with a private key.
Example
const crypto = require('crypto');
function createHmacSha256(data, secretKey) {
const queryString = Object.keys(data)
.map(key => `${key}=${data[key]}`)
.join('&');
const signature = crypto
.createHmac('sha256', secretKey)
.update(queryString)
.digest('hex');
return signature;
}
const body = { uniq_id: "0sv0c0c02da105aa6b7fbzf1zv05444d8a0ccd4c" };
console.log(createHmacSha256(body, "Your Private Key"));
import hmac
import hashlib
import json
def create_hmac_sha256(data: dict, secret_key: str):
query_string = '&'.join([f"{key}={value}" for key, value in data.items()])
signature = hmac.new(secret_key.encode('utf-8'), query_string.encode('utf-8'), hashlib.sha256).hexdigest()
return signature
body = { "uniq_id": "0sv0c0c02da105aa6b7fbzf1zv05444d8a0ccd4c" }
print(create_hmac_sha256(body, "Your Private Key"))