@hansaka02/baileys 7.3.2 → 7.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +247 -203
- package/lib/Defaults/connection.js +51 -0
- package/lib/Defaults/constants.js +62 -0
- package/lib/Defaults/history.js +17 -0
- package/lib/Defaults/index.js +36 -142
- package/lib/Defaults/media.js +48 -0
- package/lib/Defaults/prefix.js +18 -0
- package/lib/Signal/Group/group-session-builder.js +10 -42
- package/lib/Signal/Group/group_cipher.js +9 -6
- package/lib/Signal/Group/index.js +39 -53
- package/lib/Signal/Group/keyhelper.js +8 -41
- package/lib/Signal/Group/sender-chain-key.js +4 -4
- package/lib/Signal/Group/sender-key-distribution-message.js +5 -5
- package/lib/Signal/Group/sender-key-message.js +12 -8
- package/lib/Signal/Group/sender-key-record.js +7 -7
- package/lib/Signal/Group/sender-key-state.js +4 -4
- package/lib/Signal/Group/sender-message-key.js +2 -2
- package/lib/Signal/libsignal.js +45 -69
- package/lib/Signal/lid-mapping.js +15 -11
- package/lib/Socket/Client/types.js +2 -2
- package/lib/Socket/Client/websocket.js +16 -14
- package/lib/Socket/business.js +41 -32
- package/lib/Socket/chats.js +123 -98
- package/lib/Socket/community.js +50 -40
- package/lib/Socket/groups.js +59 -47
- package/lib/Socket/index.js +4 -4
- package/lib/Socket/messages-recv.js +219 -172
- package/lib/Socket/messages-send.js +187 -143
- package/lib/Socket/newsletter.js +61 -47
- package/lib/Socket/socket.js +133 -90
- package/lib/Socket/usync.js +6 -6
- package/lib/Store/index.js +27 -11
- package/lib/Store/make-cache-manager-store.js +14 -15
- package/lib/Store/make-in-memory-store.js +28 -24
- package/lib/Types/LabelAssociation.js +2 -2
- package/lib/Types/Message.js +6 -6
- package/lib/Types/MexUpdates.js +5 -5
- package/lib/Types/State.js +4 -4
- package/lib/Types/index.js +28 -12
- package/lib/Utils/auth-utils.js +28 -26
- package/lib/Utils/baileys-event-stream.js +68 -69
- package/lib/Utils/business.js +63 -53
- package/lib/Utils/chat-utils.js +81 -71
- package/lib/Utils/crypto.js +25 -45
- package/lib/Utils/decode-wa-message.js +319 -311
- package/lib/Utils/event-buffer.js +21 -22
- package/lib/Utils/generics.js +65 -82
- package/lib/Utils/history.js +21 -21
- package/lib/Utils/index.js +27 -13
- package/lib/Utils/link-preview.js +7 -30
- package/lib/Utils/logger.js +5 -5
- package/lib/Utils/lt-hash.js +3 -3
- package/lib/Utils/message-retry-manager.js +4 -4
- package/lib/Utils/messages-media.js +104 -109
- package/lib/Utils/messages.js +203 -171
- package/lib/Utils/noise-handler.js +28 -19
- package/lib/Utils/process-message.js +111 -96
- package/lib/Utils/signal.js +36 -25
- package/lib/Utils/use-multi-file-auth-state.js +18 -22
- package/lib/Utils/validate-connection.js +52 -45
- package/lib/WABinary/decode.js +6 -32
- package/lib/WABinary/encode.js +3 -29
- package/lib/WABinary/generic-utils.js +4 -4
- package/lib/WABinary/index.js +27 -11
- package/lib/WAM/encode.js +16 -8
- package/lib/WAM/index.js +27 -11
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +20 -16
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +7 -4
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -2
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -2
- package/lib/WAUSync/Protocols/index.js +27 -11
- package/lib/WAUSync/USyncQuery.js +17 -10
- package/lib/WAUSync/index.js +27 -11
- package/lib/index.js +60 -31
- package/package.json +8 -14
- package/WAProto/AICommon/AICommon.d.ts +0 -11702
- package/WAProto/Adv/Adv.d.ts +0 -643
- package/WAProto/BotMetadata/BotMetadata.d.ts +0 -5654
- package/WAProto/Cert/Cert.d.ts +0 -613
- package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +0 -476
- package/WAProto/CompanionReg/CompanionReg.d.ts +0 -1361
- package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +0 -577
- package/WAProto/E2E/E2E.d.ts +0 -41724
- package/WAProto/Ephemeral/Ephemeral.d.ts +0 -114
- package/WAProto/HistorySync/HistorySync.d.ts +0 -51700
- package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +0 -229
- package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +0 -583
- package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +0 -42897
- package/WAProto/MmsRetry/MmsRetry.d.ts +0 -243
- package/WAProto/Protocol/Protocol.d.ts +0 -270
- package/WAProto/Reporting/Reporting.d.ts +0 -371
- package/WAProto/ServerSync/ServerSync.d.ts +0 -1285
- package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +0 -1868
- package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +0 -767
- package/WAProto/StatusAttributions/StatusAttributions.d.ts +0 -1027
- package/WAProto/SyncAction/SyncAction.d.ts +0 -11193
- package/WAProto/UserPassword/UserPassword.d.ts +0 -363
- package/WAProto/VnameCert/VnameCert.d.ts +0 -821
- package/WAProto/Wa6/Wa6.d.ts +0 -2128
- package/WAProto/Web/Web.d.ts +0 -46383
- package/WAProto/index.d.ts +0 -55
- package/lib/Defaults/index.d.ts +0 -77
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
- package/lib/Signal/Group/group-session-builder.d.ts +0 -17
- package/lib/Signal/Group/group_cipher.d.ts +0 -19
- package/lib/Signal/Group/index.d.ts +0 -11
- package/lib/Signal/Group/keyhelper.d.ts +0 -16
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
- package/lib/Signal/Group/sender-key-message.d.ts +0 -19
- package/lib/Signal/Group/sender-key-name.d.ts +0 -19
- package/lib/Signal/Group/sender-key-record.d.ts +0 -32
- package/lib/Signal/Group/sender-key-state.d.ts +0 -44
- package/lib/Signal/Group/sender-message-key.d.ts +0 -11
- package/lib/Signal/libsignal.d.ts +0 -8
- package/lib/Signal/lid-mapping.d.ts +0 -28
- package/lib/Socket/Client/index.d.ts +0 -2
- package/lib/Socket/Client/types.d.ts +0 -16
- package/lib/Socket/Client/websocket.d.ts +0 -13
- package/lib/Socket/business.d.ts +0 -187
- package/lib/Socket/chats.d.ts +0 -97
- package/lib/Socket/community.d.ts +0 -129
- package/lib/Socket/groups.d.ts +0 -129
- package/lib/Socket/index.d.ts +0 -191
- package/lib/Socket/messages-recv.d.ts +0 -174
- package/lib/Socket/messages-send.d.ts +0 -165
- package/lib/Socket/newsletter.d.ts +0 -145
- package/lib/Socket/socket.d.ts +0 -45
- package/lib/Socket/usync.d.ts +0 -37
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/make-cache-manager-store.d.ts +0 -14
- package/lib/Store/make-in-memory-store.d.ts +0 -123
- package/lib/Store/make-ordered-dictionary.d.ts +0 -12
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Types/Auth.d.ts +0 -121
- package/lib/Types/Bussiness.d.ts +0 -28
- package/lib/Types/Call.d.ts +0 -14
- package/lib/Types/Chat.d.ts +0 -143
- package/lib/Types/Contact.d.ts +0 -23
- package/lib/Types/Events.d.ts +0 -226
- package/lib/Types/GroupMetadata.d.ts +0 -66
- package/lib/Types/Label.d.ts +0 -48
- package/lib/Types/LabelAssociation.d.ts +0 -35
- package/lib/Types/Message.d.ts +0 -484
- package/lib/Types/MexUpdates.d.ts +0 -9
- package/lib/Types/Newsletter.d.ts +0 -109
- package/lib/Types/Product.d.ts +0 -92
- package/lib/Types/Signal.d.ts +0 -98
- package/lib/Types/Socket.d.ts +0 -141
- package/lib/Types/State.d.ts +0 -41
- package/lib/Types/USync.d.ts +0 -26
- package/lib/Types/index.d.ts +0 -80
- package/lib/Utils/auth-utils.d.ts +0 -21
- package/lib/Utils/baileys-event-stream.d.ts +0 -18
- package/lib/Utils/business.d.ts +0 -29
- package/lib/Utils/chat-utils.d.ts +0 -82
- package/lib/Utils/crypto.d.ts +0 -56
- package/lib/Utils/decode-wa-message.d.ts +0 -53
- package/lib/Utils/event-buffer.d.ts +0 -39
- package/lib/Utils/generics.d.ts +0 -117
- package/lib/Utils/history.d.ts +0 -23
- package/lib/Utils/index.d.ts +0 -20
- package/lib/Utils/link-preview.d.ts +0 -23
- package/lib/Utils/logger.d.ts +0 -13
- package/lib/Utils/lt-hash.d.ts +0 -14
- package/lib/Utils/make-mutex.d.ts +0 -9
- package/lib/Utils/message-retry-manager.d.ts +0 -88
- package/lib/Utils/messages-media.d.ts +0 -135
- package/lib/Utils/messages.d.ts +0 -105
- package/lib/Utils/noise-handler.d.ts +0 -20
- package/lib/Utils/process-message.d.ts +0 -49
- package/lib/Utils/signal.d.ts +0 -42
- package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-mongo-file-auth-state.js +0 -84
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-single-file-auth-state.js +0 -80
- package/lib/Utils/validate-connection.d.ts +0 -13
- package/lib/WABinary/constants.d.ts +0 -30
- package/lib/WABinary/decode.d.ts +0 -9
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/generic-utils.d.ts +0 -28
- package/lib/WABinary/index.d.ts +0 -5
- package/lib/WABinary/jid-utils.d.ts +0 -58
- package/lib/WABinary/types.d.ts +0 -22
- package/lib/WAM/BinaryInfo.d.ts +0 -16
- package/lib/WAM/constants.d.ts +0 -47
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/index.d.ts +0 -3
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -26
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -14
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -14
- package/lib/WAUSync/Protocols/index.d.ts +0 -6
- package/lib/WAUSync/USyncQuery.d.ts +0 -31
- package/lib/WAUSync/USyncUser.d.ts +0 -12
- package/lib/WAUSync/index.d.ts +0 -3
- package/lib/index.d.ts +0 -13
|
@@ -2,11 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const { Boom } = require("@hapi/boom")
|
|
6
|
+
const { proto } = require("../../WAProto")
|
|
7
|
+
const {
|
|
8
|
+
NOISE_MODE,
|
|
9
|
+
WA_CERT_DETAILS
|
|
10
|
+
} = require("../Defaults/constants")
|
|
11
|
+
const { decodeBinaryNode } = require("../WABinary")
|
|
12
|
+
const {
|
|
13
|
+
aesDecryptGCM,
|
|
14
|
+
aesEncryptGCM,
|
|
15
|
+
Curve,
|
|
16
|
+
hkdf,
|
|
17
|
+
sha256
|
|
18
|
+
} = require("./crypto")
|
|
10
19
|
|
|
11
20
|
const generateIV = (counter) => {
|
|
12
21
|
const iv = new ArrayBuffer(12)
|
|
@@ -18,11 +27,11 @@ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey },
|
|
|
18
27
|
logger = logger.child({ class: 'ns' })
|
|
19
28
|
const authenticate = (data) => {
|
|
20
29
|
if (!isFinished) {
|
|
21
|
-
hash =
|
|
30
|
+
hash = sha256(Buffer.concat([hash, data]))
|
|
22
31
|
}
|
|
23
32
|
}
|
|
24
33
|
const encrypt = (plaintext) => {
|
|
25
|
-
const result =
|
|
34
|
+
const result = aesEncryptGCM(plaintext, encKey, generateIV(writeCounter), hash)
|
|
26
35
|
writeCounter += 1
|
|
27
36
|
authenticate(result)
|
|
28
37
|
return result
|
|
@@ -31,7 +40,7 @@ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey },
|
|
|
31
40
|
// before the handshake is finished, we use the same counter
|
|
32
41
|
// after handshake, the counters are different
|
|
33
42
|
const iv = generateIV(isFinished ? readCounter : writeCounter)
|
|
34
|
-
const result =
|
|
43
|
+
const result = aesDecryptGCM(ciphertext, decKey, iv, hash)
|
|
35
44
|
if (isFinished) {
|
|
36
45
|
readCounter += 1
|
|
37
46
|
}
|
|
@@ -42,7 +51,7 @@ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey },
|
|
|
42
51
|
return result
|
|
43
52
|
}
|
|
44
53
|
const localHKDF = async (data) => {
|
|
45
|
-
const key = await
|
|
54
|
+
const key = await hkdf(Buffer.from(data), 64, { salt, info: '' })
|
|
46
55
|
return [key.slice(0, 32), key.slice(32)]
|
|
47
56
|
}
|
|
48
57
|
const mixIntoKey = async (data) => {
|
|
@@ -62,8 +71,8 @@ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey },
|
|
|
62
71
|
writeCounter = 0
|
|
63
72
|
isFinished = true
|
|
64
73
|
}
|
|
65
|
-
const data = Buffer.from(
|
|
66
|
-
let hash = data.byteLength === 32 ? data :
|
|
74
|
+
const data = Buffer.from(NOISE_MODE)
|
|
75
|
+
let hash = data.byteLength === 32 ? data : sha256(data)
|
|
67
76
|
let salt = hash
|
|
68
77
|
let encKey = hash
|
|
69
78
|
let decKey = hash
|
|
@@ -82,17 +91,17 @@ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey },
|
|
|
82
91
|
finishInit,
|
|
83
92
|
processHandshake: async ({ serverHello }, noiseKey) => {
|
|
84
93
|
authenticate(serverHello.ephemeral)
|
|
85
|
-
await mixIntoKey(
|
|
94
|
+
await mixIntoKey(Curve.sharedKey(privateKey, serverHello.ephemeral))
|
|
86
95
|
const decStaticContent = decrypt(serverHello.static)
|
|
87
|
-
await mixIntoKey(
|
|
96
|
+
await mixIntoKey(Curve.sharedKey(privateKey, decStaticContent))
|
|
88
97
|
const certDecoded = decrypt(serverHello.payload)
|
|
89
|
-
const { intermediate: certIntermediate } =
|
|
90
|
-
const { issuerSerial } =
|
|
91
|
-
if (issuerSerial !==
|
|
92
|
-
throw new
|
|
98
|
+
const { intermediate: certIntermediate } = proto.CertChain.decode(certDecoded)
|
|
99
|
+
const { issuerSerial } = proto.CertChain.NoiseCertificate.Details.decode(certIntermediate.details)
|
|
100
|
+
if (issuerSerial !== WA_CERT_DETAILS.SERIAL) {
|
|
101
|
+
throw new Boom('certification match failed', { statusCode: 400 })
|
|
93
102
|
}
|
|
94
103
|
const keyEnc = encrypt(noiseKey.public)
|
|
95
|
-
await mixIntoKey(
|
|
104
|
+
await mixIntoKey(Curve.sharedKey(noiseKey.private, serverHello.ephemeral))
|
|
96
105
|
return keyEnc
|
|
97
106
|
},
|
|
98
107
|
encodeFrame: (data) => {
|
|
@@ -140,7 +149,7 @@ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey },
|
|
|
140
149
|
inBytes = inBytes.slice(size + 3)
|
|
141
150
|
if (isFinished) {
|
|
142
151
|
const result = decrypt(frame)
|
|
143
|
-
frame = await
|
|
152
|
+
frame = await decodeBinaryNode(result)
|
|
144
153
|
}
|
|
145
154
|
logger.trace({ msg: frame?.attrs?.id }, 'recv frame')
|
|
146
155
|
onFrame(frame)
|
|
@@ -2,31 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const { proto } = require("../../WAProto")
|
|
6
|
+
const { WAMessageStubType } = require("../Types")
|
|
7
|
+
const {
|
|
8
|
+
getDevice,
|
|
9
|
+
getContentType,
|
|
10
|
+
normalizeMessageContent
|
|
11
|
+
} = require("../Utils")
|
|
12
|
+
const {
|
|
13
|
+
areJidsSameUser,
|
|
14
|
+
isJidBroadcast,
|
|
15
|
+
isJidStatusBroadcast,
|
|
16
|
+
jidNormalizedUser
|
|
17
|
+
} = require("../WABinary")
|
|
18
|
+
const {
|
|
19
|
+
aesDecryptGCM,
|
|
20
|
+
hmacSign
|
|
21
|
+
} = require("./crypto")
|
|
22
|
+
const {
|
|
23
|
+
getKeyAuthor,
|
|
24
|
+
toNumber
|
|
25
|
+
} = require("./generics")
|
|
26
|
+
const { downloadAndProcessHistorySyncNotification } = require("./history")
|
|
12
27
|
|
|
13
28
|
const REAL_MSG_STUB_TYPES = new Set([
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
WAMessageStubType.CALL_MISSED_GROUP_VIDEO,
|
|
30
|
+
WAMessageStubType.CALL_MISSED_GROUP_VOICE,
|
|
31
|
+
WAMessageStubType.CALL_MISSED_VIDEO,
|
|
32
|
+
WAMessageStubType.CALL_MISSED_VOICE
|
|
18
33
|
])
|
|
19
34
|
|
|
20
35
|
const REAL_MSG_REQ_ME_STUB_TYPES = new Set([
|
|
21
|
-
|
|
36
|
+
WAMessageStubType.GROUP_PARTICIPANT_ADD
|
|
22
37
|
])
|
|
23
38
|
|
|
24
39
|
/** Cleans a received message to further processing */
|
|
25
40
|
const cleanMessage = (message, meId) => {
|
|
26
41
|
// ensure remoteJid and participant doesn't have device or agent in it
|
|
27
|
-
message.key.remoteJid =
|
|
28
|
-
message.key.participant = message.key.participant ?
|
|
29
|
-
const content =
|
|
42
|
+
message.key.remoteJid = jidNormalizedUser(message.key.remoteJid)
|
|
43
|
+
message.key.participant = message.key.participant ? jidNormalizedUser(message.key.participant) : undefined
|
|
44
|
+
const content = normalizeMessageContent(message.message)
|
|
30
45
|
// if the message has a reaction, ensure fromMe & remoteJid are from our perspective
|
|
31
46
|
if (content?.reactionMessage) {
|
|
32
47
|
normaliseKey(content.reactionMessage.key)
|
|
@@ -41,7 +56,7 @@ const cleanMessage = (message, meId) => {
|
|
|
41
56
|
// if the sender believed the message being reacted to is not from them
|
|
42
57
|
// we've to correct the key to be from them, or some other participant
|
|
43
58
|
msgKey.fromMe = !msgKey.fromMe
|
|
44
|
-
?
|
|
59
|
+
? areJidsSameUser(msgKey.participant || msgKey.remoteJid, meId)
|
|
45
60
|
// if the message being reacted to, was from them
|
|
46
61
|
// fromMe automatically becomes false
|
|
47
62
|
: false
|
|
@@ -54,14 +69,14 @@ const cleanMessage = (message, meId) => {
|
|
|
54
69
|
}
|
|
55
70
|
|
|
56
71
|
const isRealMessage = (message, meId) => {
|
|
57
|
-
const normalizedContent =
|
|
58
|
-
const hasSomeContent = !!
|
|
72
|
+
const normalizedContent = normalizeMessageContent(message.message)
|
|
73
|
+
const hasSomeContent = !!getContentType(normalizedContent)
|
|
59
74
|
return (
|
|
60
75
|
!!normalizedContent ||
|
|
61
76
|
REAL_MSG_STUB_TYPES.has(message.messageStubType) ||
|
|
62
77
|
(
|
|
63
78
|
REAL_MSG_REQ_ME_STUB_TYPES.has(message.messageStubType) &&
|
|
64
|
-
message.messageStubParameters?.some(p =>
|
|
79
|
+
message.messageStubParameters?.some(p => areJidsSameUser(meId, p))
|
|
65
80
|
)
|
|
66
81
|
) &&
|
|
67
82
|
hasSomeContent &&
|
|
@@ -77,8 +92,8 @@ const shouldIncrementChatUnread = (message) => (!message.key.fromMe && !message.
|
|
|
77
92
|
* Typically -- that'll be the remoteJid, but for broadcasts, it'll be the participant
|
|
78
93
|
*/
|
|
79
94
|
const getChatId = ({ remoteJid, participant, fromMe }) => {
|
|
80
|
-
if (
|
|
81
|
-
&& !
|
|
95
|
+
if (isJidBroadcast(remoteJid)
|
|
96
|
+
&& !isJidStatusBroadcast(remoteJid)
|
|
82
97
|
&& !fromMe) {
|
|
83
98
|
return participant
|
|
84
99
|
}
|
|
@@ -99,12 +114,12 @@ function decryptPollVote({ encPayload, encIv }, { pollCreatorJid, pollMsgId, pol
|
|
|
99
114
|
toBinary('Poll Vote'),
|
|
100
115
|
new Uint8Array([1])
|
|
101
116
|
])
|
|
102
|
-
const key0 =
|
|
103
|
-
const decKey =
|
|
117
|
+
const key0 = hmacSign(pollEncKey, new Uint8Array(32), 'sha256')
|
|
118
|
+
const decKey = hmacSign(sign, key0, 'sha256')
|
|
104
119
|
const aad = toBinary(`${pollMsgId}\u0000${voterJid}`)
|
|
105
|
-
const decrypted =
|
|
120
|
+
const decrypted = aesDecryptGCM(encPayload, decKey, encIv, aad)
|
|
106
121
|
|
|
107
|
-
return
|
|
122
|
+
return proto.Message.PollVoteMessage.decode(decrypted)
|
|
108
123
|
|
|
109
124
|
function toBinary(txt) {
|
|
110
125
|
return Buffer.from(txt)
|
|
@@ -125,11 +140,11 @@ function decryptEventEdit({ encPayload, encIv }, { eventCreatorJid, eventMsgId,
|
|
|
125
140
|
new Uint8Array([1])
|
|
126
141
|
])
|
|
127
142
|
|
|
128
|
-
const key0 =
|
|
129
|
-
const decKey =
|
|
130
|
-
const decrypted =
|
|
143
|
+
const key0 = hmacSign(eventEncKey, new Uint8Array(32), 'sha256')
|
|
144
|
+
const decKey = hmacSign(sign, key0, 'sha256')
|
|
145
|
+
const decrypted = aesDecryptGCM(encPayload, decKey, encIv, null)
|
|
131
146
|
|
|
132
|
-
return
|
|
147
|
+
return proto.Message.decode(decrypted)
|
|
133
148
|
|
|
134
149
|
function toBinary(txt) {
|
|
135
150
|
return Buffer.from(txt)
|
|
@@ -151,12 +166,12 @@ function decryptEventResponse({ encPayload, encIv }, { eventCreatorJid, eventMsg
|
|
|
151
166
|
new Uint8Array([1])
|
|
152
167
|
])
|
|
153
168
|
|
|
154
|
-
const key0 =
|
|
155
|
-
const decKey =
|
|
169
|
+
const key0 = hmacSign(eventEncKey, new Uint8Array(32), 'sha256')
|
|
170
|
+
const decKey = hmacSign(sign, key0, 'sha256')
|
|
156
171
|
const aad = toBinary(`${eventMsgId}\u0000${responderJid}`)
|
|
157
|
-
const decrypted =
|
|
172
|
+
const decrypted = aesDecryptGCM(encPayload, decKey, encIv, aad)
|
|
158
173
|
|
|
159
|
-
return
|
|
174
|
+
return proto.Message.EventResponseMessage.decode(decrypted)
|
|
160
175
|
|
|
161
176
|
function toBinary(txt) {
|
|
162
177
|
return Buffer.from(txt)
|
|
@@ -177,11 +192,11 @@ function decryptComment({ encPayload, encIv }, { commentCreatorJid, commentMsgId
|
|
|
177
192
|
new Uint8Array([1])
|
|
178
193
|
])
|
|
179
194
|
|
|
180
|
-
const key0 =
|
|
181
|
-
const decKey =
|
|
182
|
-
const decrypted =
|
|
195
|
+
const key0 = hmacSign(commentEncKey, new Uint8Array(32), 'sha256')
|
|
196
|
+
const decKey = hmacSign(sign, key0, 'sha256')
|
|
197
|
+
const decrypted = aesDecryptGCM(encPayload, decKey, encIv, null)
|
|
183
198
|
|
|
184
|
-
return
|
|
199
|
+
return proto.Message.decode(decrypted)
|
|
185
200
|
|
|
186
201
|
function toBinary(txt) {
|
|
187
202
|
return Buffer.from(txt)
|
|
@@ -202,11 +217,11 @@ function decryptReaction({ encPayload, encIv }, { reactionCreatorJid, reactionMs
|
|
|
202
217
|
new Uint8Array([1])
|
|
203
218
|
])
|
|
204
219
|
|
|
205
|
-
const key0 =
|
|
206
|
-
const decKey =
|
|
207
|
-
const decrypted =
|
|
220
|
+
const key0 = hmacSign(reactionEncKey, new Uint8Array(32), 'sha256')
|
|
221
|
+
const decKey = hmacSign(sign, key0, 'sha256')
|
|
222
|
+
const decrypted = aesDecryptGCM(encPayload, decKey, encIv, null)
|
|
208
223
|
|
|
209
|
-
return
|
|
224
|
+
return proto.Message.ReactionMessage.decode(decrypted)
|
|
210
225
|
|
|
211
226
|
function toBinary(txt) {
|
|
212
227
|
return Buffer.from(txt)
|
|
@@ -217,17 +232,17 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
217
232
|
const meId = creds.me.id
|
|
218
233
|
const meLid = creds.me.lid
|
|
219
234
|
const { accountSettings } = creds
|
|
220
|
-
const chat = { id:
|
|
235
|
+
const chat = { id: jidNormalizedUser(getChatId(message.key)) }
|
|
221
236
|
const isRealMsg = isRealMessage(message, meId)
|
|
222
237
|
if (isRealMsg) {
|
|
223
238
|
chat.messages = [{ message }]
|
|
224
|
-
chat.conversationTimestamp =
|
|
239
|
+
chat.conversationTimestamp = toNumber(message.messageTimestamp)
|
|
225
240
|
// only increment unread count if not CIPHERTEXT and from another person
|
|
226
241
|
if (shouldIncrementChatUnread(message)) {
|
|
227
242
|
chat.unreadCount = (chat.unreadCount || 0) + 1
|
|
228
243
|
}
|
|
229
244
|
}
|
|
230
|
-
const content =
|
|
245
|
+
const content = normalizeMessageContent(message.message)
|
|
231
246
|
// unarchive chat if it's a real message, or someone reacted to our message
|
|
232
247
|
// and we've the unarchive chats setting on
|
|
233
248
|
if (isRealMsg || content?.reactionMessage?.key?.fromMe
|
|
@@ -238,7 +253,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
238
253
|
const protocolMsg = content?.protocolMessage
|
|
239
254
|
if (protocolMsg) {
|
|
240
255
|
switch (protocolMsg.type) {
|
|
241
|
-
case
|
|
256
|
+
case proto.Message.ProtocolMessage.Type.HISTORY_SYNC_NOTIFICATION:
|
|
242
257
|
const histNotification = protocolMsg.historySyncNotification
|
|
243
258
|
const process = shouldProcessHistoryMsg
|
|
244
259
|
const isLatest = !creds.processedHistoryMessages?.length
|
|
@@ -249,7 +264,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
249
264
|
isLatest,
|
|
250
265
|
}, 'got history notification')
|
|
251
266
|
if (process) {
|
|
252
|
-
if (histNotification.syncType !==
|
|
267
|
+
if (histNotification.syncType !== proto.HistorySync.HistorySyncType.ON_DEMAND) {
|
|
253
268
|
ev.emit('creds.update', {
|
|
254
269
|
processedHistoryMessages: [
|
|
255
270
|
...(creds.processedHistoryMessages || []),
|
|
@@ -257,17 +272,17 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
257
272
|
]
|
|
258
273
|
})
|
|
259
274
|
}
|
|
260
|
-
const data = await
|
|
275
|
+
const data = await downloadAndProcessHistorySyncNotification(histNotification, options)
|
|
261
276
|
ev.emit('messaging-history.set', {
|
|
262
277
|
...data,
|
|
263
|
-
isLatest: histNotification.syncType !==
|
|
278
|
+
isLatest: histNotification.syncType !== proto.HistorySync.HistorySyncType.ON_DEMAND
|
|
264
279
|
? isLatest
|
|
265
280
|
: undefined,
|
|
266
281
|
peerDataRequestSessionId: histNotification.peerDataRequestSessionId
|
|
267
282
|
})
|
|
268
283
|
}
|
|
269
284
|
break
|
|
270
|
-
case
|
|
285
|
+
case proto.Message.ProtocolMessage.Type.APP_STATE_SYNC_KEY_SHARE:
|
|
271
286
|
const keys = protocolMsg.appStateSyncKeyShare.keys
|
|
272
287
|
if (keys?.length) {
|
|
273
288
|
let newAppStateSyncKeyId = ''
|
|
@@ -287,24 +302,24 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
287
302
|
logger?.info({ protocolMsg }, 'recv app state sync with 0 keys')
|
|
288
303
|
}
|
|
289
304
|
break
|
|
290
|
-
case
|
|
305
|
+
case proto.Message.ProtocolMessage.Type.REVOKE:
|
|
291
306
|
ev.emit('messages.update', [
|
|
292
307
|
{
|
|
293
308
|
key: {
|
|
294
309
|
...message.key,
|
|
295
310
|
id: protocolMsg.key.id
|
|
296
311
|
},
|
|
297
|
-
update: { message: null, messageStubType:
|
|
312
|
+
update: { message: null, messageStubType: WAMessageStubType.REVOKE, key: message.key }
|
|
298
313
|
}
|
|
299
314
|
])
|
|
300
315
|
break
|
|
301
|
-
case
|
|
316
|
+
case proto.Message.ProtocolMessage.Type.EPHEMERAL_SETTING:
|
|
302
317
|
Object.assign(chat, {
|
|
303
|
-
ephemeralSettingTimestamp:
|
|
318
|
+
ephemeralSettingTimestamp: toNumber(message.messageTimestamp),
|
|
304
319
|
ephemeralExpiration: protocolMsg.ephemeralExpiration || null
|
|
305
320
|
})
|
|
306
321
|
break
|
|
307
|
-
case
|
|
322
|
+
case proto.Message.ProtocolMessage.Type.PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE:
|
|
308
323
|
const response = protocolMsg.peerDataOperationRequestResponseMessage
|
|
309
324
|
if (response) {
|
|
310
325
|
await laceholderResendCache?.del(response.stanzaId)
|
|
@@ -314,7 +329,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
314
329
|
const { placeholderMessageResendResponse: retryResponse } = result
|
|
315
330
|
//eslint-disable-next-line max-depth
|
|
316
331
|
if (retryResponse) {
|
|
317
|
-
const webMessageInfo =
|
|
332
|
+
const webMessageInfo = proto.WebMessageInfo.decode(retryResponse.webMessageInfoBytes)
|
|
318
333
|
// wait till another upsert event is available, don't want it to be part of the PDO response message
|
|
319
334
|
setTimeout(() => {
|
|
320
335
|
ev.emit('messages.upsert', {
|
|
@@ -327,7 +342,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
327
342
|
}
|
|
328
343
|
}
|
|
329
344
|
break
|
|
330
|
-
case
|
|
345
|
+
case proto.Message.ProtocolMessage.Type.MESSAGE_EDIT:
|
|
331
346
|
ev.emit('messages.update', [
|
|
332
347
|
{
|
|
333
348
|
// flip the sender / fromMe properties because they're in the perspective of the sender
|
|
@@ -339,15 +354,15 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
339
354
|
}
|
|
340
355
|
},
|
|
341
356
|
messageTimestamp: protocolMsg.timestampMs
|
|
342
|
-
? Math.floor(
|
|
357
|
+
? Math.floor(toNumber(protocolMsg.timestampMs) / 1000)
|
|
343
358
|
: message.messageTimestamp
|
|
344
359
|
}
|
|
345
360
|
}
|
|
346
361
|
])
|
|
347
362
|
break
|
|
348
|
-
case
|
|
363
|
+
case proto.Message.ProtocolMessage.Type.LID_MIGRATION_MAPPING_SYNC:
|
|
349
364
|
const encodedPayload = protocolMsg.lidMigrationMappingSyncMessage?.encodedMappingPayload
|
|
350
|
-
const { pnToLidMappings, chatDbMigrationTimestamp } =
|
|
365
|
+
const { pnToLidMappings, chatDbMigrationTimestamp } = proto.LIDMigrationMappingSyncPayload.decode(encodedPayload)
|
|
351
366
|
|
|
352
367
|
logger?.debug({ pnToLidMappings, chatDbMigrationTimestamp }, 'got lid mappings and chat db migration timestamp')
|
|
353
368
|
|
|
@@ -360,10 +375,10 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
360
375
|
|
|
361
376
|
await signalRepository.lidMapping.storeLIDPNMappings(pairs)
|
|
362
377
|
break
|
|
363
|
-
case
|
|
378
|
+
case proto.Message.ProtocolMessage.Type.LIMIT_SHARING:
|
|
364
379
|
ev.emit('limit-sharing.update', {
|
|
365
380
|
id: message.key.remoteJid,
|
|
366
|
-
author:
|
|
381
|
+
author: areJidsSameUser(message.key.remoteJid, protocolMsg.key.remoteJid) ? jidNormalizedUser(meId) : message.key.remoteJid,
|
|
367
382
|
action: `${protocolMsg.limitSharing.sharingLimited ? 'on' : 'off'}`,
|
|
368
383
|
trigger: protocolMsg.limitSharing.trigger,
|
|
369
384
|
update_time: protocolMsg.limitSharing.limitSharingSettingTimestamp
|
|
@@ -392,13 +407,13 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
392
407
|
const emitGroupRequestJoin = (participant, action, method) => {
|
|
393
408
|
ev.emit('group.join-request', { id: jid, author: message.participant, participant, action, method: method })
|
|
394
409
|
}
|
|
395
|
-
const participantsIncludesMe = () => participants.find(jid =>
|
|
410
|
+
const participantsIncludesMe = () => participants.find(jid => areJidsSameUser(meId, jid))
|
|
396
411
|
switch (message.messageStubType) {
|
|
397
|
-
case
|
|
412
|
+
case WAMessageStubType.GROUP_PARTICIPANT_CHANGE_NUMBER:
|
|
398
413
|
participants = message.messageStubParameters || []
|
|
399
414
|
emitParticipantsUpdate('modify')
|
|
400
415
|
break
|
|
401
|
-
case
|
|
416
|
+
case WAMessageStubType.GROUP_PARTICIPANT_LEAVE:
|
|
402
417
|
participants = message.messageStubParameters || [];
|
|
403
418
|
emitParticipantsUpdate('leave');
|
|
404
419
|
// mark the chat read only if you left the group
|
|
@@ -406,7 +421,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
406
421
|
chat.readOnly = true;
|
|
407
422
|
}
|
|
408
423
|
break;
|
|
409
|
-
case
|
|
424
|
+
case WAMessageStubType.GROUP_PARTICIPANT_REMOVE:
|
|
410
425
|
participants = message.messageStubParameters || []
|
|
411
426
|
emitParticipantsUpdate('remove')
|
|
412
427
|
// mark the chat read only if you left the group
|
|
@@ -414,62 +429,62 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
414
429
|
chat.readOnly = true
|
|
415
430
|
}
|
|
416
431
|
break
|
|
417
|
-
case
|
|
418
|
-
case
|
|
432
|
+
case WAMessageStubType.GROUP_PARTICIPANT_ADD:
|
|
433
|
+
case WAMessageStubType.GROUP_PARTICIPANT_INVITE:
|
|
419
434
|
let actionGp = 'invite'
|
|
420
435
|
participants = message.messageStubParameters || []
|
|
421
436
|
if (participantsIncludesMe()) chat.readOnly = false;
|
|
422
437
|
if (message?.key?.participant && !participants.includes(message?.key?.participant)) {
|
|
423
438
|
actionGp = 'approval-invite'
|
|
424
439
|
}
|
|
425
|
-
case
|
|
440
|
+
case WAMessageStubType.GROUP_PARTICIPANT_ADD_REQUEST_JOIN:
|
|
426
441
|
participants = message.messageStubParameters || []
|
|
427
442
|
if (participantsIncludesMe()) {
|
|
428
443
|
chat.readOnly = false
|
|
429
444
|
}
|
|
430
445
|
emitParticipantsUpdate('add')
|
|
431
446
|
break
|
|
432
|
-
case
|
|
433
|
-
case
|
|
447
|
+
case WAMessageStubType.GROUP_PARTICIPANT_DEMOTE:
|
|
448
|
+
case WAMessageStubType.COMMUNITY_PARTICIPANT_DEMOTE:
|
|
434
449
|
participants = message.messageStubParameters || []
|
|
435
450
|
emitParticipantsUpdate('demote')
|
|
436
451
|
break
|
|
437
|
-
case
|
|
438
|
-
case
|
|
452
|
+
case WAMessageStubType.GROUP_PARTICIPANT_PROMOTE:
|
|
453
|
+
case WAMessageStubType.COMMUNITY_PARTICIPANT_PROMOTE:
|
|
439
454
|
participants = message.messageStubParameters || []
|
|
440
455
|
emitParticipantsUpdate('promote')
|
|
441
456
|
break
|
|
442
|
-
case
|
|
457
|
+
case WAMessageStubType.GROUP_CHANGE_ANNOUNCE:
|
|
443
458
|
const announceValue = message.messageStubParameters?.[0]
|
|
444
459
|
emitGroupUpdate({ announce: announceValue === 'true' || announceValue === 'on' })
|
|
445
460
|
break
|
|
446
|
-
case
|
|
461
|
+
case WAMessageStubType.GROUP_CHANGE_RESTRICT:
|
|
447
462
|
const restrictValue = message.messageStubParameters?.[0]
|
|
448
463
|
emitGroupUpdate({ restrict: restrictValue === 'true' || restrictValue === 'on' })
|
|
449
464
|
break
|
|
450
|
-
case
|
|
465
|
+
case WAMessageStubType.GROUP_CHANGE_SUBJECT:
|
|
451
466
|
const name = message.messageStubParameters?.[0]
|
|
452
467
|
chat.name = name
|
|
453
468
|
emitGroupUpdate({ subject: name })
|
|
454
469
|
break
|
|
455
|
-
case
|
|
470
|
+
case WAMessageStubType.GROUP_CHANGE_DESCRIPTION:
|
|
456
471
|
const description = message.messageStubParameters?.[0]
|
|
457
472
|
chat.description = description
|
|
458
473
|
emitGroupUpdate({ desc: description })
|
|
459
474
|
break
|
|
460
|
-
case
|
|
475
|
+
case WAMessageStubType.GROUP_CHANGE_INVITE_LINK:
|
|
461
476
|
const code = message.messageStubParameters?.[0]
|
|
462
477
|
emitGroupUpdate({ inviteCode: code })
|
|
463
478
|
break
|
|
464
|
-
case
|
|
479
|
+
case WAMessageStubType.GROUP_MEMBER_ADD_MODE:
|
|
465
480
|
const memberAddValue = message.messageStubParameters?.[0]
|
|
466
481
|
emitGroupUpdate({ memberAddMode: memberAddValue === 'all_member_add' })
|
|
467
482
|
break
|
|
468
|
-
case
|
|
483
|
+
case WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE:
|
|
469
484
|
const approvalMode = message.messageStubParameters?.[0]
|
|
470
485
|
emitGroupUpdate({ joinApprovalMode: approvalMode === 'on' })
|
|
471
486
|
break
|
|
472
|
-
case
|
|
487
|
+
case WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD:
|
|
473
488
|
const participant = message.messageStubParameters?.[0]
|
|
474
489
|
const action = message.messageStubParameters?.[1]
|
|
475
490
|
const method = message.messageStubParameters?.[2]
|
|
@@ -485,13 +500,13 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
485
500
|
const pollMsg = await getMessage(creationMsgKey)
|
|
486
501
|
if (pollMsg) {
|
|
487
502
|
try {
|
|
488
|
-
const meLidNormalised =
|
|
489
|
-
const
|
|
490
|
-
const pollCreationFromMe =
|
|
503
|
+
const meLidNormalised = jidNormalizedUser(meLid)
|
|
504
|
+
const deviceType = getDevice(creationMsgKey.id)
|
|
505
|
+
const pollCreationFromMe = deviceType === 'baileys' ? true : false
|
|
491
506
|
const pollEncKey = pollMsg.messageContextInfo?.messageSecret
|
|
492
|
-
const voterJid =
|
|
507
|
+
const voterJid = getKeyAuthor(message.key, meLidNormalised)
|
|
493
508
|
|
|
494
|
-
let pollCreatorJid =
|
|
509
|
+
let pollCreatorJid = getKeyAuthor(creationMsgKey, meLidNormalised)
|
|
495
510
|
|
|
496
511
|
if (pollCreationFromMe) {
|
|
497
512
|
pollCreatorJid = meLidNormalised
|
|
@@ -535,15 +550,15 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
535
550
|
const encEventEdit = content.secretEncryptedMessage
|
|
536
551
|
const creationMsgKey = encEventEdit.targetMessageKey
|
|
537
552
|
|
|
538
|
-
if (
|
|
553
|
+
if (proto.Message.SecretEncryptedMessage.SecretEncType[encEventEdit.secretEncType] !== 'EVENT_EDIT') return
|
|
539
554
|
|
|
540
555
|
// we need to fetch the event creation message to get the event enc key
|
|
541
556
|
const eventMsg = await getMessage(creationMsgKey)
|
|
542
557
|
if (eventMsg) {
|
|
543
558
|
try {
|
|
544
|
-
const meLidNormalised =
|
|
545
|
-
const eventCreatorJid =
|
|
546
|
-
const responderJid =
|
|
559
|
+
const meLidNormalised = jidNormalizedUser(meLid)
|
|
560
|
+
const eventCreatorJid = getKeyAuthor(message.key, meLidNormalised)
|
|
561
|
+
const responderJid = getKeyAuthor(message.key, meLidNormalised)
|
|
547
562
|
const eventEncKey = eventMsg.messageContextInfo?.messageSecret
|
|
548
563
|
|
|
549
564
|
if (!eventEncKey) {
|
|
@@ -555,7 +570,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
555
570
|
eventMsgId: creationMsgKey.id,
|
|
556
571
|
responderJid
|
|
557
572
|
})
|
|
558
|
-
const content =
|
|
573
|
+
const content = normalizeMessageContent(responseMsg)
|
|
559
574
|
const protocolMsg = content?.protocolMessage
|
|
560
575
|
|
|
561
576
|
ev.emit('messages.update', [
|
|
@@ -569,7 +584,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
569
584
|
}
|
|
570
585
|
},
|
|
571
586
|
messageTimestamp: protocolMsg.timestampMs
|
|
572
|
-
? Math.floor(
|
|
587
|
+
? Math.floor(toNumber(protocolMsg.timestampMs) / 1000)
|
|
573
588
|
: message.messageTimestamp
|
|
574
589
|
}
|
|
575
590
|
}
|
|
@@ -592,9 +607,9 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
592
607
|
const eventMsg = await getMessage(creationMsgKey)
|
|
593
608
|
if (eventMsg) {
|
|
594
609
|
try {
|
|
595
|
-
const meLidNormalised =
|
|
596
|
-
const eventCreatorJid =
|
|
597
|
-
const responderJid =
|
|
610
|
+
const meLidNormalised = jidNormalizedUser(meLid)
|
|
611
|
+
const eventCreatorJid = getKeyAuthor(creationMsgKey, meLidNormalised)
|
|
612
|
+
const responderJid = getKeyAuthor(message.key, meLidNormalised)
|
|
598
613
|
const eventEncKey = eventMsg.messageContextInfo?.messageSecret
|
|
599
614
|
|
|
600
615
|
if (!eventEncKey) {
|
|
@@ -639,7 +654,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
639
654
|
const commentMsg = await getMessage(creationMsgKey)
|
|
640
655
|
if (commentMsg) {
|
|
641
656
|
try {
|
|
642
|
-
const meLidNormalised =
|
|
657
|
+
const meLidNormalised = jidNormalizedUser(meLid)
|
|
643
658
|
const commentCreatorJid = creationMsgKey.participant ? creationMsgKey.participant : message.key?.participant ? message.key.participant : meLidNormalised
|
|
644
659
|
const commentJid = message.key?.participant ? message.key.participant : creationMsgKey.participant ? creationMsgKey.participant : meLidNormalised
|
|
645
660
|
const commentEncKey = commentMsg.messageContextInfo?.messageSecret
|
|
@@ -679,7 +694,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
679
694
|
const reactMsg = await getMessage(creationMsgKey)
|
|
680
695
|
if (reactMsg) {
|
|
681
696
|
try {
|
|
682
|
-
const meLidNormalised =
|
|
697
|
+
const meLidNormalised = jidNormalizedUser(meLid)
|
|
683
698
|
const reactionCreatorJid = creationMsgKey.participant ? creationMsgKey.participant : message.key?.participant ? message.key.participant : meLidNormalised
|
|
684
699
|
const reactionJid = message.key?.participant ? message.key.participant : creationMsgKey.participant ? creationMsgKey.participant : meLidNormalised
|
|
685
700
|
const reactionEncKey = reactMsg.messageContextInfo?.messageSecret
|