@badzz88/baileys 8.5.4 → 8.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/WAProto/WAProto.proto +75 -1256
- package/WAProto/index.d.ts +19729 -36122
- package/WAProto/index.js +132193 -178538
- package/engine-requirements.js +15 -7
- package/lib/Defaults/index.js +14 -22
- package/lib/Signal/Group/group_cipher.js +5 -5
- package/lib/Signal/Group/keyhelper.js +4 -4
- package/lib/Signal/Group/sender-chain-key.js +2 -2
- package/lib/Signal/Group/sender-key-distribution-message.js +1 -1
- package/lib/Signal/Group/sender-key-message.js +3 -3
- package/lib/Signal/Group/sender-key-record.js +1 -1
- package/lib/Signal/Group/sender-message-key.js +5 -5
- package/lib/Signal/libsignal.js +28 -39
- package/lib/Signal/lid-mapping.js +8 -28
- package/lib/Socket/aigroups.js +5 -5
- package/lib/Socket/business.js +11 -3
- package/lib/Socket/chats.js +319 -668
- package/lib/Socket/communities.js +89 -85
- package/lib/Socket/graphql.js +228 -435
- package/lib/Socket/groups.js +211 -132
- package/lib/Socket/index.js +7 -9
- package/lib/Socket/interactive-handler.js +60 -117
- package/lib/Socket/interop.js +175 -56
- package/lib/Socket/luxu.js +387 -0
- package/lib/Socket/managed-account.js +48 -79
- package/lib/Socket/messages-recv.js +340 -898
- package/lib/Socket/messages-send.js +160 -462
- package/lib/Socket/mex.js +53 -40
- package/lib/Socket/newsletter.js +295 -291
- package/lib/Socket/privacy.js +265 -77
- package/lib/Socket/registration.js +157 -164
- package/lib/Socket/socket.js +199 -181
- package/lib/Socket/text-router.js +83 -0
- package/lib/Socket/username.js +227 -144
- package/lib/Store/keyed-db.js +108 -0
- package/lib/Store/make-cache-manager-store.js +2 -2
- package/lib/Store/make-in-memory-store.js +141 -25
- package/lib/Types/Auth.js +3 -3
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Mex.js +112 -0
- package/lib/Types/Newsletter.js +65 -96
- package/lib/Types/State.js +4 -4
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.js +57 -52
- package/lib/Utils/browser-utils.js +1 -1
- package/lib/Utils/business.js +6 -2
- package/lib/Utils/chat-utils.js +38 -102
- package/lib/Utils/command-loader.d.ts +31 -0
- package/lib/Utils/command-loader.js +100 -0
- package/lib/Utils/companion-reg-client-utils.js +42 -0
- package/lib/Utils/crypto.js +84 -54
- package/lib/Utils/curve25519-js.js +275 -0
- package/lib/Utils/decode-wa-message.js +83 -316
- package/lib/Utils/event-buffer.js +61 -37
- package/lib/Utils/generics.js +103 -157
- package/lib/Utils/group-history.js +12 -3
- package/lib/Utils/history.js +15 -15
- package/lib/Utils/index.js +5 -1
- package/lib/Utils/link-preview.js +8 -3
- package/lib/Utils/lt-hash.js +35 -2
- package/lib/Utils/make-mutex.js +1 -1
- package/lib/Utils/message-retry-manager.js +92 -27
- package/lib/Utils/messages-media.js +130 -159
- package/lib/Utils/messages.js +566 -144
- package/lib/Utils/meta-ai-msmsg.js +202 -62
- package/lib/Utils/native-bridge.js +82 -0
- package/lib/Utils/noise-handler.js +21 -19
- package/lib/Utils/offline-node-processor.js +8 -3
- package/lib/Utils/pre-key-manager.js +23 -13
- package/lib/Utils/process-message.js +106 -197
- package/lib/Utils/reporting-utils.js +2 -2
- package/lib/Utils/session-pool.d.ts +16 -0
- package/lib/Utils/session-pool.js +94 -0
- package/lib/Utils/signal.js +63 -28
- package/lib/Utils/stanza-ack.js +12 -39
- package/lib/Utils/sticker.d.ts +17 -0
- package/lib/Utils/sticker.js +145 -0
- package/lib/Utils/sync-action-utils.js +7 -4
- package/lib/Utils/tc-token-utils.js +25 -20
- package/lib/Utils/use-multi-file-auth-state.js +14 -30
- package/lib/Utils/validate-connection.js +19 -59
- package/lib/Utils/view-once-cache.d.ts +9 -0
- package/lib/Utils/view-once-cache.js +79 -0
- package/lib/WABinary/decode.js +16 -50
- package/lib/WABinary/encode.js +224 -54
- package/lib/WABinary/generic-utils.js +97 -7
- package/lib/WABinary/jid-utils.js +14 -27
- package/lib/WAM/encode.js +7 -7
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +1 -58
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +1 -7
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +5 -13
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +4 -1
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +7 -20
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +1 -1
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +2 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -7
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +1 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +1 -2
- package/lib/WAUSync/Protocols/index.js +0 -1
- package/lib/WAUSync/USyncQuery.js +6 -77
- package/lib/WAUSync/USyncUser.js +8 -16
- package/lib/WAUSync/index.js +0 -1
- package/lib/antiban.js +854 -608
- package/lib/index.js +1 -1
- package/package.json +20 -16
package/lib/Socket/privacy.js
CHANGED
|
@@ -4,38 +4,41 @@ exports.makePrivacySocket = void 0
|
|
|
4
4
|
|
|
5
5
|
const { executeWMexQuery } = require('./mex')
|
|
6
6
|
|
|
7
|
-
|
|
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
|
+
*/
|
|
8
11
|
const PRIVACY_MEX_IDS = {
|
|
9
|
-
|
|
10
|
-
GET_SETTINGS: '
|
|
11
|
-
SET_SETTING: '
|
|
12
|
-
UPDATE_CONTACT_LIST: '
|
|
13
|
-
GET_CONTACT_LIST: '
|
|
14
|
-
|
|
15
|
-
UPDATE_TEXT_STATUS: '25863197129975892',
|
|
16
|
-
GET_TEXT_STATUS_LIST: '
|
|
17
|
-
UPDATE_USER_STATUS: '7452341274886724',
|
|
18
|
-
FETCH_USER_PICTURE: '
|
|
19
|
-
PROFILE_PICTURE_MUTATION: '24714239711610700',
|
|
20
|
-
|
|
21
|
-
ACCOUNT_LOGIN: '
|
|
22
|
-
ACCOUNT_LOGOUT: '
|
|
23
|
-
MULTI_ACCOUNT_REVOKE: '
|
|
24
|
-
ADD_MULTI_ACCOUNT_LINK: '
|
|
25
|
-
ADD_TRUSTED_DEVICE: '
|
|
26
|
-
GET_TRUSTED_DEVICES: '
|
|
27
|
-
UNTRUST_TRUSTED_DEVICE: '26574930682133620',
|
|
28
|
-
DELETE_TRUSTED_DEVICE: '
|
|
29
|
-
|
|
30
|
-
MOBILE_CONFIG_FETCH: '
|
|
31
|
-
NOTIFY_PUSH_NAME: '
|
|
32
|
-
CONTACT_INTEGRITY: '
|
|
33
|
-
BIZ_INTEGRITY: '
|
|
34
|
-
LINKED_PROFILES_SET: '25013968611531010',
|
|
35
|
-
LINKED_PROFILES_REMOVE: '
|
|
36
|
-
LINKED_PROFILES_UPDATE: '
|
|
37
|
-
MIGRATE_BLOCKLIST_LID: '
|
|
38
|
-
QR_CODE_SCAN: '26287165600869744'
|
|
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
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
const makePrivacySocket = sock => {
|
|
@@ -44,19 +47,45 @@ const makePrivacySocket = sock => {
|
|
|
44
47
|
const mexQuery = (variables, queryId, dataPath) =>
|
|
45
48
|
executeWMexQuery(variables, queryId, dataPath, query, generateMessageTag)
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
// ── Privacy Settings ────────────────────────────────────────────────────
|
|
48
51
|
|
|
49
|
-
|
|
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
|
+
*/
|
|
50
60
|
const getPrivacySettings = (jid, features = null) => {
|
|
51
61
|
const users = [{ jid, ...(features ? { privacy_features: features } : {}) }]
|
|
52
62
|
return mexQuery({ users }, PRIVACY_MEX_IDS.GET_SETTINGS, 'xwa2_fetch_wa_users')
|
|
53
63
|
}
|
|
54
64
|
|
|
55
|
-
|
|
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
|
+
*/
|
|
56
77
|
const setPrivacySetting = (feature, setting) =>
|
|
57
78
|
mexQuery({ feature, setting }, PRIVACY_MEX_IDS.SET_SETTING, 'xwa2_privacy_feature_update')
|
|
58
79
|
|
|
59
|
-
|
|
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
|
+
*/
|
|
60
89
|
const updatePrivacyContactList = (feature, setting, jids) =>
|
|
61
90
|
mexQuery(
|
|
62
91
|
{ feature, setting, contacts: jids.map(jid => ({ jid })) },
|
|
@@ -64,33 +93,73 @@ const makePrivacySocket = sock => {
|
|
|
64
93
|
'xwa2_privacy_contact_list_update'
|
|
65
94
|
)
|
|
66
95
|
|
|
67
|
-
|
|
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
|
+
*/
|
|
68
103
|
const getPrivacyContactList = (feature, setting) =>
|
|
69
104
|
mexQuery({ feature, setting }, PRIVACY_MEX_IDS.GET_CONTACT_LIST, 'xwa2_privacy_contact_list')
|
|
70
105
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
+
*/
|
|
74
117
|
const updateTextStatus = (text, emoji = null) => {
|
|
75
118
|
const input = { text }
|
|
76
119
|
if (emoji) input.emoji = { content: emoji }
|
|
77
120
|
return mexQuery({ text_status_input: input }, PRIVACY_MEX_IDS.UPDATE_TEXT_STATUS, 'xwa2_text_status_update')
|
|
78
121
|
}
|
|
79
122
|
|
|
80
|
-
|
|
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
|
+
*/
|
|
81
132
|
const getTextStatusList = (jids, lastUpdateTime = null) => {
|
|
82
133
|
const input = jids.map(jid => ({ jid, last_update_time: lastUpdateTime }))
|
|
83
134
|
return mexQuery({ input }, PRIVACY_MEX_IDS.GET_TEXT_STATUS_LIST, 'xwa2_text_status_list')
|
|
84
135
|
}
|
|
85
136
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
+
*/
|
|
90
153
|
const fetchUserPictureInfo = jid =>
|
|
91
154
|
mexQuery({ jid }, PRIVACY_MEX_IDS.FETCH_USER_PICTURE, 'xwa2_fetch_user_picture_info')
|
|
92
155
|
|
|
93
|
-
|
|
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
|
+
*/
|
|
94
163
|
const setProfilePictureMex = (imageBase64, type = 'image') =>
|
|
95
164
|
mexQuery(
|
|
96
165
|
{ input: { image: imageBase64, type } },
|
|
@@ -98,13 +167,28 @@ const makePrivacySocket = sock => {
|
|
|
98
167
|
'xwa2_profile_picture_mutation'
|
|
99
168
|
)
|
|
100
169
|
|
|
101
|
-
|
|
170
|
+
// ── Account / Auth ─────────────────────────────────────────────────────
|
|
102
171
|
|
|
103
|
-
|
|
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
|
+
*/
|
|
104
180
|
const accountLogin = phoneNumber =>
|
|
105
181
|
mexQuery({ input: { phone_number: phoneNumber } }, PRIVACY_MEX_IDS.ACCOUNT_LOGIN, 'xwa2_account_login')
|
|
106
182
|
|
|
107
|
-
|
|
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
|
+
*/
|
|
108
192
|
const accountLogout = (phoneNumber, enabledBiometric = false) =>
|
|
109
193
|
mexQuery(
|
|
110
194
|
{ input: { phone_number: phoneNumber, enabled_biometric: enabledBiometric } },
|
|
@@ -112,7 +196,14 @@ const makePrivacySocket = sock => {
|
|
|
112
196
|
'xwa2_account_logout'
|
|
113
197
|
)
|
|
114
198
|
|
|
115
|
-
|
|
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
|
+
*/
|
|
116
207
|
const addMultiAccountLink = phoneNumber =>
|
|
117
208
|
mexQuery(
|
|
118
209
|
{ input: { phone_number: phoneNumber } },
|
|
@@ -120,32 +211,70 @@ const makePrivacySocket = sock => {
|
|
|
120
211
|
'xwa2_add_multi_account_link'
|
|
121
212
|
)
|
|
122
213
|
|
|
123
|
-
|
|
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
|
+
*/
|
|
124
223
|
const addTrustedDevice = (deviceId, deviceName) =>
|
|
125
|
-
mexQuery(
|
|
126
|
-
{ device_id: deviceId, device_name: deviceName },
|
|
127
|
-
PRIVACY_MEX_IDS.ADD_TRUSTED_DEVICE,
|
|
128
|
-
'xwa2_add_trusted_device'
|
|
129
|
-
)
|
|
224
|
+
mexQuery({ device_id: deviceId, device_name: deviceName }, PRIVACY_MEX_IDS.ADD_TRUSTED_DEVICE, 'xwa2_add_trusted_device')
|
|
130
225
|
|
|
131
|
-
|
|
226
|
+
/**
|
|
227
|
+
* Fetch list of trusted devices for the account via MEX.
|
|
228
|
+
* dataPath: xwa2_get_trusted_devices
|
|
229
|
+
*/
|
|
132
230
|
const getTrustedDevices = () => mexQuery({}, PRIVACY_MEX_IDS.GET_TRUSTED_DEVICES, 'xwa2_get_trusted_devices')
|
|
133
231
|
|
|
134
|
-
|
|
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
|
+
*/
|
|
135
241
|
const untrustTrustedDevice = (deviceId, reason = 'USER_INITIATED') =>
|
|
136
|
-
mexQuery(
|
|
242
|
+
mexQuery(
|
|
243
|
+
{ device_id: deviceId, reason },
|
|
244
|
+
PRIVACY_MEX_IDS.UNTRUST_TRUSTED_DEVICE,
|
|
245
|
+
'xwa2_untrust_trusted_device'
|
|
246
|
+
)
|
|
137
247
|
|
|
138
|
-
|
|
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
|
+
*/
|
|
139
254
|
const deleteTrustedDevice = deviceId =>
|
|
140
255
|
mexQuery({ device_id: deviceId }, PRIVACY_MEX_IDS.DELETE_TRUSTED_DEVICE, 'xwa2_delete_trusted_device')
|
|
141
256
|
|
|
142
|
-
|
|
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
|
+
*/
|
|
143
263
|
const revokeMultiAccount = accountJid =>
|
|
144
264
|
mexQuery({ account_jid: accountJid }, PRIVACY_MEX_IDS.MULTI_ACCOUNT_REVOKE, 'xwa2_multi_account_revoke')
|
|
145
265
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
+
*/
|
|
149
278
|
const fetchMobileConfig = (apiVersion = 0, epRefreshId = 0, flags = '') =>
|
|
150
279
|
mexQuery(
|
|
151
280
|
{ api_version: apiVersion, ep_refresh_id: epRefreshId, flags },
|
|
@@ -153,7 +282,15 @@ const makePrivacySocket = sock => {
|
|
|
153
282
|
'xwa2_mobile_config_fetch'
|
|
154
283
|
)
|
|
155
284
|
|
|
156
|
-
|
|
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
|
+
*/
|
|
157
294
|
const notifyPushName = (groupJid, participants) =>
|
|
158
295
|
mexQuery(
|
|
159
296
|
{
|
|
@@ -166,7 +303,14 @@ const makePrivacySocket = sock => {
|
|
|
166
303
|
'xwa2_notify_push_name'
|
|
167
304
|
)
|
|
168
305
|
|
|
169
|
-
|
|
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
|
+
*/
|
|
170
314
|
const contactIntegrityQuery = (jids, useCase = 'START_CHAT_CONTEXT') =>
|
|
171
315
|
mexQuery(
|
|
172
316
|
{ users: jids.map(jid => ({ jid })), use_case: useCase },
|
|
@@ -174,11 +318,28 @@ const makePrivacySocket = sock => {
|
|
|
174
318
|
'xwa2_fetch_wa_users'
|
|
175
319
|
)
|
|
176
320
|
|
|
177
|
-
|
|
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
|
+
*/
|
|
178
328
|
const bizIntegrityQuery = jids =>
|
|
179
|
-
mexQuery(
|
|
329
|
+
mexQuery(
|
|
330
|
+
{ users: jids.map(jid => ({ jid })) },
|
|
331
|
+
PRIVACY_MEX_IDS.BIZ_INTEGRITY,
|
|
332
|
+
'xwa2_fetch_wa_users'
|
|
333
|
+
)
|
|
180
334
|
|
|
181
|
-
|
|
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
|
+
*/
|
|
182
343
|
const linkedProfilesSet = profiles => {
|
|
183
344
|
const mapped = profiles.map(p => {
|
|
184
345
|
const entry = { type: p.type }
|
|
@@ -189,7 +350,12 @@ const makePrivacySocket = sock => {
|
|
|
189
350
|
return mexQuery({ profiles: mapped }, PRIVACY_MEX_IDS.LINKED_PROFILES_SET, 'xwa2_linked_profiles_set')
|
|
190
351
|
}
|
|
191
352
|
|
|
192
|
-
|
|
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
|
+
*/
|
|
193
359
|
const linkedProfilesRemove = types =>
|
|
194
360
|
mexQuery(
|
|
195
361
|
{ profiles: types.map(type => ({ type })) },
|
|
@@ -197,7 +363,14 @@ const makePrivacySocket = sock => {
|
|
|
197
363
|
'xwa2_linked_profiles_remove'
|
|
198
364
|
)
|
|
199
365
|
|
|
200
|
-
|
|
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
|
+
*/
|
|
201
374
|
const linkedProfilesUpdate = profiles =>
|
|
202
375
|
mexQuery(
|
|
203
376
|
{ profiles: profiles.map(({ type, showOnProfile }) => ({ type, show_on_profile: showOnProfile })) },
|
|
@@ -205,7 +378,16 @@ const makePrivacySocket = sock => {
|
|
|
205
378
|
'xwa2_linked_profiles_update'
|
|
206
379
|
)
|
|
207
380
|
|
|
208
|
-
|
|
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
|
+
*/
|
|
209
391
|
const migrateBlocklistLid = (jids, dhash = '', dirtyAck = true) =>
|
|
210
392
|
mexQuery(
|
|
211
393
|
{
|
|
@@ -219,23 +401,29 @@ const makePrivacySocket = sock => {
|
|
|
219
401
|
'xwa2_migrate_blocklist_lid'
|
|
220
402
|
)
|
|
221
403
|
|
|
222
|
-
|
|
223
|
-
|
|
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')
|
|
224
412
|
|
|
225
413
|
return {
|
|
226
414
|
...sock,
|
|
227
|
-
|
|
415
|
+
// Privacy
|
|
228
416
|
getPrivacySettings,
|
|
229
417
|
setPrivacySetting,
|
|
230
418
|
updatePrivacyContactList,
|
|
231
419
|
getPrivacyContactList,
|
|
232
|
-
|
|
420
|
+
// Status / profile
|
|
233
421
|
updateTextStatus,
|
|
234
422
|
getTextStatusList,
|
|
235
423
|
updateUserStatus,
|
|
236
424
|
fetchUserPictureInfo,
|
|
237
425
|
setProfilePictureMex,
|
|
238
|
-
|
|
426
|
+
// Account / auth
|
|
239
427
|
accountLogin,
|
|
240
428
|
accountLogout,
|
|
241
429
|
addMultiAccountLink,
|
|
@@ -244,7 +432,7 @@ const makePrivacySocket = sock => {
|
|
|
244
432
|
untrustTrustedDevice,
|
|
245
433
|
deleteTrustedDevice,
|
|
246
434
|
revokeMultiAccount,
|
|
247
|
-
|
|
435
|
+
// Misc
|
|
248
436
|
fetchMobileConfig,
|
|
249
437
|
notifyPushName,
|
|
250
438
|
contactIntegrityQuery,
|