@vanzxy/baileys 1.3.7 → 1.3.8

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 (122) hide show
  1. package/README.md +1 -1
  2. package/WAProto/index.d.ts +9 -0
  3. package/lib/Defaults/index.d.ts +147 -0
  4. package/lib/Defaults/index.js +2 -2
  5. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  6. package/lib/Signal/Group/group-session-builder.d.ts +7 -0
  7. package/lib/Signal/Group/group_cipher.d.ts +10 -0
  8. package/lib/Signal/Group/index.d.ts +11 -0
  9. package/lib/Signal/Group/keyhelper.d.ts +6 -0
  10. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  11. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  12. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  13. package/lib/Signal/Group/sender-key-name.d.ts +11 -0
  14. package/lib/Signal/Group/sender-key-record.d.ts +12 -0
  15. package/lib/Signal/Group/sender-key-state.d.ts +16 -0
  16. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  17. package/lib/Signal/libsignal.d.ts +54 -0
  18. package/lib/Signal/lid-mapping.d.ts +20 -0
  19. package/lib/Socket/Client/index.d.ts +2 -0
  20. package/lib/Socket/Client/types.d.ts +5 -0
  21. package/lib/Socket/Client/websocket.d.ts +12 -0
  22. package/lib/Socket/business.d.ts +395 -0
  23. package/lib/Socket/chats.d.ts +136 -0
  24. package/lib/Socket/communities.d.ts +561 -0
  25. package/lib/Socket/communities.js +4 -2
  26. package/lib/Socket/dugong.d.ts +117 -0
  27. package/lib/Socket/dugong.js +26 -1
  28. package/lib/Socket/groups.d.ts +285 -0
  29. package/lib/Socket/index.d.ts +531 -0
  30. package/lib/Socket/messages-recv.d.ts +333 -0
  31. package/lib/Socket/messages-send.d.ts +329 -0
  32. package/lib/Socket/mex.d.ts +1 -0
  33. package/lib/Socket/newsletter.d.ts +281 -0
  34. package/lib/Socket/newsletter.js +19 -19
  35. package/lib/Socket/socket.d.ts +60 -0
  36. package/lib/Store/index.d.ts +3 -0
  37. package/lib/Store/make-in-memory-store.d.ts +62 -0
  38. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  39. package/lib/Store/object-repository.d.ts +10 -0
  40. package/lib/Types/Auth.d.ts +117 -0
  41. package/lib/Types/Bussines.d.ts +25 -0
  42. package/lib/Types/Call.d.ts +15 -0
  43. package/lib/Types/Chat.d.ts +124 -0
  44. package/lib/Types/Contact.d.ts +26 -0
  45. package/lib/Types/Events.d.ts +256 -0
  46. package/lib/Types/GroupMetadata.d.ts +71 -0
  47. package/lib/Types/Label.d.ts +2 -0
  48. package/lib/Types/LabelAssociation.d.ts +2 -0
  49. package/lib/Types/Message.d.ts +11 -0
  50. package/lib/Types/Mex.d.ts +2 -0
  51. package/lib/Types/Product.d.ts +79 -0
  52. package/lib/Types/RichType.d.ts +2 -0
  53. package/lib/Types/Signal.d.ts +87 -0
  54. package/lib/Types/Socket.d.ts +136 -0
  55. package/lib/Types/State.d.ts +5 -0
  56. package/lib/Types/USync.d.ts +26 -0
  57. package/lib/Types/index.d.ts +66 -0
  58. package/lib/Utils/auth-utils.d.ts +57 -0
  59. package/lib/Utils/browser-utils.d.ts +8 -0
  60. package/lib/Utils/business.d.ts +49 -0
  61. package/lib/Utils/business.js +2 -1
  62. package/lib/Utils/chat-utils.d.ts +407 -0
  63. package/lib/Utils/chat-utils.js +15 -1
  64. package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
  65. package/lib/Utils/crypto.d.ts +41 -0
  66. package/lib/Utils/decode-wa-message.d.ts +83 -0
  67. package/lib/Utils/decode-wa-message.js +1 -3
  68. package/lib/Utils/event-buffer.d.ts +12 -0
  69. package/lib/Utils/generics.d.ts +63 -0
  70. package/lib/Utils/generics.js +2 -4
  71. package/lib/Utils/history.d.ts +90 -0
  72. package/lib/Utils/identity-change-handler.d.ts +13 -0
  73. package/lib/Utils/index.d.ts +24 -0
  74. package/lib/Utils/link-preview.d.ts +12 -0
  75. package/lib/Utils/logger.d.ts +2 -0
  76. package/lib/Utils/lt-hash.d.ts +12 -0
  77. package/lib/Utils/lt-hash.js +21 -2
  78. package/lib/Utils/make-mutex.d.ts +6 -0
  79. package/lib/Utils/message-retry-manager.d.ts +79 -0
  80. package/lib/Utils/messages-media.d.ts +135 -0
  81. package/lib/Utils/messages.d.ts +44 -0
  82. package/lib/Utils/noise-handler.d.ts +20 -0
  83. package/lib/Utils/offline-node-processor.d.ts +9 -0
  84. package/lib/Utils/pre-key-manager.d.ts +25 -0
  85. package/lib/Utils/process-message.d.ts +82 -0
  86. package/lib/Utils/reporting-utils.d.ts +12 -0
  87. package/lib/Utils/rich-message-utils.d.ts +48 -0
  88. package/lib/Utils/signal.d.ts +82 -0
  89. package/lib/Utils/stanza-ack.d.ts +16 -0
  90. package/lib/Utils/sync-action-utils.d.ts +2 -0
  91. package/lib/Utils/tc-token-utils.d.ts +29 -0
  92. package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
  93. package/lib/Utils/use-single-file-auth-state.d.ts +10 -0
  94. package/lib/Utils/use-single-file-auth-state.js +6 -1
  95. package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
  96. package/lib/Utils/use-sqlite-auth-state.js +12 -0
  97. package/lib/Utils/validate-connection.d.ts +42 -0
  98. package/lib/WABinary/constants.d.ts +61 -0
  99. package/lib/WABinary/decode.d.ts +9 -0
  100. package/lib/WABinary/encode.d.ts +2 -0
  101. package/lib/WABinary/generic-utils.d.ts +74 -0
  102. package/lib/WABinary/index.d.ts +5 -0
  103. package/lib/WABinary/jid-utils.d.ts +28 -0
  104. package/lib/WABinary/types.d.ts +19 -0
  105. package/lib/WAM/BinaryInfo.d.ts +7 -0
  106. package/lib/WAM/constants.d.ts +34926 -0
  107. package/lib/WAM/encode.d.ts +1 -0
  108. package/lib/WAM/index.d.ts +3 -0
  109. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
  110. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +29 -0
  111. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  112. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  113. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
  114. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
  115. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
  116. package/lib/WAUSync/Protocols/index.d.ts +7 -0
  117. package/lib/WAUSync/USyncQuery.d.ts +20 -0
  118. package/lib/WAUSync/USyncUser.d.ts +16 -0
  119. package/lib/WAUSync/index.d.ts +3 -0
  120. package/lib/index.d.ts +12 -0
  121. package/package.json +12 -7
  122. package/postinstall-banner.js +23 -0
@@ -0,0 +1,407 @@
1
+ export function makeLtHashGenerator({ indexValueMap, hash }: {
2
+ indexValueMap: any;
3
+ hash: any;
4
+ }): {
5
+ mix: ({ indexMac, valueMac, operation }: {
6
+ indexMac: any;
7
+ valueMac: any;
8
+ operation: any;
9
+ }) => void;
10
+ finish: () => {
11
+ hash: any;
12
+ indexValueMap: any;
13
+ };
14
+ };
15
+ export function newLTHashState(): {
16
+ version: number;
17
+ hash: any;
18
+ indexValueMap: {};
19
+ };
20
+ export function ensureLTHashStateVersion(state: any): any;
21
+ export const MAX_SYNC_ATTEMPTS: 2;
22
+ export function isMissingKeyError(error: any): boolean;
23
+ export function isAppStateSyncIrrecoverable(error: any, attempts: any): boolean;
24
+ export function encodeSyncdPatch({ type, index, syncAction, apiVersion, operation }: {
25
+ type: any;
26
+ index: any;
27
+ syncAction: any;
28
+ apiVersion: any;
29
+ operation: any;
30
+ }, myAppStateKeyId: any, state: any, getAppStateSyncKey: any): Promise<{
31
+ patch: {
32
+ patchMac: any;
33
+ snapshotMac: any;
34
+ keyId: {
35
+ id: any;
36
+ };
37
+ mutations: {
38
+ operation: any;
39
+ record: {
40
+ index: {
41
+ blob: any;
42
+ };
43
+ value: {
44
+ blob: any;
45
+ };
46
+ keyId: {
47
+ id: any;
48
+ };
49
+ };
50
+ }[];
51
+ };
52
+ state: any;
53
+ }>;
54
+ export function decodeSyncdMutations(msgMutations: any, initialState: any, getAppStateSyncKey: any, onMutation: any, validateMacs: any): Promise<{
55
+ hash: any;
56
+ indexValueMap: any;
57
+ }>;
58
+ export function decodeSyncdPatch(msg: any, name: any, initialState: any, getAppStateSyncKey: any, onMutation: any, validateMacs: any): Promise<{
59
+ hash: any;
60
+ indexValueMap: any;
61
+ }>;
62
+ export function extractSyncdPatches(result: any, options: any): Promise<{}>;
63
+ export function downloadExternalBlob(blob: any, options: any): Promise<any>;
64
+ export function downloadExternalPatch(blob: any, options: any): Promise<any>;
65
+ export function decodeSyncdSnapshot(name: any, snapshot: any, getAppStateSyncKey: any, minimumVersionNumber: any, validateMacs: boolean | undefined, logger: any): Promise<{
66
+ state: {
67
+ version: number;
68
+ hash: any;
69
+ indexValueMap: {};
70
+ };
71
+ mutationMap: {};
72
+ }>;
73
+ export function decodePatches(name: any, syncds: any, initial: any, getAppStateSyncKey: any, options: any, minimumVersionNumber: any, logger: any, validateMacs?: boolean): Promise<{
74
+ state: any;
75
+ mutationMap: {};
76
+ }>;
77
+ export function chatModificationToAppPatch(mod: any, jid: any): {
78
+ syncAction: {
79
+ muteAction: {
80
+ muted: boolean;
81
+ muteEndTimestamp: any;
82
+ };
83
+ archiveChatAction?: undefined;
84
+ markChatAsReadAction?: undefined;
85
+ deleteMessageForMeAction?: undefined;
86
+ clearChatAction?: undefined;
87
+ pinAction?: undefined;
88
+ contactAction?: undefined;
89
+ privacySettingDisableLinkPreviewsAction?: undefined;
90
+ starAction?: undefined;
91
+ deleteChatAction?: undefined;
92
+ pushNameSetting?: undefined;
93
+ quickReplyAction?: undefined;
94
+ labelEditAction?: undefined;
95
+ labelAssociationAction?: undefined;
96
+ };
97
+ index: any[];
98
+ type: string;
99
+ apiVersion: number;
100
+ operation: any;
101
+ } | {
102
+ syncAction: {
103
+ archiveChatAction: {
104
+ archived: boolean;
105
+ messageRange: any;
106
+ };
107
+ muteAction?: undefined;
108
+ markChatAsReadAction?: undefined;
109
+ deleteMessageForMeAction?: undefined;
110
+ clearChatAction?: undefined;
111
+ pinAction?: undefined;
112
+ contactAction?: undefined;
113
+ privacySettingDisableLinkPreviewsAction?: undefined;
114
+ starAction?: undefined;
115
+ deleteChatAction?: undefined;
116
+ pushNameSetting?: undefined;
117
+ quickReplyAction?: undefined;
118
+ labelEditAction?: undefined;
119
+ labelAssociationAction?: undefined;
120
+ };
121
+ index: any[];
122
+ type: string;
123
+ apiVersion: number;
124
+ operation: any;
125
+ } | {
126
+ syncAction: {
127
+ markChatAsReadAction: {
128
+ read: any;
129
+ messageRange: any;
130
+ };
131
+ muteAction?: undefined;
132
+ archiveChatAction?: undefined;
133
+ deleteMessageForMeAction?: undefined;
134
+ clearChatAction?: undefined;
135
+ pinAction?: undefined;
136
+ contactAction?: undefined;
137
+ privacySettingDisableLinkPreviewsAction?: undefined;
138
+ starAction?: undefined;
139
+ deleteChatAction?: undefined;
140
+ pushNameSetting?: undefined;
141
+ quickReplyAction?: undefined;
142
+ labelEditAction?: undefined;
143
+ labelAssociationAction?: undefined;
144
+ };
145
+ index: any[];
146
+ type: string;
147
+ apiVersion: number;
148
+ operation: any;
149
+ } | {
150
+ syncAction: {
151
+ deleteMessageForMeAction: {
152
+ deleteMedia: any;
153
+ messageTimestamp: any;
154
+ };
155
+ muteAction?: undefined;
156
+ archiveChatAction?: undefined;
157
+ markChatAsReadAction?: undefined;
158
+ clearChatAction?: undefined;
159
+ pinAction?: undefined;
160
+ contactAction?: undefined;
161
+ privacySettingDisableLinkPreviewsAction?: undefined;
162
+ starAction?: undefined;
163
+ deleteChatAction?: undefined;
164
+ pushNameSetting?: undefined;
165
+ quickReplyAction?: undefined;
166
+ labelEditAction?: undefined;
167
+ labelAssociationAction?: undefined;
168
+ };
169
+ index: any[];
170
+ type: string;
171
+ apiVersion: number;
172
+ operation: any;
173
+ } | {
174
+ syncAction: {
175
+ clearChatAction: {
176
+ messageRange: any;
177
+ };
178
+ muteAction?: undefined;
179
+ archiveChatAction?: undefined;
180
+ markChatAsReadAction?: undefined;
181
+ deleteMessageForMeAction?: undefined;
182
+ pinAction?: undefined;
183
+ contactAction?: undefined;
184
+ privacySettingDisableLinkPreviewsAction?: undefined;
185
+ starAction?: undefined;
186
+ deleteChatAction?: undefined;
187
+ pushNameSetting?: undefined;
188
+ quickReplyAction?: undefined;
189
+ labelEditAction?: undefined;
190
+ labelAssociationAction?: undefined;
191
+ };
192
+ index: any[];
193
+ type: string;
194
+ apiVersion: number;
195
+ operation: any;
196
+ } | {
197
+ syncAction: {
198
+ pinAction: {
199
+ pinned: boolean;
200
+ };
201
+ muteAction?: undefined;
202
+ archiveChatAction?: undefined;
203
+ markChatAsReadAction?: undefined;
204
+ deleteMessageForMeAction?: undefined;
205
+ clearChatAction?: undefined;
206
+ contactAction?: undefined;
207
+ privacySettingDisableLinkPreviewsAction?: undefined;
208
+ starAction?: undefined;
209
+ deleteChatAction?: undefined;
210
+ pushNameSetting?: undefined;
211
+ quickReplyAction?: undefined;
212
+ labelEditAction?: undefined;
213
+ labelAssociationAction?: undefined;
214
+ };
215
+ index: any[];
216
+ type: string;
217
+ apiVersion: number;
218
+ operation: any;
219
+ } | {
220
+ syncAction: {
221
+ contactAction: any;
222
+ muteAction?: undefined;
223
+ archiveChatAction?: undefined;
224
+ markChatAsReadAction?: undefined;
225
+ deleteMessageForMeAction?: undefined;
226
+ clearChatAction?: undefined;
227
+ pinAction?: undefined;
228
+ privacySettingDisableLinkPreviewsAction?: undefined;
229
+ starAction?: undefined;
230
+ deleteChatAction?: undefined;
231
+ pushNameSetting?: undefined;
232
+ quickReplyAction?: undefined;
233
+ labelEditAction?: undefined;
234
+ labelAssociationAction?: undefined;
235
+ };
236
+ index: any[];
237
+ type: string;
238
+ apiVersion: number;
239
+ operation: any;
240
+ } | {
241
+ syncAction: {
242
+ privacySettingDisableLinkPreviewsAction: any;
243
+ muteAction?: undefined;
244
+ archiveChatAction?: undefined;
245
+ markChatAsReadAction?: undefined;
246
+ deleteMessageForMeAction?: undefined;
247
+ clearChatAction?: undefined;
248
+ pinAction?: undefined;
249
+ contactAction?: undefined;
250
+ starAction?: undefined;
251
+ deleteChatAction?: undefined;
252
+ pushNameSetting?: undefined;
253
+ quickReplyAction?: undefined;
254
+ labelEditAction?: undefined;
255
+ labelAssociationAction?: undefined;
256
+ };
257
+ index: string[];
258
+ type: string;
259
+ apiVersion: number;
260
+ operation: any;
261
+ } | {
262
+ syncAction: {
263
+ starAction: {
264
+ starred: boolean;
265
+ };
266
+ muteAction?: undefined;
267
+ archiveChatAction?: undefined;
268
+ markChatAsReadAction?: undefined;
269
+ deleteMessageForMeAction?: undefined;
270
+ clearChatAction?: undefined;
271
+ pinAction?: undefined;
272
+ contactAction?: undefined;
273
+ privacySettingDisableLinkPreviewsAction?: undefined;
274
+ deleteChatAction?: undefined;
275
+ pushNameSetting?: undefined;
276
+ quickReplyAction?: undefined;
277
+ labelEditAction?: undefined;
278
+ labelAssociationAction?: undefined;
279
+ };
280
+ index: any[];
281
+ type: string;
282
+ apiVersion: number;
283
+ operation: any;
284
+ } | {
285
+ syncAction: {
286
+ deleteChatAction: {
287
+ messageRange: any;
288
+ };
289
+ muteAction?: undefined;
290
+ archiveChatAction?: undefined;
291
+ markChatAsReadAction?: undefined;
292
+ deleteMessageForMeAction?: undefined;
293
+ clearChatAction?: undefined;
294
+ pinAction?: undefined;
295
+ contactAction?: undefined;
296
+ privacySettingDisableLinkPreviewsAction?: undefined;
297
+ starAction?: undefined;
298
+ pushNameSetting?: undefined;
299
+ quickReplyAction?: undefined;
300
+ labelEditAction?: undefined;
301
+ labelAssociationAction?: undefined;
302
+ };
303
+ index: any[];
304
+ type: string;
305
+ apiVersion: number;
306
+ operation: any;
307
+ } | {
308
+ syncAction: {
309
+ pushNameSetting: {
310
+ name: any;
311
+ };
312
+ muteAction?: undefined;
313
+ archiveChatAction?: undefined;
314
+ markChatAsReadAction?: undefined;
315
+ deleteMessageForMeAction?: undefined;
316
+ clearChatAction?: undefined;
317
+ pinAction?: undefined;
318
+ contactAction?: undefined;
319
+ privacySettingDisableLinkPreviewsAction?: undefined;
320
+ starAction?: undefined;
321
+ deleteChatAction?: undefined;
322
+ quickReplyAction?: undefined;
323
+ labelEditAction?: undefined;
324
+ labelAssociationAction?: undefined;
325
+ };
326
+ index: string[];
327
+ type: string;
328
+ apiVersion: number;
329
+ operation: any;
330
+ } | {
331
+ syncAction: {
332
+ quickReplyAction: {
333
+ count: number;
334
+ deleted: any;
335
+ keywords: never[];
336
+ message: any;
337
+ shortcut: any;
338
+ };
339
+ muteAction?: undefined;
340
+ archiveChatAction?: undefined;
341
+ markChatAsReadAction?: undefined;
342
+ deleteMessageForMeAction?: undefined;
343
+ clearChatAction?: undefined;
344
+ pinAction?: undefined;
345
+ contactAction?: undefined;
346
+ privacySettingDisableLinkPreviewsAction?: undefined;
347
+ starAction?: undefined;
348
+ deleteChatAction?: undefined;
349
+ pushNameSetting?: undefined;
350
+ labelEditAction?: undefined;
351
+ labelAssociationAction?: undefined;
352
+ };
353
+ index: any[];
354
+ type: string;
355
+ apiVersion: number;
356
+ operation: any;
357
+ } | {
358
+ syncAction: {
359
+ labelEditAction: {
360
+ name: any;
361
+ color: any;
362
+ predefinedId: any;
363
+ deleted: any;
364
+ };
365
+ muteAction?: undefined;
366
+ archiveChatAction?: undefined;
367
+ markChatAsReadAction?: undefined;
368
+ deleteMessageForMeAction?: undefined;
369
+ clearChatAction?: undefined;
370
+ pinAction?: undefined;
371
+ contactAction?: undefined;
372
+ privacySettingDisableLinkPreviewsAction?: undefined;
373
+ starAction?: undefined;
374
+ deleteChatAction?: undefined;
375
+ pushNameSetting?: undefined;
376
+ quickReplyAction?: undefined;
377
+ labelAssociationAction?: undefined;
378
+ };
379
+ index: any[];
380
+ type: string;
381
+ apiVersion: number;
382
+ operation: any;
383
+ } | {
384
+ syncAction: {
385
+ labelAssociationAction: {
386
+ labeled: boolean;
387
+ };
388
+ muteAction?: undefined;
389
+ archiveChatAction?: undefined;
390
+ markChatAsReadAction?: undefined;
391
+ deleteMessageForMeAction?: undefined;
392
+ clearChatAction?: undefined;
393
+ pinAction?: undefined;
394
+ contactAction?: undefined;
395
+ privacySettingDisableLinkPreviewsAction?: undefined;
396
+ starAction?: undefined;
397
+ deleteChatAction?: undefined;
398
+ pushNameSetting?: undefined;
399
+ quickReplyAction?: undefined;
400
+ labelEditAction?: undefined;
401
+ };
402
+ index: any[];
403
+ type: string;
404
+ apiVersion: number;
405
+ operation: any;
406
+ };
407
+ export function processSyncAction(syncAction: any, ev: any, me: any, initialSyncOpts: any, logger: any): void;
@@ -1,5 +1,4 @@
1
1
  import { Boom } from '@hapi/boom';
2
- import { expandAppStateKeys } from 'whatsapp-rust-bridge';
3
2
  import { proto } from '../../WAProto/index.js';
4
3
  import { LabelAssociationType } from '../Types/LabelAssociation.js';
5
4
  import { getBinaryNodeChild, getBinaryNodeChildren, isJidGroup, jidNormalizedUser } from '../WABinary/index.js';
@@ -8,6 +7,21 @@ import { toNumber } from './generics.js';
8
7
  import { LT_HASH_ANTI_TAMPERING } from './lt-hash.js';
9
8
  import { downloadContentFromMessage } from './messages-media.js';
10
9
  import { emitSyncActionResults, processContactAction } from './sync-action-utils.js';
10
+ // Vanz@Fix (bug 36 follow-up): same top-level-await try/catch treatment as crypto.js and
11
+ // lt-hash.js — avoid crashing the whole library at import time if the whatsapp-rust-bridge
12
+ // native binary is missing on this platform (ARM musl/Alpine/Termux/some Pterodactyl nodes);
13
+ // only throw when app-state sync actually needs it. Kept synchronous (not async) because
14
+ // mutationKeys() is called synchronously throughout this file — making it async would be
15
+ // a breaking change for those call sites.
16
+ let expandAppStateKeys;
17
+ try {
18
+ ({ expandAppStateKeys } = await import('whatsapp-rust-bridge'));
19
+ }
20
+ catch (err) {
21
+ const message = '`whatsapp-rust-bridge` failed to load (no prebuilt binary for this platform/arch). ' +
22
+ 'App-state sync is unavailable here. Original error: ' + (err?.message || err);
23
+ expandAppStateKeys = () => { throw new Error(message); };
24
+ }
11
25
  const mutationKeys = (keydata) => {
12
26
  const keys = expandAppStateKeys(keydata);
13
27
  return {
@@ -0,0 +1,4 @@
1
+ export const CompanionWebClientType: any;
2
+ export function getCompanionWebClientType([os, browserName]: [any, any]): any;
3
+ export function getCompanionPlatformId(browser: any): any;
4
+ export function buildPairingQRData(ref: any, noiseKeyB64: any, identityKeyB64: any, advB64: any, browser: any): string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * encrypt AES 256 GCM;
3
+ * where the tag tag is suffixed to the ciphertext
4
+ * */
5
+ export function aesEncryptGCM(plaintext: any, key: any, iv: any, additionalData: any): any;
6
+ /**
7
+ * decrypt AES 256 GCM;
8
+ * where the auth tag is suffixed to the ciphertext
9
+ * */
10
+ export function aesDecryptGCM(ciphertext: any, key: any, iv: any, additionalData: any): any;
11
+ export function aesEncryptCTR(plaintext: any, key: any, iv: any): any;
12
+ export function aesDecryptCTR(ciphertext: any, key: any, iv: any): any;
13
+ /** decrypt AES 256 CBC; where the IV is prefixed to the buffer */
14
+ export function aesDecrypt(buffer: any, key: any): any;
15
+ /** decrypt AES 256 CBC */
16
+ export function aesDecryptWithIV(buffer: any, key: any, IV: any): any;
17
+ export function aesEncrypt(buffer: any, key: any): any;
18
+ export function aesEncrypWithIV(buffer: any, key: any, IV: any): any;
19
+ export function hmacSign(buffer: any, key: any, variant?: string): any;
20
+ export function sha256(buffer: any): any;
21
+ export function derivePairingCodeKey(pairingCode: any, salt: any): Promise<any>;
22
+ export function generateSignalPubKey(pubKey: any): any;
23
+ export namespace Curve {
24
+ function generateKeyPair(): {
25
+ private: any;
26
+ public: any;
27
+ };
28
+ function sharedKey(privateKey: any, publicKey: any): any;
29
+ function sign(privateKey: any, buf: any): any;
30
+ function verify(pubKey: any, message: any, signature: any): boolean;
31
+ }
32
+ export function signedKeyPair(identityKeyPair: any, keyId: any): {
33
+ keyPair: {
34
+ private: any;
35
+ public: any;
36
+ };
37
+ signature: any;
38
+ keyId: any;
39
+ };
40
+ export let md5: any;
41
+ export let hkdf: any;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Decode the received node as a message.
3
+ * @note this will only parse the message, not decrypt it
4
+ */
5
+ export function decodeMessageNode(stanza: any, meId: any, meLid: any): {
6
+ fullMessage: {
7
+ key: {
8
+ server_id?: any;
9
+ remoteJid: any;
10
+ remoteJidAlt: any;
11
+ remoteJidUsername: any;
12
+ fromMe: boolean;
13
+ id: any;
14
+ participant: any;
15
+ participantAlt: any;
16
+ participantUsername: any;
17
+ addressingMode: any;
18
+ };
19
+ category: any;
20
+ messageTimestamp: number;
21
+ pushName: any;
22
+ broadcast: any;
23
+ };
24
+ author: any;
25
+ sender: any;
26
+ };
27
+ export function getDecryptionJid(sender: any, repository: any): Promise<any>;
28
+ export const NO_MESSAGE_FOUND_ERROR_TEXT: "Message absent from node";
29
+ export const MISSING_KEYS_ERROR_TEXT: "Key used already or never filled";
30
+ export const ACCOUNT_RESTRICTED_TEXT: "Your account has been restricted";
31
+ export namespace DECRYPTION_RETRY_CONFIG {
32
+ let maxRetries: number;
33
+ let baseDelayMs: number;
34
+ let sessionRecordErrors: string[];
35
+ }
36
+ export namespace NACK_REASONS {
37
+ let SenderReachoutTimelocked: number;
38
+ let ParsingError: number;
39
+ let UnrecognizedStanza: number;
40
+ let UnrecognizedStanzaClass: number;
41
+ let UnrecognizedStanzaType: number;
42
+ let InvalidProtobuf: number;
43
+ let InvalidHostedCompanionStanza: number;
44
+ let MissingMessageSecret: number;
45
+ let SignalErrorOldCounter: number;
46
+ let MessageDeletedOnPeer: number;
47
+ let UnhandledError: number;
48
+ let UnsupportedAdminRevoke: number;
49
+ let UnsupportedLIDGroup: number;
50
+ let DBOperationFailed: number;
51
+ }
52
+ export namespace SERVER_ERROR_CODES {
53
+ let MessageAccountRestriction: string;
54
+ let SmaxInvalid: string;
55
+ }
56
+ export function extractAddressingContext(stanza: any): {
57
+ addressingMode: any;
58
+ senderAlt: any;
59
+ recipientAlt: any;
60
+ };
61
+ export function decryptMessageNode(stanza: any, meId: any, meLid: any, repository: any, logger: any): {
62
+ fullMessage: {
63
+ key: {
64
+ server_id?: any;
65
+ remoteJid: any;
66
+ remoteJidAlt: any;
67
+ remoteJidUsername: any;
68
+ fromMe: boolean;
69
+ id: any;
70
+ participant: any;
71
+ participantAlt: any;
72
+ participantUsername: any;
73
+ addressingMode: any;
74
+ };
75
+ category: any;
76
+ messageTimestamp: number;
77
+ pushName: any;
78
+ broadcast: any;
79
+ };
80
+ category: any;
81
+ author: any;
82
+ decrypt(): Promise<void>;
83
+ };
@@ -1,8 +1,6 @@
1
1
  import { Boom } from '@hapi/boom';
2
2
  import { proto } from '../../WAProto/index.js';
3
- import { areJidsSameUser, isHostedLidUser, isHostedPnUser, isJidBroadcast, isJidGroup, isJidMetaAI, isJidNewsletter, isJidStatusBroadcast, isLidUser, isPnUser
4
- // transferDevice
5
- } from '../WABinary/index.js';
3
+ import { areJidsSameUser, isHostedLidUser, isHostedPnUser, isJidBroadcast, isJidGroup, isJidMetaAI, isJidNewsletter, isJidStatusBroadcast, isLidUser, isPnUser } from '../WABinary/index.js';
6
4
  import { unpadRandomMax16 } from './generics.js';
7
5
  export const getDecryptionJid = async (sender, repository) => {
8
6
  if (isLidUser(sender) || isHostedLidUser(sender)) {
@@ -0,0 +1,12 @@
1
+ export function makeEventBuffer(logger: any, timeoutMs: any): {
2
+ process(handler: any): () => void;
3
+ emit(event: any, evData: any): any;
4
+ isBuffering(): boolean;
5
+ buffer: () => void;
6
+ flush: () => boolean;
7
+ createBufferedFunction(work: any): (...args: any[]) => Promise<any>;
8
+ on: (...args: any[]) => any;
9
+ off: (...args: any[]) => any;
10
+ removeAllListeners: (...args: any[]) => any;
11
+ destroy(): void;
12
+ };
@@ -0,0 +1,63 @@
1
+ export function promiseTimeout(ms: any, promise: any): Promise<any>;
2
+ export function bindWaitForEvent(ev: any, event: any): (check: any, timeoutMs: any) => Promise<void>;
3
+ export function trimUndefined(obj: any): any;
4
+ export function bytesToCrockford(buffer: any): string;
5
+ export function encodeNewsletterMessage(message: any): any;
6
+ export namespace BufferJSON {
7
+ function replacer(k: any, value: any): any;
8
+ function reviver(_: any, value: any): any;
9
+ }
10
+ export function getKeyAuthor(key: any, meId?: string): any;
11
+ export function isStringNullOrEmpty(value: any): boolean;
12
+ export function writeRandomPadMax16(msg: any): any;
13
+ export function unpadRandomMax16(e: any): Uint8Array<any>;
14
+ export function generateParticipantHashV2(participants: any): string;
15
+ export function encodeWAMessage(message: any): any;
16
+ export function generateRegistrationId(): number;
17
+ export function encodeBigEndian(e: any, t?: number): Uint8Array<ArrayBuffer>;
18
+ export function toNumber(t: any): any;
19
+ export function unixTimestampSeconds(date?: Date): number;
20
+ export function debouncedTimeout(intervalMs: number | undefined, task: any): {
21
+ start: (newIntervalMs: any, newTask: any) => void;
22
+ cancel: () => void;
23
+ setTask: (newTask: any) => any;
24
+ setInterval: (newInterval: any) => any;
25
+ };
26
+ export function delay(ms: any): Promise<any>;
27
+ export function delayCancellable(ms: any): {
28
+ delay: Promise<any>;
29
+ cancel: () => void;
30
+ };
31
+ export function generateMessageIDV2(userId: any): string;
32
+ export function generateMessageID(): string;
33
+ export function bindWaitForConnectionUpdate(ev: any): (check: any, timeoutMs: any) => Promise<void>;
34
+ export function fetchLatestBaileysVersion(options?: {}): Promise<{
35
+ version: number[];
36
+ isLatest: boolean;
37
+ error?: undefined;
38
+ } | {
39
+ version: number[];
40
+ isLatest: boolean;
41
+ error: unknown;
42
+ }>;
43
+ export function fetchLatestWaWebVersion(options?: {}): Promise<{
44
+ version: number[];
45
+ isLatest: boolean;
46
+ error?: undefined;
47
+ } | {
48
+ version: number[];
49
+ isLatest: boolean;
50
+ error: unknown;
51
+ }>;
52
+ export function generateMdTagPrefix(): string;
53
+ export function getStatusFromReceiptType(type: any): any;
54
+ export function getErrorCodeFromStreamError(node: any): {
55
+ reason: any;
56
+ statusCode: number;
57
+ };
58
+ export function getCallStatusFromNode({ tag, attrs }: {
59
+ tag: any;
60
+ attrs: any;
61
+ }): string;
62
+ export function getCodeFromWSError(error: any): number;
63
+ export function isWABusinessPlatform(platform: any): boolean;
@@ -1,7 +1,7 @@
1
1
  import { Boom } from '@hapi/boom';
2
2
  import { createHash, randomBytes, randomFillSync } from 'crypto';
3
3
  import { proto } from '../../WAProto/index.js';
4
- const baileysVersion = [2, 3000, 1040735178];
4
+ const baileysVersion = [2, 3000, 1043857760];
5
5
  import { DisconnectReason } from '../Types/index.js';
6
6
  import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
7
7
  import { sha256 } from './crypto.js';
@@ -144,9 +144,7 @@ export const generateMessageIDV2 = (userId) => {
144
144
  randomFillSync(data, 28, 16);
145
145
  const hash = createHash('sha256').update(data).digest();
146
146
  const hex = hash.toString('hex', 0, 9).toUpperCase();
147
- const baseId = '3EB0' + hex;
148
- const pos = 4 + (hash[0] & 15);
149
- return baseId.slice(0, pos) + 'STARFALL' + baseId.slice(pos);
147
+ return '3EB0' + hex;
150
148
  };
151
149
  // generate a random ID to attach to a message
152
150
  export const generateMessageID = () => '3EB0' + randomBytes(18).toString('hex').toUpperCase();