@pure0cd/freefire-api
Version:
A powerful Node.js library to interact with Garena Free Fire API using Protobuf. Login, Search Players, and get Profile Stats.
16 lines (13 loc) • 463 B
JavaScript
const crypto = require('crypto');
const { AE } = require('./constants');
/**
* Encrypts data using AES-128-CBC with PKCS7 padding.
* @param {Buffer} buffer - The data to encrypt
* @returns {Buffer} Encrypted data
*/
function encrypt(buffer) {
const cipher = crypto.createCipheriv('aes-128-cbc', AE.MAIN_KEY, AE.MAIN_IV);
const encrypted = Buffer.concat([cipher.update(buffer), cipher.final()]);
return encrypted;
}
module.exports = { encrypt };