lordceaser-baileys 2.0.39 → 2.0.41

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.
Files changed (155) hide show
  1. package/index.js +59 -412
  2. package/package.json +8 -3
  3. package/WAProto/GenerateStatics.sh +0 -4
  4. package/WAProto/WAProto.proto +0 -3344
  5. package/WAProto/index.d.ts +0 -37016
  6. package/WAProto/index.js +0 -101044
  7. package/WASignalGroup/GroupProtocol.js +0 -1697
  8. package/WASignalGroup/ciphertext_message.js +0 -16
  9. package/WASignalGroup/group_cipher.js +0 -120
  10. package/WASignalGroup/group_session_builder.js +0 -46
  11. package/WASignalGroup/index.js +0 -5
  12. package/WASignalGroup/keyhelper.js +0 -21
  13. package/WASignalGroup/protobufs.js +0 -3
  14. package/WASignalGroup/queue_job.js +0 -69
  15. package/WASignalGroup/sender_chain_key.js +0 -50
  16. package/WASignalGroup/sender_key_distribution_message.js +0 -78
  17. package/WASignalGroup/sender_key_message.js +0 -92
  18. package/WASignalGroup/sender_key_name.js +0 -70
  19. package/WASignalGroup/sender_key_record.js +0 -56
  20. package/WASignalGroup/sender_key_state.js +0 -129
  21. package/WASignalGroup/sender_message_key.js +0 -39
  22. package/lib/Defaults/baileys-version.json +0 -3
  23. package/lib/Defaults/index.d.ts +0 -283
  24. package/lib/Defaults/index.js +0 -121
  25. package/lib/Defaults/phonenumber-mcc.json +0 -223
  26. package/lib/Signal/libsignal.d.ts +0 -3
  27. package/lib/Signal/libsignal.js +0 -152
  28. package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
  29. package/lib/Socket/Client/abstract-socket-client.js +0 -13
  30. package/lib/Socket/Client/index.d.ts +0 -3
  31. package/lib/Socket/Client/index.js +0 -19
  32. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  33. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  34. package/lib/Socket/Client/web-socket-client.d.ts +0 -12
  35. package/lib/Socket/Client/web-socket-client.js +0 -62
  36. package/lib/Socket/business.d.ts +0 -148
  37. package/lib/Socket/business.js +0 -260
  38. package/lib/Socket/chats.d.ts +0 -83
  39. package/lib/Socket/chats.js +0 -879
  40. package/lib/Socket/groups.d.ts +0 -123
  41. package/lib/Socket/groups.js +0 -314
  42. package/lib/Socket/index.d.ts +0 -150
  43. package/lib/Socket/index.js +0 -10
  44. package/lib/Socket/messages-recv.d.ts +0 -135
  45. package/lib/Socket/messages-recv.js +0 -867
  46. package/lib/Socket/messages-send.d.ts +0 -128
  47. package/lib/Socket/messages-send.js +0 -677
  48. package/lib/Socket/registration.d.ts +0 -242
  49. package/lib/Socket/registration.js +0 -166
  50. package/lib/Socket/socket.d.ts +0 -43
  51. package/lib/Socket/socket.js +0 -619
  52. package/lib/Store/index.d.ts +0 -3
  53. package/lib/Store/index.js +0 -10
  54. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  55. package/lib/Store/make-cache-manager-store.js +0 -83
  56. package/lib/Store/make-in-memory-store.d.ts +0 -118
  57. package/lib/Store/make-in-memory-store.js +0 -422
  58. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  59. package/lib/Store/make-ordered-dictionary.js +0 -81
  60. package/lib/Store/object-repository.d.ts +0 -10
  61. package/lib/Store/object-repository.js +0 -27
  62. package/lib/Types/Auth.d.ts +0 -110
  63. package/lib/Types/Auth.js +0 -2
  64. package/lib/Types/Call.d.ts +0 -13
  65. package/lib/Types/Call.js +0 -2
  66. package/lib/Types/Chat.d.ts +0 -107
  67. package/lib/Types/Chat.js +0 -4
  68. package/lib/Types/Contact.d.ts +0 -19
  69. package/lib/Types/Contact.js +0 -2
  70. package/lib/Types/Events.d.ts +0 -172
  71. package/lib/Types/Events.js +0 -2
  72. package/lib/Types/GroupMetadata.d.ts +0 -56
  73. package/lib/Types/GroupMetadata.js +0 -2
  74. package/lib/Types/Label.d.ts +0 -46
  75. package/lib/Types/Label.js +0 -27
  76. package/lib/Types/LabelAssociation.d.ts +0 -29
  77. package/lib/Types/LabelAssociation.js +0 -9
  78. package/lib/Types/Message.d.ts +0 -268
  79. package/lib/Types/Message.js +0 -9
  80. package/lib/Types/Product.d.ts +0 -78
  81. package/lib/Types/Product.js +0 -2
  82. package/lib/Types/Signal.d.ts +0 -57
  83. package/lib/Types/Signal.js +0 -2
  84. package/lib/Types/Socket.d.ts +0 -116
  85. package/lib/Types/Socket.js +0 -2
  86. package/lib/Types/State.d.ts +0 -27
  87. package/lib/Types/State.js +0 -2
  88. package/lib/Types/index.d.ts +0 -63
  89. package/lib/Types/index.js +0 -41
  90. package/lib/Utils/auth-utils.d.ts +0 -18
  91. package/lib/Utils/auth-utils.js +0 -206
  92. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  93. package/lib/Utils/baileys-event-stream.js +0 -63
  94. package/lib/Utils/business.d.ts +0 -22
  95. package/lib/Utils/business.js +0 -234
  96. package/lib/Utils/chat-utils.d.ts +0 -71
  97. package/lib/Utils/chat-utils.js +0 -740
  98. package/lib/Utils/crypto.d.ts +0 -41
  99. package/lib/Utils/crypto.js +0 -153
  100. package/lib/Utils/decode-wa-message.d.ts +0 -20
  101. package/lib/Utils/decode-wa-message.js +0 -188
  102. package/lib/Utils/event-buffer.d.ts +0 -35
  103. package/lib/Utils/event-buffer.js +0 -520
  104. package/lib/Utils/generics.d.ts +0 -89
  105. package/lib/Utils/generics.js +0 -394
  106. package/lib/Utils/history.d.ts +0 -19
  107. package/lib/Utils/history.js +0 -94
  108. package/lib/Utils/index.d.ts +0 -17
  109. package/lib/Utils/index.js +0 -33
  110. package/lib/Utils/link-preview.d.ts +0 -21
  111. package/lib/Utils/link-preview.js +0 -93
  112. package/lib/Utils/logger.d.ts +0 -4
  113. package/lib/Utils/logger.js +0 -7
  114. package/lib/Utils/lt-hash.d.ts +0 -12
  115. package/lib/Utils/lt-hash.js +0 -51
  116. package/lib/Utils/make-mutex.d.ts +0 -7
  117. package/lib/Utils/make-mutex.js +0 -43
  118. package/lib/Utils/messages-media.d.ts +0 -107
  119. package/lib/Utils/messages-media.js +0 -674
  120. package/lib/Utils/messages.d.ts +0 -77
  121. package/lib/Utils/messages.js +0 -758
  122. package/lib/Utils/noise-handler.d.ts +0 -21
  123. package/lib/Utils/noise-handler.js +0 -155
  124. package/lib/Utils/process-message.d.ts +0 -42
  125. package/lib/Utils/process-message.js +0 -354
  126. package/lib/Utils/signal.d.ts +0 -32
  127. package/lib/Utils/signal.js +0 -161
  128. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -12
  129. package/lib/Utils/use-multi-file-auth-state.js +0 -93
  130. package/lib/Utils/validate-connection.d.ts +0 -11
  131. package/lib/Utils/validate-connection.js +0 -205
  132. package/lib/WABinary/constants.d.ts +0 -27
  133. package/lib/WABinary/constants.js +0 -40
  134. package/lib/WABinary/decode.d.ts +0 -7
  135. package/lib/WABinary/decode.js +0 -254
  136. package/lib/WABinary/encode.d.ts +0 -3
  137. package/lib/WABinary/encode.js +0 -232
  138. package/lib/WABinary/generic-utils.d.ts +0 -15
  139. package/lib/WABinary/generic-utils.js +0 -110
  140. package/lib/WABinary/index.d.ts +0 -5
  141. package/lib/WABinary/index.js +0 -21
  142. package/lib/WABinary/jid-utils.d.ts +0 -31
  143. package/lib/WABinary/jid-utils.js +0 -62
  144. package/lib/WABinary/types.d.ts +0 -18
  145. package/lib/WABinary/types.js +0 -2
  146. package/lib/WAM/BinaryInfo.d.ts +0 -17
  147. package/lib/WAM/BinaryInfo.js +0 -13
  148. package/lib/WAM/constants.d.ts +0 -38
  149. package/lib/WAM/constants.js +0 -15350
  150. package/lib/WAM/encode.d.ts +0 -3
  151. package/lib/WAM/encode.js +0 -155
  152. package/lib/WAM/index.d.ts +0 -3
  153. package/lib/WAM/index.js +0 -19
  154. package/lib/index.d.ts +0 -11
  155. package/lib/index.js +0 -30
@@ -1,867 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.makeMessagesRecvSocket = void 0;
7
- const boom_1 = require("@hapi/boom");
8
- const crypto_1 = require("crypto");
9
- const node_cache_1 = __importDefault(require("node-cache"));
10
- const WAProto_1 = require("../../WAProto");
11
- const Defaults_1 = require("../Defaults");
12
- const Types_1 = require("../Types");
13
- const Utils_1 = require("../Utils");
14
- const Utils_2 = require("../Utils");
15
- const make_mutex_1 = require("../Utils/make-mutex");
16
- const WABinary_1 = require("../WABinary");
17
- const groups_1 = require("./groups");
18
- const messages_send_1 = require("./messages-send");
19
- const makeMessagesRecvSocket = (config) => {
20
- const { logger, retryRequestDelayMs, maxMsgRetryCount, getMessage, shouldIgnoreJid } = config;
21
- const sock = (0, messages_send_1.makeMessagesSocket)(config);
22
- const { ev, authState, ws, processingMutex, signalRepository, query, upsertMessage, resyncAppState, onUnexpectedError, assertSessions, sendNode, relayMessage, sendReceipt, uploadPreKeys, sendPeerDataOperationMessage, } = sock;
23
- /** this mutex ensures that each retryRequest will wait for the previous one to finish */
24
- const retryMutex = (0, make_mutex_1.makeMutex)();
25
- const msgRetryCache = config.msgRetryCounterCache || new node_cache_1.default({
26
- stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.MSG_RETRY,
27
- useClones: false
28
- });
29
- const callOfferCache = config.callOfferCache || new node_cache_1.default({
30
- stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.CALL_OFFER,
31
- useClones: false
32
- });
33
- const placeholderResendCache = config.placeholderResendCache || new node_cache_1.default({
34
- stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.MSG_RETRY,
35
- useClones: false
36
- });
37
- let sendActiveReceipts = false;
38
- const sendMessageAck = async ({ tag, attrs, content }) => {
39
- const stanza = {
40
- tag: 'ack',
41
- attrs: {
42
- id: attrs.id,
43
- to: attrs.from,
44
- class: tag,
45
- }
46
- };
47
- if (!!attrs.participant) {
48
- stanza.attrs.participant = attrs.participant;
49
- }
50
- if (!!attrs.recipient) {
51
- stanza.attrs.recipient = attrs.recipient;
52
- }
53
- if (!!attrs.type && (tag !== 'message' || (0, WABinary_1.getBinaryNodeChild)({ tag, attrs, content }, 'unavailable'))) {
54
- stanza.attrs.type = attrs.type;
55
- }
56
- if (tag === 'message' && (0, WABinary_1.getBinaryNodeChild)({ tag, attrs, content }, 'unavailable')) {
57
- stanza.attrs.from = authState.creds.me.id;
58
- }
59
- logger.debug({ recv: { tag, attrs }, sent: stanza.attrs }, 'sent ack');
60
- await sendNode(stanza);
61
- };
62
- const rejectCall = async (callId, callFrom) => {
63
- const stanza = ({
64
- tag: 'call',
65
- attrs: {
66
- from: authState.creds.me.id,
67
- to: callFrom,
68
- },
69
- content: [{
70
- tag: 'reject',
71
- attrs: {
72
- 'call-id': callId,
73
- 'call-creator': callFrom,
74
- count: '0',
75
- },
76
- content: undefined,
77
- }],
78
- });
79
- await query(stanza);
80
- };
81
- const sendRetryRequest = async (node, forceIncludeKeys = false) => {
82
- const { fullMessage } = (0, Utils_1.decodeMessageNode)(node, authState.creds.me.id, authState.creds.me.lid || '');
83
- const { key: msgKey } = fullMessage;
84
- const msgId = msgKey.id;
85
- const key = `${msgId}:${msgKey === null || msgKey === void 0 ? void 0 : msgKey.participant}`;
86
- let retryCount = msgRetryCache.get(key) || 0;
87
- if (retryCount >= maxMsgRetryCount) {
88
- logger.debug({ retryCount, msgId }, 'reached retry limit, clearing');
89
- msgRetryCache.del(key);
90
- return;
91
- }
92
- retryCount += 1;
93
- msgRetryCache.set(key, retryCount);
94
- const { account, signedPreKey, signedIdentityKey: identityKey } = authState.creds;
95
- if (retryCount === 1) {
96
- //request a resend via phone
97
- const msgId = await requestPlaceholderResend(msgKey);
98
- logger.debug(`sendRetryRequest: requested placeholder resend for message ${msgId}`);
99
- }
100
- const deviceIdentity = (0, Utils_1.encodeSignedDeviceIdentity)(account, true);
101
- await authState.keys.transaction(async () => {
102
- const receipt = {
103
- tag: 'receipt',
104
- attrs: {
105
- id: msgId,
106
- type: 'retry',
107
- to: node.attrs.from
108
- },
109
- content: [
110
- {
111
- tag: 'retry',
112
- attrs: {
113
- count: retryCount.toString(),
114
- id: node.attrs.id,
115
- t: node.attrs.t,
116
- v: '1'
117
- }
118
- },
119
- {
120
- tag: 'registration',
121
- attrs: {},
122
- content: (0, Utils_1.encodeBigEndian)(authState.creds.registrationId)
123
- }
124
- ]
125
- };
126
- if (node.attrs.recipient) {
127
- receipt.attrs.recipient = node.attrs.recipient;
128
- }
129
- if (node.attrs.participant) {
130
- receipt.attrs.participant = node.attrs.participant;
131
- }
132
- if (retryCount > 1 || forceIncludeKeys) {
133
- const { update, preKeys } = await (0, Utils_1.getNextPreKeys)(authState, 1);
134
- const [keyId] = Object.keys(preKeys);
135
- const key = preKeys[+keyId];
136
- const content = receipt.content;
137
- content.push({
138
- tag: 'keys',
139
- attrs: {},
140
- content: [
141
- { tag: 'type', attrs: {}, content: Buffer.from(Defaults_1.KEY_BUNDLE_TYPE) },
142
- { tag: 'identity', attrs: {}, content: identityKey.public },
143
- (0, Utils_1.xmppPreKey)(key, +keyId),
144
- (0, Utils_1.xmppSignedPreKey)(signedPreKey),
145
- { tag: 'device-identity', attrs: {}, content: deviceIdentity }
146
- ]
147
- });
148
- ev.emit('creds.update', update);
149
- }
150
- await sendNode(receipt);
151
- logger.info({ msgAttrs: node.attrs, retryCount }, 'sent retry receipt');
152
- });
153
- };
154
- const handleEncryptNotification = async (node) => {
155
- const from = node.attrs.from;
156
- if (from === WABinary_1.S_WHATSAPP_NET) {
157
- const countChild = (0, WABinary_1.getBinaryNodeChild)(node, 'count');
158
- const count = +countChild.attrs.value;
159
- const shouldUploadMorePreKeys = count < Defaults_1.MIN_PREKEY_COUNT;
160
- logger.debug({ count, shouldUploadMorePreKeys }, 'recv pre-key count');
161
- if (shouldUploadMorePreKeys) {
162
- await uploadPreKeys();
163
- }
164
- }
165
- else {
166
- const identityNode = (0, WABinary_1.getBinaryNodeChild)(node, 'identity');
167
- if (identityNode) {
168
- logger.info({ jid: from }, 'identity changed');
169
- // not handling right now
170
- // signal will override new identity anyway
171
- }
172
- else {
173
- logger.info({ node }, 'unknown encrypt notification');
174
- }
175
- }
176
- };
177
- const handleGroupNotification = (participant, child, msg) => {
178
- var _a, _b, _c, _d;
179
- const participantJid = ((_b = (_a = (0, WABinary_1.getBinaryNodeChild)(child, 'participant')) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.jid) || participant;
180
- switch (child === null || child === void 0 ? void 0 : child.tag) {
181
- case 'create':
182
- const metadata = (0, groups_1.extractGroupMetadata)(child);
183
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_CREATE;
184
- msg.messageStubParameters = [metadata.subject];
185
- msg.key = { participant: metadata.owner };
186
- ev.emit('chats.upsert', [{
187
- id: metadata.id,
188
- name: metadata.subject,
189
- conversationTimestamp: metadata.creation,
190
- }]);
191
- ev.emit('groups.upsert', [{
192
- ...metadata,
193
- author: participant
194
- }]);
195
- break;
196
- case 'ephemeral':
197
- case 'not_ephemeral':
198
- msg.message = {
199
- protocolMessage: {
200
- type: WAProto_1.proto.Message.ProtocolMessage.Type.EPHEMERAL_SETTING,
201
- ephemeralExpiration: +(child.attrs.expiration || 0)
202
- }
203
- };
204
- break;
205
- case 'modify':
206
- const oldNumber = (0, WABinary_1.getBinaryNodeChildren)(child, 'participant').map(p => p.attrs.jid);
207
- msg.messageStubParameters = oldNumber || [];
208
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_PARTICIPANT_CHANGE_NUMBER;
209
- break;
210
- case 'promote':
211
- case 'demote':
212
- case 'remove':
213
- case 'add':
214
- case 'leave':
215
- const stubType = `GROUP_PARTICIPANT_${child.tag.toUpperCase()}`;
216
- msg.messageStubType = Types_1.WAMessageStubType[stubType];
217
- const participants = (0, WABinary_1.getBinaryNodeChildren)(child, 'participant').map(p => p.attrs.jid);
218
- if (participants.length === 1 &&
219
- // if recv. "remove" message and sender removed themselves
220
- // mark as left
221
- (0, WABinary_1.areJidsSameUser)(participants[0], participant) &&
222
- child.tag === 'remove') {
223
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_PARTICIPANT_LEAVE;
224
- }
225
- msg.messageStubParameters = participants;
226
- break;
227
- case 'subject':
228
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_SUBJECT;
229
- msg.messageStubParameters = [child.attrs.subject];
230
- break;
231
- case 'description':
232
- const description = (_d = (_c = (0, WABinary_1.getBinaryNodeChild)(child, 'body')) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.toString();
233
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_DESCRIPTION;
234
- msg.messageStubParameters = description ? [description] : undefined;
235
- break;
236
- case 'announcement':
237
- case 'not_announcement':
238
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_ANNOUNCE;
239
- msg.messageStubParameters = [(child.tag === 'announcement') ? 'on' : 'off'];
240
- break;
241
- case 'locked':
242
- case 'unlocked':
243
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_RESTRICT;
244
- msg.messageStubParameters = [(child.tag === 'locked') ? 'on' : 'off'];
245
- break;
246
- case 'invite':
247
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_INVITE_LINK;
248
- msg.messageStubParameters = [child.attrs.code];
249
- break;
250
- case 'member_add_mode':
251
- const addMode = child.content;
252
- if (addMode) {
253
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_MEMBER_ADD_MODE;
254
- msg.messageStubParameters = [addMode.toString()];
255
- }
256
- break;
257
- case 'membership_approval_mode':
258
- const approvalMode = (0, WABinary_1.getBinaryNodeChild)(child, 'group_join');
259
- if (approvalMode) {
260
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE;
261
- msg.messageStubParameters = [approvalMode.attrs.state];
262
- }
263
- break;
264
- case 'created_membership_requests':
265
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD;
266
- msg.messageStubParameters = [participantJid, 'created', child.attrs.request_method];
267
- break;
268
- case 'revoked_membership_requests':
269
- const isDenied = (0, WABinary_1.areJidsSameUser)(participantJid, participant);
270
- msg.messageStubType = Types_1.WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD;
271
- msg.messageStubParameters = [participantJid, isDenied ? 'revoked' : 'rejected'];
272
- break;
273
- }
274
- };
275
- const processNotification = async (node) => {
276
- var _a, _b, _c;
277
- const result = {};
278
- const [child] = (0, WABinary_1.getAllBinaryNodeChildren)(node);
279
- const nodeType = node.attrs.type;
280
- const from = (0, WABinary_1.jidNormalizedUser)(node.attrs.from);
281
- switch (nodeType) {
282
- case 'privacy_token':
283
- const tokenList = (0, WABinary_1.getBinaryNodeChildren)(child, 'token');
284
- for (const { attrs, content } of tokenList) {
285
- const jid = attrs.jid;
286
- ev.emit('chats.update', [
287
- {
288
- id: jid,
289
- tcToken: content
290
- }
291
- ]);
292
- logger.debug({ jid }, 'got privacy token update');
293
- }
294
- break;
295
- case 'w:gp2':
296
- handleGroupNotification(node.attrs.participant, child, result);
297
- break;
298
- case 'mediaretry':
299
- const event = (0, Utils_1.decodeMediaRetryNode)(node);
300
- ev.emit('messages.media-update', [event]);
301
- break;
302
- case 'encrypt':
303
- await handleEncryptNotification(node);
304
- break;
305
- case 'devices':
306
- const devices = (0, WABinary_1.getBinaryNodeChildren)(child, 'device');
307
- if ((0, WABinary_1.areJidsSameUser)(child.attrs.jid, authState.creds.me.id)) {
308
- const deviceJids = devices.map(d => d.attrs.jid);
309
- logger.info({ deviceJids }, 'got my own devices');
310
- }
311
- break;
312
- case 'server_sync':
313
- const update = (0, WABinary_1.getBinaryNodeChild)(node, 'collection');
314
- if (update) {
315
- const name = update.attrs.name;
316
- await resyncAppState([name], false);
317
- }
318
- break;
319
- case 'picture':
320
- const setPicture = (0, WABinary_1.getBinaryNodeChild)(node, 'set');
321
- const delPicture = (0, WABinary_1.getBinaryNodeChild)(node, 'delete');
322
- ev.emit('contacts.update', [{
323
- id: (0, WABinary_1.jidNormalizedUser)((_a = node === null || node === void 0 ? void 0 : node.attrs) === null || _a === void 0 ? void 0 : _a.from) || ((_c = (_b = (setPicture || delPicture)) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c.hash) || '',
324
- imgUrl: setPicture ? 'changed' : 'removed'
325
- }]);
326
- if ((0, WABinary_1.isJidGroup)(from)) {
327
- const node = setPicture || delPicture;
328
- result.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_ICON;
329
- if (setPicture) {
330
- result.messageStubParameters = [setPicture.attrs.id];
331
- }
332
- result.participant = node === null || node === void 0 ? void 0 : node.attrs.author;
333
- result.key = {
334
- ...result.key || {},
335
- participant: setPicture === null || setPicture === void 0 ? void 0 : setPicture.attrs.author
336
- };
337
- }
338
- break;
339
- case 'account_sync':
340
- if (child.tag === 'disappearing_mode') {
341
- const newDuration = +child.attrs.duration;
342
- const timestamp = +child.attrs.t;
343
- logger.info({ newDuration }, 'updated account disappearing mode');
344
- ev.emit('creds.update', {
345
- accountSettings: {
346
- ...authState.creds.accountSettings,
347
- defaultDisappearingMode: {
348
- ephemeralExpiration: newDuration,
349
- ephemeralSettingTimestamp: timestamp,
350
- },
351
- }
352
- });
353
- }
354
- else if (child.tag === 'blocklist') {
355
- const blocklists = (0, WABinary_1.getBinaryNodeChildren)(child, 'item');
356
- for (const { attrs } of blocklists) {
357
- const blocklist = [attrs.jid];
358
- const type = (attrs.action === 'block') ? 'add' : 'remove';
359
- ev.emit('blocklist.update', { blocklist, type });
360
- }
361
- }
362
- break;
363
- case 'link_code_companion_reg':
364
- const linkCodeCompanionReg = (0, WABinary_1.getBinaryNodeChild)(node, 'link_code_companion_reg');
365
- const ref = toRequiredBuffer((0, WABinary_1.getBinaryNodeChildBuffer)(linkCodeCompanionReg, 'link_code_pairing_ref'));
366
- const primaryIdentityPublicKey = toRequiredBuffer((0, WABinary_1.getBinaryNodeChildBuffer)(linkCodeCompanionReg, 'primary_identity_pub'));
367
- const primaryEphemeralPublicKeyWrapped = toRequiredBuffer((0, WABinary_1.getBinaryNodeChildBuffer)(linkCodeCompanionReg, 'link_code_pairing_wrapped_primary_ephemeral_pub'));
368
- const codePairingPublicKey = await decipherLinkPublicKey(primaryEphemeralPublicKeyWrapped);
369
- const companionSharedKey = Utils_1.Curve.sharedKey(authState.creds.pairingEphemeralKeyPair.private, codePairingPublicKey);
370
- const random = (0, crypto_1.randomBytes)(32);
371
- const linkCodeSalt = (0, crypto_1.randomBytes)(32);
372
- const linkCodePairingExpanded = (0, Utils_1.hkdf)(companionSharedKey, 32, {
373
- salt: linkCodeSalt,
374
- info: 'link_code_pairing_key_bundle_encryption_key'
375
- });
376
- const encryptPayload = Buffer.concat([Buffer.from(authState.creds.signedIdentityKey.public), primaryIdentityPublicKey, random]);
377
- const encryptIv = (0, crypto_1.randomBytes)(12);
378
- const encrypted = (0, Utils_1.aesEncryptGCM)(encryptPayload, linkCodePairingExpanded, encryptIv, Buffer.alloc(0));
379
- const encryptedPayload = Buffer.concat([linkCodeSalt, encryptIv, encrypted]);
380
- const identitySharedKey = Utils_1.Curve.sharedKey(authState.creds.signedIdentityKey.private, primaryIdentityPublicKey);
381
- const identityPayload = Buffer.concat([companionSharedKey, identitySharedKey, random]);
382
- authState.creds.advSecretKey = (0, Utils_1.hkdf)(identityPayload, 32, { info: 'adv_secret' }).toString('base64');
383
- await query({
384
- tag: 'iq',
385
- attrs: {
386
- to: WABinary_1.S_WHATSAPP_NET,
387
- type: 'set',
388
- id: sock.generateMessageTag(),
389
- xmlns: 'md'
390
- },
391
- content: [
392
- {
393
- tag: 'link_code_companion_reg',
394
- attrs: {
395
- jid: authState.creds.me.id,
396
- stage: 'companion_finish',
397
- },
398
- content: [
399
- {
400
- tag: 'link_code_pairing_wrapped_key_bundle',
401
- attrs: {},
402
- content: encryptedPayload
403
- },
404
- {
405
- tag: 'companion_identity_public',
406
- attrs: {},
407
- content: authState.creds.signedIdentityKey.public
408
- },
409
- {
410
- tag: 'link_code_pairing_ref',
411
- attrs: {},
412
- content: ref
413
- }
414
- ]
415
- }
416
- ]
417
- });
418
- authState.creds.registered = true;
419
- ev.emit('creds.update', authState.creds);
420
- }
421
- if (Object.keys(result).length) {
422
- return result;
423
- }
424
- };
425
- async function decipherLinkPublicKey(data) {
426
- const buffer = toRequiredBuffer(data);
427
- const salt = buffer.slice(0, 32);
428
- const secretKey = await (0, Utils_1.derivePairingCodeKey)(authState.creds.pairingCode, salt);
429
- const iv = buffer.slice(32, 48);
430
- const payload = buffer.slice(48, 80);
431
- return (0, Utils_1.aesDecryptCTR)(payload, secretKey, iv);
432
- }
433
- function toRequiredBuffer(data) {
434
- if (data === undefined) {
435
- throw new boom_1.Boom('Invalid buffer', { statusCode: 400 });
436
- }
437
- return data instanceof Buffer ? data : Buffer.from(data);
438
- }
439
- const willSendMessageAgain = (id, participant) => {
440
- const key = `${id}:${participant}`;
441
- const retryCount = msgRetryCache.get(key) || 0;
442
- return retryCount < maxMsgRetryCount;
443
- };
444
- const updateSendMessageAgainCount = (id, participant) => {
445
- const key = `${id}:${participant}`;
446
- const newValue = (msgRetryCache.get(key) || 0) + 1;
447
- msgRetryCache.set(key, newValue);
448
- };
449
- const sendMessagesAgain = async (key, ids, retryNode) => {
450
- var _a;
451
- const msgs = await Promise.all(ids.map(id => getMessage({ ...key, id })));
452
- const remoteJid = key.remoteJid;
453
- const participant = key.participant || remoteJid;
454
- // if it's the primary jid sending the request
455
- // just re-send the message to everyone
456
- // prevents the first message decryption failure
457
- const sendToAll = !((_a = (0, WABinary_1.jidDecode)(participant)) === null || _a === void 0 ? void 0 : _a.device);
458
- await assertSessions([participant], true);
459
- if ((0, WABinary_1.isJidGroup)(remoteJid)) {
460
- await authState.keys.set({ 'sender-key-memory': { [remoteJid]: null } });
461
- }
462
- logger.debug({ participant, sendToAll }, 'forced new session for retry recp');
463
- for (let i = 0; i < msgs.length; i++) {
464
- const msg = msgs[i];
465
- if (msg) {
466
- updateSendMessageAgainCount(ids[i], participant);
467
- const msgRelayOpts = { messageId: ids[i] };
468
- if (sendToAll) {
469
- msgRelayOpts.useUserDevicesCache = false;
470
- }
471
- else {
472
- msgRelayOpts.participant = {
473
- jid: participant,
474
- count: +retryNode.attrs.count
475
- };
476
- }
477
- await relayMessage(key.remoteJid, msg, msgRelayOpts);
478
- }
479
- else {
480
- logger.debug({ jid: key.remoteJid, id: ids[i] }, 'recv retry request, but message not available');
481
- }
482
- }
483
- };
484
- const handleReceipt = async (node) => {
485
- var _a, _b;
486
- const { attrs, content } = node;
487
- const isLid = attrs.from.includes('lid');
488
- const isNodeFromMe = (0, WABinary_1.areJidsSameUser)(attrs.participant || attrs.from, isLid ? (_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.lid : (_b = authState.creds.me) === null || _b === void 0 ? void 0 : _b.id);
489
- const remoteJid = !isNodeFromMe || (0, WABinary_1.isJidGroup)(attrs.from) ? attrs.from : attrs.recipient;
490
- const fromMe = !attrs.recipient || (attrs.type === 'retry' && isNodeFromMe);
491
- const key = {
492
- remoteJid,
493
- id: '',
494
- fromMe,
495
- participant: attrs.participant
496
- };
497
- if (shouldIgnoreJid(remoteJid) && remoteJid !== '@s.whatsapp.net') {
498
- logger.debug({ remoteJid }, 'ignoring receipt from jid');
499
- await sendMessageAck(node);
500
- return;
501
- }
502
- const ids = [attrs.id];
503
- if (Array.isArray(content)) {
504
- const items = (0, WABinary_1.getBinaryNodeChildren)(content[0], 'item');
505
- ids.push(...items.map(i => i.attrs.id));
506
- }
507
- try {
508
- await Promise.all([
509
- processingMutex.mutex(async () => {
510
- const status = (0, Utils_1.getStatusFromReceiptType)(attrs.type);
511
- if (typeof status !== 'undefined' &&
512
- (
513
- // basically, we only want to know when a message from us has been delivered to/read by the other person
514
- // or another device of ours has read some messages
515
- status > WAProto_1.proto.WebMessageInfo.Status.DELIVERY_ACK ||
516
- !isNodeFromMe)) {
517
- if ((0, WABinary_1.isJidGroup)(remoteJid) || (0, WABinary_1.isJidStatusBroadcast)(remoteJid)) {
518
- if (attrs.participant) {
519
- const updateKey = status === WAProto_1.proto.WebMessageInfo.Status.DELIVERY_ACK ? 'receiptTimestamp' : 'readTimestamp';
520
- ev.emit('message-receipt.update', ids.map(id => ({
521
- key: { ...key, id },
522
- receipt: {
523
- userJid: (0, WABinary_1.jidNormalizedUser)(attrs.participant),
524
- [updateKey]: +attrs.t
525
- }
526
- })));
527
- }
528
- }
529
- else {
530
- ev.emit('messages.update', ids.map(id => ({
531
- key: { ...key, id },
532
- update: { status }
533
- })));
534
- }
535
- }
536
- if (attrs.type === 'retry') {
537
- // correctly set who is asking for the retry
538
- key.participant = key.participant || attrs.from;
539
- const retryNode = (0, WABinary_1.getBinaryNodeChild)(node, 'retry');
540
- if (willSendMessageAgain(ids[0], key.participant)) {
541
- if (key.fromMe) {
542
- try {
543
- logger.debug({ attrs, key }, 'recv retry request');
544
- await sendMessagesAgain(key, ids, retryNode);
545
- }
546
- catch (error) {
547
- logger.error({ key, ids, trace: error.stack }, 'error in sending message again');
548
- }
549
- }
550
- else {
551
- logger.info({ attrs, key }, 'recv retry for not fromMe message');
552
- }
553
- }
554
- else {
555
- logger.info({ attrs, key }, 'will not send message again, as sent too many times');
556
- }
557
- }
558
- })
559
- ]);
560
- }
561
- finally {
562
- await sendMessageAck(node);
563
- }
564
- };
565
- const handleNotification = async (node) => {
566
- const remoteJid = node.attrs.from;
567
- if (shouldIgnoreJid(remoteJid) && remoteJid !== '@s.whatsapp.net') {
568
- logger.debug({ remoteJid, id: node.attrs.id }, 'ignored notification');
569
- await sendMessageAck(node);
570
- return;
571
- }
572
- try {
573
- await Promise.all([
574
- processingMutex.mutex(async () => {
575
- var _a;
576
- const msg = await processNotification(node);
577
- if (msg) {
578
- const fromMe = (0, WABinary_1.areJidsSameUser)(node.attrs.participant || remoteJid, authState.creds.me.id);
579
- msg.key = {
580
- remoteJid,
581
- fromMe,
582
- participant: node.attrs.participant,
583
- id: node.attrs.id,
584
- ...(msg.key || {})
585
- };
586
- (_a = msg.participant) !== null && _a !== void 0 ? _a : (msg.participant = node.attrs.participant);
587
- msg.messageTimestamp = +node.attrs.t;
588
- const fullMsg = WAProto_1.proto.WebMessageInfo.fromObject(msg);
589
- await upsertMessage(fullMsg, 'append');
590
- }
591
- })
592
- ]);
593
- }
594
- finally {
595
- await sendMessageAck(node);
596
- }
597
- };
598
- const handleMessage = async (node) => {
599
- var _a, _b, _c;
600
- if (shouldIgnoreJid(node.attrs.from) && node.attrs.from !== '@s.whatsapp.net') {
601
- logger.debug({ key: node.attrs.key }, 'ignored message');
602
- await sendMessageAck(node);
603
- return;
604
- }
605
- let response;
606
- if ((0, WABinary_1.getBinaryNodeChild)(node, 'unavailable') && !(0, WABinary_1.getBinaryNodeChild)(node, 'enc')) {
607
- await sendMessageAck(node);
608
- const { key } = (0, Utils_1.decodeMessageNode)(node, authState.creds.me.id, authState.creds.me.lid || '').fullMessage;
609
- response = await requestPlaceholderResend(key);
610
- if (response === 'RESOLVED') {
611
- return;
612
- }
613
- logger.debug('received unavailable message, acked and requested resend from phone');
614
- }
615
- else {
616
- if (placeholderResendCache.get(node.attrs.id)) {
617
- placeholderResendCache.del(node.attrs.id);
618
- }
619
- }
620
- const { fullMessage: msg, category, author, decrypt } = (0, Utils_1.decryptMessageNode)(node, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, logger);
621
- if (response && ((_a = msg === null || msg === void 0 ? void 0 : msg.messageStubParameters) === null || _a === void 0 ? void 0 : _a[0]) === Utils_1.NO_MESSAGE_FOUND_ERROR_TEXT) {
622
- msg.messageStubParameters = [Utils_1.NO_MESSAGE_FOUND_ERROR_TEXT, response];
623
- }
624
- if (((_c = (_b = msg.message) === null || _b === void 0 ? void 0 : _b.protocolMessage) === null || _c === void 0 ? void 0 : _c.type) === WAProto_1.proto.Message.ProtocolMessage.Type.SHARE_PHONE_NUMBER) {
625
- if (node.attrs.sender_pn) {
626
- ev.emit('chats.phoneNumberShare', { lid: node.attrs.from, jid: node.attrs.sender_pn });
627
- }
628
- }
629
- try {
630
- await Promise.all([
631
- processingMutex.mutex(async () => {
632
- await decrypt();
633
- // message failed to decrypt
634
- if (msg.messageStubType === WAProto_1.proto.WebMessageInfo.StubType.CIPHERTEXT) {
635
- retryMutex.mutex(async () => {
636
- if (ws.isOpen) {
637
- if ((0, WABinary_1.getBinaryNodeChild)(node, 'unavailable')) {
638
- return;
639
- }
640
- const encNode = (0, WABinary_1.getBinaryNodeChild)(node, 'enc');
641
- await sendRetryRequest(node, !encNode);
642
- if (retryRequestDelayMs) {
643
- await (0, Utils_1.delay)(retryRequestDelayMs);
644
- }
645
- }
646
- else {
647
- logger.debug({ node }, 'connection closed, ignoring retry req');
648
- }
649
- });
650
- }
651
- else {
652
- // no type in the receipt => message delivered
653
- let type = undefined;
654
- let participant = msg.key.participant;
655
- if (category === 'peer') { // special peer message
656
- type = 'peer_msg';
657
- }
658
- else if (msg.key.fromMe) { // message was sent by us from a different device
659
- type = 'sender';
660
- // need to specially handle this case
661
- if ((0, WABinary_1.isJidUser)(msg.key.remoteJid)) {
662
- participant = author;
663
- }
664
- }
665
- else if (!sendActiveReceipts) {
666
- type = 'inactive';
667
- }
668
- await sendReceipt(msg.key.remoteJid, participant, [msg.key.id], type);
669
- // send ack for history message
670
- const isAnyHistoryMsg = (0, Utils_1.getHistoryMsg)(msg.message);
671
- if (isAnyHistoryMsg) {
672
- const jid = (0, WABinary_1.jidNormalizedUser)(msg.key.remoteJid);
673
- await sendReceipt(jid, undefined, [msg.key.id], 'hist_sync');
674
- }
675
- }
676
- (0, Utils_2.cleanMessage)(msg, authState.creds.me.id);
677
- await upsertMessage(msg, node.attrs.offline ? 'append' : 'notify');
678
- })
679
- ]);
680
- }
681
- finally {
682
- await sendMessageAck(node);
683
- }
684
- };
685
- const fetchMessageHistory = async (count, oldestMsgKey, oldestMsgTimestamp) => {
686
- var _a;
687
- if (!((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id)) {
688
- throw new boom_1.Boom('Not authenticated');
689
- }
690
- const pdoMessage = {
691
- historySyncOnDemandRequest: {
692
- chatJid: oldestMsgKey.remoteJid,
693
- oldestMsgFromMe: oldestMsgKey.fromMe,
694
- oldestMsgId: oldestMsgKey.id,
695
- oldestMsgTimestampMs: oldestMsgTimestamp,
696
- onDemandMsgCount: count
697
- },
698
- peerDataOperationRequestType: WAProto_1.proto.Message.PeerDataOperationRequestType.HISTORY_SYNC_ON_DEMAND
699
- };
700
- return sendPeerDataOperationMessage(pdoMessage);
701
- };
702
- const requestPlaceholderResend = async (messageKey) => {
703
- var _a;
704
- if (!((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id)) {
705
- throw new boom_1.Boom('Not authenticated');
706
- }
707
- if (placeholderResendCache.get(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id)) {
708
- logger.debug('already requested resend', { messageKey });
709
- return;
710
- }
711
- else {
712
- placeholderResendCache.set(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id, true);
713
- }
714
- await (0, Utils_1.delay)(5000);
715
- if (!placeholderResendCache.get(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id)) {
716
- logger.debug('message received while resend requested', { messageKey });
717
- return 'RESOLVED';
718
- }
719
- const pdoMessage = {
720
- placeholderMessageResendRequest: [{
721
- messageKey
722
- }],
723
- peerDataOperationRequestType: WAProto_1.proto.Message.PeerDataOperationRequestType.PLACEHOLDER_MESSAGE_RESEND
724
- };
725
- setTimeout(() => {
726
- if (placeholderResendCache.get(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id)) {
727
- logger.debug('PDO message without response after 15 seconds. Phone possibly offline', { messageKey });
728
- placeholderResendCache.del(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id);
729
- }
730
- }, 15000);
731
- return sendPeerDataOperationMessage(pdoMessage);
732
- };
733
- const handleCall = async (node) => {
734
- const { attrs } = node;
735
- const [infoChild] = (0, WABinary_1.getAllBinaryNodeChildren)(node);
736
- const callId = infoChild.attrs['call-id'];
737
- const from = infoChild.attrs.from || infoChild.attrs['call-creator'];
738
- const status = (0, Utils_1.getCallStatusFromNode)(infoChild);
739
- const call = {
740
- chatId: attrs.from,
741
- from,
742
- id: callId,
743
- date: new Date(+attrs.t * 1000),
744
- offline: !!attrs.offline,
745
- status,
746
- };
747
- if (status === 'offer') {
748
- call.isVideo = !!(0, WABinary_1.getBinaryNodeChild)(infoChild, 'video');
749
- call.isGroup = infoChild.attrs.type === 'group' || !!infoChild.attrs['group-jid'];
750
- call.groupJid = infoChild.attrs['group-jid'];
751
- callOfferCache.set(call.id, call);
752
- }
753
- const existingCall = callOfferCache.get(call.id);
754
- // use existing call info to populate this event
755
- if (existingCall) {
756
- call.isVideo = existingCall.isVideo;
757
- call.isGroup = existingCall.isGroup;
758
- }
759
- // delete data once call has ended
760
- if (status === 'reject' || status === 'accept' || status === 'timeout' || status === 'terminate') {
761
- callOfferCache.del(call.id);
762
- }
763
- ev.emit('call', [call]);
764
- await sendMessageAck(node);
765
- };
766
- const handleBadAck = async ({ attrs }) => {
767
- const key = { remoteJid: attrs.from, fromMe: true, id: attrs.id };
768
- // current hypothesis is that if pash is sent in the ack
769
- // it means -- the message hasn't reached all devices yet
770
- // we'll retry sending the message here
771
- if (attrs.phash) {
772
- logger.info({ attrs }, 'received phash in ack, resending message...');
773
- const msg = await getMessage(key);
774
- if (msg) {
775
- await relayMessage(key.remoteJid, msg, { messageId: key.id, useUserDevicesCache: false });
776
- }
777
- else {
778
- logger.warn({ attrs }, 'could not send message again, as it was not found');
779
- }
780
- }
781
- // error in acknowledgement,
782
- // device could not display the message
783
- if (attrs.error) {
784
- logger.warn({ attrs }, 'received error in ack');
785
- ev.emit('messages.update', [
786
- {
787
- key,
788
- update: {
789
- status: Types_1.WAMessageStatus.ERROR,
790
- messageStubParameters: [
791
- attrs.error
792
- ]
793
- }
794
- }
795
- ]);
796
- }
797
- };
798
- /// processes a node with the given function
799
- /// and adds the task to the existing buffer if we're buffering events
800
- const processNodeWithBuffer = async (node, identifier, exec) => {
801
- ev.buffer();
802
- await execTask();
803
- ev.flush();
804
- function execTask() {
805
- return exec(node)
806
- .catch(err => onUnexpectedError(err, identifier));
807
- }
808
- };
809
- // recv a message
810
- ws.on('CB:message', (node) => {
811
- processNodeWithBuffer(node, 'processing message', handleMessage);
812
- });
813
- ws.on('CB:call', async (node) => {
814
- processNodeWithBuffer(node, 'handling call', handleCall);
815
- });
816
- ws.on('CB:receipt', node => {
817
- processNodeWithBuffer(node, 'handling receipt', handleReceipt);
818
- });
819
- ws.on('CB:notification', async (node) => {
820
- processNodeWithBuffer(node, 'handling notification', handleNotification);
821
- });
822
- ws.on('CB:ack,class:message', (node) => {
823
- handleBadAck(node)
824
- .catch(error => onUnexpectedError(error, 'handling bad ack'));
825
- });
826
- ev.on('call', ([call]) => {
827
- // missed call + group call notification message generation
828
- if (call.status === 'timeout' || (call.status === 'offer' && call.isGroup)) {
829
- const msg = {
830
- key: {
831
- remoteJid: call.chatId,
832
- id: call.id,
833
- fromMe: false
834
- },
835
- messageTimestamp: (0, Utils_1.unixTimestampSeconds)(call.date),
836
- };
837
- if (call.status === 'timeout') {
838
- if (call.isGroup) {
839
- msg.messageStubType = call.isVideo ? Types_1.WAMessageStubType.CALL_MISSED_GROUP_VIDEO : Types_1.WAMessageStubType.CALL_MISSED_GROUP_VOICE;
840
- }
841
- else {
842
- msg.messageStubType = call.isVideo ? Types_1.WAMessageStubType.CALL_MISSED_VIDEO : Types_1.WAMessageStubType.CALL_MISSED_VOICE;
843
- }
844
- }
845
- else {
846
- msg.message = { call: { callKey: Buffer.from(call.id) } };
847
- }
848
- const protoMsg = WAProto_1.proto.WebMessageInfo.fromObject(msg);
849
- upsertMessage(protoMsg, call.offline ? 'append' : 'notify');
850
- }
851
- });
852
- ev.on('connection.update', ({ isOnline }) => {
853
- if (typeof isOnline !== 'undefined') {
854
- sendActiveReceipts = isOnline;
855
- logger.trace(`sendActiveReceipts set to "${sendActiveReceipts}"`);
856
- }
857
- });
858
- return {
859
- ...sock,
860
- sendMessageAck,
861
- sendRetryRequest,
862
- rejectCall,
863
- fetchMessageHistory,
864
- requestPlaceholderResend,
865
- };
866
- };
867
- exports.makeMessagesRecvSocket = makeMessagesRecvSocket;