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
@@ -27,6 +27,7 @@ import { type BinaryNode, getBinaryNodeChild, getBinaryNodeChildBuffer, jidNorma
|
||||
import { aesDecryptGCM, aesEncryptGCM, hkdf } from './crypto'
|
||||
import { generateMessageIDV2 } from './generics'
|
||||
import type { ILogger } from './logger'
|
||||
import { decodeAndHydrate } from './proto-utils'
|
||||
|
||||
const getTmpFilesDirectory = () => tmpdir()
|
||||
|
||||
@@ -783,7 +784,7 @@ export const decryptMediaRetryData = async (
|
||||
) => {
|
||||
const retryKey = await getMediaRetryKey(mediaKey)
|
||||
const plaintext = aesDecryptGCM(ciphertext, retryKey, iv, Buffer.from(msgId))
|
||||
return proto.MediaRetryNotification.decode(plaintext)
|
||||
return decodeAndHydrate(proto.MediaRetryNotification, plaintext)
|
||||
}
|
||||
|
||||
export const getStatusCodeForMediaRetry = (code: number) =>
|
||||
|
||||
Reference in New Issue
Block a user