fix: harden Protobuf Deserialization and Refactor Utilities (#1820)
* refactor: reorganize browser utility functions and improve buffer handling * fix: harden protobuf deserialization and clean up code * refactor: simplify data handling in GroupCipher and SenderKey classes * fix: Ensure consistent Buffer hydration and remove redundant code * refactor: update decodeAndHydrate calls to use proto types for improved type safety
This commit is contained in:
committed by
GitHub
parent
202c39f3fe
commit
3b46d43beb
@@ -1,5 +1,6 @@
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { decodeAndHydrate } from '../Utils/proto-utils'
|
||||
import { type BinaryNode } from './types'
|
||||
|
||||
// some extra useful utilities
|
||||
@@ -78,7 +79,7 @@ export const getBinaryNodeMessages = ({ content }: BinaryNode) => {
|
||||
if (Array.isArray(content)) {
|
||||
for (const item of content) {
|
||||
if (item.tag === 'message') {
|
||||
msgs.push(proto.WebMessageInfo.decode(item.content as Buffer))
|
||||
msgs.push(decodeAndHydrate(proto.WebMessageInfo, item.content as Buffer))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user