Complete integration guide for authenticating HTTP requests, logging field activities, and verifying inbound webhook cryptographic signatures within the Keyft protocol.
All outbound requests from external clients or edge workers to our backend cluster must include your production API Key (kft_live_...) within the HTTP header using the Bearer Token authorization scheme.
curl -X POST "/api/client/settings" \
-H "Authorization: Bearer kft_live_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"vpn_check_enabled": 1,
"gps_check_enabled": 1,
"tamper_check_enabled": 1,
"max_gps_accuracy": 50,
"vpn_action": "BLOCKED",
"gps_action": "CHALLENGED",
"tamper_action": "BLOCKED"
}'
const apiKey = 'kft_live_YOUR_SECRET_KEY';
const response = await fetch('/api/client/runtime-health', {
method: 'GET',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
const result = await response.json();
console.log('Runtime Health Status:', result);
To prevent Man-in-the-Middle (MITM) attacks and third-party payload spoofing (including requests destined for SAP Enterprise Gateways or custom middleware listeners), every outbound webhook event attaches a cryptographic HMAC-SHA256 signature to the X-KeyFT-Signature HTTP header.
Your receiving endpoint must verify this digital signature using your unique Signing Secret (whsec_...) issued during webhook endpoint creation.
const express = require('express');
const crypto = require('crypto');
const app = express();
app.use('/api/webhook-receiver', express.raw({ type: 'application/json' }));
app.post('/api/webhook-receiver', (req, res) => {
const SIGNING_SECRET = 'whsec_YOUR_WEBHOOK_SIGNING_SECRET';
const clientSignature = req.headers['x-keyft-signature'];
if (!clientSignature) {
return res.status(401).json({ error: 'Missing X-KeyFT-Signature header' });
}
const calculatedHash = crypto
.createHmac('sha256', SIGNING_SECRET)
.update(req.body)
.digest('hex');
const isValid = crypto.timingSafeEqual(
Buffer.from(clientSignature, 'utf-8'),
Buffer.from(calculatedHash, 'utf-8')
);
if (!isValid) {
return res.status(403).json({ error: 'Invalid HMAC signature verification failed' });
}
const payload = JSON.parse(req.body.toString());
console.log('Webhook Event Verified & Received:', payload);
res.status(200).json({ success: true, status: 'DELIVERED' });
});
app.listen(3000, () => console.log('Webhook Listener server running on port 3000'));