zalo_encrypt_params.js

Home   »   zalo_encrypt_params.js

const CryptoJS = require('crypto-js')

const e = {
	message: "test phát nữa", 
	clientId: null, // type: Number 
	toid: "" // type: String
}

const getParam = e => {
	const t = CryptoJS.enc.Base64.parse('kMj/NDripXEt4d7Fm9PlwQ==')
	const iv = CryptoJS.enc.Hex.parse('00000000000000000000000000000000')
	const mode = CryptoJS.mode.CBC
	const padding = CryptoJS.pad.Pkcs7
	return CryptoJS.AES.encrypt(JSON.stringify(e), t, {
		iv, mode, padding
	}).ciphertext.toString(CryptoJS.enc.Base64)
}

Leave a Reply

Your email address will not be published. Required fields are marked *