Webhooks
This section shows you how our webhook service works, what it delivers and explains its messages.
Pre-requisites
Security / Encryption
import * as crypto from 'crypto';
export class Decipher {
decipherAES_256_CBC(request: any) {
const CIPHER_KEY = 'YOUR-PLAIN-KEY';
const BASE64_PLAIN_IV = request.headers['x-pvt-cipher-iv'];
const BASE64_CIPHERED_MESSAGE = request.body;
const BUFFER_KEY = Buffer.from(CIPHER_KEY);
const BUFFER_IV = Buffer.from(BASE64_PLAIN_IV, 'base64');
const BUFFER_CIPHERED_MESSAGE = Buffer.from(BASE64_CIPHERED_MESSAGE, 'base64');
const DECIPHER = crypto.createDecipheriv('aes-256-cbc', BUFFER_KEY, BUFFER_IV);
DECIPHER.setAutoPadding(true);
let deciphered_message = DECIPHER.update(BUFFER_CIPHERED_MESSAGE, 'hex', 'utf8');
deciphered_message += DECIPHER.final('utf-8');
return deciphered_message.toString();
}
}Last updated