@badzz88/baileys 8.5.3 → 8.5.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.
Files changed (110) hide show
  1. package/README.md +1 -1
  2. package/WAProto/WAProto.proto +1256 -75
  3. package/WAProto/index.d.ts +36042 -19649
  4. package/WAProto/index.js +181990 -135645
  5. package/engine-requirements.js +7 -15
  6. package/lib/Defaults/index.js +22 -17
  7. package/lib/Signal/Group/group_cipher.js +5 -5
  8. package/lib/Signal/Group/keyhelper.js +4 -4
  9. package/lib/Signal/Group/sender-chain-key.js +2 -2
  10. package/lib/Signal/Group/sender-key-distribution-message.js +1 -1
  11. package/lib/Signal/Group/sender-key-message.js +3 -3
  12. package/lib/Signal/Group/sender-key-record.js +1 -1
  13. package/lib/Signal/Group/sender-message-key.js +5 -5
  14. package/lib/Signal/libsignal.js +39 -59
  15. package/lib/Signal/lid-mapping.js +28 -10
  16. package/lib/Socket/aigroups.js +5 -5
  17. package/lib/Socket/business.js +3 -11
  18. package/lib/Socket/chats.js +668 -319
  19. package/lib/Socket/communities.js +85 -89
  20. package/lib/Socket/graphql.js +435 -228
  21. package/lib/Socket/groups.js +132 -211
  22. package/lib/Socket/index.js +9 -7
  23. package/lib/Socket/interactive-handler.js +117 -60
  24. package/lib/Socket/interop.js +56 -175
  25. package/lib/Socket/managed-account.js +79 -48
  26. package/lib/Socket/messages-recv.js +898 -340
  27. package/lib/Socket/messages-send.js +462 -160
  28. package/lib/Socket/mex.js +40 -53
  29. package/lib/Socket/newsletter.js +291 -295
  30. package/lib/Socket/privacy.js +77 -265
  31. package/lib/Socket/registration.js +164 -157
  32. package/lib/Socket/socket.js +181 -199
  33. package/lib/Socket/username.js +144 -227
  34. package/lib/Store/make-cache-manager-store.js +2 -2
  35. package/lib/Store/make-in-memory-store.js +25 -141
  36. package/lib/Types/Auth.js +3 -3
  37. package/lib/Types/Label.js +1 -1
  38. package/lib/Types/LabelAssociation.js +1 -1
  39. package/lib/Types/Newsletter.js +96 -65
  40. package/lib/Types/State.js +4 -4
  41. package/lib/Types/index.js +1 -1
  42. package/lib/Utils/auth-utils.js +52 -57
  43. package/lib/Utils/browser-utils.js +1 -1
  44. package/lib/Utils/business.js +2 -6
  45. package/lib/Utils/chat-utils.js +102 -38
  46. package/lib/Utils/crypto.js +54 -84
  47. package/lib/Utils/decode-wa-message.js +316 -83
  48. package/lib/Utils/event-buffer.js +37 -61
  49. package/lib/Utils/generics.js +157 -103
  50. package/lib/Utils/group-history.js +3 -12
  51. package/lib/Utils/history.js +15 -15
  52. package/lib/Utils/index.js +1 -5
  53. package/lib/Utils/link-preview.js +3 -8
  54. package/lib/Utils/lt-hash.js +2 -35
  55. package/lib/Utils/make-mutex.js +1 -1
  56. package/lib/Utils/message-inspect.js +393 -0
  57. package/lib/Utils/message-retry-manager.js +27 -92
  58. package/lib/Utils/messages-media.js +159 -130
  59. package/lib/Utils/messages.js +144 -566
  60. package/lib/Utils/meta-ai-msmsg.js +62 -202
  61. package/lib/Utils/noise-handler.js +19 -21
  62. package/lib/Utils/offline-node-processor.js +3 -8
  63. package/lib/Utils/pre-key-manager.js +13 -23
  64. package/lib/Utils/process-message.js +197 -106
  65. package/lib/Utils/reporting-utils.js +2 -2
  66. package/lib/Utils/signal.js +28 -63
  67. package/lib/Utils/stanza-ack.js +39 -12
  68. package/lib/Utils/sync-action-utils.js +4 -7
  69. package/lib/Utils/tc-token-utils.js +20 -25
  70. package/lib/Utils/use-multi-file-auth-state.js +30 -14
  71. package/lib/Utils/validate-connection.js +59 -19
  72. package/lib/WABinary/decode.js +50 -16
  73. package/lib/WABinary/encode.js +54 -224
  74. package/lib/WABinary/generic-utils.js +7 -97
  75. package/lib/WABinary/jid-utils.js +27 -14
  76. package/lib/WAM/encode.js +7 -7
  77. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +58 -1
  78. package/lib/WAUSync/Protocols/USyncContactProtocol.js +7 -1
  79. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +13 -5
  80. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -4
  81. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +20 -7
  82. package/lib/WAUSync/Protocols/USyncNewsletterProtocol.js +865 -0
  83. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +1 -1
  84. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +2 -2
  85. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +7 -2
  86. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +1 -1
  87. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +2 -1
  88. package/lib/WAUSync/Protocols/index.js +1 -0
  89. package/lib/WAUSync/USyncBackoff.js +26 -0
  90. package/lib/WAUSync/USyncQuery.js +77 -6
  91. package/lib/WAUSync/USyncUser.js +16 -8
  92. package/lib/WAUSync/index.js +1 -0
  93. package/lib/antiban.js +608 -854
  94. package/lib/index.js +1 -1
  95. package/package.json +16 -20
  96. package/lib/Socket/luxu.js +0 -387
  97. package/lib/Socket/text-router.js +0 -83
  98. package/lib/Store/keyed-db.js +0 -108
  99. package/lib/Types/Mex.js +0 -112
  100. package/lib/Utils/command-loader.d.ts +0 -31
  101. package/lib/Utils/command-loader.js +0 -100
  102. package/lib/Utils/companion-reg-client-utils.js +0 -42
  103. package/lib/Utils/curve25519-js.js +0 -275
  104. package/lib/Utils/native-bridge.js +0 -82
  105. package/lib/Utils/session-pool.d.ts +0 -16
  106. package/lib/Utils/session-pool.js +0 -94
  107. package/lib/Utils/sticker.d.ts +0 -17
  108. package/lib/Utils/sticker.js +0 -145
  109. package/lib/Utils/view-once-cache.d.ts +0 -9
  110. package/lib/Utils/view-once-cache.js +0 -79
@@ -4,41 +4,38 @@ exports.makePrivacySocket = void 0
4
4
 
5
5
  const { executeWMexQuery } = require('./mex')
6
6
 
7
- /**
8
- * MEX query IDs for privacy, status/profile, account/auth, and misc operations.
9
- * Source: assets/whatsapp-android-mex_client_persist_ids.json
10
- */
7
+
11
8
  const PRIVACY_MEX_IDS = {
12
- // Privacy settings
13
- GET_SETTINGS: '32774292262215380', // GetPrivacySettingsQuery
14
- SET_SETTING: '26887749497493184', // SetPrivacySettingMutation
15
- UPDATE_CONTACT_LIST: '26375158178762800', // UpdatePrivacyContactListMutation
16
- GET_CONTACT_LIST: '25700444246275824', // GetPrivacyContactListQuery
17
- // Status / profile
18
- UPDATE_TEXT_STATUS: '25863197129975892', // UpdateTextStatus
19
- GET_TEXT_STATUS_LIST: '25741205615468936', // GetTextStatusList
20
- UPDATE_USER_STATUS: '7452341274886724', // UpdateUserStatus
21
- FETCH_USER_PICTURE: '24983561624604410', // FetchUserPictureInfo
22
- PROFILE_PICTURE_MUTATION: '24714239711610700', // ProfilePictureMutation
23
- // Account / auth
24
- ACCOUNT_LOGIN: '27298465499757130', // AccountLoginMutation
25
- ACCOUNT_LOGOUT: '26863447609979190', // AccountLogoutMutation
26
- MULTI_ACCOUNT_REVOKE: '25846242091639660', // MultiAccountRevokeAccount
27
- ADD_MULTI_ACCOUNT_LINK: '25502812266025190', // AddMultiAccountLink
28
- ADD_TRUSTED_DEVICE: '24522952587403290', // AddTrustedDeviceMutation
29
- GET_TRUSTED_DEVICES: '25123358920671964', // GetTrustedDevicesQuery
30
- UNTRUST_TRUSTED_DEVICE: '26574930682133620', // UntrustTrustedDeviceMutation
31
- DELETE_TRUSTED_DEVICE: '33867503889559536', // DeleteTrustedDeviceMutation
32
- // Misc
33
- MOBILE_CONFIG_FETCH: '25676911271914596', // MobileConfigFetchQuery
34
- NOTIFY_PUSH_NAME: '25900490552974544', // NotifyPushName
35
- CONTACT_INTEGRITY: '25924358997169496', // ContactIntegrityQuery
36
- BIZ_INTEGRITY: '25975613018777536', // BizIntegrityQuery
37
- LINKED_PROFILES_SET: '25013968611531010', // LinkedProfilesSet
38
- LINKED_PROFILES_REMOVE: '24537675509265524', // LinkedProfilesRemove
39
- LINKED_PROFILES_UPDATE: '24876967165297616', // LinkedProfilesUpdate
40
- MIGRATE_BLOCKLIST_LID: '25028600226770430', // MigrateBlocklistLid
41
- QR_CODE_SCAN: '26287165600869744' // QRCodeScan
9
+
10
+ GET_SETTINGS: '32774292262215379',
11
+ SET_SETTING: '26887749497493182',
12
+ UPDATE_CONTACT_LIST: '26375158178762799',
13
+ GET_CONTACT_LIST: '25700444246275822',
14
+
15
+ UPDATE_TEXT_STATUS: '25863197129975892',
16
+ GET_TEXT_STATUS_LIST: '25741205615468935',
17
+ UPDATE_USER_STATUS: '7452341274886724',
18
+ FETCH_USER_PICTURE: '24983561624604407',
19
+ PROFILE_PICTURE_MUTATION: '24714239711610700',
20
+
21
+ ACCOUNT_LOGIN: '27298465499757127',
22
+ ACCOUNT_LOGOUT: '26863447609979194',
23
+ MULTI_ACCOUNT_REVOKE: '25846242091639661',
24
+ ADD_MULTI_ACCOUNT_LINK: '25502812266025193',
25
+ ADD_TRUSTED_DEVICE: '24522952587403287',
26
+ GET_TRUSTED_DEVICES: '27391232653862770',
27
+ UNTRUST_TRUSTED_DEVICE: '26574930682133620',
28
+ DELETE_TRUSTED_DEVICE: '33867503889559538',
29
+
30
+ MOBILE_CONFIG_FETCH: '25676911271914597',
31
+ NOTIFY_PUSH_NAME: '25900490552974543',
32
+ CONTACT_INTEGRITY: '25924358997169495',
33
+ BIZ_INTEGRITY: '25975613018777537',
34
+ LINKED_PROFILES_SET: '25013968611531010',
35
+ LINKED_PROFILES_REMOVE: '24537675509265525',
36
+ LINKED_PROFILES_UPDATE: '24876967165297614',
37
+ MIGRATE_BLOCKLIST_LID: '25028600226770432',
38
+ QR_CODE_SCAN: '26287165600869744'
42
39
  }
43
40
 
44
41
  const makePrivacySocket = sock => {
@@ -47,45 +44,19 @@ const makePrivacySocket = sock => {
47
44
  const mexQuery = (variables, queryId, dataPath) =>
48
45
  executeWMexQuery(variables, queryId, dataPath, query, generateMessageTag)
49
46
 
50
- // ── Privacy Settings ────────────────────────────────────────────────────
47
+
51
48
 
52
- /**
53
- * Fetch all privacy settings via MEX.
54
- * Confirmed from C24395AkT.java — variables: { users: [{ jid, privacy_features: [...] }] }
55
- * dataPath: xwa2_fetch_wa_users (array of users, each with privacy_settings[])
56
- *
57
- * @param {string} jid - Own JID
58
- * @param {string[]} [features] - Privacy features to fetch (default: all known)
59
- */
49
+
60
50
  const getPrivacySettings = (jid, features = null) => {
61
51
  const users = [{ jid, ...(features ? { privacy_features: features } : {}) }]
62
52
  return mexQuery({ users }, PRIVACY_MEX_IDS.GET_SETTINGS, 'xwa2_fetch_wa_users')
63
53
  }
64
54
 
65
- /**
66
- * Set a privacy setting via MEX.
67
- * Confirmed from C24403Akb.java — variables: { feature, setting }
68
- * dataPath: xwa2_privacy_feature_update
69
- *
70
- * Known features: "LAST_SEEN", "ONLINE", "PROFILE_PHOTO", "STATUS", "READ_RECEIPTS",
71
- * "GROUPS", "CALLS", "SCREENSHOT", "LIVE_LOCATION"
72
- * Known settings: "ALL", "CONTACTS", "CONTACT_BLACKLIST", "NONE"
73
- *
74
- * @param {string} feature - Privacy feature name
75
- * @param {string} setting - New value
76
- */
55
+
77
56
  const setPrivacySetting = (feature, setting) =>
78
57
  mexQuery({ feature, setting }, PRIVACY_MEX_IDS.SET_SETTING, 'xwa2_privacy_feature_update')
79
58
 
80
- /**
81
- * Update the contact list for a privacy setting (e.g. "GROUPS" with CONTACT_BLACKLIST).
82
- * Confirmed from InteropPrivacySettingWithContactListUpdate pattern.
83
- * dataPath: xwa2_privacy_contact_list_update
84
- *
85
- * @param {string} feature - Privacy feature
86
- * @param {string} setting - "CONTACT_BLACKLIST" | "CONTACTS"
87
- * @param {string[]} jids - List of JIDs to include in the list
88
- */
59
+
89
60
  const updatePrivacyContactList = (feature, setting, jids) =>
90
61
  mexQuery(
91
62
  { feature, setting, contacts: jids.map(jid => ({ jid })) },
@@ -93,73 +64,33 @@ const makePrivacySocket = sock => {
93
64
  'xwa2_privacy_contact_list_update'
94
65
  )
95
66
 
96
- /**
97
- * Fetch the contact list for a privacy setting.
98
- * dataPath: xwa2_privacy_contact_list
99
- *
100
- * @param {string} feature - Privacy feature
101
- * @param {string} setting - "CONTACT_BLACKLIST" | "CONTACTS"
102
- */
67
+
103
68
  const getPrivacyContactList = (feature, setting) =>
104
69
  mexQuery({ feature, setting }, PRIVACY_MEX_IDS.GET_CONTACT_LIST, 'xwa2_privacy_contact_list')
105
70
 
106
- // ── Status / Profile ───────────────────────────────────────────────────
107
-
108
- /**
109
- * Update own text status (About/Evolved About) via MEX.
110
- * Confirmed from C227219wi.java:
111
- * text_status_input: { text, emoji: { content } }
112
- * dataPath: xwa2_text_status_update
113
- *
114
- * @param {string} text - Status text
115
- * @param {string} [emoji] - Optional emoji to attach
116
- */
71
+
72
+
73
+
117
74
  const updateTextStatus = (text, emoji = null) => {
118
75
  const input = { text }
119
76
  if (emoji) input.emoji = { content: emoji }
120
77
  return mexQuery({ text_status_input: input }, PRIVACY_MEX_IDS.UPDATE_TEXT_STATUS, 'xwa2_text_status_update')
121
78
  }
122
79
 
123
- /**
124
- * Fetch text statuses (About) for a list of JIDs via MEX.
125
- * Confirmed from C227219wi.java:
126
- * input: [{ jid, last_update_time: null }]
127
- * dataPath: xwa2_text_status_list
128
- *
129
- * @param {string[]} jids - JIDs to fetch statuses for
130
- * @param {number|null} [lastUpdateTime] - Only return statuses newer than this timestamp
131
- */
80
+
132
81
  const getTextStatusList = (jids, lastUpdateTime = null) => {
133
82
  const input = jids.map(jid => ({ jid, last_update_time: lastUpdateTime }))
134
83
  return mexQuery({ input }, PRIVACY_MEX_IDS.GET_TEXT_STATUS_LIST, 'xwa2_text_status_list')
135
84
  }
136
85
 
137
- /**
138
- * Update own user status string via MEX.
139
- * Confirmed from UpdateUserStatus mutation — variables: { status }
140
- * dataPath: xwa2_update_user_status
141
- *
142
- * @param {string} status - New status string
143
- */
144
- const updateUserStatus = status =>
145
- mexQuery({ status }, PRIVACY_MEX_IDS.UPDATE_USER_STATUS, 'xwa2_update_user_status')
146
-
147
- /**
148
- * Fetch picture info for a user via MEX.
149
- * dataPath: xwa2_fetch_user_picture_info
150
- *
151
- * @param {string} jid - JID to fetch picture info for
152
- */
86
+
87
+ const updateUserStatus = status => mexQuery({ status }, PRIVACY_MEX_IDS.UPDATE_USER_STATUS, 'xwa2_update_user_status')
88
+
89
+
153
90
  const fetchUserPictureInfo = jid =>
154
91
  mexQuery({ jid }, PRIVACY_MEX_IDS.FETCH_USER_PICTURE, 'xwa2_fetch_user_picture_info')
155
92
 
156
- /**
157
- * Set own profile picture via MEX.
158
- * dataPath: xwa2_profile_picture_mutation
159
- *
160
- * @param {string} imageBase64 - Base64-encoded image data
161
- * @param {'image'|'preview'} [type='image'] - Picture type
162
- */
93
+
163
94
  const setProfilePictureMex = (imageBase64, type = 'image') =>
164
95
  mexQuery(
165
96
  { input: { image: imageBase64, type } },
@@ -167,28 +98,13 @@ const makePrivacySocket = sock => {
167
98
  'xwa2_profile_picture_mutation'
168
99
  )
169
100
 
170
- // ── Account / Auth ─────────────────────────────────────────────────────
101
+
171
102
 
172
- /**
173
- * Mark account as logged-in via MEX (companion device registration flow).
174
- * Confirmed from LogoutManager.java:
175
- * input: { phone_number }
176
- * dataPath: xwa2_account_login
177
- *
178
- * @param {string} phoneNumber - Phone number (raw, e.g. "491234567890")
179
- */
103
+
180
104
  const accountLogin = phoneNumber =>
181
105
  mexQuery({ input: { phone_number: phoneNumber } }, PRIVACY_MEX_IDS.ACCOUNT_LOGIN, 'xwa2_account_login')
182
106
 
183
- /**
184
- * Mark account as logged-out via MEX.
185
- * Confirmed from LogoutManager.java:
186
- * input: { phone_number, enabled_biometric }
187
- * dataPath: xwa2_account_logout
188
- *
189
- * @param {string} phoneNumber - Phone number
190
- * @param {boolean} [enabledBiometric=false]
191
- */
107
+
192
108
  const accountLogout = (phoneNumber, enabledBiometric = false) =>
193
109
  mexQuery(
194
110
  { input: { phone_number: phoneNumber, enabled_biometric: enabledBiometric } },
@@ -196,14 +112,7 @@ const makePrivacySocket = sock => {
196
112
  'xwa2_account_logout'
197
113
  )
198
114
 
199
- /**
200
- * Add a multi-account link (secondary account) via MEX.
201
- * Confirmed from AddMultiAccountLink mutation:
202
- * input: { phone_number }
203
- * dataPath: xwa2_add_multi_account_link
204
- *
205
- * @param {string} phoneNumber - Phone number of account to link
206
- */
115
+
207
116
  const addMultiAccountLink = phoneNumber =>
208
117
  mexQuery(
209
118
  { input: { phone_number: phoneNumber } },
@@ -211,70 +120,32 @@ const makePrivacySocket = sock => {
211
120
  'xwa2_add_multi_account_link'
212
121
  )
213
122
 
214
- /**
215
- * Add a trusted device (biometric/passkey) via MEX.
216
- * Confirmed from RegTrustedDeviceGraphQLHelper.java:
217
- * device_id, device_name
218
- * dataPath: xwa2_add_trusted_device
219
- *
220
- * @param {string} deviceId - Device ID suffix
221
- * @param {string} deviceName - Human-readable device name
222
- */
123
+
223
124
  const addTrustedDevice = (deviceId, deviceName) =>
224
- mexQuery({ device_id: deviceId, device_name: deviceName }, PRIVACY_MEX_IDS.ADD_TRUSTED_DEVICE, 'xwa2_add_trusted_device')
125
+ mexQuery(
126
+ { device_id: deviceId, device_name: deviceName },
127
+ PRIVACY_MEX_IDS.ADD_TRUSTED_DEVICE,
128
+ 'xwa2_add_trusted_device'
129
+ )
225
130
 
226
- /**
227
- * Fetch list of trusted devices for the account via MEX.
228
- * dataPath: xwa2_get_trusted_devices
229
- */
131
+
230
132
  const getTrustedDevices = () => mexQuery({}, PRIVACY_MEX_IDS.GET_TRUSTED_DEVICES, 'xwa2_get_trusted_devices')
231
133
 
232
- /**
233
- * Untrust (remove) a trusted device via MEX.
234
- * Confirmed from RegTrustedDeviceGraphQLHelper.java:
235
- * device_id, reason (default: "REREG")
236
- * dataPath: xwa2_untrust_trusted_device
237
- *
238
- * @param {string} deviceId - Device ID to remove
239
- * @param {string} [reason='USER_INITIATED']
240
- */
134
+
241
135
  const untrustTrustedDevice = (deviceId, reason = 'USER_INITIATED') =>
242
- mexQuery(
243
- { device_id: deviceId, reason },
244
- PRIVACY_MEX_IDS.UNTRUST_TRUSTED_DEVICE,
245
- 'xwa2_untrust_trusted_device'
246
- )
136
+ mexQuery({ device_id: deviceId, reason }, PRIVACY_MEX_IDS.UNTRUST_TRUSTED_DEVICE, 'xwa2_untrust_trusted_device')
247
137
 
248
- /**
249
- * Delete a trusted device entirely via MEX.
250
- * dataPath: xwa2_delete_trusted_device
251
- *
252
- * @param {string} deviceId - Device ID to delete
253
- */
138
+
254
139
  const deleteTrustedDevice = deviceId =>
255
140
  mexQuery({ device_id: deviceId }, PRIVACY_MEX_IDS.DELETE_TRUSTED_DEVICE, 'xwa2_delete_trusted_device')
256
141
 
257
- /**
258
- * Revoke multi-account link for a secondary account via MEX.
259
- * dataPath: xwa2_multi_account_revoke
260
- *
261
- * @param {string} accountJid - JID of the account to revoke
262
- */
142
+
263
143
  const revokeMultiAccount = accountJid =>
264
144
  mexQuery({ account_jid: accountJid }, PRIVACY_MEX_IDS.MULTI_ACCOUNT_REVOKE, 'xwa2_multi_account_revoke')
265
145
 
266
- // ── Misc ───────────────────────────────────────────────────────────────
267
-
268
- /**
269
- * Fetch mobile config via MEX.
270
- * Confirmed from C28889Clt.java:
271
- * api_version, ep_refresh_id, flags
272
- * dataPath: xwa2_mobile_config_fetch
273
- *
274
- * @param {number} [apiVersion=0]
275
- * @param {number} [epRefreshId=0]
276
- * @param {string} [flags='']
277
- */
146
+
147
+
148
+
278
149
  const fetchMobileConfig = (apiVersion = 0, epRefreshId = 0, flags = '') =>
279
150
  mexQuery(
280
151
  { api_version: apiVersion, ep_refresh_id: epRefreshId, flags },
@@ -282,15 +153,7 @@ const makePrivacySocket = sock => {
282
153
  'xwa2_mobile_config_fetch'
283
154
  )
284
155
 
285
- /**
286
- * Notify group members of your push name via MEX.
287
- * Confirmed from C128275fj.java:
288
- * input: { group_jid, participants: [{ jid, push_name }] }
289
- * dataPath: xwa2_notify_push_name
290
- *
291
- * @param {string} groupJid - Group JID
292
- * @param {{ jid: string, pushName: string }[]} participants
293
- */
156
+
294
157
  const notifyPushName = (groupJid, participants) =>
295
158
  mexQuery(
296
159
  {
@@ -303,14 +166,7 @@ const makePrivacySocket = sock => {
303
166
  'xwa2_notify_push_name'
304
167
  )
305
168
 
306
- /**
307
- * Run a contact integrity check via MEX.
308
- * Confirmed from RunnableC24106Aep.java — uses xwa2_fetch_wa_users path.
309
- * use_case: "START_CHAT_CONTEXT"
310
- *
311
- * @param {string[]} jids - JIDs to check
312
- * @param {string} [useCase='START_CHAT_CONTEXT']
313
- */
169
+
314
170
  const contactIntegrityQuery = (jids, useCase = 'START_CHAT_CONTEXT') =>
315
171
  mexQuery(
316
172
  { users: jids.map(jid => ({ jid })), use_case: useCase },
@@ -318,28 +174,11 @@ const makePrivacySocket = sock => {
318
174
  'xwa2_fetch_wa_users'
319
175
  )
320
176
 
321
- /**
322
- * Run a business integrity check via MEX.
323
- * Confirmed from BizIntegrityQuery — variables: { users: [{ jid }] }
324
- * dataPath: xwa2_fetch_wa_users
325
- *
326
- * @param {string[]} jids - Business JIDs to check
327
- */
177
+
328
178
  const bizIntegrityQuery = jids =>
329
- mexQuery(
330
- { users: jids.map(jid => ({ jid })) },
331
- PRIVACY_MEX_IDS.BIZ_INTEGRITY,
332
- 'xwa2_fetch_wa_users'
333
- )
179
+ mexQuery({ users: jids.map(jid => ({ jid })) }, PRIVACY_MEX_IDS.BIZ_INTEGRITY, 'xwa2_fetch_wa_users')
334
180
 
335
- /**
336
- * Set linked social profiles (FB/IG) via MEX.
337
- * Confirmed from C24386Ak3.java:
338
- * profiles: [{ type: "FB"|"IG", username|vid, encrypted_metadata?, user_info? }]
339
- * dataPath: xwa2_linked_profiles_set
340
- *
341
- * @param {{ type: 'FB'|'IG', username?: string, vid?: string }[]} profiles
342
- */
181
+
343
182
  const linkedProfilesSet = profiles => {
344
183
  const mapped = profiles.map(p => {
345
184
  const entry = { type: p.type }
@@ -350,12 +189,7 @@ const makePrivacySocket = sock => {
350
189
  return mexQuery({ profiles: mapped }, PRIVACY_MEX_IDS.LINKED_PROFILES_SET, 'xwa2_linked_profiles_set')
351
190
  }
352
191
 
353
- /**
354
- * Remove linked social profiles via MEX.
355
- * dataPath: xwa2_linked_profiles_remove
356
- *
357
- * @param {('FB'|'IG')[]} types - Profile types to remove
358
- */
192
+
359
193
  const linkedProfilesRemove = types =>
360
194
  mexQuery(
361
195
  { profiles: types.map(type => ({ type })) },
@@ -363,14 +197,7 @@ const makePrivacySocket = sock => {
363
197
  'xwa2_linked_profiles_remove'
364
198
  )
365
199
 
366
- /**
367
- * Update linked social profile visibility/settings via MEX.
368
- * Confirmed from LinkedProfilesUpdate mutation:
369
- * profiles: [{ type, show_on_profile }]
370
- * dataPath: xwa2_linked_profiles_update
371
- *
372
- * @param {{ type: 'FB'|'IG', showOnProfile: boolean }[]} profiles
373
- */
200
+
374
201
  const linkedProfilesUpdate = profiles =>
375
202
  mexQuery(
376
203
  { profiles: profiles.map(({ type, showOnProfile }) => ({ type, show_on_profile: showOnProfile })) },
@@ -378,16 +205,7 @@ const makePrivacySocket = sock => {
378
205
  'xwa2_linked_profiles_update'
379
206
  )
380
207
 
381
- /**
382
- * Migrate blocklist to LID addressing via MEX.
383
- * Confirmed from C8Eu.java:
384
- * input: { blocklist: [{ jid }], dhash, dirty_ack }
385
- * dataPath: xwa2_migrate_blocklist_lid
386
- *
387
- * @param {string[]} jids - Blocked JIDs to migrate
388
- * @param {string} [dhash=''] - Current blocklist hash
389
- * @param {boolean} [dirtyAck=true]
390
- */
208
+
391
209
  const migrateBlocklistLid = (jids, dhash = '', dirtyAck = true) =>
392
210
  mexQuery(
393
211
  {
@@ -401,29 +219,23 @@ const makePrivacySocket = sock => {
401
219
  'xwa2_migrate_blocklist_lid'
402
220
  )
403
221
 
404
- /**
405
- * Scan a QR code via MEX (used for linking companion devices).
406
- * dataPath: xwa2_qr_code_scan
407
- *
408
- * @param {string} qrData - Raw QR code data string
409
- */
410
- const qrCodeScan = qrData =>
411
- mexQuery({ qr_data: qrData }, PRIVACY_MEX_IDS.QR_CODE_SCAN, 'xwa2_qr_code_scan')
222
+
223
+ const qrCodeScan = qrData => mexQuery({ qr_data: qrData }, PRIVACY_MEX_IDS.QR_CODE_SCAN, 'xwa2_qr_code_scan')
412
224
 
413
225
  return {
414
226
  ...sock,
415
- // Privacy
227
+
416
228
  getPrivacySettings,
417
229
  setPrivacySetting,
418
230
  updatePrivacyContactList,
419
231
  getPrivacyContactList,
420
- // Status / profile
232
+
421
233
  updateTextStatus,
422
234
  getTextStatusList,
423
235
  updateUserStatus,
424
236
  fetchUserPictureInfo,
425
237
  setProfilePictureMex,
426
- // Account / auth
238
+
427
239
  accountLogin,
428
240
  accountLogout,
429
241
  addMultiAccountLink,
@@ -432,7 +244,7 @@ const makePrivacySocket = sock => {
432
244
  untrustTrustedDevice,
433
245
  deleteTrustedDevice,
434
246
  revokeMultiAccount,
435
- // Misc
247
+
436
248
  fetchMobileConfig,
437
249
  notifyPushName,
438
250
  contactIntegrityQuery,