chats: stop using getMessage to decrypt poll votes

The new expected behavior is to decrypt the new votes yourself like in the Example.ts file
This commit is contained in:
Rajeh Taher
2025-03-14 23:40:33 +02:00
parent a29138758c
commit b7a9f7bd67
2 changed files with 7 additions and 8 deletions

View File

@@ -896,7 +896,6 @@ export const makeChatsSocket = (config: SocketConfig) => {
keyStore: authState.keys,
logger,
options: config.options,
getMessage: config.getMessage,
}
)
])

View File

@@ -1,10 +1,10 @@
import { AxiosRequestConfig } from 'axios'
import { proto } from '../../WAProto'
import { AuthenticationCreds, BaileysEventEmitter, CacheStore, Chat, GroupMetadata, ParticipantAction, RequestJoinAction, RequestJoinMethod, SignalKeyStoreWithTransaction, SocketConfig, WAMessageStubType } from '../Types'
import { AuthenticationCreds, BaileysEventEmitter, CacheStore, Chat, GroupMetadata, ParticipantAction, RequestJoinAction, RequestJoinMethod, SignalKeyStoreWithTransaction, WAMessageStubType } from '../Types'
import { getContentType, normalizeMessageContent } from '../Utils/messages'
import { areJidsSameUser, isJidBroadcast, isJidStatusBroadcast, jidNormalizedUser } from '../WABinary'
import { aesDecryptGCM, hmacSign } from './crypto'
import { getKeyAuthor, toNumber } from './generics'
import { toNumber } from './generics'
import { downloadAndProcessHistorySyncNotification } from './history'
import { ILogger } from './logger'
@@ -14,7 +14,6 @@ type ProcessMessageContext = {
creds: AuthenticationCreds
keyStore: SignalKeyStoreWithTransaction
ev: BaileysEventEmitter
getMessage: SocketConfig['getMessage']
logger?: ILogger
options: AxiosRequestConfig<{}>
}
@@ -158,8 +157,7 @@ const processMessage = async(
creds,
keyStore,
logger,
options,
getMessage
options
}: ProcessMessageContext
) => {
const meId = creds.me!.id
@@ -418,9 +416,11 @@ const processMessage = async(
break
}
} else if(content?.pollUpdateMessage) {
} /* else if(content?.pollUpdateMessage) {
const creationMsgKey = content.pollUpdateMessage.pollCreationMessageKey!
// we need to fetch the poll creation message to get the poll enc key
// TODO: make standalone, remove getMessage reference
// TODO: Remove entirely
const pollMsg = await getMessage(creationMsgKey)
if(pollMsg) {
const meIdNormalised = jidNormalizedUser(meId)
@@ -464,7 +464,7 @@ const processMessage = async(
'poll creation message not found, cannot decrypt update'
)
}
}
} */
if(Object.keys(chat).length > 1) {
ev.emit('chats.update', [chat])