@japofc/baileys 2.1.0

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 (342) hide show
  1. package/NOTICE.md +111 -0
  2. package/README.md +1254 -0
  3. package/WAProto/index.d.ts +9 -0
  4. package/WAProto/index.js +142276 -0
  5. package/engine-requirements.js +13 -0
  6. package/lib/Builders/A2UI.d.ts +242 -0
  7. package/lib/Builders/A2UI.js +308 -0
  8. package/lib/Builders/AIRich.d.ts +105 -0
  9. package/lib/Builders/AIRich.js +2286 -0
  10. package/lib/Builders/Button.d.ts +103 -0
  11. package/lib/Builders/Button.js +883 -0
  12. package/lib/Builders/ButtonV2.d.ts +28 -0
  13. package/lib/Builders/ButtonV2.js +144 -0
  14. package/lib/Builders/ButtonV3.d.ts +25 -0
  15. package/lib/Builders/ButtonV3.js +184 -0
  16. package/lib/Builders/Carousel.d.ts +22 -0
  17. package/lib/Builders/Carousel.js +111 -0
  18. package/lib/Builders/JapBaileys.d.ts +34 -0
  19. package/lib/Builders/JapBaileys.js +108 -0
  20. package/lib/Builders/Poll.d.ts +25 -0
  21. package/lib/Builders/Poll.js +128 -0
  22. package/lib/Builders/index.d.ts +17 -0
  23. package/lib/Builders/index.js +11 -0
  24. package/lib/Builders/shared.d.ts +67 -0
  25. package/lib/Builders/shared.js +652 -0
  26. package/lib/Defaults/index.d.ts +154 -0
  27. package/lib/Defaults/index.js +178 -0
  28. package/lib/Framework/Bot.d.ts +61 -0
  29. package/lib/Framework/Bot.js +248 -0
  30. package/lib/Framework/Context.d.ts +21 -0
  31. package/lib/Framework/Context.js +89 -0
  32. package/lib/Framework/MediaManager.d.ts +17 -0
  33. package/lib/Framework/MediaManager.js +151 -0
  34. package/lib/Framework/SessionManager.d.ts +13 -0
  35. package/lib/Framework/SessionManager.js +33 -0
  36. package/lib/Framework/StatsManager.d.ts +26 -0
  37. package/lib/Framework/StatsManager.js +119 -0
  38. package/lib/Framework/Store/SQLiteStore.d.ts +11 -0
  39. package/lib/Framework/Store/SQLiteStore.js +73 -0
  40. package/lib/Framework/index.d.ts +9 -0
  41. package/lib/Framework/index.js +10 -0
  42. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  43. package/lib/Signal/Group/ciphertext-message.js +11 -0
  44. package/lib/Signal/Group/group-session-builder.d.ts +7 -0
  45. package/lib/Signal/Group/group-session-builder.js +29 -0
  46. package/lib/Signal/Group/group_cipher.d.ts +10 -0
  47. package/lib/Signal/Group/group_cipher.js +81 -0
  48. package/lib/Signal/Group/index.d.ts +11 -0
  49. package/lib/Signal/Group/index.js +11 -0
  50. package/lib/Signal/Group/keyhelper.d.ts +6 -0
  51. package/lib/Signal/Group/keyhelper.js +17 -0
  52. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  53. package/lib/Signal/Group/sender-chain-key.js +25 -0
  54. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  55. package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
  56. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  57. package/lib/Signal/Group/sender-key-message.js +65 -0
  58. package/lib/Signal/Group/sender-key-name.d.ts +11 -0
  59. package/lib/Signal/Group/sender-key-name.js +47 -0
  60. package/lib/Signal/Group/sender-key-record.d.ts +12 -0
  61. package/lib/Signal/Group/sender-key-record.js +40 -0
  62. package/lib/Signal/Group/sender-key-state.d.ts +16 -0
  63. package/lib/Signal/Group/sender-key-state.js +83 -0
  64. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  65. package/lib/Signal/Group/sender-message-key.js +25 -0
  66. package/lib/Signal/libsignal.d.ts +54 -0
  67. package/lib/Signal/libsignal.js +430 -0
  68. package/lib/Signal/lid-mapping.d.ts +20 -0
  69. package/lib/Signal/lid-mapping.js +276 -0
  70. package/lib/Socket/Client/index.d.ts +2 -0
  71. package/lib/Socket/Client/index.js +2 -0
  72. package/lib/Socket/Client/types.d.ts +5 -0
  73. package/lib/Socket/Client/types.js +10 -0
  74. package/lib/Socket/Client/websocket.d.ts +12 -0
  75. package/lib/Socket/Client/websocket.js +53 -0
  76. package/lib/Socket/business.d.ts +395 -0
  77. package/lib/Socket/business.js +379 -0
  78. package/lib/Socket/chats.d.ts +136 -0
  79. package/lib/Socket/chats.js +1327 -0
  80. package/lib/Socket/communities.d.ts +562 -0
  81. package/lib/Socket/communities.js +439 -0
  82. package/lib/Socket/dugong.d.ts +117 -0
  83. package/lib/Socket/dugong.js +798 -0
  84. package/lib/Socket/groups.d.ts +285 -0
  85. package/lib/Socket/groups.js +354 -0
  86. package/lib/Socket/index.d.ts +585 -0
  87. package/lib/Socket/index.js +52 -0
  88. package/lib/Socket/messages-recv.d.ts +333 -0
  89. package/lib/Socket/messages-recv.js +1781 -0
  90. package/lib/Socket/messages-send.d.ts +353 -0
  91. package/lib/Socket/messages-send.js +1524 -0
  92. package/lib/Socket/mex.d.ts +1 -0
  93. package/lib/Socket/mex.js +41 -0
  94. package/lib/Socket/newsletter.d.ts +286 -0
  95. package/lib/Socket/newsletter.js +364 -0
  96. package/lib/Socket/socket.d.ts +60 -0
  97. package/lib/Socket/socket.js +1012 -0
  98. package/lib/Socket/username.d.ts +82 -0
  99. package/lib/Socket/username.js +159 -0
  100. package/lib/Store/index.d.ts +3 -0
  101. package/lib/Store/index.js +3 -0
  102. package/lib/Store/make-in-memory-store.d.ts +62 -0
  103. package/lib/Store/make-in-memory-store.js +428 -0
  104. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  105. package/lib/Store/make-ordered-dictionary.js +78 -0
  106. package/lib/Store/object-repository.d.ts +10 -0
  107. package/lib/Store/object-repository.js +23 -0
  108. package/lib/Types/Auth.d.ts +117 -0
  109. package/lib/Types/Auth.js +1 -0
  110. package/lib/Types/Bussines.d.ts +25 -0
  111. package/lib/Types/Call.d.ts +15 -0
  112. package/lib/Types/Call.js +1 -0
  113. package/lib/Types/Chat.d.ts +124 -0
  114. package/lib/Types/Chat.js +7 -0
  115. package/lib/Types/Contact.d.ts +26 -0
  116. package/lib/Types/Contact.js +1 -0
  117. package/lib/Types/Events.d.ts +256 -0
  118. package/lib/Types/Events.js +1 -0
  119. package/lib/Types/GroupMetadata.d.ts +71 -0
  120. package/lib/Types/GroupMetadata.js +1 -0
  121. package/lib/Types/Label.d.ts +5 -0
  122. package/lib/Types/Label.js +24 -0
  123. package/lib/Types/LabelAssociation.d.ts +6 -0
  124. package/lib/Types/LabelAssociation.js +6 -0
  125. package/lib/Types/Message.d.ts +62 -0
  126. package/lib/Types/Message.js +17 -0
  127. package/lib/Types/Mex.d.ts +2 -0
  128. package/lib/Types/Mex.js +38 -0
  129. package/lib/Types/Product.d.ts +79 -0
  130. package/lib/Types/Product.js +1 -0
  131. package/lib/Types/RichType.d.ts +2 -0
  132. package/lib/Types/RichType.js +22 -0
  133. package/lib/Types/Signal.d.ts +87 -0
  134. package/lib/Types/Signal.js +1 -0
  135. package/lib/Types/Socket.d.ts +138 -0
  136. package/lib/Types/Socket.js +1 -0
  137. package/lib/Types/State.d.ts +8 -0
  138. package/lib/Types/State.js +55 -0
  139. package/lib/Types/USync.d.ts +26 -0
  140. package/lib/Types/index.d.ts +68 -0
  141. package/lib/Types/index.js +27 -0
  142. package/lib/Utils/MessageBuilder.d.ts +2 -0
  143. package/lib/Utils/MessageBuilder.js +2 -0
  144. package/lib/Utils/PersistentStore.d.ts +60 -0
  145. package/lib/Utils/PersistentStore.js +592 -0
  146. package/lib/Utils/anti-delete.d.ts +74 -0
  147. package/lib/Utils/anti-delete.js +221 -0
  148. package/lib/Utils/auth-secure.d.ts +86 -0
  149. package/lib/Utils/auth-secure.js +764 -0
  150. package/lib/Utils/auth-utils.d.ts +57 -0
  151. package/lib/Utils/auth-utils.js +306 -0
  152. package/lib/Utils/auto-reply.d.ts +47 -0
  153. package/lib/Utils/auto-reply.js +157 -0
  154. package/lib/Utils/baileys-event-stream.d.ts +8 -0
  155. package/lib/Utils/baileys-event-stream.js +62 -0
  156. package/lib/Utils/browser-utils.d.ts +8 -0
  157. package/lib/Utils/browser-utils.js +27 -0
  158. package/lib/Utils/business.d.ts +49 -0
  159. package/lib/Utils/business.js +239 -0
  160. package/lib/Utils/button-helper-utils.d.ts +53 -0
  161. package/lib/Utils/button-helper-utils.js +312 -0
  162. package/lib/Utils/button-sender.d.ts +54 -0
  163. package/lib/Utils/button-sender.js +822 -0
  164. package/lib/Utils/chat-control.d.ts +159 -0
  165. package/lib/Utils/chat-control.js +230 -0
  166. package/lib/Utils/chat-history-helpers.d.ts +21 -0
  167. package/lib/Utils/chat-history-helpers.js +70 -0
  168. package/lib/Utils/chat-utils.d.ts +407 -0
  169. package/lib/Utils/chat-utils.js +885 -0
  170. package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
  171. package/lib/Utils/companion-reg-client-utils.js +39 -0
  172. package/lib/Utils/crypto.d.ts +41 -0
  173. package/lib/Utils/crypto.js +147 -0
  174. package/lib/Utils/decode-wa-message.d.ts +83 -0
  175. package/lib/Utils/decode-wa-message.js +316 -0
  176. package/lib/Utils/event-buffer.d.ts +12 -0
  177. package/lib/Utils/event-buffer.js +635 -0
  178. package/lib/Utils/generics.d.ts +69 -0
  179. package/lib/Utils/generics.js +438 -0
  180. package/lib/Utils/history-share.d.ts +11 -0
  181. package/lib/Utils/history-share.js +70 -0
  182. package/lib/Utils/history.d.ts +90 -0
  183. package/lib/Utils/history.js +146 -0
  184. package/lib/Utils/humanizer.d.ts +12 -0
  185. package/lib/Utils/humanizer.js +73 -0
  186. package/lib/Utils/identity-change-handler.d.ts +13 -0
  187. package/lib/Utils/identity-change-handler.js +49 -0
  188. package/lib/Utils/index.d.ts +57 -0
  189. package/lib/Utils/index.js +56 -0
  190. package/lib/Utils/jid-tools.d.ts +6 -0
  191. package/lib/Utils/jid-tools.js +77 -0
  192. package/lib/Utils/link-preview.d.ts +12 -0
  193. package/lib/Utils/link-preview.js +84 -0
  194. package/lib/Utils/logger.d.ts +4 -0
  195. package/lib/Utils/logger.js +2 -0
  196. package/lib/Utils/lt-hash.d.ts +12 -0
  197. package/lib/Utils/lt-hash.js +26 -0
  198. package/lib/Utils/make-mutex.d.ts +6 -0
  199. package/lib/Utils/make-mutex.js +32 -0
  200. package/lib/Utils/media-messages.d.ts +18 -0
  201. package/lib/Utils/media-messages.js +70 -0
  202. package/lib/Utils/media-set.d.ts +13 -0
  203. package/lib/Utils/media-set.js +171 -0
  204. package/lib/Utils/message-kind.d.ts +32 -0
  205. package/lib/Utils/message-kind.js +136 -0
  206. package/lib/Utils/message-retry-manager.d.ts +79 -0
  207. package/lib/Utils/message-retry-manager.js +264 -0
  208. package/lib/Utils/message-search.d.ts +44 -0
  209. package/lib/Utils/message-search.js +188 -0
  210. package/lib/Utils/messages-media.d.ts +135 -0
  211. package/lib/Utils/messages-media.js +868 -0
  212. package/lib/Utils/messages.d.ts +44 -0
  213. package/lib/Utils/messages.js +2326 -0
  214. package/lib/Utils/meta-ai.d.ts +13 -0
  215. package/lib/Utils/meta-ai.js +74 -0
  216. package/lib/Utils/mini-app.d.ts +35 -0
  217. package/lib/Utils/mini-app.js +213 -0
  218. package/lib/Utils/noise-handler.d.ts +20 -0
  219. package/lib/Utils/noise-handler.js +200 -0
  220. package/lib/Utils/offline-node-processor.d.ts +9 -0
  221. package/lib/Utils/offline-node-processor.js +39 -0
  222. package/lib/Utils/past-participants.d.ts +14 -0
  223. package/lib/Utils/past-participants.js +40 -0
  224. package/lib/Utils/pre-key-manager.d.ts +25 -0
  225. package/lib/Utils/pre-key-manager.js +105 -0
  226. package/lib/Utils/process-message.d.ts +82 -0
  227. package/lib/Utils/process-message.js +808 -0
  228. package/lib/Utils/qr-render.d.ts +59 -0
  229. package/lib/Utils/qr-render.js +179 -0
  230. package/lib/Utils/qrcodegen.d.ts +79 -0
  231. package/lib/Utils/qrcodegen.js +848 -0
  232. package/lib/Utils/reporting-utils.d.ts +12 -0
  233. package/lib/Utils/reporting-utils.js +257 -0
  234. package/lib/Utils/rich-message-utils.d.ts +48 -0
  235. package/lib/Utils/rich-message-utils.js +444 -0
  236. package/lib/Utils/router.d.ts +37 -0
  237. package/lib/Utils/router.js +165 -0
  238. package/lib/Utils/scheduled-posts.d.ts +30 -0
  239. package/lib/Utils/scheduled-posts.js +110 -0
  240. package/lib/Utils/scheduling.d.ts +42 -0
  241. package/lib/Utils/scheduling.js +139 -0
  242. package/lib/Utils/signal.d.ts +82 -0
  243. package/lib/Utils/signal.js +200 -0
  244. package/lib/Utils/stanza-ack.d.ts +16 -0
  245. package/lib/Utils/stanza-ack.js +37 -0
  246. package/lib/Utils/status.d.ts +50 -0
  247. package/lib/Utils/status.js +107 -0
  248. package/lib/Utils/stickerpack.d.ts +51 -0
  249. package/lib/Utils/stickerpack.js +274 -0
  250. package/lib/Utils/sync-action-utils.d.ts +2 -0
  251. package/lib/Utils/sync-action-utils.js +48 -0
  252. package/lib/Utils/tag.d.ts +12 -0
  253. package/lib/Utils/tag.js +44 -0
  254. package/lib/Utils/tc-token-utils.d.ts +29 -0
  255. package/lib/Utils/tc-token-utils.js +162 -0
  256. package/lib/Utils/templates.d.ts +76 -0
  257. package/lib/Utils/templates.js +150 -0
  258. package/lib/Utils/transcribe.d.ts +12 -0
  259. package/lib/Utils/transcribe.js +107 -0
  260. package/lib/Utils/use-cache-manager-auth-state.d.ts +13 -0
  261. package/lib/Utils/use-cache-manager-auth-state.js +81 -0
  262. package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
  263. package/lib/Utils/use-multi-file-auth-state.js +166 -0
  264. package/lib/Utils/use-single-file-auth-state.d.ts +10 -0
  265. package/lib/Utils/use-single-file-auth-state.js +113 -0
  266. package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
  267. package/lib/Utils/use-sqlite-auth-state.js +169 -0
  268. package/lib/Utils/validate-connection.d.ts +42 -0
  269. package/lib/Utils/validate-connection.js +198 -0
  270. package/lib/Utils/vcard.d.ts +58 -0
  271. package/lib/Utils/vcard.js +104 -0
  272. package/lib/Utils/voice-note.d.ts +15 -0
  273. package/lib/Utils/voice-note.js +63 -0
  274. package/lib/VoIP/audio-feeder.d.ts +18 -0
  275. package/lib/VoIP/audio-feeder.js +160 -0
  276. package/lib/VoIP/call-recorder.d.ts +13 -0
  277. package/lib/VoIP/call-recorder.js +73 -0
  278. package/lib/VoIP/index.d.ts +86 -0
  279. package/lib/VoIP/index.js +611 -0
  280. package/lib/VoIP/relay-transport.d.ts +43 -0
  281. package/lib/VoIP/relay-transport.js +563 -0
  282. package/lib/VoIP/signaling.d.ts +26 -0
  283. package/lib/VoIP/signaling.js +662 -0
  284. package/lib/VoIP/types.d.ts +69 -0
  285. package/lib/VoIP/types.js +17 -0
  286. package/lib/VoIP/wasm-engine.d.ts +120 -0
  287. package/lib/VoIP/wasm-engine.js +1358 -0
  288. package/lib/VoIP/worker-bootstrap.d.ts +4 -0
  289. package/lib/VoIP/worker-bootstrap.js +1046 -0
  290. package/lib/WABinary/constants.d.ts +61 -0
  291. package/lib/WABinary/constants.js +1466 -0
  292. package/lib/WABinary/decode.d.ts +9 -0
  293. package/lib/WABinary/decode.js +261 -0
  294. package/lib/WABinary/encode.d.ts +2 -0
  295. package/lib/WABinary/encode.js +219 -0
  296. package/lib/WABinary/generic-utils.d.ts +74 -0
  297. package/lib/WABinary/generic-utils.js +276 -0
  298. package/lib/WABinary/index.d.ts +5 -0
  299. package/lib/WABinary/index.js +5 -0
  300. package/lib/WABinary/jid-utils.d.ts +28 -0
  301. package/lib/WABinary/jid-utils.js +95 -0
  302. package/lib/WABinary/types.d.ts +19 -0
  303. package/lib/WABinary/types.js +1 -0
  304. package/lib/WAM/BinaryInfo.d.ts +7 -0
  305. package/lib/WAM/BinaryInfo.js +9 -0
  306. package/lib/WAM/constants.d.ts +34926 -0
  307. package/lib/WAM/constants.js +22852 -0
  308. package/lib/WAM/encode.d.ts +1 -0
  309. package/lib/WAM/encode.js +149 -0
  310. package/lib/WAM/index.d.ts +3 -0
  311. package/lib/WAM/index.js +3 -0
  312. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
  313. package/lib/WAUSync/Protocols/USyncContactProtocol.js +51 -0
  314. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +29 -0
  315. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +62 -0
  316. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  317. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
  318. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  319. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
  320. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
  321. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
  322. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
  323. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
  324. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
  325. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
  326. package/lib/WAUSync/Protocols/index.d.ts +7 -0
  327. package/lib/WAUSync/Protocols/index.js +7 -0
  328. package/lib/WAUSync/USyncQuery.d.ts +20 -0
  329. package/lib/WAUSync/USyncQuery.js +121 -0
  330. package/lib/WAUSync/USyncUser.d.ts +16 -0
  331. package/lib/WAUSync/USyncUser.js +30 -0
  332. package/lib/WAUSync/index.d.ts +3 -0
  333. package/lib/WAUSync/index.js +3 -0
  334. package/lib/assets/wasm/loader.d.ts +5 -0
  335. package/lib/assets/wasm/loader.js +5 -0
  336. package/lib/assets/wasm/whatsapp.wasm +0 -0
  337. package/lib/assets/wasm/worker-modules.d.ts +5 -0
  338. package/lib/assets/wasm/worker-modules.js +273 -0
  339. package/lib/index.d.ts +18 -0
  340. package/lib/index.js +23 -0
  341. package/package.json +180 -0
  342. package/postinstall-banner.js +82 -0
@@ -0,0 +1,264 @@
1
+ import { LRUCache } from 'lru-cache';
2
+ /** Number of sent messages to cache in memory for handling retry receipts */
3
+ const RECENT_MESSAGES_SIZE = 1024;
4
+ const MESSAGE_KEY_SEPARATOR = '\u0000';
5
+ /** Timeout for session recreation - 1 hour */
6
+ const RECREATE_SESSION_TIMEOUT = 60 * 60 * 1000; // 1 hour in milliseconds
7
+ const PHONE_REQUEST_DELAY = 3000;
8
+ // Retry reason codes matching WhatsApp Web's Signal error codes.
9
+ export var RetryReason;
10
+ (function (RetryReason) {
11
+ RetryReason[RetryReason["UnknownError"] = 0] = "UnknownError";
12
+ RetryReason[RetryReason["SignalErrorNoSession"] = 1] = "SignalErrorNoSession";
13
+ RetryReason[RetryReason["SignalErrorInvalidKey"] = 2] = "SignalErrorInvalidKey";
14
+ RetryReason[RetryReason["SignalErrorInvalidKeyId"] = 3] = "SignalErrorInvalidKeyId";
15
+ /** MAC verification failed - most common cause of decryption failures */
16
+ RetryReason[RetryReason["SignalErrorInvalidMessage"] = 4] = "SignalErrorInvalidMessage";
17
+ RetryReason[RetryReason["SignalErrorInvalidSignature"] = 5] = "SignalErrorInvalidSignature";
18
+ RetryReason[RetryReason["SignalErrorFutureMessage"] = 6] = "SignalErrorFutureMessage";
19
+ /** Explicit MAC failure - session is definitely out of sync */
20
+ RetryReason[RetryReason["SignalErrorBadMac"] = 7] = "SignalErrorBadMac";
21
+ RetryReason[RetryReason["SignalErrorInvalidSession"] = 8] = "SignalErrorInvalidSession";
22
+ RetryReason[RetryReason["SignalErrorInvalidMsgKey"] = 9] = "SignalErrorInvalidMsgKey";
23
+ RetryReason[RetryReason["BadBroadcastEphemeralSetting"] = 10] = "BadBroadcastEphemeralSetting";
24
+ RetryReason[RetryReason["UnknownCompanionNoPrekey"] = 11] = "UnknownCompanionNoPrekey";
25
+ RetryReason[RetryReason["AdvFailure"] = 12] = "AdvFailure";
26
+ RetryReason[RetryReason["StatusRevokeDelay"] = 13] = "StatusRevokeDelay";
27
+ })(RetryReason || (RetryReason = {}));
28
+ /** Error codes that indicate a MAC failure and require immediate session recreation */
29
+ const MAC_ERROR_CODES = new Set([RetryReason.SignalErrorInvalidMessage, RetryReason.SignalErrorBadMac]);
30
+ export class MessageRetryManager {
31
+ constructor(logger, maxMsgRetryCount) {
32
+ this.logger = logger;
33
+ this.recentMessagesMap = new LRUCache({
34
+ max: RECENT_MESSAGES_SIZE,
35
+ ttl: 5 * 60 * 1000,
36
+ ttlAutopurge: true,
37
+ dispose: (_value, key) => {
38
+ const separatorIndex = key.lastIndexOf(MESSAGE_KEY_SEPARATOR);
39
+ if (separatorIndex > -1) {
40
+ const messageId = key.slice(separatorIndex + MESSAGE_KEY_SEPARATOR.length);
41
+ this.messageKeyIndex.delete(messageId);
42
+ }
43
+ }
44
+ });
45
+ this.messageKeyIndex = new Map();
46
+ this.sessionRecreateHistory = new LRUCache({
47
+ ttl: RECREATE_SESSION_TIMEOUT * 2,
48
+ ttlAutopurge: true
49
+ });
50
+ this.retryCounters = new LRUCache({
51
+ ttl: 15 * 60 * 1000,
52
+ ttlAutopurge: true,
53
+ updateAgeOnGet: true
54
+ }); // 15 minutes TTL
55
+ this.baseKeys = new LRUCache({
56
+ max: 1024,
57
+ ttl: 15 * 60 * 1000,
58
+ ttlAutopurge: true
59
+ });
60
+ this.pendingPhoneRequests = {};
61
+ this.maxMsgRetryCount = 5;
62
+ this.statistics = {
63
+ totalRetries: 0,
64
+ successfulRetries: 0,
65
+ failedRetries: 0,
66
+ mediaRetries: 0,
67
+ sessionRecreations: 0,
68
+ phoneRequests: 0
69
+ };
70
+ this.maxMsgRetryCount = maxMsgRetryCount;
71
+ }
72
+ /**
73
+ * Add a recent message to the cache for retry handling
74
+ */
75
+ addRecentMessage(to, id, message) {
76
+ const key = { to, id };
77
+ const keyStr = this.keyToString(key);
78
+ // Add new message
79
+ this.recentMessagesMap.set(keyStr, {
80
+ message,
81
+ timestamp: Date.now()
82
+ });
83
+ this.messageKeyIndex.set(id, keyStr);
84
+ this.logger.debug(`Added message to retry cache: ${to}/${id}`);
85
+ }
86
+ /**
87
+ * Get a recent message from the cache
88
+ */
89
+ getRecentMessage(to, id) {
90
+ const key = { to, id };
91
+ const keyStr = this.keyToString(key);
92
+ return this.recentMessagesMap.get(keyStr);
93
+ }
94
+ /**
95
+ * Check if a session should be recreated based on retry count, history, and error code.
96
+ * MAC errors (codes 4 and 7) trigger immediate session recreation regardless of timeout.
97
+ */
98
+ shouldRecreateSession(jid, hasSession, errorCode) {
99
+ // If we don't have a session, always recreate
100
+ if (!hasSession) {
101
+ this.sessionRecreateHistory.set(jid, Date.now());
102
+ this.statistics.sessionRecreations++;
103
+ return {
104
+ reason: "we don't have a Signal session with them",
105
+ recreate: true
106
+ };
107
+ }
108
+ // IMMEDIATE recreation for MAC errors - session is definitely out of sync
109
+ if (errorCode !== undefined && MAC_ERROR_CODES.has(errorCode)) {
110
+ this.sessionRecreateHistory.set(jid, Date.now());
111
+ this.statistics.sessionRecreations++;
112
+ this.logger.warn({ jid, errorCode: RetryReason[errorCode] }, 'MAC error detected, forcing immediate session recreation');
113
+ return {
114
+ reason: `MAC error (code ${errorCode}: ${RetryReason[errorCode]}), immediate session recreation`,
115
+ recreate: true
116
+ };
117
+ }
118
+ const now = Date.now();
119
+ const prevTime = this.sessionRecreateHistory.get(jid);
120
+ // If no previous recreation or it's been more than an hour
121
+ if (!prevTime || now - prevTime > RECREATE_SESSION_TIMEOUT) {
122
+ this.sessionRecreateHistory.set(jid, now);
123
+ this.statistics.sessionRecreations++;
124
+ return {
125
+ reason: 'retry count > 1 and over an hour since last recreation',
126
+ recreate: true
127
+ };
128
+ }
129
+ return { reason: '', recreate: false };
130
+ }
131
+ /**
132
+ * Parse error code from retry receipt's retry node.
133
+ * Returns undefined if no error code is present.
134
+ */
135
+ parseRetryErrorCode(errorAttr) {
136
+ if (errorAttr === undefined || errorAttr === '') {
137
+ return undefined;
138
+ }
139
+ const code = parseInt(errorAttr, 10);
140
+ if (Number.isNaN(code)) {
141
+ return undefined;
142
+ }
143
+ // Validate it's a known RetryReason
144
+ if (code >= RetryReason.UnknownError && code <= RetryReason.StatusRevokeDelay) {
145
+ return code;
146
+ }
147
+ return RetryReason.UnknownError;
148
+ }
149
+ /**
150
+ * Check if an error code indicates a MAC failure
151
+ */
152
+ isMacError(errorCode) {
153
+ return errorCode !== undefined && MAC_ERROR_CODES.has(errorCode);
154
+ }
155
+ /**
156
+ * Increment retry counter for a message
157
+ */
158
+ incrementRetryCount(messageId) {
159
+ this.retryCounters.set(messageId, (this.retryCounters.get(messageId) || 0) + 1);
160
+ this.statistics.totalRetries++;
161
+ return this.retryCounters.get(messageId);
162
+ }
163
+ /**
164
+ * Get retry count for a message
165
+ */
166
+ getRetryCount(messageId) {
167
+ return this.retryCounters.get(messageId) || 0;
168
+ }
169
+ /**
170
+ * Check if message has exceeded maximum retry attempts
171
+ */
172
+ hasExceededMaxRetries(messageId) {
173
+ return this.getRetryCount(messageId) >= this.maxMsgRetryCount;
174
+ }
175
+ /**
176
+ * Mark retry as successful
177
+ */
178
+ markRetrySuccess(messageId) {
179
+ this.statistics.successfulRetries++;
180
+ // Clean up retry counter for successful message
181
+ this.retryCounters.delete(messageId);
182
+ this.cancelPendingPhoneRequest(messageId);
183
+ this.removeRecentMessage(messageId);
184
+ }
185
+ /**
186
+ * Mark retry as failed
187
+ */
188
+ markRetryFailed(messageId) {
189
+ this.statistics.failedRetries++;
190
+ this.retryCounters.delete(messageId);
191
+ this.cancelPendingPhoneRequest(messageId);
192
+ this.removeRecentMessage(messageId);
193
+ }
194
+ /**
195
+ * Schedule a phone request with delay
196
+ */
197
+ schedulePhoneRequest(messageId, callback, delay = PHONE_REQUEST_DELAY) {
198
+ // Cancel any existing request for this message
199
+ this.cancelPendingPhoneRequest(messageId);
200
+ this.pendingPhoneRequests[messageId] = setTimeout(() => {
201
+ delete this.pendingPhoneRequests[messageId];
202
+ this.statistics.phoneRequests++;
203
+ callback();
204
+ }, delay);
205
+ this.logger.debug(`Scheduled phone request for message ${messageId} with ${delay}ms delay`);
206
+ }
207
+ /**
208
+ * Cancel pending phone request
209
+ */
210
+ cancelPendingPhoneRequest(messageId) {
211
+ const timeout = this.pendingPhoneRequests[messageId];
212
+ if (timeout) {
213
+ clearTimeout(timeout);
214
+ delete this.pendingPhoneRequests[messageId];
215
+ this.logger.debug(`Cancelled pending phone request for message ${messageId}`);
216
+ }
217
+ }
218
+ clear() {
219
+ this.recentMessagesMap.clear();
220
+ this.messageKeyIndex.clear();
221
+ this.sessionRecreateHistory.clear();
222
+ this.retryCounters.clear();
223
+ this.baseKeys.clear();
224
+ for (const messageId of Object.keys(this.pendingPhoneRequests)) {
225
+ this.cancelPendingPhoneRequest(messageId);
226
+ }
227
+ this.statistics = {
228
+ totalRetries: 0,
229
+ successfulRetries: 0,
230
+ failedRetries: 0,
231
+ mediaRetries: 0,
232
+ sessionRecreations: 0,
233
+ phoneRequests: 0
234
+ };
235
+ }
236
+ saveBaseKey(addr, msgId, baseKey) {
237
+ this.baseKeys.set(`${addr}:${msgId}`, baseKey);
238
+ }
239
+ hasSameBaseKey(addr, msgId, baseKey) {
240
+ const stored = this.baseKeys.get(`${addr}:${msgId}`);
241
+ if (!stored || stored.length !== baseKey.length) {
242
+ return false;
243
+ }
244
+ for (let i = 0; i < stored.length; i++) {
245
+ if (stored[i] !== baseKey[i])
246
+ return false;
247
+ }
248
+ return true;
249
+ }
250
+ deleteBaseKey(addr, msgId) {
251
+ this.baseKeys.delete(`${addr}:${msgId}`);
252
+ }
253
+ keyToString(key) {
254
+ return `${key.to}${MESSAGE_KEY_SEPARATOR}${key.id}`;
255
+ }
256
+ removeRecentMessage(messageId) {
257
+ const keyStr = this.messageKeyIndex.get(messageId);
258
+ if (!keyStr) {
259
+ return;
260
+ }
261
+ this.recentMessagesMap.delete(keyStr);
262
+ this.messageKeyIndex.delete(messageId);
263
+ }
264
+ }
@@ -0,0 +1,44 @@
1
+ import type { WAMessage } from '../Types/index.js';
2
+ export type SearchMessageType = 'text' | 'image' | 'video' | 'document' | 'audio' | 'sticker' | 'location' | 'contact' | 'other';
3
+ export interface SearchOptions {
4
+ jid?: string;
5
+ fromDate?: Date;
6
+ toDate?: Date;
7
+ fromSender?: string;
8
+ fromMe?: boolean;
9
+ messageTypes?: SearchMessageType[];
10
+ limit?: number;
11
+ caseSensitive?: boolean;
12
+ }
13
+ export interface SearchResult {
14
+ message: WAMessage;
15
+ matchedText: string;
16
+ matchPosition: number;
17
+ relevanceScore: number;
18
+ }
19
+ export interface RegexSearchOptions {
20
+ jid?: string;
21
+ fromSender?: string;
22
+ fromMe?: boolean;
23
+ messageTypes?: SearchMessageType[];
24
+ limit?: number;
25
+ }
26
+ export declare const extractMessageText: (message: WAMessage) => string;
27
+ export declare const calculateRelevance: (query: string, text: string, position: number) => number;
28
+ export declare const searchMessages: (messages: WAMessage[], query: string, options?: SearchOptions) => SearchResult[];
29
+ export declare const searchMessagesRegex: (messages: WAMessage[], pattern: RegExp, options?: RegexSearchOptions) => SearchResult[];
30
+ export declare class MessageSearchManager {
31
+ private messages;
32
+ private messageIndex;
33
+ addMessages(messages: WAMessage[]): void;
34
+ removeMessages(messageIds: string[]): void;
35
+ clear(): void;
36
+ get count(): number;
37
+ search(query: string, options?: SearchOptions): SearchResult[];
38
+ searchRegex(pattern: RegExp, options?: RegexSearchOptions): SearchResult[];
39
+ getByJid(jid: string): WAMessage[];
40
+ getBySender(sender: string): WAMessage[];
41
+ getByType(type: SearchMessageType): WAMessage[];
42
+ getById(id: string): WAMessage | undefined;
43
+ }
44
+ export declare const createMessageSearch: () => MessageSearchManager;
@@ -0,0 +1,188 @@
1
+ // JAP@Add --- part of the @japofc/baileys utils (message-search.ts) (type-only
2
+ // annotations dropped; behavior unchanged).
3
+ // JAP@Fix (bug 58): peel off ephemeral / view-once wrappers so search still
4
+ // indexes text from disappearing-message chats instead of always seeing '{}'.
5
+ const unwrapMessage = (content) => {
6
+ let c = content;
7
+ while (c && (c.ephemeralMessage || c.viewOnceMessage || c.viewOnceMessageV2 || c.viewOnceMessageV2Extension || c.documentWithCaptionMessage)) {
8
+ c = c.ephemeralMessage?.message ||
9
+ c.viewOnceMessage?.message ||
10
+ c.viewOnceMessageV2?.message ||
11
+ c.viewOnceMessageV2Extension?.message ||
12
+ c.documentWithCaptionMessage?.message;
13
+ }
14
+ return c;
15
+ };
16
+ export const extractMessageText = (message) => {
17
+ const c = unwrapMessage(message.message);
18
+ if (!c)
19
+ return '';
20
+ if (c.conversation)
21
+ return c.conversation;
22
+ if (c.extendedTextMessage?.text)
23
+ return c.extendedTextMessage.text;
24
+ if (c.imageMessage?.caption)
25
+ return c.imageMessage.caption;
26
+ if (c.videoMessage?.caption)
27
+ return c.videoMessage.caption;
28
+ if (c.documentMessage?.caption)
29
+ return c.documentMessage.caption;
30
+ if (c.documentMessage?.fileName)
31
+ return c.documentMessage.fileName;
32
+ if (c.locationMessage?.name)
33
+ return c.locationMessage.name;
34
+ if (c.locationMessage?.address)
35
+ return c.locationMessage.address;
36
+ if (c.contactMessage?.displayName)
37
+ return c.contactMessage.displayName;
38
+ if (c.pollCreationMessage?.name)
39
+ return c.pollCreationMessage.name;
40
+ return '';
41
+ };
42
+ const getMessageType = (message) => {
43
+ const c = unwrapMessage(message.message);
44
+ if (!c)
45
+ return 'other';
46
+ if (c.conversation || c.extendedTextMessage)
47
+ return 'text';
48
+ if (c.imageMessage)
49
+ return 'image';
50
+ if (c.videoMessage)
51
+ return 'video';
52
+ if (c.documentMessage)
53
+ return 'document';
54
+ if (c.audioMessage)
55
+ return 'audio';
56
+ if (c.stickerMessage)
57
+ return 'sticker';
58
+ if (c.locationMessage || c.liveLocationMessage)
59
+ return 'location';
60
+ if (c.contactMessage || c.contactsArrayMessage)
61
+ return 'contact';
62
+ return 'other';
63
+ };
64
+ export const calculateRelevance = (query, text, position) => {
65
+ let score = 100;
66
+ if (text.toLowerCase() === query.toLowerCase())
67
+ score += 50;
68
+ score -= Math.min(position / 10, 20);
69
+ const lt = text.toLowerCase(), lq = query.toLowerCase();
70
+ if (position === 0 ||
71
+ lt[position - 1] === ' ' ||
72
+ lt[position + lq.length] === ' ' ||
73
+ position + lq.length === text.length)
74
+ score += 20;
75
+ return Math.max(score, 0);
76
+ };
77
+ /** Plain-text substring search with relevance-sorted results. */
78
+ export const searchMessages = (messages, query, options = {}) => {
79
+ const results = [];
80
+ const sq = options.caseSensitive ? query : query.toLowerCase();
81
+ for (const message of messages) {
82
+ if (options.jid && message.key.remoteJid !== options.jid)
83
+ continue;
84
+ const ts = message.messageTimestamp;
85
+ const mt = ts ? new Date((typeof ts === 'number' ? ts : Number(ts)) * 1000) : null;
86
+ if (options.fromDate && mt && mt < options.fromDate)
87
+ continue;
88
+ if (options.toDate && mt && mt > options.toDate)
89
+ continue;
90
+ if (options.fromSender && message.key.participant !== options.fromSender)
91
+ continue;
92
+ if (options.fromMe !== undefined && message.key.fromMe !== options.fromMe)
93
+ continue;
94
+ if (options.messageTypes?.length) {
95
+ if (!options.messageTypes.includes(getMessageType(message)))
96
+ continue;
97
+ }
98
+ const text = extractMessageText(message);
99
+ if (!text)
100
+ continue;
101
+ const st = options.caseSensitive ? text : text.toLowerCase();
102
+ const pos = st.indexOf(sq);
103
+ if (pos !== -1) {
104
+ results.push({
105
+ message,
106
+ matchedText: text.substring(Math.max(0, pos - 20), Math.min(text.length, pos + query.length + 20)),
107
+ matchPosition: pos,
108
+ relevanceScore: calculateRelevance(query, text, pos)
109
+ });
110
+ }
111
+ // JAP@Fix (bug 59): limit used to break the scan loop *before* sorting,
112
+ // so it kept the first N matches in document order and could drop
113
+ // higher-relevance matches found later. Sort first, then slice.
114
+ }
115
+ results.sort((a, b) => b.relevanceScore - a.relevanceScore);
116
+ return options.limit ? results.slice(0, options.limit) : results;
117
+ };
118
+ /** Regex-based search (e.g. for commands/patterns), unordered by relevance. */
119
+ export const searchMessagesRegex = (messages, pattern, options = {}) => {
120
+ const results = [];
121
+ for (const message of messages) {
122
+ if (options.jid && message.key.remoteJid !== options.jid)
123
+ continue;
124
+ if (options.fromSender && message.key.participant !== options.fromSender)
125
+ continue;
126
+ if (options.fromMe !== undefined && message.key.fromMe !== options.fromMe)
127
+ continue;
128
+ if (options.messageTypes?.length) {
129
+ if (!options.messageTypes.includes(getMessageType(message)))
130
+ continue;
131
+ }
132
+ const text = extractMessageText(message);
133
+ if (!text)
134
+ continue;
135
+ const match = text.match(pattern);
136
+ if (match)
137
+ results.push({ message, matchedText: match[0], matchPosition: match.index ?? 0, relevanceScore: 100 });
138
+ if (options.limit && results.length >= options.limit)
139
+ break;
140
+ }
141
+ return results;
142
+ };
143
+ /** Standalone searchable index — feed it messages independently of the main Store. */
144
+ export class MessageSearchManager {
145
+ messages = [];
146
+ messageIndex = new Map();
147
+ addMessages(messages) {
148
+ for (const msg of messages) {
149
+ const id = msg.key.id;
150
+ if (id && !this.messageIndex.has(id)) {
151
+ this.messages.push(msg);
152
+ this.messageIndex.set(id, msg);
153
+ }
154
+ }
155
+ }
156
+ removeMessages(messageIds) {
157
+ const idSet = new Set(messageIds);
158
+ this.messages = this.messages.filter((m) => !idSet.has(m.key.id || ''));
159
+ for (const id of messageIds)
160
+ this.messageIndex.delete(id);
161
+ }
162
+ clear() {
163
+ this.messages = [];
164
+ this.messageIndex.clear();
165
+ }
166
+ get count() {
167
+ return this.messages.length;
168
+ }
169
+ search(query, options) {
170
+ return searchMessages(this.messages, query, options);
171
+ }
172
+ searchRegex(pattern, options) {
173
+ return searchMessagesRegex(this.messages, pattern, options);
174
+ }
175
+ getByJid(jid) {
176
+ return this.messages.filter((m) => m.key.remoteJid === jid);
177
+ }
178
+ getBySender(sender) {
179
+ return this.messages.filter((m) => m.key.participant === sender || m.key.remoteJid === sender);
180
+ }
181
+ getByType(type) {
182
+ return this.messages.filter((m) => getMessageType(m) === type);
183
+ }
184
+ getById(id) {
185
+ return this.messageIndex.get(id);
186
+ }
187
+ }
188
+ export const createMessageSearch = () => new MessageSearchManager();
@@ -0,0 +1,135 @@
1
+ /** generates all the keys required to encrypt/decrypt & sign a media message */
2
+ export function getMediaKeys(buffer: any, mediaType: any): Promise<{
3
+ iv: any;
4
+ cipherKey: any;
5
+ macKey: any;
6
+ }>;
7
+ export function getAudioDuration(buffer: any): Promise<any>;
8
+ /**
9
+ referenced from and modifying https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/prepareAudioWaveform.ts
10
+ */
11
+ export function getAudioWaveform(buffer: any, logger: any): Promise<Uint8Array<ArrayBuffer> | undefined>;
12
+ /** generates a thumbnail for a given media, if required */
13
+ export function generateThumbnail(file: any, mediaType: any, options: any): Promise<{
14
+ thumbnail: any;
15
+ originalImageDimensions: {
16
+ width: any;
17
+ height: any;
18
+ } | undefined;
19
+ }>;
20
+ export function extensionForMediaMessage(message: any): any;
21
+ export function getImageProcessingLibrary(): Promise<any>;
22
+ export function hkdfInfoKey(type: any): string;
23
+ export function getRawMediaUploadData(media: any, mediaType: any, logger: any): Promise<{
24
+ filePath: any;
25
+ fileSha256: any;
26
+ fileLength: number;
27
+ }>;
28
+ export function extractVideoThumb(path: any, time: any, size: any): Promise<any>;
29
+ export function extractImageThumb(bufferOrFilePath: any, width?: number): Promise<{
30
+ buffer: any;
31
+ original: {
32
+ width: any;
33
+ height: any;
34
+ };
35
+ }>;
36
+ export function encodeBase64EncodedStringForUpload(b64: any): string;
37
+ export function generateProfilePicture(mediaUpload: any, dimensions: any): Promise<{
38
+ img: any;
39
+ }>;
40
+ export function mediaMessageSHA256B64(message: any): any;
41
+ export function toReadable(buffer: any): any;
42
+ export function toBuffer(stream: any): Promise<any>;
43
+ export function getStream(item: any, opts: any): Promise<{
44
+ stream: any;
45
+ type: string;
46
+ }>;
47
+ export function getHttpStream(url: any, options?: any): Promise<any>;
48
+ export function encryptedStream(media: any, mediaType: any, { logger, saveOriginalFileIfRequired, opts }?: any): Promise<{
49
+ mediaKey: any;
50
+ originalFilePath: any;
51
+ encFilePath: any;
52
+ mac: any;
53
+ fileEncSha256: any;
54
+ fileSha256: any;
55
+ fileLength: number;
56
+ }>;
57
+ export const DEF_MEDIA_HOST: "mmg.whatsapp.net";
58
+ export function getUrlFromDirectPath(directPath: any, host?: string): string;
59
+ export function downloadContentFromMessage({ mediaKey, directPath, url }: {
60
+ mediaKey: any;
61
+ directPath: any;
62
+ url: any;
63
+ }, type: any, opts?: any): Promise<any>;
64
+ export function downloadEncryptedContent(downloadUrl: any, { cipherKey, iv }: {
65
+ cipherKey: any;
66
+ iv: any;
67
+ }, { startByte, endByte, options }?: any): Promise<any>;
68
+ export function uploadWithNodeHttp({ url, filePath, headers, timeoutMs, agent }: {
69
+ url: any;
70
+ filePath: any;
71
+ headers: any;
72
+ timeoutMs: any;
73
+ agent: any;
74
+ }, redirectCount?: number): Promise<any>;
75
+ export function getWAUploadToServer({ customUploadHosts, fetchAgent, logger, options }: {
76
+ customUploadHosts: any;
77
+ fetchAgent: any;
78
+ logger: any;
79
+ options: any;
80
+ }, refreshMediaConn: any): (filePath: any, { mediaType, fileEncSha256B64, timeoutMs, newsletter }: {
81
+ mediaType: any;
82
+ fileEncSha256B64: any;
83
+ timeoutMs: any;
84
+ newsletter: any;
85
+ }) => Promise<{
86
+ mediaUrl: any;
87
+ directPath: any;
88
+ meta_hmac: any;
89
+ fbid: any;
90
+ ts: any;
91
+ thumbnailDirectPath: any;
92
+ thumbnailSha256: any;
93
+ }>;
94
+ export function encryptMediaRetryRequest(key: any, mediaKey: any, meId: any): {
95
+ tag: string;
96
+ attrs: {
97
+ id: any;
98
+ to: string;
99
+ type: string;
100
+ };
101
+ content: ({
102
+ tag: string;
103
+ attrs: {
104
+ jid?: undefined;
105
+ from_me?: undefined;
106
+ participant?: undefined;
107
+ };
108
+ content: {
109
+ tag: string;
110
+ attrs: {};
111
+ content: any;
112
+ }[];
113
+ } | {
114
+ tag: string;
115
+ attrs: {
116
+ jid: any;
117
+ from_me: string;
118
+ participant: any;
119
+ };
120
+ content?: undefined;
121
+ })[];
122
+ };
123
+ export function decodeMediaRetryNode(node: any): {
124
+ key: {
125
+ id: any;
126
+ remoteJid: any;
127
+ fromMe: boolean;
128
+ participant: any;
129
+ };
130
+ };
131
+ export function decryptMediaRetryData({ ciphertext, iv }: {
132
+ ciphertext: any;
133
+ iv: any;
134
+ }, mediaKey: any, msgId: any): any;
135
+ export function getStatusCodeForMediaRetry(code: any): number;