@alannxd/baileys 6.0.5 → 6.0.6

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 (234) hide show
  1. package/WAProto/fix-import.js +29 -0
  2. package/WAProto/index.js +160 -201
  3. package/engine-requirements.js +1 -1
  4. package/lib/Defaults/baileys-version.json +3 -0
  5. package/lib/Defaults/index.d.ts +15 -37
  6. package/lib/Defaults/index.js +136 -119
  7. package/lib/Defaults/phonenumber-mcc.json +223 -0
  8. package/lib/Signal/Group/ciphertext-message.d.ts +0 -1
  9. package/lib/Signal/Group/ciphertext-message.js +5 -2
  10. package/lib/Signal/Group/group-session-builder.d.ts +3 -4
  11. package/lib/Signal/Group/group-session-builder.js +41 -7
  12. package/lib/Signal/Group/group_cipher.d.ts +4 -4
  13. package/lib/Signal/Group/group_cipher.js +51 -37
  14. package/lib/Signal/Group/index.d.ts +11 -12
  15. package/lib/Signal/Group/index.js +57 -12
  16. package/lib/Signal/Group/keyhelper.d.ts +1 -2
  17. package/lib/Signal/Group/keyhelper.js +44 -7
  18. package/lib/Signal/Group/queue-job.d.ts +1 -0
  19. package/lib/Signal/Group/queue-job.js +57 -0
  20. package/lib/Signal/Group/sender-chain-key.d.ts +2 -3
  21. package/lib/Signal/Group/sender-chain-key.js +15 -7
  22. package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -2
  23. package/lib/Signal/Group/sender-key-distribution-message.js +11 -8
  24. package/lib/Signal/Group/sender-key-message.d.ts +1 -2
  25. package/lib/Signal/Group/sender-key-message.js +12 -9
  26. package/lib/Signal/Group/sender-key-name.d.ts +0 -1
  27. package/lib/Signal/Group/sender-key-name.js +5 -2
  28. package/lib/Signal/Group/sender-key-record.d.ts +2 -3
  29. package/lib/Signal/Group/sender-key-record.js +21 -9
  30. package/lib/Signal/Group/sender-key-state.d.ts +6 -7
  31. package/lib/Signal/Group/sender-key-state.js +42 -27
  32. package/lib/Signal/Group/sender-message-key.d.ts +0 -1
  33. package/lib/Signal/Group/sender-message-key.js +7 -4
  34. package/lib/Signal/libsignal.d.ts +3 -5
  35. package/lib/Signal/libsignal.js +90 -347
  36. package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +5 -4
  37. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  38. package/lib/Socket/Client/index.d.ts +3 -3
  39. package/lib/Socket/Client/index.js +19 -3
  40. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  41. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  42. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +2 -3
  43. package/lib/Socket/Client/web-socket-client.js +62 -0
  44. package/lib/Socket/business.d.ts +108 -154
  45. package/lib/Socket/business.js +43 -162
  46. package/lib/Socket/chats.d.ts +239 -96
  47. package/lib/Socket/chats.js +427 -627
  48. package/lib/Socket/communities.d.ts +146 -239
  49. package/lib/Socket/communities.js +80 -90
  50. package/lib/Socket/groups.d.ts +57 -104
  51. package/lib/Socket/groups.js +161 -154
  52. package/lib/Socket/index.d.ts +115 -202
  53. package/lib/Socket/index.js +10 -11
  54. package/lib/Socket/luxu.d.ts +266 -22
  55. package/lib/Socket/luxu.js +465 -422
  56. package/lib/Socket/messages-recv.d.ts +84 -136
  57. package/lib/Socket/messages-recv.js +615 -1421
  58. package/lib/Socket/messages-send.d.ts +126 -142
  59. package/lib/Socket/messages-send.js +671 -878
  60. package/lib/Socket/newsletter.d.ts +85 -121
  61. package/lib/Socket/newsletter.js +272 -147
  62. package/lib/Socket/registration.d.ts +267 -0
  63. package/lib/Socket/registration.js +166 -0
  64. package/lib/Socket/socket.d.ts +19 -34
  65. package/lib/Socket/socket.js +313 -544
  66. package/lib/Socket/usync.d.ts +36 -0
  67. package/lib/Socket/usync.js +70 -0
  68. package/lib/Store/index.d.ts +3 -10
  69. package/lib/Store/index.js +10 -10
  70. package/lib/Store/make-cache-manager-store.d.ts +11 -17
  71. package/lib/Store/make-cache-manager-store.js +41 -43
  72. package/lib/Store/make-in-memory-store.d.ts +118 -39
  73. package/lib/Store/make-in-memory-store.js +341 -112
  74. package/lib/Store/make-ordered-dictionary.d.ts +10 -11
  75. package/lib/Store/make-ordered-dictionary.js +20 -14
  76. package/lib/Store/object-repository.d.ts +9 -10
  77. package/lib/Store/object-repository.js +6 -11
  78. package/lib/Types/Auth.d.ts +12 -19
  79. package/lib/Types/Auth.js +2 -2
  80. package/lib/Types/Call.d.ts +1 -3
  81. package/lib/Types/Call.js +2 -2
  82. package/lib/Types/Chat.d.ts +13 -35
  83. package/lib/Types/Chat.js +4 -8
  84. package/lib/Types/Contact.d.ts +1 -8
  85. package/lib/Types/Contact.js +2 -2
  86. package/lib/Types/Events.d.ts +17 -116
  87. package/lib/Types/Events.js +2 -2
  88. package/lib/Types/GroupMetadata.d.ts +5 -21
  89. package/lib/Types/GroupMetadata.js +2 -2
  90. package/lib/Types/Label.d.ts +0 -12
  91. package/lib/Types/Label.js +5 -3
  92. package/lib/Types/LabelAssociation.d.ts +0 -1
  93. package/lib/Types/LabelAssociation.js +5 -3
  94. package/lib/Types/Message.d.ts +58 -105
  95. package/lib/Types/Message.js +9 -11
  96. package/lib/Types/Newsletter.d.ts +103 -0
  97. package/lib/Types/Newsletter.js +38 -0
  98. package/lib/Types/Product.d.ts +1 -2
  99. package/lib/Types/Product.js +2 -2
  100. package/lib/Types/Signal.d.ts +2 -32
  101. package/lib/Types/Signal.js +2 -2
  102. package/lib/Types/Socket.d.ts +25 -50
  103. package/lib/Types/Socket.js +2 -3
  104. package/lib/Types/State.d.ts +2 -72
  105. package/lib/Types/State.js +2 -56
  106. package/lib/Types/USync.d.ts +2 -3
  107. package/lib/Types/USync.js +2 -2
  108. package/lib/Types/index.d.ts +14 -22
  109. package/lib/Types/index.js +31 -15
  110. package/lib/Utils/auth-utils.d.ts +6 -12
  111. package/lib/Utils/auth-utils.js +143 -239
  112. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  113. package/lib/Utils/baileys-event-stream.js +63 -0
  114. package/lib/Utils/business.d.ts +2 -3
  115. package/lib/Utils/business.js +69 -66
  116. package/lib/Utils/chat-utils.d.ts +23 -52
  117. package/lib/Utils/chat-utils.js +253 -396
  118. package/lib/Utils/crypto.d.ts +22 -18
  119. package/lib/Utils/crypto.js +90 -57
  120. package/lib/Utils/decode-wa-message.d.ts +8 -55
  121. package/lib/Utils/decode-wa-message.js +84 -203
  122. package/lib/Utils/event-buffer.d.ts +8 -9
  123. package/lib/Utils/event-buffer.js +77 -185
  124. package/lib/Utils/generics.d.ts +29 -28
  125. package/lib/Utils/generics.js +210 -180
  126. package/lib/Utils/history.d.ts +9 -18
  127. package/lib/Utils/history.js +55 -93
  128. package/lib/Utils/index.d.ts +17 -22
  129. package/lib/Utils/index.js +33 -22
  130. package/lib/Utils/link-preview.d.ts +5 -5
  131. package/lib/Utils/link-preview.js +24 -16
  132. package/lib/Utils/logger.d.ts +3 -11
  133. package/lib/Utils/logger.js +7 -3
  134. package/lib/Utils/lt-hash.d.ts +12 -8
  135. package/lib/Utils/lt-hash.js +46 -3
  136. package/lib/Utils/make-mutex.d.ts +2 -4
  137. package/lib/Utils/make-mutex.js +34 -24
  138. package/lib/Utils/messages-media.d.ts +44 -61
  139. package/lib/Utils/messages-media.js +482 -451
  140. package/lib/Utils/messages.d.ts +18 -32
  141. package/lib/Utils/messages.js +369 -458
  142. package/lib/Utils/noise-handler.d.ts +14 -13
  143. package/lib/Utils/noise-handler.js +99 -145
  144. package/lib/Utils/process-message.d.ts +12 -31
  145. package/lib/Utils/process-message.js +150 -459
  146. package/lib/Utils/signal.d.ts +5 -20
  147. package/lib/Utils/signal.js +72 -120
  148. package/lib/Utils/use-multi-file-auth-state.d.ts +2 -2
  149. package/lib/Utils/use-multi-file-auth-state.js +27 -29
  150. package/lib/Utils/validate-connection.d.ts +7 -7
  151. package/lib/Utils/validate-connection.js +99 -73
  152. package/lib/WABinary/constants.d.ts +27 -25
  153. package/lib/WABinary/constants.js +20 -1281
  154. package/lib/WABinary/decode.d.ts +5 -5
  155. package/lib/WABinary/decode.js +42 -52
  156. package/lib/WABinary/encode.d.ts +3 -3
  157. package/lib/WABinary/encode.js +155 -110
  158. package/lib/WABinary/generic-utils.d.ts +7 -8
  159. package/lib/WABinary/generic-utils.js +49 -48
  160. package/lib/WABinary/index.d.ts +5 -6
  161. package/lib/WABinary/index.js +21 -6
  162. package/lib/WABinary/jid-utils.d.ts +8 -25
  163. package/lib/WABinary/jid-utils.js +40 -74
  164. package/lib/WABinary/types.d.ts +1 -2
  165. package/lib/WABinary/types.js +2 -2
  166. package/lib/WAM/BinaryInfo.d.ts +11 -3
  167. package/lib/WAM/BinaryInfo.js +5 -2
  168. package/lib/WAM/constants.d.ts +3 -5
  169. package/lib/WAM/constants.js +11958 -19461
  170. package/lib/WAM/encode.d.ts +3 -3
  171. package/lib/WAM/encode.js +22 -17
  172. package/lib/WAM/index.d.ts +3 -4
  173. package/lib/WAM/index.js +19 -4
  174. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -4
  175. package/lib/WAUSync/Protocols/USyncContactProtocol.js +13 -33
  176. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -3
  177. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +14 -11
  178. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -3
  179. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -9
  180. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -3
  181. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +13 -9
  182. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -4
  183. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +22 -20
  184. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -5
  185. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +8 -13
  186. package/lib/WAUSync/Protocols/index.d.ts +4 -6
  187. package/lib/WAUSync/Protocols/index.js +20 -6
  188. package/lib/WAUSync/USyncQuery.d.ts +4 -6
  189. package/lib/WAUSync/USyncQuery.js +35 -44
  190. package/lib/WAUSync/USyncUser.d.ts +5 -10
  191. package/lib/WAUSync/USyncUser.js +5 -10
  192. package/lib/WAUSync/index.js +19 -4
  193. package/lib/index.d.ts +9 -10
  194. package/lib/index.js +34 -12
  195. package/package.json +50 -83
  196. package/WAProto/GenerateStatics.sh +0 -3
  197. package/WAProto/WAProto.proto +0 -5479
  198. package/WAProto/fix-imports.js +0 -85
  199. package/WAProto/index.d.ts +0 -14017
  200. package/lib/Signal/lid-mapping.d.ts +0 -23
  201. package/lib/Signal/lid-mapping.js +0 -277
  202. package/lib/Socket/Client/types.js +0 -11
  203. package/lib/Socket/Client/websocket.js +0 -54
  204. package/lib/Socket/mex.d.ts +0 -3
  205. package/lib/Socket/mex.js +0 -42
  206. package/lib/Store/keyed-db.d.ts +0 -22
  207. package/lib/Store/keyed-db.js +0 -108
  208. package/lib/Types/Bussines.d.ts +0 -25
  209. package/lib/Types/Bussines.js +0 -2
  210. package/lib/Types/Mex.d.ts +0 -141
  211. package/lib/Types/Mex.js +0 -37
  212. package/lib/Utils/browser-utils.d.ts +0 -4
  213. package/lib/Utils/browser-utils.js +0 -28
  214. package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
  215. package/lib/Utils/companion-reg-client-utils.js +0 -35
  216. package/lib/Utils/identity-change-handler.d.ts +0 -44
  217. package/lib/Utils/identity-change-handler.js +0 -50
  218. package/lib/Utils/message-retry-manager.d.ts +0 -115
  219. package/lib/Utils/message-retry-manager.js +0 -265
  220. package/lib/Utils/offline-node-processor.d.ts +0 -17
  221. package/lib/Utils/offline-node-processor.js +0 -40
  222. package/lib/Utils/pre-key-manager.d.ts +0 -28
  223. package/lib/Utils/pre-key-manager.js +0 -106
  224. package/lib/Utils/reporting-utils.d.ts +0 -11
  225. package/lib/Utils/reporting-utils.js +0 -258
  226. package/lib/Utils/stanza-ack.d.ts +0 -11
  227. package/lib/Utils/stanza-ack.js +0 -38
  228. package/lib/Utils/sync-action-utils.d.ts +0 -19
  229. package/lib/Utils/sync-action-utils.js +0 -49
  230. package/lib/Utils/tc-token-utils.d.ts +0 -37
  231. package/lib/Utils/tc-token-utils.js +0 -163
  232. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
  233. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -25
  234. package/lib/WAUSync/index.d.ts +0 -4
@@ -1,12 +1,13 @@
1
- import { proto } from '../../WAProto/index.js';
2
- import { WAMessageStubType } from '../Types/index.js';
3
- import { generateMessageID, generateMessageIDV2, unixTimestampSeconds } from '../Utils/index.js';
4
- import logger from '../Utils/logger.js';
5
- import { getBinaryNodeChild, getBinaryNodeChildren, getBinaryNodeChildString, jidEncode, jidNormalizedUser } from '../WABinary/index.js';
6
- import { makeBusinessSocket } from './business.js';
7
- export const makeCommunitiesSocket = (config) => {
8
- const sock = makeBusinessSocket(config);
1
+ const WAProto_1 = require('../../WAProto');
2
+ const Types_1 = require('../Types');
3
+ const Utils_1 = require('../Utils');
4
+ const WABinary_1 = require('../WABinary');
5
+ const newsletter_1 = require('./newsletter');
6
+
7
+ const makeCommunitiesSocket = (config) => {
8
+ const sock = (0, newsletter_1.makeNewsletterSocket)(config);
9
9
  const { authState, ev, query, upsertMessage } = sock;
10
+
10
11
  const communityQuery = async (jid, type, content) => query({
11
12
  tag: 'iq',
12
13
  attrs: {
@@ -16,10 +17,12 @@ export const makeCommunitiesSocket = (config) => {
16
17
  },
17
18
  content
18
19
  });
20
+
19
21
  const communityMetadata = async (jid) => {
20
22
  const result = await communityQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
21
23
  return extractCommunityMetadata(result);
22
24
  };
25
+
23
26
  const communityFetchAllParticipating = async () => {
24
27
  const result = await query({
25
28
  tag: 'iq',
@@ -40,9 +43,9 @@ export const makeCommunitiesSocket = (config) => {
40
43
  ]
41
44
  });
42
45
  const data = {};
43
- const communitiesChild = getBinaryNodeChild(result, 'communities');
46
+ const communitiesChild = WABinary_1.getBinaryNodeChild(result, 'communities');
44
47
  if (communitiesChild) {
45
- const communities = getBinaryNodeChildren(communitiesChild, 'community');
48
+ const communities = WABinary_1.getBinaryNodeChildren(communitiesChild, 'community');
46
49
  for (const communityNode of communities) {
47
50
  const meta = extractCommunityMetadata({
48
51
  tag: 'result',
@@ -55,14 +58,15 @@ export const makeCommunitiesSocket = (config) => {
55
58
  sock.ev.emit('groups.update', Object.values(data));
56
59
  return data;
57
60
  };
61
+
58
62
  async function parseGroupResult(node) {
59
- logger.info({ node }, 'parseGroupResult');
60
- const groupNode = getBinaryNodeChild(node, 'group');
63
+ Utils_1.logger.info({ node }, 'parseGroupResult');
64
+ const groupNode = WABinary_1.getBinaryNodeChild(node, 'group');
61
65
  if (groupNode) {
62
66
  try {
63
- logger.info({ groupNode }, 'groupNode');
67
+ Utils_1.logger.info({ groupNode }, 'groupNode');
64
68
  const metadata = await sock.groupMetadata(`${groupNode.attrs.id}@g.us`);
65
- return metadata ? metadata : Optional.empty();
69
+ return metadata? metadata : Optional.empty();
66
70
  }
67
71
  catch (error) {
68
72
  console.error('Error parsing group metadata:', error);
@@ -71,23 +75,26 @@ export const makeCommunitiesSocket = (config) => {
71
75
  }
72
76
  return Optional.empty();
73
77
  }
78
+
74
79
  const Optional = {
75
80
  empty: () => null,
76
- of: (value) => (value !== null ? { value } : null)
81
+ of: (value) => (value!== null? { value } : null)
77
82
  };
83
+
78
84
  sock.ws.on('CB:ib,,dirty', async (node) => {
79
- const { attrs } = getBinaryNodeChild(node, 'dirty');
80
- if (attrs.type !== 'communities') {
85
+ const { attrs } = WABinary_1.getBinaryNodeChild(node, 'dirty');
86
+ if (attrs.type!== 'communities') {
81
87
  return;
82
88
  }
83
89
  await communityFetchAllParticipating();
84
90
  await sock.cleanDirtyBits('groups');
85
91
  });
92
+
86
93
  return {
87
- ...sock,
94
+ ...sock,
88
95
  communityMetadata,
89
96
  communityCreate: async (subject, body) => {
90
- const descriptionId = generateMessageID().substring(0, 12);
97
+ const descriptionId = Utils_1.generateMessageID().substring(0, 12);
91
98
  const result = await communityQuery('@g.us', 'set', [
92
99
  {
93
100
  tag: 'create',
@@ -122,7 +129,7 @@ export const makeCommunitiesSocket = (config) => {
122
129
  return await parseGroupResult(result);
123
130
  },
124
131
  communityCreateGroup: async (subject, participants, parentCommunityJid) => {
125
- const key = generateMessageIDV2();
132
+ const key = Utils_1.generateMessageIDV2();
126
133
  const result = await communityQuery('@g.us', 'set', [
127
134
  {
128
135
  tag: 'create',
@@ -131,7 +138,7 @@ export const makeCommunitiesSocket = (config) => {
131
138
  key
132
139
  },
133
140
  content: [
134
- ...participants.map(jid => ({
141
+ ...participants.map(jid => ({
135
142
  tag: 'participant',
136
143
  attrs: { jid }
137
144
  })),
@@ -186,29 +193,25 @@ export const makeCommunitiesSocket = (config) => {
186
193
  communityFetchLinkedGroups: async (jid) => {
187
194
  let communityJid = jid;
188
195
  let isCommunity = false;
189
- // Try to determine if it is a subgroup or a community
190
196
  const metadata = await sock.groupMetadata(jid);
191
197
  if (metadata.linkedParent) {
192
- // It is a subgroup, get the community jid
193
198
  communityJid = metadata.linkedParent;
194
199
  }
195
200
  else {
196
- // It is a community
197
201
  isCommunity = true;
198
202
  }
199
- // Fetch all subgroups of the community
200
203
  const result = await communityQuery(communityJid, 'get', [{ tag: 'sub_groups', attrs: {} }]);
201
204
  const linkedGroupsData = [];
202
- const subGroupsNode = getBinaryNodeChild(result, 'sub_groups');
205
+ const subGroupsNode = WABinary_1.getBinaryNodeChild(result, 'sub_groups');
203
206
  if (subGroupsNode) {
204
- const groupNodes = getBinaryNodeChildren(subGroupsNode, 'group');
207
+ const groupNodes = WABinary_1.getBinaryNodeChildren(subGroupsNode, 'group');
205
208
  for (const groupNode of groupNodes) {
206
209
  linkedGroupsData.push({
207
- id: groupNode.attrs.id ? jidEncode(groupNode.attrs.id, 'g.us') : undefined,
210
+ id: groupNode.attrs.id? WABinary_1.jidEncode(groupNode.attrs.id, 'g.us') : undefined,
208
211
  subject: groupNode.attrs.subject || '',
209
- creation: groupNode.attrs.creation ? Number(groupNode.attrs.creation) : undefined,
210
- owner: groupNode.attrs.creator ? jidNormalizedUser(groupNode.attrs.creator) : undefined,
211
- size: groupNode.attrs.size ? Number(groupNode.attrs.size) : undefined
212
+ creation: groupNode.attrs.creation? Number(groupNode.attrs.creation) : undefined,
213
+ owner: groupNode.attrs.creator? WABinary_1.jidNormalizedUser(groupNode.attrs.creator) : undefined,
214
+ size: groupNode.attrs.size? Number(groupNode.attrs.size) : undefined
212
215
  });
213
216
  }
214
217
  }
@@ -225,8 +228,8 @@ export const makeCommunitiesSocket = (config) => {
225
228
  attrs: {}
226
229
  }
227
230
  ]);
228
- const node = getBinaryNodeChild(result, 'membership_approval_requests');
229
- const participants = getBinaryNodeChildren(node, 'membership_approval_request');
231
+ const node = WABinary_1.getBinaryNodeChild(result, 'membership_approval_requests');
232
+ const participants = WABinary_1.getBinaryNodeChildren(node, 'membership_approval_request');
230
233
  return participants.map(v => v.attrs);
231
234
  },
232
235
  communityRequestParticipantsUpdate: async (jid, participants, action) => {
@@ -246,9 +249,9 @@ export const makeCommunitiesSocket = (config) => {
246
249
  ]
247
250
  }
248
251
  ]);
249
- const node = getBinaryNodeChild(result, 'membership_requests_action');
250
- const nodeAction = getBinaryNodeChild(node, action);
251
- const participantsAffected = getBinaryNodeChildren(nodeAction, 'participant');
252
+ const node = WABinary_1.getBinaryNodeChild(result, 'membership_requests_action');
253
+ const nodeAction = WABinary_1.getBinaryNodeChild(node, action);
254
+ const participantsAffected = WABinary_1.getBinaryNodeChildren(nodeAction, 'participant');
252
255
  return participantsAffected.map(p => {
253
256
  return { status: p.attrs.error || '200', jid: p.attrs.jid };
254
257
  });
@@ -257,67 +260,56 @@ export const makeCommunitiesSocket = (config) => {
257
260
  const result = await communityQuery(jid, 'set', [
258
261
  {
259
262
  tag: action,
260
- attrs: action === 'remove' ? { linked_groups: 'true' } : {},
263
+ attrs: action === 'remove'? { linked_groups: 'true' } : {},
261
264
  content: participants.map(jid => ({
262
265
  tag: 'participant',
263
266
  attrs: { jid }
264
267
  }))
265
268
  }
266
269
  ]);
267
- const node = getBinaryNodeChild(result, action);
268
- const participantsAffected = getBinaryNodeChildren(node, 'participant');
270
+ const node = WABinary_1.getBinaryNodeChild(result, action);
271
+ const participantsAffected = WABinary_1.getBinaryNodeChildren(node, 'participant');
269
272
  return participantsAffected.map(p => {
270
273
  return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p };
271
274
  });
272
275
  },
273
276
  communityUpdateDescription: async (jid, description) => {
274
277
  const metadata = await communityMetadata(jid);
275
- const prev = metadata.descId ?? null;
278
+ const prev = metadata.descId?? null;
276
279
  await communityQuery(jid, 'set', [
277
280
  {
278
281
  tag: 'description',
279
282
  attrs: {
280
- ...(description ? { id: generateMessageID() } : { delete: 'true' }),
281
- ...(prev ? { prev } : {})
283
+ ...(description? { id: Utils_1.generateMessageID() } : { delete: 'true' }),
284
+ ...(prev? { prev } : {})
282
285
  },
283
- content: description ? [{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }] : undefined
286
+ content: description? [{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }] : undefined
284
287
  }
285
288
  ]);
286
289
  },
287
290
  communityInviteCode: async (jid) => {
288
291
  const result = await communityQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]);
289
- const inviteNode = getBinaryNodeChild(result, 'invite');
292
+ const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
290
293
  return inviteNode?.attrs.code;
291
294
  },
292
295
  communityRevokeInvite: async (jid) => {
293
296
  const result = await communityQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]);
294
- const inviteNode = getBinaryNodeChild(result, 'invite');
297
+ const inviteNode = WABinary_1.getBinaryNodeChild(result, 'invite');
295
298
  return inviteNode?.attrs.code;
296
299
  },
297
300
  communityAcceptInvite: async (code) => {
298
301
  const results = await communityQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]);
299
- const result = getBinaryNodeChild(results, 'community');
302
+ const result = WABinary_1.getBinaryNodeChild(results, 'community');
300
303
  return result?.attrs.jid;
301
304
  },
302
- /**
303
- * revoke a v4 invite for someone
304
- * @param communityJid community jid
305
- * @param invitedJid jid of person you invited
306
- * @returns true if successful
307
- */
308
305
  communityRevokeInviteV4: async (communityJid, invitedJid) => {
309
306
  const result = await communityQuery(communityJid, 'set', [
310
307
  { tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }
311
308
  ]);
312
- return !!result;
309
+ return!!result;
313
310
  },
314
- /**
315
- * accept a CommunityInviteMessage
316
- * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
317
- * @param inviteMessage the message to accept
318
- */
319
311
  communityAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
320
- key = typeof key === 'string' ? { remoteJid: key } : key;
312
+ key = typeof key === 'string'? { remoteJid: key } : key;
321
313
  const results = await communityQuery(inviteMessage.groupJid, 'set', [
322
314
  {
323
315
  tag: 'accept',
@@ -328,11 +320,8 @@ export const makeCommunitiesSocket = (config) => {
328
320
  }
329
321
  }
330
322
  ]);
331
- // if we have the full message key
332
- // update the invite message to be expired
333
323
  if (key.id) {
334
- // create new invite message that is expired
335
- inviteMessage = proto.Message.GroupInviteMessage.fromObject(inviteMessage);
324
+ inviteMessage = WAProto_1.proto.Message.GroupInviteMessage.fromObject(inviteMessage);
336
325
  inviteMessage.inviteExpiration = 0;
337
326
  inviteMessage.inviteCode = '';
338
327
  ev.emit('messages.update', [
@@ -346,18 +335,17 @@ export const makeCommunitiesSocket = (config) => {
346
335
  }
347
336
  ]);
348
337
  }
349
- // generate the community add message
350
338
  await upsertMessage({
351
339
  key: {
352
340
  remoteJid: inviteMessage.groupJid,
353
- id: generateMessageIDV2(sock.user?.id),
341
+ id: Utils_1.generateMessageIDV2(sock.user?.id),
354
342
  fromMe: false,
355
- participant: key.remoteJid // TODO: investigate if this makes any sense at all
343
+ participant: key.remoteJid
356
344
  },
357
- messageStubType: WAMessageStubType.GROUP_PARTICIPANT_ADD,
345
+ messageStubType: Types_1.WAMessageStubType.GROUP_PARTICIPANT_ADD,
358
346
  messageStubParameters: [JSON.stringify(authState.creds.me)],
359
347
  participant: key.remoteJid,
360
- messageTimestamp: unixTimestampSeconds()
348
+ messageTimestamp: Utils_1.unixTimestampSeconds()
361
349
  }, 'notify');
362
350
  return results.attrs.from;
363
351
  }),
@@ -367,7 +355,7 @@ export const makeCommunitiesSocket = (config) => {
367
355
  },
368
356
  communityToggleEphemeral: async (jid, ephemeralExpiration) => {
369
357
  const content = ephemeralExpiration
370
- ? { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } }
358
+ ? { tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } }
371
359
  : { tag: 'not_ephemeral', attrs: {} };
372
360
  await communityQuery(jid, 'set', [content]);
373
361
  },
@@ -385,47 +373,49 @@ export const makeCommunitiesSocket = (config) => {
385
373
  communityFetchAllParticipating
386
374
  };
387
375
  };
388
- export const extractCommunityMetadata = (result) => {
389
- const community = getBinaryNodeChild(result, 'community');
390
- const descChild = getBinaryNodeChild(community, 'description');
376
+
377
+ const extractCommunityMetadata = (result) => {
378
+ const community = WABinary_1.getBinaryNodeChild(result, 'community');
379
+ const descChild = WABinary_1.getBinaryNodeChild(community, 'description');
391
380
  let desc;
392
381
  let descId;
393
382
  if (descChild) {
394
- desc = getBinaryNodeChildString(descChild, 'body');
383
+ desc = WABinary_1.getBinaryNodeChildString(descChild, 'body');
395
384
  descId = descChild.attrs.id;
396
385
  }
397
386
  const communityId = community.attrs.id?.includes('@')
398
- ? community.attrs.id
399
- : jidEncode(community.attrs.id || '', 'g.us');
400
- const eph = getBinaryNodeChild(community, 'ephemeral')?.attrs.expiration;
401
- const memberAddMode = getBinaryNodeChildString(community, 'member_add_mode') === 'all_member_add';
387
+ ? community.attrs.id
388
+ : WABinary_1.jidEncode(community.attrs.id || '', 'g.us');
389
+ const eph = WABinary_1.getBinaryNodeChild(community, 'ephemeral')?.attrs.expiration;
390
+ const memberAddMode = WABinary_1.getBinaryNodeChildString(community, 'member_add_mode') === 'all_member_add';
402
391
  const metadata = {
403
392
  id: communityId,
404
393
  subject: community.attrs.subject || '',
405
394
  subjectOwner: community.attrs.s_o,
406
395
  subjectTime: Number(community.attrs.s_t || 0),
407
- size: getBinaryNodeChildren(community, 'participant').length,
396
+ size: WABinary_1.getBinaryNodeChildren(community, 'participant').length,
408
397
  creation: Number(community.attrs.creation || 0),
409
- owner: community.attrs.creator ? jidNormalizedUser(community.attrs.creator) : undefined,
398
+ owner: community.attrs.creator? WABinary_1.jidNormalizedUser(community.attrs.creator) : undefined,
410
399
  desc,
411
400
  descId,
412
- linkedParent: getBinaryNodeChild(community, 'linked_parent')?.attrs.jid || undefined,
413
- restrict: !!getBinaryNodeChild(community, 'locked'),
414
- announce: !!getBinaryNodeChild(community, 'announcement'),
415
- isCommunity: !!getBinaryNodeChild(community, 'parent'),
416
- isCommunityAnnounce: !!getBinaryNodeChild(community, 'default_sub_community'),
417
- joinApprovalMode: !!getBinaryNodeChild(community, 'membership_approval_mode'),
401
+ linkedParent: WABinary_1.getBinaryNodeChild(community, 'linked_parent')?.attrs.jid || undefined,
402
+ restrict:!!WABinary_1.getBinaryNodeChild(community, 'locked'),
403
+ announce:!!WABinary_1.getBinaryNodeChild(community, 'announcement'),
404
+ isCommunity:!!WABinary_1.getBinaryNodeChild(community, 'parent'),
405
+ isCommunityAnnounce:!!WABinary_1.getBinaryNodeChild(community, 'default_sub_community'),
406
+ joinApprovalMode:!!WABinary_1.getBinaryNodeChild(community, 'membership_approval_mode'),
418
407
  memberAddMode,
419
- participants: getBinaryNodeChildren(community, 'participant').map(({ attrs }) => {
408
+ participants: WABinary_1.getBinaryNodeChildren(community, 'participant').map(({ attrs }) => {
420
409
  return {
421
- // TODO: IMPLEMENT THE PN/LID FIELDS HERE!!
422
410
  id: attrs.jid,
423
411
  admin: (attrs.type || null)
424
412
  };
425
413
  }),
426
- ephemeralDuration: eph ? +eph : undefined,
427
- addressingMode: getBinaryNodeChildString(community, 'addressing_mode')
414
+ ephemeralDuration: eph? +eph : undefined,
415
+ addressingMode: WABinary_1.getBinaryNodeChildString(community, 'addressing_mode')
428
416
  };
429
417
  return metadata;
430
418
  };
431
- //# sourceMappingURL=communities.js.map
419
+
420
+ exports.makeCommunitiesSocket = makeCommunitiesSocket;
421
+ exports.extractCommunityMetadata = extractCommunityMetadata;
@@ -1,7 +1,7 @@
1
- import { Boom } from '@hapi/boom';
2
- import { proto } from '../../WAProto/index.js';
3
- import type { GroupMetadata, ParticipantAction, SocketConfig, WAMessageKey } from '../Types/index.js';
4
- import { type BinaryNode } from '../WABinary/index.js';
1
+ /// <reference types="node" />
2
+ import { proto } from '../../WAProto';
3
+ import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
4
+ import { BinaryNode } from '../WABinary';
5
5
  export declare const makeGroupsSocket: (config: SocketConfig) => {
6
6
  groupMetadata: (jid: string) => Promise<GroupMetadata>;
7
7
  groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
@@ -10,153 +10,106 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
10
10
  groupRequestParticipantsList: (jid: string) => Promise<{
11
11
  [key: string]: string;
12
12
  }[]>;
13
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
13
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
14
14
  status: string;
15
- jid: string | undefined;
15
+ jid: string;
16
16
  }[]>;
17
17
  groupParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
18
18
  status: string;
19
- jid: string | undefined;
19
+ jid: string;
20
20
  content: BinaryNode;
21
21
  }[]>;
22
22
  groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
23
23
  groupInviteCode: (jid: string) => Promise<string | undefined>;
24
24
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
25
25
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
26
- /**
27
- * revoke a v4 invite for someone
28
- * @param groupJid group jid
29
- * @param invitedJid jid of person you invited
30
- * @returns true if successful
31
- */
32
- groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
33
26
  /**
34
27
  * accept a GroupInviteMessage
35
28
  * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
36
29
  * @param inviteMessage the message to accept
37
30
  */
38
- groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<any>;
31
+ groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
39
32
  groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
40
33
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
41
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
42
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
43
- groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
44
- groupToggleHistory: (jid: string, enable: boolean) => Promise<void>
34
+ groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>;
35
+ groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>;
36
+ groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>;
45
37
  groupFetchAllParticipating: () => Promise<{
46
38
  [_: string]: GroupMetadata;
47
39
  }>;
48
- serverProps: {
49
- privacyTokenOn1to1: boolean;
50
- profilePicPrivacyToken: boolean;
51
- lidTrustedTokenIssueToLid: boolean;
52
- };
53
- createCallLink: (type: "audio" | "video", event?: {
54
- startTime: number;
55
- }, timeoutMs?: number) => Promise<string | undefined>;
56
- getBotListV2: () => Promise<import("../Types/index.js").BotListInfo[]>;
57
- messageMutex: {
58
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
59
- };
60
- receiptMutex: {
61
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
62
- };
63
- appStatePatchMutex: {
64
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
65
- };
66
- notificationMutex: {
67
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
40
+ processingMutex: {
41
+ mutex<T>(code: () => T | Promise<T>): Promise<T>;
68
42
  };
69
43
  fetchPrivacySettings: (force?: boolean) => Promise<{
70
44
  [_: string]: string;
71
45
  }>;
72
- upsertMessage: (msg: import("../Types/index.js").WAMessage, type: import("../Types/index.js").MessageUpsertType) => Promise<void>;
73
- appPatch: (patchCreate: import("../Types/index.js").WAPatchCreate) => Promise<void>;
74
- sendPresenceUpdate: (type: import("../Types/index.js").WAPresence, toJid?: string) => Promise<void>;
75
- presenceSubscribe: (toJid: string) => Promise<void>;
76
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
77
- fetchBlocklist: () => Promise<(string | undefined)[]>;
78
- fetchStatus: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
79
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
80
- updateProfilePicture: (jid: string, content: import("../Types/index.js").WAMediaUpload, dimensions?: {
81
- width: number;
82
- height: number;
83
- }) => Promise<void>;
46
+ upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
47
+ appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
48
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
49
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
50
+ profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
51
+ onWhatsApp: (...jids: string[]) => Promise<{
52
+ jid: string;
53
+ exists: unknown;
54
+ lid: unknown;
55
+ }[] | undefined>;
56
+ fetchBlocklist: () => Promise<string[]>;
57
+ fetchStatus: (jid: string) => Promise<{
58
+ status: string | undefined;
59
+ setAt: Date;
60
+ } | undefined>;
61
+ updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
84
62
  removeProfilePicture: (jid: string) => Promise<void>;
85
63
  updateProfileStatus: (status: string) => Promise<void>;
86
64
  updateProfileName: (name: string) => Promise<void>;
87
65
  updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
88
- updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
89
- updateCallPrivacy: (value: import("../Types/index.js").WAPrivacyCallValue) => Promise<void>;
90
- updateMessagesPrivacy: (value: import("../Types/index.js").WAPrivacyMessagesValue) => Promise<void>;
91
- updateLastSeenPrivacy: (value: import("../Types/index.js").WAPrivacyValue) => Promise<void>;
92
- updateOnlinePrivacy: (value: import("../Types/index.js").WAPrivacyOnlineValue) => Promise<void>;
93
- updateProfilePicturePrivacy: (value: import("../Types/index.js").WAPrivacyValue) => Promise<void>;
94
- updateStatusPrivacy: (value: import("../Types/index.js").WAPrivacyValue) => Promise<void>;
95
- updateReadReceiptsPrivacy: (value: import("../Types/index.js").WAReadReceiptsValue) => Promise<void>;
96
- updateGroupsAddPrivacy: (value: import("../Types/index.js").WAPrivacyGroupAddValue) => Promise<void>;
66
+ updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
67
+ updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
68
+ updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
69
+ updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
70
+ updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
71
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
97
72
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
98
- getBusinessProfile: (jid: string) => Promise<import("../Types/index.js").WABusinessProfile | void>;
99
- resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
100
- chatModify: (mod: import("../Types/index.js").ChatModification, jid: string) => Promise<void>;
101
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
102
- addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
103
- removeContact: (jid: string) => Promise<void>;
104
- placeholderResendCache: import("../Types/index.js").CacheStore;
105
- addLabel: (jid: string, labels: import("../Types/Label.js").LabelActionBody) => Promise<void>;
73
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
74
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
75
+ chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
76
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
106
77
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
107
78
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
108
79
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
109
80
  removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
110
81
  star: (jid: string, messages: {
111
82
  id: string;
112
- fromMe?: boolean;
83
+ fromMe?: boolean | undefined;
113
84
  }[], star: boolean) => Promise<void>;
114
- addOrEditQuickReply: (quickReply: import("../Types/Bussines.js").QuickReplyAction) => Promise<void>;
115
- removeQuickReply: (timestamp: string) => Promise<void>;
116
85
  type: "md";
117
- ws: import("./Client/websocket.js").WebSocketClient;
118
- ev: import("../Types/index.js").BaileysEventEmitter & {
119
- process(handler: (events: Partial<import("../Types/index.js").BaileysEventMap>) => void | Promise<void>): () => void;
86
+ ws: any;
87
+ ev: import("../Types").BaileysEventEmitter & {
88
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
120
89
  buffer(): void;
121
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
122
- flush(): boolean;
90
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
91
+ flush(force?: boolean | undefined): boolean;
123
92
  isBuffering(): boolean;
124
- destroy(): void;
125
93
  };
126
94
  authState: {
127
- creds: import("../Types/index.js").AuthenticationCreds;
128
- keys: import("../Types/index.js").SignalKeyStoreWithTransaction;
95
+ creds: import("../Types").AuthenticationCreds;
96
+ keys: import("../Types").SignalKeyStoreWithTransaction;
129
97
  };
130
- signalRepository: import("../Types/index.js").SignalRepositoryWithLIDStore;
131
- user: import("../Types/index.js").Contact | undefined;
98
+ signalRepository: import("../Types").SignalRepository;
99
+ user: import("../Types").Contact | undefined;
132
100
  generateMessageTag: () => string;
133
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
134
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
101
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
102
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
135
103
  waitForSocketOpen: () => Promise<void>;
136
104
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
137
105
  sendNode: (frame: BinaryNode) => Promise<void>;
138
- logout: (msg?: string) => Promise<void>;
139
- end: (error: Error | undefined) => Promise<void>;
140
- registerSocketEndHandler: (handler: (error: Error | undefined) => void | Promise<void>) => void;
141
- onUnexpectedError: (err: Error | Boom, msg: string) => void;
106
+ logout: (msg?: string | undefined) => Promise<void>;
107
+ end: (error: Error | undefined) => void;
108
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
142
109
  uploadPreKeys: (count?: number) => Promise<void>;
143
110
  uploadPreKeysToServerIfRequired: () => Promise<void>;
144
- digestKeyBundle: () => Promise<void>;
145
- rotateSignedPreKey: () => Promise<void>;
146
- requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
147
- updateServerTimeOffset: ({ attrs }: BinaryNode) => void;
148
- sendUnifiedSession: () => Promise<void>;
149
- wamBuffer: import("../index.js").BinaryInfo;
150
- waitForConnectionUpdate: (check: (u: Partial<import("../Types/index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
151
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
152
- executeUSyncQuery: (usyncQuery: import("../index.js").USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
153
- onWhatsApp: (...phoneNumber: string[]) => Promise<{
154
- jid: string;
155
- exists: boolean;
156
- }[] | undefined>;
157
- fetchAccountReachoutTimelock: () => Promise<import("../Types/index.js").ReachoutTimelockState>;
158
- fetchNewChatMessageCap: () => Promise<import("../Types/index.js").NewChatMessageCapInfo>;
111
+ requestPairingCode: (phoneNumber: string) => Promise<string>;
112
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
113
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
159
114
  };
160
115
  export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
161
- export type GroupsSocket = ReturnType<typeof makeGroupsSocket>;
162
- //# sourceMappingURL=groups.d.ts.map