sender-key: Properly digest new uint8array format keys. THANKS @w3nder!!

This commit is contained in:
Rajeh Taher
2025-09-09 23:57:30 +03:00
parent 2ebaaf35a4
commit 9aa356845d
3 changed files with 8 additions and 2 deletions
+2
View File
@@ -12,6 +12,8 @@ export class SenderChainKey {
this.iteration = iteration
if (chainKey instanceof Buffer) {
this.chainKey = chainKey
} else if (chainKey instanceof Uint8Array) {
this.chainKey = Buffer.from(chainKey)
} else {
this.chainKey = Buffer.from(chainKey || [])
}
+4
View File
@@ -98,6 +98,8 @@ export class SenderKeyState {
const publicKey = this.senderKeyStateStructure.senderSigningKey.public
if (publicKey instanceof Buffer) {
return publicKey
} else if (publicKey instanceof Uint8Array) {
return Buffer.from(publicKey)
} else if (typeof publicKey === 'string') {
return Buffer.from(publicKey, 'base64')
}
@@ -113,6 +115,8 @@ export class SenderKeyState {
if (privateKey instanceof Buffer) {
return privateKey
} else if (privateKey instanceof Uint8Array) {
return Buffer.from(privateKey)
} else if (typeof privateKey === 'string') {
return Buffer.from(privateKey, 'base64')
}
+2 -2
View File
@@ -1159,11 +1159,11 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
const altServer = jidDecode(alt)?.server
const lidMapping = signalRepository.getLIDMappingStore()
if (altServer === 'lid') {
if (!(await lidMapping.getPNForLID(alt))) {
if (typeof await lidMapping.getPNForLID(alt) == "string") {
await lidMapping.storeLIDPNMapping(alt, msg.key.participant || msg.key.remoteJid!)
}
} else {
if (!(await lidMapping.getLIDForPN(alt))) {
if (typeof await lidMapping.getLIDForPN(alt) == "string") {
await lidMapping.storeLIDPNMapping(msg.key.participant || msg.key.remoteJid!, alt)
}
}