Compatibility with older versions of Node + decodeMedia bug fix

This commit is contained in:
Adhiraj
2020-05-15 22:00:12 +05:30
parent 80adc095a3
commit ea5ca61e49
7 changed files with 29 additions and 20 deletions

View File

@@ -252,7 +252,7 @@ module.exports = {
var buff = Utils.aesEncrypt(binary, this.authInfo.encKey) // encrypt it using AES and our encKey
const sign = Utils.hmacSign(buff, this.authInfo.macKey) // sign the message using HMAC and our macKey
tag = tag ?? Utils.generateMessageTag()
tag = tag || Utils.generateMessageTag()
buff = Buffer.concat([
Buffer.from(tag + ","), // generate & prefix the message tag
Buffer.from(tags), // prefix some bytes that tell whatsapp what the message is about
@@ -271,7 +271,7 @@ module.exports = {
*/
sendJSON: function (json, tag) {
const str = JSON.stringify(json)
tag = tag ?? Utils.generateMessageTag()
tag = tag || Utils.generateMessageTag()
this.send(tag + "," + str)
return tag
},