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
@@ -9,16 +9,7 @@ export class SenderChainKey {
|
||||
|
||||
constructor(iteration: number, chainKey: Uint8Array | Buffer) {
|
||||
this.iteration = iteration
|
||||
if (Buffer.isBuffer(chainKey)) {
|
||||
this.chainKey = chainKey
|
||||
} else if (chainKey instanceof Uint8Array) {
|
||||
this.chainKey = Buffer.from(chainKey)
|
||||
} else if (chainKey && typeof chainKey === 'object') {
|
||||
// backported from @MartinSchere (#1741)
|
||||
this.chainKey = Buffer.from(Object.values(chainKey)) // temp fix // backported from @MartinSchere (#1741)
|
||||
} else {
|
||||
this.chainKey = Buffer.alloc(0)
|
||||
}
|
||||
this.chainKey = Buffer.from(chainKey)
|
||||
}
|
||||
|
||||
public getIteration(): number {
|
||||
|
||||
Reference in New Issue
Block a user