API Integration

You can use this API to create new sessions or get existing session link

Generate hmac signature

const crypto = require('crypto');

const generateHmac = (httpMethod, url, body, contentType, xAuthClient, secretKey) => {
  const requestUrl = new URL(url);
  const requestPath = requestUrl.pathname;
  const queryParams = requestUrl.searchParams.toString();

  const dataToHash = `${httpMethod}\n${requestPath}\n${queryParams}\n${xAuthClient}\n${contentType}\n${body}`;

  const hmac = crypto.createHmac('sha256', secretKey);
  hmac.update(dataToHash);
  return hmac.digest('hex');
};
let httpMethod = "POST";
const url = "https://start.faceverify.ai/api/v1/session";
const body = JSON.stringify({
    country: country,
    uniqueIdentifier,
});
const contentType = "application/json";
//xAuthClient is your apiKey
const xAuthClient = "xxx-xxx-xxx-xxx-xxx"
const secretKey = "xxx-xxx-xxx-xxx-xxx";
const hmacSignature = generateHmac(httpMethod,url,body,contentType,xAuthClient,secretKey);
console.log(hmacSignature);

Last updated