Fetch stories + broadcast list info

This commit is contained in:
Adhiraj
2020-07-13 13:45:46 +05:30
parent 2aca2f7485
commit 51484df602
7 changed files with 167 additions and 97 deletions

View File

@@ -77,11 +77,11 @@ export function errorOnNon200Status(p: Promise<any>) {
}
export function decryptWA (message: any, macKey: Buffer, encKey: Buffer, decoder: Decoder, fromMe: boolean=false): [string, Object, [number, number]?] {
const commaIndex = message.indexOf(',') // all whatsapp messages have a tag and a comma, followed by the actual message
if (commaIndex < 0) {
// if there was no comma, then this message must be not be valid
throw Error ('invalid message: ' + message)
}
let commaIndex = message.indexOf(',') // all whatsapp messages have a tag and a comma, followed by the actual message
if (commaIndex < 0) throw Error ('invalid message: ' + message) // if there was no comma, then this message must be not be valid
if (message[commaIndex+1] === ',') commaIndex += 1
let data = message.slice(commaIndex+1, message.length)
// get the message tag.
// If a query was done, the server will respond with the same message tag we sent the query with