mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: implement privacy token fetch
This commit is contained in:
@@ -494,12 +494,43 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
return msgId
|
return msgId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPrivacyTokens = async(jids: string[]) => {
|
||||||
|
const t = unixTimestampSeconds().toString()
|
||||||
|
const result = await query({
|
||||||
|
tag: 'iq',
|
||||||
|
attrs: {
|
||||||
|
to: S_WHATSAPP_NET,
|
||||||
|
type: 'set',
|
||||||
|
xmlns: 'privacy'
|
||||||
|
},
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
tag: 'tokens',
|
||||||
|
attrs: { },
|
||||||
|
content: jids.map(
|
||||||
|
jid => ({
|
||||||
|
tag: 'token',
|
||||||
|
attrs: {
|
||||||
|
jid: jidNormalizedUser(jid),
|
||||||
|
t,
|
||||||
|
type: 'trusted_contact'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
const waUploadToServer = getWAUploadToServer(config, refreshMediaConn)
|
const waUploadToServer = getWAUploadToServer(config, refreshMediaConn)
|
||||||
|
|
||||||
const waitForMsgMediaUpdate = bindWaitForEvent(ev, 'messages.media-update')
|
const waitForMsgMediaUpdate = bindWaitForEvent(ev, 'messages.media-update')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...sock,
|
...sock,
|
||||||
|
getPrivacyTokens,
|
||||||
assertSessions,
|
assertSessions,
|
||||||
relayMessage,
|
relayMessage,
|
||||||
sendReceipt,
|
sendReceipt,
|
||||||
|
|||||||
Reference in New Issue
Block a user