Unread fix + regen QR code changes + Browser message decoding
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import fs from 'fs'
|
||||
import { decryptWA } from './Utils'
|
||||
import Decoder from '../Binary/Decoder'
|
||||
|
||||
interface BrowserMessagesInfo {
|
||||
encKey: string,
|
||||
macKey: string,
|
||||
messages: string[]
|
||||
}
|
||||
const file = fs.readFileSync ('./browser-messages.json', {encoding: 'utf-8'})
|
||||
const json: BrowserMessagesInfo = JSON.parse (file)
|
||||
|
||||
const encKey = Buffer.from (json.encKey, 'base64')
|
||||
const macKey = Buffer.from (json.macKey, 'base64')
|
||||
|
||||
const decrypt = buffer => {
|
||||
try {
|
||||
return decryptWA (buffer, macKey, encKey, new Decoder())
|
||||
} catch {
|
||||
return decryptWA (buffer, macKey, encKey, new Decoder(), true)
|
||||
}
|
||||
}
|
||||
|
||||
json.messages.forEach ((str, i) => {
|
||||
const buffer = Buffer.from (str, 'hex')
|
||||
try {
|
||||
const [tag, json, binaryTags] = decrypt (buffer)
|
||||
console.log (
|
||||
`
|
||||
${i}.
|
||||
messageTag: ${tag}
|
||||
output: ${JSON.stringify(json)}
|
||||
binaryTags: ${binaryTags}
|
||||
`
|
||||
)
|
||||
} catch (error) {
|
||||
console.error (`received error in decoding ${i}: ${error}`)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user