@ikyyjee/ikyysinggle 1.7.7
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/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +8083 -0
- package/WAProto/fix-imports.js +85 -0
- package/WAProto/index.d.ts +29095 -0
- package/WAProto/index.js +172336 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.js +194 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-message-key.js +26 -0
- package/lib/Signal/libsignal.js +431 -0
- package/lib/Signal/lid-mapping.js +277 -0
- package/lib/Socket/Client/index.js +3 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/websocket.js +102 -0
- package/lib/Socket/aigroups.js +221 -0
- package/lib/Socket/business.js +379 -0
- package/lib/Socket/chats.js +1193 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/graphql.js +524 -0
- package/lib/Socket/groups.js +408 -0
- package/lib/Socket/index.js +49 -0
- package/lib/Socket/interop.js +341 -0
- package/lib/Socket/luxu.js +510 -0
- package/lib/Socket/managed-account.js +99 -0
- package/lib/Socket/messages-recv.js +2009 -0
- package/lib/Socket/messages-send.js +1608 -0
- package/lib/Socket/mex.js +41 -0
- package/lib/Socket/newsletter.js +399 -0
- package/lib/Socket/privacy.js +128 -0
- package/lib/Socket/registration.js +238 -0
- package/lib/Socket/socket.js +1000 -0
- package/lib/Socket/text-router.js +67 -0
- package/lib/Socket/username.js +234 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/keyed-db.js +108 -0
- package/lib/Store/make-cache-manager-store.js +85 -0
- package/lib/Store/make-in-memory-store.js +198 -0
- package/lib/Store/make-ordered-dictionary.js +75 -0
- package/lib/Store/object-repository.js +32 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.js +25 -0
- package/lib/Types/LabelAssociation.js +7 -0
- package/lib/Types/Message.js +11 -0
- package/lib/Types/Mex.js +114 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.js +3 -0
- package/lib/Types/State.js +56 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.js +26 -0
- package/lib/Utils/adaptive-healing.js +53 -0
- package/lib/Utils/auth-utils.js +302 -0
- package/lib/Utils/browser-utils.js +50 -0
- package/lib/Utils/business.js +231 -0
- package/lib/Utils/chat-utils.js +872 -0
- package/lib/Utils/command-loader.js +108 -0
- package/lib/Utils/companion-reg-client-utils.js +35 -0
- package/lib/Utils/consumer-application.js +106 -0
- package/lib/Utils/crypto.js +137 -0
- package/lib/Utils/curve25519-js.js +262 -0
- package/lib/Utils/decode-wa-message.js +498 -0
- package/lib/Utils/event-buffer.js +622 -0
- package/lib/Utils/generics.js +403 -0
- package/lib/Utils/group-history.js +47 -0
- package/lib/Utils/history.js +134 -0
- package/lib/Utils/identity-change-handler.js +50 -0
- package/lib/Utils/index.js +38 -0
- package/lib/Utils/jid-display-normalization.js +198 -0
- package/lib/Utils/link-preview.js +85 -0
- package/lib/Utils/logger.js +3 -0
- package/lib/Utils/lt-hash.js +8 -0
- package/lib/Utils/make-mutex.js +33 -0
- package/lib/Utils/message-composer.js +273 -0
- package/lib/Utils/message-retry-manager.js +267 -0
- package/lib/Utils/messages-media.js +791 -0
- package/lib/Utils/messages.js +1260 -0
- package/lib/Utils/meta-ai-msmsg.js +271 -0
- package/lib/Utils/native-bridge.js +77 -0
- package/lib/Utils/noise-handler.js +201 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/optimizer.js +90 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/process-message.js +630 -0
- package/lib/Utils/reporting-utils.js +258 -0
- package/lib/Utils/session-pool.js +73 -0
- package/lib/Utils/signal.js +207 -0
- package/lib/Utils/stanza-ack.js +38 -0
- package/lib/Utils/sticker.js +139 -0
- package/lib/Utils/sync-action-utils.js +49 -0
- package/lib/Utils/tc-token-utils.js +163 -0
- package/lib/Utils/use-multi-file-auth-state.js +121 -0
- package/lib/Utils/use-sqlite-auth-state.js +168 -0
- package/lib/Utils/validate-connection.js +203 -0
- package/lib/Utils/view-once-cache.js +79 -0
- package/lib/Utils/voip-rekey.js +25 -0
- package/lib/Utils/warmup.js +117 -0
- package/lib/WABinary/constants.js +1301 -0
- package/lib/WABinary/decode.js +262 -0
- package/lib/WABinary/encode.js +220 -0
- package/lib/WABinary/generic-utils.js +204 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/jid-utils.js +98 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.js +10 -0
- package/lib/WAM/constants.js +22853 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/index.js +4 -0
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +41 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +52 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +31 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +26 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +35 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/index.js +13 -0
- package/lib/WAUSync/USyncQuery.js +127 -0
- package/lib/WAUSync/USyncUser.js +31 -0
- package/lib/WAUSync/index.js +4 -0
- package/lib/antiban.js +4083 -0
- package/lib/index.js +24 -0
- package/package.json +147 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/Socket/interop.js — Meta's cross-app messaging interoperability
|
|
3
|
+
* (EU DMA-mandated interop with Messenger/Instagram). Every function here
|
|
4
|
+
* only runs when you explicitly call it (e.g. `sock.initInterop()`) — it's
|
|
5
|
+
* never wired into the connection lifecycle automatically.
|
|
6
|
+
*/
|
|
7
|
+
import { getBinaryNodeChild, getBinaryNodeChildren, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
8
|
+
import { executeWMexQuery } from './mex.js';
|
|
9
|
+
const INTEROP_MEX_QUERY_IDS = {
|
|
10
|
+
CREATE_GROUP: '25726817620301612',
|
|
11
|
+
LEAVE_GROUP: '25346167795013270',
|
|
12
|
+
ADD_PARTICIPANTS: '25732168276369452',
|
|
13
|
+
QUERY_GROUP_INFO: '32734144032867936',
|
|
14
|
+
PRIVACY_SETTINGS_QUERY: '24849123668112656',
|
|
15
|
+
PRIVACY_SETTINGS_UPDATE: '25421856497452764',
|
|
16
|
+
PRIVACY_SETTINGS_WITH_CONTACT_LIST: '24913399124998600'
|
|
17
|
+
};
|
|
18
|
+
const INTEGRATOR_BIRDYCHAT = 12;
|
|
19
|
+
const INTEGRATOR_HAIKET = 13;
|
|
20
|
+
const TOS_TRACKABLE_ID = '20240306';
|
|
21
|
+
const TOS_RESULT_SHOWN = '105';
|
|
22
|
+
const TOS_RESULT_ACCEPTED = '160';
|
|
23
|
+
const INTEROP_BATCH_MAX = 256;
|
|
24
|
+
export const makeInteropSocket = (sock) => {
|
|
25
|
+
const { query, generateMessageTag, logger, signalRepository } = sock;
|
|
26
|
+
const mexQuery = (variables, queryId, dataPath) => executeWMexQuery(variables, queryId, dataPath, query, generateMessageTag);
|
|
27
|
+
const fetchIntegrators = async () => {
|
|
28
|
+
const result = await query({
|
|
29
|
+
tag: 'iq',
|
|
30
|
+
attrs: {
|
|
31
|
+
type: 'get',
|
|
32
|
+
xmlns: 'w:interop',
|
|
33
|
+
to: S_WHATSAPP_NET
|
|
34
|
+
},
|
|
35
|
+
content: [{ tag: 'integrator', attrs: { fetch: 'all' } }]
|
|
36
|
+
});
|
|
37
|
+
const listNode = getBinaryNodeChild(result, 'integrator_list');
|
|
38
|
+
if (!listNode)
|
|
39
|
+
return [];
|
|
40
|
+
const globalOptedIn = listNode.attrs?.opted_in === 'true';
|
|
41
|
+
return getBinaryNodeChildren(listNode, 'integrator').map(node => {
|
|
42
|
+
const featuresNode = getBinaryNodeChild(node, 'features');
|
|
43
|
+
return {
|
|
44
|
+
id: parseInt(node.attrs.id),
|
|
45
|
+
name: node.attrs.name,
|
|
46
|
+
status: node.attrs.status,
|
|
47
|
+
icon: node.attrs.icon,
|
|
48
|
+
identifierType: node.attrs.identifier_type,
|
|
49
|
+
optedIn: node.attrs.opted_in === 'true' || globalOptedIn,
|
|
50
|
+
features: {
|
|
51
|
+
groupMessaging: featuresNode?.attrs?.group_messaging === 'true'
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const sendTOSTrackable = async (id, result) => {
|
|
57
|
+
await query({
|
|
58
|
+
tag: 'iq',
|
|
59
|
+
attrs: { to: S_WHATSAPP_NET, type: 'set', xmlns: 'tos' },
|
|
60
|
+
content: [{ tag: 'trackable', attrs: { id, result } }]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const acceptInteropTOS = async () => {
|
|
64
|
+
await sendTOSTrackable(TOS_TRACKABLE_ID, TOS_RESULT_SHOWN);
|
|
65
|
+
await sendTOSTrackable(TOS_TRACKABLE_ID, TOS_RESULT_ACCEPTED);
|
|
66
|
+
};
|
|
67
|
+
const optInIntegrators = async (integratorIds = [INTEGRATOR_BIRDYCHAT, INTEGRATOR_HAIKET]) => {
|
|
68
|
+
await query({
|
|
69
|
+
tag: 'iq',
|
|
70
|
+
attrs: { type: 'set', xmlns: 'w:interop', to: S_WHATSAPP_NET },
|
|
71
|
+
content: [
|
|
72
|
+
{
|
|
73
|
+
tag: 'opt_in_integrators',
|
|
74
|
+
attrs: {},
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
tag: 'integrator_list',
|
|
78
|
+
attrs: {},
|
|
79
|
+
content: integratorIds.map(id => ({
|
|
80
|
+
tag: 'integrator',
|
|
81
|
+
attrs: { id: id.toString() }
|
|
82
|
+
}))
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const optOutIntegrators = async (integratorIds = [INTEGRATOR_BIRDYCHAT, INTEGRATOR_HAIKET]) => {
|
|
90
|
+
await query({
|
|
91
|
+
tag: 'iq',
|
|
92
|
+
attrs: { type: 'set', xmlns: 'w:interop', to: S_WHATSAPP_NET },
|
|
93
|
+
content: [
|
|
94
|
+
{
|
|
95
|
+
tag: 'opt_out_integrators',
|
|
96
|
+
attrs: {},
|
|
97
|
+
content: [
|
|
98
|
+
{
|
|
99
|
+
tag: 'integrator_list',
|
|
100
|
+
attrs: {},
|
|
101
|
+
content: integratorIds.map(id => ({
|
|
102
|
+
tag: 'integrator',
|
|
103
|
+
attrs: { id: id.toString() }
|
|
104
|
+
}))
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const resolveInteropUsers = async (users) => {
|
|
112
|
+
if (!users || users.length === 0)
|
|
113
|
+
return [];
|
|
114
|
+
if (users.length > INTEROP_BATCH_MAX) {
|
|
115
|
+
throw new Error(`resolveInteropUsers: max ${INTEROP_BATCH_MAX} users per request`);
|
|
116
|
+
}
|
|
117
|
+
const result = await query({
|
|
118
|
+
tag: 'iq',
|
|
119
|
+
attrs: { type: 'get', xmlns: 'w:interop', to: S_WHATSAPP_NET },
|
|
120
|
+
content: [
|
|
121
|
+
{
|
|
122
|
+
tag: 'users',
|
|
123
|
+
attrs: {},
|
|
124
|
+
content: users.map(({ externalId, integratorId }) => ({
|
|
125
|
+
tag: 'user',
|
|
126
|
+
attrs: {
|
|
127
|
+
external_id: externalId,
|
|
128
|
+
integrator_id: integratorId.toString()
|
|
129
|
+
}
|
|
130
|
+
}))
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
const usersNode = getBinaryNodeChild(result, 'users');
|
|
135
|
+
if (!usersNode)
|
|
136
|
+
return [];
|
|
137
|
+
return getBinaryNodeChildren(usersNode, 'user').map(userNode => {
|
|
138
|
+
const errorNode = getBinaryNodeChild(userNode, 'error');
|
|
139
|
+
if (errorNode) {
|
|
140
|
+
return {
|
|
141
|
+
externalId: userNode.attrs.external_id,
|
|
142
|
+
integratorId: parseInt(userNode.attrs.integrator_id),
|
|
143
|
+
error: {
|
|
144
|
+
code: parseInt(errorNode.attrs.code),
|
|
145
|
+
text: errorNode.attrs.text
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
jid: userNode.attrs.jid,
|
|
151
|
+
externalId: userNode.attrs.external_id,
|
|
152
|
+
normalizedExternalId: userNode.attrs.normalized_external_id,
|
|
153
|
+
integratorId: parseInt(userNode.attrs.integrator_id)
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
const resolveInteropUser = async (externalId, integratorId) => {
|
|
158
|
+
const results = await resolveInteropUsers([{ externalId, integratorId }]);
|
|
159
|
+
return results[0] ?? null;
|
|
160
|
+
};
|
|
161
|
+
const getReachabilitySettings = async () => {
|
|
162
|
+
const result = await query({
|
|
163
|
+
tag: 'iq',
|
|
164
|
+
attrs: { type: 'get', xmlns: 'w:interop', to: S_WHATSAPP_NET },
|
|
165
|
+
content: [{ tag: 'reachability_settings', attrs: {} }]
|
|
166
|
+
});
|
|
167
|
+
const settingsNode = getBinaryNodeChild(result, 'reachability_settings');
|
|
168
|
+
if (!settingsNode)
|
|
169
|
+
return null;
|
|
170
|
+
return {
|
|
171
|
+
enabled: settingsNode.attrs?.enabled,
|
|
172
|
+
users: getBinaryNodeChildren(settingsNode, 'user').map(n => ({
|
|
173
|
+
externalId: n.attrs.external_id,
|
|
174
|
+
integratorId: parseInt(n.attrs.integrator_id),
|
|
175
|
+
jid: n.attrs.jid
|
|
176
|
+
}))
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
const setReachabilitySettings = async (users, enabled = 'true') => {
|
|
180
|
+
await query({
|
|
181
|
+
tag: 'iq',
|
|
182
|
+
attrs: { type: 'set', xmlns: 'w:interop', to: S_WHATSAPP_NET },
|
|
183
|
+
content: [
|
|
184
|
+
{
|
|
185
|
+
tag: 'reachability_settings',
|
|
186
|
+
attrs: { enabled },
|
|
187
|
+
content: users.map(({ externalId, integratorId }) => ({
|
|
188
|
+
tag: 'user',
|
|
189
|
+
attrs: {
|
|
190
|
+
external_id: externalId,
|
|
191
|
+
integrator_id: integratorId.toString()
|
|
192
|
+
}
|
|
193
|
+
}))
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
const updateInteropBlockStatus = async (jid, action) => {
|
|
199
|
+
await query({
|
|
200
|
+
tag: 'iq',
|
|
201
|
+
attrs: { type: 'set', xmlns: 'w:interop', to: S_WHATSAPP_NET },
|
|
202
|
+
content: [
|
|
203
|
+
{
|
|
204
|
+
tag: 'blocklist',
|
|
205
|
+
attrs: {},
|
|
206
|
+
content: [{ tag: 'item', attrs: { action, jid } }]
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
const blockInteropUser = jid => updateInteropBlockStatus(jid, 'block');
|
|
212
|
+
const unblockInteropUser = jid => updateInteropBlockStatus(jid, 'unblock');
|
|
213
|
+
const reportInteropSpam = async (jid, spamFlow = 'account_info_block') => {
|
|
214
|
+
await query({
|
|
215
|
+
tag: 'iq',
|
|
216
|
+
attrs: { type: 'set', xmlns: 'spam', to: S_WHATSAPP_NET },
|
|
217
|
+
content: [{ tag: 'spam_list', attrs: { jid, spam_flow: spamFlow } }]
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
const trustInteropContact = async (jid) => {
|
|
221
|
+
const t = Math.floor(Date.now() / 1000).toString();
|
|
222
|
+
await query({
|
|
223
|
+
tag: 'iq',
|
|
224
|
+
attrs: { to: S_WHATSAPP_NET, xmlns: 'privacy', type: 'set' },
|
|
225
|
+
content: [
|
|
226
|
+
{
|
|
227
|
+
tag: 'tokens',
|
|
228
|
+
attrs: {},
|
|
229
|
+
content: [{ tag: 'token', attrs: { jid, type: 'trusted_contact', t } }]
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
const initInterop = async () => {
|
|
235
|
+
let integrators;
|
|
236
|
+
try {
|
|
237
|
+
integrators = await fetchIntegrators();
|
|
238
|
+
}
|
|
239
|
+
catch (err) {
|
|
240
|
+
logger.warn({ err }, 'interop: failed to fetch integrators');
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
const toOptIn = integrators.filter(i => i.status === 'active' || i.status === 'onboarding');
|
|
244
|
+
if (toOptIn.length === 0)
|
|
245
|
+
return integrators;
|
|
246
|
+
try {
|
|
247
|
+
await acceptInteropTOS();
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
logger.warn({ err }, 'interop: failed to accept TOS');
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
await optInIntegrators(toOptIn.map(i => i.id));
|
|
254
|
+
}
|
|
255
|
+
catch (err) {
|
|
256
|
+
logger.warn({ err }, 'interop: failed to opt-in integrators');
|
|
257
|
+
}
|
|
258
|
+
logger.info({ integrators: toOptIn.map(i => i.name) }, 'interop: initialized');
|
|
259
|
+
return integrators;
|
|
260
|
+
};
|
|
261
|
+
const resetInteropSession = async (jid) => {
|
|
262
|
+
await signalRepository.deleteSession([jid]);
|
|
263
|
+
logger.info({ jid }, '[interop] session reset — next send will use pkmsg');
|
|
264
|
+
};
|
|
265
|
+
const createInteropGroup = async (participants) => {
|
|
266
|
+
const result = await mexQuery({ input: { participants: participants.map(jid => ({ jid })) } }, INTEROP_MEX_QUERY_IDS.CREATE_GROUP, 'xwa2_interop_group_create');
|
|
267
|
+
logger.info({ participants }, '[interop] group created via MEX');
|
|
268
|
+
return result;
|
|
269
|
+
};
|
|
270
|
+
const leaveInteropGroup = async (jids) => {
|
|
271
|
+
const ids = Array.isArray(jids) ? jids : [jids];
|
|
272
|
+
const result = await mexQuery({ input: { groups_to_leave: ids.map(jid => ({ gid: jid.split('@')[0] })) } }, INTEROP_MEX_QUERY_IDS.LEAVE_GROUP, 'xwa2_interop_group_leave');
|
|
273
|
+
logger.info({ jids: ids }, '[interop] left group(s) via MEX');
|
|
274
|
+
return result;
|
|
275
|
+
};
|
|
276
|
+
const addParticipantsToInteropGroup = async (groupJid, participants) => {
|
|
277
|
+
const gid = groupJid.split('@')[0];
|
|
278
|
+
return mexQuery({ input: { gid, participants: participants.map(jid => ({ jid })) } }, INTEROP_MEX_QUERY_IDS.ADD_PARTICIPANTS, 'xwa2_interop_add_participants_to_group');
|
|
279
|
+
};
|
|
280
|
+
const queryInteropGroupInfo = async (groupJid) => {
|
|
281
|
+
const gid = groupJid.split('@')[0];
|
|
282
|
+
return mexQuery({ group_input: { gid } }, INTEROP_MEX_QUERY_IDS.QUERY_GROUP_INFO, 'xwa2_interop_group_query_by_id');
|
|
283
|
+
};
|
|
284
|
+
const updateInteropPrivacySetting = async (feature, setting) => {
|
|
285
|
+
return mexQuery({ feature, setting }, INTEROP_MEX_QUERY_IDS.PRIVACY_SETTINGS_UPDATE, 'xwa2_interop_privacy_setting_update');
|
|
286
|
+
};
|
|
287
|
+
const updateInteropPrivacySettingWithContactList = async (feature, setting, contacts, contactListType, dhash = 'none') => {
|
|
288
|
+
return mexQuery({ feature, setting, contacts, contact_list_type: contactListType, dhash }, INTEROP_MEX_QUERY_IDS.PRIVACY_SETTINGS_WITH_CONTACT_LIST, 'xwa2_interop_privacy_setting_with_contact_list_update');
|
|
289
|
+
};
|
|
290
|
+
const getInteropGroupAddPrivacy = async (jid, integratorId) => {
|
|
291
|
+
const result = await query({
|
|
292
|
+
tag: 'iq',
|
|
293
|
+
attrs: { type: 'get', xmlns: 'w:interop', to: S_WHATSAPP_NET },
|
|
294
|
+
content: [
|
|
295
|
+
{
|
|
296
|
+
tag: 'privacy',
|
|
297
|
+
attrs: { feature: 'GROUPADD' },
|
|
298
|
+
content: [
|
|
299
|
+
{
|
|
300
|
+
tag: 'user',
|
|
301
|
+
attrs: {
|
|
302
|
+
jid,
|
|
303
|
+
integrator_id: integratorId.toString()
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
]
|
|
309
|
+
});
|
|
310
|
+
const privacyNode = getBinaryNodeChild(result, 'privacy');
|
|
311
|
+
const userNode = getBinaryNodeChild(privacyNode, 'user');
|
|
312
|
+
return userNode?.attrs?.result === 'allowed';
|
|
313
|
+
};
|
|
314
|
+
return {
|
|
315
|
+
...sock,
|
|
316
|
+
fetchIntegrators,
|
|
317
|
+
acceptInteropTOS,
|
|
318
|
+
optInIntegrators,
|
|
319
|
+
optOutIntegrators,
|
|
320
|
+
resolveInteropUser,
|
|
321
|
+
resolveInteropUsers,
|
|
322
|
+
getReachabilitySettings,
|
|
323
|
+
setReachabilitySettings,
|
|
324
|
+
blockInteropUser,
|
|
325
|
+
unblockInteropUser,
|
|
326
|
+
reportInteropSpam,
|
|
327
|
+
trustInteropContact,
|
|
328
|
+
initInterop,
|
|
329
|
+
resetInteropSession,
|
|
330
|
+
createInteropGroup,
|
|
331
|
+
leaveInteropGroup,
|
|
332
|
+
addParticipantsToInteropGroup,
|
|
333
|
+
queryInteropGroupInfo,
|
|
334
|
+
updateInteropPrivacySetting,
|
|
335
|
+
updateInteropPrivacySettingWithContactList,
|
|
336
|
+
getInteropGroupAddPrivacy,
|
|
337
|
+
INTEGRATOR_BIRDYCHAT,
|
|
338
|
+
INTEGRATOR_HAIKET,
|
|
339
|
+
INTEROP_MEX_QUERY_IDS
|
|
340
|
+
};
|
|
341
|
+
};
|