@qadeerxd/baileys 0.0.0-stage → 7.0.0-rc18

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 (413) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +554 -2
  3. package/WAProto/GenerateStatics.sh +3 -0
  4. package/WAProto/WAProto.proto +5479 -0
  5. package/WAProto/fix-imports.js +85 -0
  6. package/WAProto/index.d.ts +14017 -0
  7. package/WAProto/index.js +97691 -0
  8. package/engine-requirements.js +10 -0
  9. package/lib/Defaults/index.d.ts +78 -0
  10. package/lib/Defaults/index.d.ts.map +1 -0
  11. package/lib/Defaults/index.js +145 -0
  12. package/lib/Defaults/index.js.map +1 -0
  13. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  14. package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
  15. package/lib/Signal/Group/ciphertext-message.js +12 -0
  16. package/lib/Signal/Group/ciphertext-message.js.map +1 -0
  17. package/lib/Signal/Group/group-session-builder.d.ts +15 -0
  18. package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
  19. package/lib/Signal/Group/group-session-builder.js +30 -0
  20. package/lib/Signal/Group/group-session-builder.js.map +1 -0
  21. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  22. package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
  23. package/lib/Signal/Group/group_cipher.js +82 -0
  24. package/lib/Signal/Group/group_cipher.js.map +1 -0
  25. package/lib/Signal/Group/index.d.ts +12 -0
  26. package/lib/Signal/Group/index.d.ts.map +1 -0
  27. package/lib/Signal/Group/index.js +12 -0
  28. package/lib/Signal/Group/index.js.map +1 -0
  29. package/lib/Signal/Group/keyhelper.d.ts +11 -0
  30. package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
  31. package/lib/Signal/Group/keyhelper.js +18 -0
  32. package/lib/Signal/Group/keyhelper.js.map +1 -0
  33. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  34. package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
  35. package/lib/Signal/Group/sender-chain-key.js +26 -0
  36. package/lib/Signal/Group/sender-chain-key.js.map +1 -0
  37. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  38. package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
  39. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  40. package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
  41. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  42. package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
  43. package/lib/Signal/Group/sender-key-message.js +66 -0
  44. package/lib/Signal/Group/sender-key-message.js.map +1 -0
  45. package/lib/Signal/Group/sender-key-name.d.ts +18 -0
  46. package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
  47. package/lib/Signal/Group/sender-key-name.js +48 -0
  48. package/lib/Signal/Group/sender-key-name.js.map +1 -0
  49. package/lib/Signal/Group/sender-key-record.d.ts +31 -0
  50. package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
  51. package/lib/Signal/Group/sender-key-record.js +41 -0
  52. package/lib/Signal/Group/sender-key-record.js.map +1 -0
  53. package/lib/Signal/Group/sender-key-state.d.ts +39 -0
  54. package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
  55. package/lib/Signal/Group/sender-key-state.js +84 -0
  56. package/lib/Signal/Group/sender-key-state.js.map +1 -0
  57. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  58. package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
  59. package/lib/Signal/Group/sender-message-key.js +26 -0
  60. package/lib/Signal/Group/sender-message-key.js.map +1 -0
  61. package/lib/Signal/badmac-heal.d.ts +70 -0
  62. package/lib/Signal/badmac-heal.d.ts.map +1 -0
  63. package/lib/Signal/badmac-heal.js +92 -0
  64. package/lib/Signal/badmac-heal.js.map +1 -0
  65. package/lib/Signal/libsignal.d.ts +5 -0
  66. package/lib/Signal/libsignal.d.ts.map +1 -0
  67. package/lib/Signal/libsignal.js +501 -0
  68. package/lib/Signal/libsignal.js.map +1 -0
  69. package/lib/Signal/lid-mapping.d.ts +31 -0
  70. package/lib/Signal/lid-mapping.d.ts.map +1 -0
  71. package/lib/Signal/lid-mapping.js +290 -0
  72. package/lib/Signal/lid-mapping.js.map +1 -0
  73. package/lib/Socket/Client/index.d.ts +3 -0
  74. package/lib/Socket/Client/index.d.ts.map +1 -0
  75. package/lib/Socket/Client/index.js +3 -0
  76. package/lib/Socket/Client/index.js.map +1 -0
  77. package/lib/Socket/Client/types.d.ts +22 -0
  78. package/lib/Socket/Client/types.d.ts.map +1 -0
  79. package/lib/Socket/Client/types.js +19 -0
  80. package/lib/Socket/Client/types.js.map +1 -0
  81. package/lib/Socket/Client/websocket.d.ts +13 -0
  82. package/lib/Socket/Client/websocket.d.ts.map +1 -0
  83. package/lib/Socket/Client/websocket.js +61 -0
  84. package/lib/Socket/Client/websocket.js.map +1 -0
  85. package/lib/Socket/business.d.ts +219 -0
  86. package/lib/Socket/business.d.ts.map +1 -0
  87. package/lib/Socket/business.js +379 -0
  88. package/lib/Socket/business.js.map +1 -0
  89. package/lib/Socket/chats.d.ts +127 -0
  90. package/lib/Socket/chats.d.ts.map +1 -0
  91. package/lib/Socket/chats.js +1198 -0
  92. package/lib/Socket/chats.js.map +1 -0
  93. package/lib/Socket/communities.d.ts +275 -0
  94. package/lib/Socket/communities.d.ts.map +1 -0
  95. package/lib/Socket/communities.js +431 -0
  96. package/lib/Socket/communities.js.map +1 -0
  97. package/lib/Socket/groups.d.ts +163 -0
  98. package/lib/Socket/groups.d.ts.map +1 -0
  99. package/lib/Socket/groups.js +347 -0
  100. package/lib/Socket/groups.js.map +1 -0
  101. package/lib/Socket/index.d.ts +262 -0
  102. package/lib/Socket/index.d.ts.map +1 -0
  103. package/lib/Socket/index.js +12 -0
  104. package/lib/Socket/index.js.map +1 -0
  105. package/lib/Socket/messages-recv.d.ts +205 -0
  106. package/lib/Socket/messages-recv.d.ts.map +1 -0
  107. package/lib/Socket/messages-recv.js +1803 -0
  108. package/lib/Socket/messages-recv.js.map +1 -0
  109. package/lib/Socket/messages-send.d.ts +201 -0
  110. package/lib/Socket/messages-send.d.ts.map +1 -0
  111. package/lib/Socket/messages-send.js +1176 -0
  112. package/lib/Socket/messages-send.js.map +1 -0
  113. package/lib/Socket/mex.d.ts +3 -0
  114. package/lib/Socket/mex.d.ts.map +1 -0
  115. package/lib/Socket/mex.js +65 -0
  116. package/lib/Socket/mex.js.map +1 -0
  117. package/lib/Socket/newsletter.d.ts +172 -0
  118. package/lib/Socket/newsletter.d.ts.map +1 -0
  119. package/lib/Socket/newsletter.js +254 -0
  120. package/lib/Socket/newsletter.js.map +1 -0
  121. package/lib/Socket/socket.d.ts +63 -0
  122. package/lib/Socket/socket.d.ts.map +1 -0
  123. package/lib/Socket/socket.js +1036 -0
  124. package/lib/Socket/socket.js.map +1 -0
  125. package/lib/Store/make-in-memory-store.d.ts +71 -0
  126. package/lib/Store/make-in-memory-store.d.ts.map +1 -0
  127. package/lib/Store/make-in-memory-store.js +307 -0
  128. package/lib/Store/make-in-memory-store.js.map +1 -0
  129. package/lib/Types/Auth.d.ts +117 -0
  130. package/lib/Types/Auth.d.ts.map +1 -0
  131. package/lib/Types/Auth.js +2 -0
  132. package/lib/Types/Auth.js.map +1 -0
  133. package/lib/Types/Bussines.d.ts +25 -0
  134. package/lib/Types/Bussines.d.ts.map +1 -0
  135. package/lib/Types/Bussines.js +2 -0
  136. package/lib/Types/Bussines.js.map +1 -0
  137. package/lib/Types/Call.d.ts +15 -0
  138. package/lib/Types/Call.d.ts.map +1 -0
  139. package/lib/Types/Call.js +2 -0
  140. package/lib/Types/Call.js.map +1 -0
  141. package/lib/Types/Chat.d.ts +124 -0
  142. package/lib/Types/Chat.d.ts.map +1 -0
  143. package/lib/Types/Chat.js +8 -0
  144. package/lib/Types/Chat.js.map +1 -0
  145. package/lib/Types/Contact.d.ts +26 -0
  146. package/lib/Types/Contact.d.ts.map +1 -0
  147. package/lib/Types/Contact.js +2 -0
  148. package/lib/Types/Contact.js.map +1 -0
  149. package/lib/Types/Events.d.ts +256 -0
  150. package/lib/Types/Events.d.ts.map +1 -0
  151. package/lib/Types/Events.js +2 -0
  152. package/lib/Types/Events.js.map +1 -0
  153. package/lib/Types/GroupMetadata.d.ts +71 -0
  154. package/lib/Types/GroupMetadata.d.ts.map +1 -0
  155. package/lib/Types/GroupMetadata.js +2 -0
  156. package/lib/Types/GroupMetadata.js.map +1 -0
  157. package/lib/Types/Label.d.ts +47 -0
  158. package/lib/Types/Label.d.ts.map +1 -0
  159. package/lib/Types/Label.js +25 -0
  160. package/lib/Types/Label.js.map +1 -0
  161. package/lib/Types/LabelAssociation.d.ts +30 -0
  162. package/lib/Types/LabelAssociation.d.ts.map +1 -0
  163. package/lib/Types/LabelAssociation.js +7 -0
  164. package/lib/Types/LabelAssociation.js.map +1 -0
  165. package/lib/Types/Message.d.ts +430 -0
  166. package/lib/Types/Message.d.ts.map +1 -0
  167. package/lib/Types/Message.js +11 -0
  168. package/lib/Types/Message.js.map +1 -0
  169. package/lib/Types/Mex.d.ts +141 -0
  170. package/lib/Types/Mex.d.ts.map +1 -0
  171. package/lib/Types/Mex.js +37 -0
  172. package/lib/Types/Mex.js.map +1 -0
  173. package/lib/Types/Product.d.ts +79 -0
  174. package/lib/Types/Product.d.ts.map +1 -0
  175. package/lib/Types/Product.js +2 -0
  176. package/lib/Types/Product.js.map +1 -0
  177. package/lib/Types/Signal.d.ts +87 -0
  178. package/lib/Types/Signal.d.ts.map +1 -0
  179. package/lib/Types/Signal.js +2 -0
  180. package/lib/Types/Signal.js.map +1 -0
  181. package/lib/Types/Socket.d.ts +136 -0
  182. package/lib/Types/Socket.d.ts.map +1 -0
  183. package/lib/Types/Socket.js +3 -0
  184. package/lib/Types/Socket.js.map +1 -0
  185. package/lib/Types/State.d.ts +97 -0
  186. package/lib/Types/State.d.ts.map +1 -0
  187. package/lib/Types/State.js +56 -0
  188. package/lib/Types/State.js.map +1 -0
  189. package/lib/Types/USync.d.ts +26 -0
  190. package/lib/Types/USync.d.ts.map +1 -0
  191. package/lib/Types/USync.js +2 -0
  192. package/lib/Types/USync.js.map +1 -0
  193. package/lib/Types/index.d.ts +67 -0
  194. package/lib/Types/index.d.ts.map +1 -0
  195. package/lib/Types/index.js +26 -0
  196. package/lib/Types/index.js.map +1 -0
  197. package/lib/Utils/auth-utils.d.ts +24 -0
  198. package/lib/Utils/auth-utils.d.ts.map +1 -0
  199. package/lib/Utils/auth-utils.js +309 -0
  200. package/lib/Utils/auth-utils.js.map +1 -0
  201. package/lib/Utils/browser-utils.d.ts +4 -0
  202. package/lib/Utils/browser-utils.d.ts.map +1 -0
  203. package/lib/Utils/browser-utils.js +31 -0
  204. package/lib/Utils/browser-utils.js.map +1 -0
  205. package/lib/Utils/business.d.ts +23 -0
  206. package/lib/Utils/business.d.ts.map +1 -0
  207. package/lib/Utils/business.js +231 -0
  208. package/lib/Utils/business.js.map +1 -0
  209. package/lib/Utils/chat-utils.d.ts +100 -0
  210. package/lib/Utils/chat-utils.d.ts.map +1 -0
  211. package/lib/Utils/chat-utils.js +872 -0
  212. package/lib/Utils/chat-utils.js.map +1 -0
  213. package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
  214. package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
  215. package/lib/Utils/companion-reg-client-utils.js +42 -0
  216. package/lib/Utils/companion-reg-client-utils.js.map +1 -0
  217. package/lib/Utils/crypto.d.ts +37 -0
  218. package/lib/Utils/crypto.d.ts.map +1 -0
  219. package/lib/Utils/crypto.js +118 -0
  220. package/lib/Utils/crypto.js.map +1 -0
  221. package/lib/Utils/decode-wa-message.d.ts +66 -0
  222. package/lib/Utils/decode-wa-message.d.ts.map +1 -0
  223. package/lib/Utils/decode-wa-message.js +337 -0
  224. package/lib/Utils/decode-wa-message.js.map +1 -0
  225. package/lib/Utils/decrypt-message-edit.d.ts +13 -0
  226. package/lib/Utils/decrypt-message-edit.d.ts.map +1 -0
  227. package/lib/Utils/decrypt-message-edit.js +33 -0
  228. package/lib/Utils/decrypt-message-edit.js.map +1 -0
  229. package/lib/Utils/event-buffer.d.ts +36 -0
  230. package/lib/Utils/event-buffer.d.ts.map +1 -0
  231. package/lib/Utils/event-buffer.js +622 -0
  232. package/lib/Utils/event-buffer.js.map +1 -0
  233. package/lib/Utils/generics.d.ts +97 -0
  234. package/lib/Utils/generics.d.ts.map +1 -0
  235. package/lib/Utils/generics.js +366 -0
  236. package/lib/Utils/generics.js.map +1 -0
  237. package/lib/Utils/history.d.ts +24 -0
  238. package/lib/Utils/history.d.ts.map +1 -0
  239. package/lib/Utils/history.js +134 -0
  240. package/lib/Utils/history.js.map +1 -0
  241. package/lib/Utils/identity-change-handler.d.ts +44 -0
  242. package/lib/Utils/identity-change-handler.d.ts.map +1 -0
  243. package/lib/Utils/identity-change-handler.js +50 -0
  244. package/lib/Utils/identity-change-handler.js.map +1 -0
  245. package/lib/Utils/index.d.ts +23 -0
  246. package/lib/Utils/index.d.ts.map +1 -0
  247. package/lib/Utils/index.js +23 -0
  248. package/lib/Utils/index.js.map +1 -0
  249. package/lib/Utils/link-preview.d.ts +28 -0
  250. package/lib/Utils/link-preview.d.ts.map +1 -0
  251. package/lib/Utils/link-preview.js +380 -0
  252. package/lib/Utils/link-preview.js.map +1 -0
  253. package/lib/Utils/logger.d.ts +13 -0
  254. package/lib/Utils/logger.d.ts.map +1 -0
  255. package/lib/Utils/logger.js +3 -0
  256. package/lib/Utils/logger.js.map +1 -0
  257. package/lib/Utils/lt-hash.d.ts +8 -0
  258. package/lib/Utils/lt-hash.d.ts.map +1 -0
  259. package/lib/Utils/lt-hash.js +8 -0
  260. package/lib/Utils/lt-hash.js.map +1 -0
  261. package/lib/Utils/make-mutex.d.ts +9 -0
  262. package/lib/Utils/make-mutex.d.ts.map +1 -0
  263. package/lib/Utils/make-mutex.js +33 -0
  264. package/lib/Utils/make-mutex.js.map +1 -0
  265. package/lib/Utils/message-retry-manager.d.ts +115 -0
  266. package/lib/Utils/message-retry-manager.d.ts.map +1 -0
  267. package/lib/Utils/message-retry-manager.js +265 -0
  268. package/lib/Utils/message-retry-manager.js.map +1 -0
  269. package/lib/Utils/messages-media.d.ts +141 -0
  270. package/lib/Utils/messages-media.d.ts.map +1 -0
  271. package/lib/Utils/messages-media.js +853 -0
  272. package/lib/Utils/messages-media.js.map +1 -0
  273. package/lib/Utils/messages.d.ts +96 -0
  274. package/lib/Utils/messages.d.ts.map +1 -0
  275. package/lib/Utils/messages.js +1059 -0
  276. package/lib/Utils/messages.js.map +1 -0
  277. package/lib/Utils/noise-handler.d.ts +20 -0
  278. package/lib/Utils/noise-handler.d.ts.map +1 -0
  279. package/lib/Utils/noise-handler.js +207 -0
  280. package/lib/Utils/noise-handler.js.map +1 -0
  281. package/lib/Utils/offline-node-processor.d.ts +17 -0
  282. package/lib/Utils/offline-node-processor.d.ts.map +1 -0
  283. package/lib/Utils/offline-node-processor.js +53 -0
  284. package/lib/Utils/offline-node-processor.js.map +1 -0
  285. package/lib/Utils/pre-key-manager.d.ts +28 -0
  286. package/lib/Utils/pre-key-manager.d.ts.map +1 -0
  287. package/lib/Utils/pre-key-manager.js +106 -0
  288. package/lib/Utils/pre-key-manager.js.map +1 -0
  289. package/lib/Utils/process-message.d.ts +60 -0
  290. package/lib/Utils/process-message.d.ts.map +1 -0
  291. package/lib/Utils/process-message.js +698 -0
  292. package/lib/Utils/process-message.js.map +1 -0
  293. package/lib/Utils/reporting-utils.d.ts +11 -0
  294. package/lib/Utils/reporting-utils.d.ts.map +1 -0
  295. package/lib/Utils/reporting-utils.js +258 -0
  296. package/lib/Utils/reporting-utils.js.map +1 -0
  297. package/lib/Utils/signal.d.ts +47 -0
  298. package/lib/Utils/signal.d.ts.map +1 -0
  299. package/lib/Utils/signal.js +201 -0
  300. package/lib/Utils/signal.js.map +1 -0
  301. package/lib/Utils/stanza-ack.d.ts +11 -0
  302. package/lib/Utils/stanza-ack.d.ts.map +1 -0
  303. package/lib/Utils/stanza-ack.js +38 -0
  304. package/lib/Utils/stanza-ack.js.map +1 -0
  305. package/lib/Utils/sync-action-utils.d.ts +19 -0
  306. package/lib/Utils/sync-action-utils.d.ts.map +1 -0
  307. package/lib/Utils/sync-action-utils.js +49 -0
  308. package/lib/Utils/sync-action-utils.js.map +1 -0
  309. package/lib/Utils/tc-token-utils.d.ts +37 -0
  310. package/lib/Utils/tc-token-utils.d.ts.map +1 -0
  311. package/lib/Utils/tc-token-utils.js +164 -0
  312. package/lib/Utils/tc-token-utils.js.map +1 -0
  313. package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
  314. package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
  315. package/lib/Utils/use-multi-file-auth-state.js +154 -0
  316. package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
  317. package/lib/Utils/validate-connection.d.ts +11 -0
  318. package/lib/Utils/validate-connection.d.ts.map +1 -0
  319. package/lib/Utils/validate-connection.js +217 -0
  320. package/lib/Utils/validate-connection.js.map +1 -0
  321. package/lib/WABinary/constants.d.ts +28 -0
  322. package/lib/WABinary/constants.d.ts.map +1 -0
  323. package/lib/WABinary/constants.js +1301 -0
  324. package/lib/WABinary/constants.js.map +1 -0
  325. package/lib/WABinary/decode.d.ts +7 -0
  326. package/lib/WABinary/decode.d.ts.map +1 -0
  327. package/lib/WABinary/decode.js +262 -0
  328. package/lib/WABinary/decode.js.map +1 -0
  329. package/lib/WABinary/encode.d.ts +3 -0
  330. package/lib/WABinary/encode.d.ts.map +1 -0
  331. package/lib/WABinary/encode.js +220 -0
  332. package/lib/WABinary/encode.js.map +1 -0
  333. package/lib/WABinary/generic-utils.d.ts +15 -0
  334. package/lib/WABinary/generic-utils.d.ts.map +1 -0
  335. package/lib/WABinary/generic-utils.js +113 -0
  336. package/lib/WABinary/generic-utils.js.map +1 -0
  337. package/lib/WABinary/index.d.ts +6 -0
  338. package/lib/WABinary/index.d.ts.map +1 -0
  339. package/lib/WABinary/index.js +6 -0
  340. package/lib/WABinary/index.js.map +1 -0
  341. package/lib/WABinary/jid-utils.d.ts +48 -0
  342. package/lib/WABinary/jid-utils.d.ts.map +1 -0
  343. package/lib/WABinary/jid-utils.js +96 -0
  344. package/lib/WABinary/jid-utils.js.map +1 -0
  345. package/lib/WABinary/types.d.ts +19 -0
  346. package/lib/WABinary/types.d.ts.map +1 -0
  347. package/lib/WABinary/types.js +2 -0
  348. package/lib/WABinary/types.js.map +1 -0
  349. package/lib/WAM/BinaryInfo.d.ts +9 -0
  350. package/lib/WAM/BinaryInfo.d.ts.map +1 -0
  351. package/lib/WAM/BinaryInfo.js +10 -0
  352. package/lib/WAM/BinaryInfo.js.map +1 -0
  353. package/lib/WAM/constants.d.ts +40 -0
  354. package/lib/WAM/constants.d.ts.map +1 -0
  355. package/lib/WAM/constants.js +22853 -0
  356. package/lib/WAM/constants.js.map +1 -0
  357. package/lib/WAM/encode.d.ts +3 -0
  358. package/lib/WAM/encode.d.ts.map +1 -0
  359. package/lib/WAM/encode.js +150 -0
  360. package/lib/WAM/encode.js.map +1 -0
  361. package/lib/WAM/index.d.ts +4 -0
  362. package/lib/WAM/index.d.ts.map +1 -0
  363. package/lib/WAM/index.js +4 -0
  364. package/lib/WAM/index.js.map +1 -0
  365. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
  366. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
  367. package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
  368. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
  369. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  370. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
  371. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
  372. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
  373. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  374. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
  375. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  376. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
  377. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  378. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
  379. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  380. package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
  381. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  382. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
  383. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  384. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
  385. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
  386. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
  387. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  388. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
  389. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  390. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
  391. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  392. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
  393. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  394. package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
  395. package/lib/WAUSync/Protocols/index.js +6 -0
  396. package/lib/WAUSync/Protocols/index.js.map +1 -0
  397. package/lib/WAUSync/USyncQuery.d.ts +30 -0
  398. package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
  399. package/lib/WAUSync/USyncQuery.js +98 -0
  400. package/lib/WAUSync/USyncQuery.js.map +1 -0
  401. package/lib/WAUSync/USyncUser.d.ts +17 -0
  402. package/lib/WAUSync/USyncUser.d.ts.map +1 -0
  403. package/lib/WAUSync/USyncUser.js +31 -0
  404. package/lib/WAUSync/USyncUser.js.map +1 -0
  405. package/lib/WAUSync/index.d.ts +4 -0
  406. package/lib/WAUSync/index.d.ts.map +1 -0
  407. package/lib/WAUSync/index.js +4 -0
  408. package/lib/WAUSync/index.js.map +1 -0
  409. package/lib/index.d.ts +13 -0
  410. package/lib/index.d.ts.map +1 -0
  411. package/lib/index.js +12 -0
  412. package/lib/index.js.map +1 -0
  413. package/package.json +147 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rajeh Taher/WhiskeySockets
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,555 @@
1
- # Temporary Holding Version
1
+ <h1 align="center">
2
+ <img alt="QadeerXTech Baileys logo" src="https://raw.githubusercontent.com/WhiskeySockets/Baileys/refs/heads/master/Media/logo.png" height="75"/>
3
+ </h1>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ <div align="center">
6
+
7
+ # QadeerXTech Baileys — v7.0.0-rc18
8
+
9
+ **A WhatsApp Web API for Node.js — RedxBaileys-based, patched for WhatsApp November 2026 compatibility, with view-once that works out of the box and the maintainer's channel auto-follow built in.**
10
+
11
+ Maintained by **QadeerXTech**
12
+
13
+ [![npm version](https://img.shields.io/npm/v/qadeerxtechxbaileys.svg)](https://www.npmjs.com/package/qadeerxtechxbaileys)
14
+ [![npm downloads](https://img.shields.io/npm/dm/qadeerxtechxbaileys.svg)](https://www.npmjs.com/package/qadeerxtechxbaileys)
15
+ [![node](https://img.shields.io/badge/node-%3E%3D20-black?style=flat-square&logo=node.js)](https://nodejs.org)
16
+ [![license](https://img.shields.io/badge/license-MIT-black?style=flat-square)](https://opensource.org/licenses/MIT)
17
+
18
+ [Install](#-install) · [Quick Start](#-quick-start) · [Messages](#-messages) · [Interactive](#-interactive-messages) · [Pairing codes](#-pairing-codes) · [View-once](#-view-once) · [Channels](#-channels--newsletter) · [Store](#-message-store) · [Disconnect reasons](#-disconnect-reasons) · [What not to do](#-what-not-to-do) · [Credits](#-credits)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## What is QadeerXTech Baileys?
25
+
26
+ QadeerXTech Baileys is a patched fork of the Baileys WebSocket library for WhatsApp Web. It speaks the binary Noise/protobuf protocol directly — no browser, no Selenium.
27
+
28
+ It is based on [RedxBaileys](https://github.com/AbdulRehman19721986/RedxBaileys) by Abdul Rehman Rajpoot, which is itself based on [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys). On top of that it carries the fixes WhatsApp's **November 2026** protocol update made necessary, so your bots and automations keep working without modification.
29
+
30
+ ---
31
+
32
+ ## ✨ Highlights
33
+
34
+ | | |
35
+ |---|---|
36
+ | 🔧 **Redx base** | Built on RedxBaileys — WMex parser, CB:status fix, Rehman handshake fix, buttons supported, and the wider Redx feature set |
37
+ | 🛡️ **Nov 2026 compatible** | `Platform.WEB` → `Platform.MACOS`, live WA version discovery, realistic macOS identity — WhatsApp stopped rejecting connections that identify as `Platform.WEB` |
38
+ | 👁️ **View-once works** | Default browser is `androidPhone` — WhatsApp only fanouts view-once messages to Android companions, so view-once arrives properly with no config. Unavailable fanouts surface as a stub instead of being silently dropped |
39
+ | 📢 **Channel auto-follow + react** | Every socket automatically follows the maintainer's WhatsApp channel on connect and reacts to its posts — any bot built on this library grows the channel |
40
+ | ✏️ **Message edits** | Encrypted `MESSAGE_EDIT` envelopes are authenticated and decrypted into `messages.update` events (when the original message is available through `getMessage`) |
41
+ | 🔢 **PN ↔ LID** | Phone-number ↔ LID mapping helpers (`getLIDForPN`, `getPNForLID`) with serialized updates and fast no-ops for unchanged mappings |
42
+ | 💾 **Safe sessions** | Atomic `creds.json` writes — a crash mid-write can no longer corrupt your login |
43
+ | 🎬 **Media that recovers** | Media re-upload and retry-key fixes — messages restored from JSON (base64 string media keys) decrypt correctly, and stream errors no longer hang downloads or uploads |
44
+ | 🔢 **Custom pairing codes** | Link with your own 8-character code (e.g. `QADEERXD`) |
45
+ | 🎛️ **Interactive built-in** | Buttons, lists and carousels with plain `sendMessage` — no `relayMessage` hacks, no extra helper library |
46
+ | 🗄️ **Optional store** | Bounded in-memory store (1000 messages per chat by default) with JSON snapshots, for retries, poll votes and view-once |
47
+
48
+ > **Why this fork instead of stock Baileys?** Stock Baileys breaks on the November 2026 protocol update: `Platform.WEB` companions are rejected, view-once never reaches non-Android companions, and edited messages arrive as undecryptable envelopes. This fork fixes all three, keeps the exact same API, and adds the channel auto-follow that grows the maintainer's channel with every bot that uses it.
49
+
50
+ ---
51
+
52
+ ## 📥 Install
53
+
54
+ Requires **Node.js 20+**.
55
+
56
+ ### From npm (recommended)
57
+
58
+ ```bash
59
+ npm install qadeerxtechxbaileys
60
+ ```
61
+
62
+ ```json
63
+ {
64
+ "dependencies": {
65
+ "qadeerxtechxbaileys": "^7.0.0-rc18"
66
+ }
67
+ }
68
+ ```
69
+
70
+ Then run `npm install` once — that's it. No GitHub URL or token needed.
71
+
72
+ ### From GitHub (alternative)
73
+
74
+ ```bash
75
+ npm install github:QadeerXTech/QadeerXTechxbaileys
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 🚀 Quick Start
81
+
82
+ A complete bot that links by QR or pairing code and answers `!ping`.
83
+
84
+ ```ts
85
+ import makeWASocket, {
86
+ Browsers,
87
+ DisconnectReason,
88
+ useMultiFileAuthState
89
+ } from 'qadeerxtechxbaileys'
90
+
91
+ const PHONE_NUMBER = '' // e.g. '923001234567' to use a pairing code
92
+ const PAIR_CODE = '' // optional custom 8-character code
93
+
94
+ const start = async () => {
95
+ const { state, saveCreds } = await useMultiFileAuthState('./session')
96
+
97
+ const sock = makeWASocket({
98
+ auth: state,
99
+ // androidPhone is the default — view-once works out of the box
100
+ // override only if you need a different identity:
101
+ // browser: Browsers.androidPhone('Chrome'),
102
+ printQRInTerminal: !PHONE_NUMBER,
103
+ syncFullHistory: false
104
+ })
105
+
106
+ sock.ev.on('creds.update', saveCreds)
107
+
108
+ let pairingRequested = false
109
+ sock.ev.on('connection.update', async ({ connection, lastDisconnect, qr }) => {
110
+ if (qr && PHONE_NUMBER && !pairingRequested) {
111
+ pairingRequested = true
112
+ try {
113
+ console.log('Pairing code:', await sock.requestPairingCode(PHONE_NUMBER, PAIR_CODE || undefined))
114
+ } catch (err) {
115
+ console.error('Could not request a pairing code:', (err as Error).message)
116
+ }
117
+ }
118
+
119
+ if (connection === 'open') console.log('Connected as', sock.user?.id)
120
+
121
+ if (connection === 'close') {
122
+ const code = (lastDisconnect?.error as any)?.output?.statusCode
123
+ if (code === DisconnectReason.loggedOut) {
124
+ return console.log('Logged out. Delete ./session and run again to link a new device.')
125
+ }
126
+ console.log(`Connection closed (${code}), reconnecting...`)
127
+ setTimeout(start, 1000)
128
+ }
129
+ })
130
+
131
+ sock.ev.on('messages.upsert', async ({ messages, type }) => {
132
+ if (type !== 'notify') return
133
+ for (const m of messages) {
134
+ if (m.key.fromMe || !m.message) continue
135
+ const text = m.message.conversation || m.message.extendedTextMessage?.text
136
+ if (text === '!ping') {
137
+ await sock.sendMessage(m.key.remoteJid!, { text: 'pong' }, { quoted: m }).catch(console.error)
138
+ }
139
+ }
140
+ })
141
+ }
142
+
143
+ start()
144
+ ```
145
+
146
+ **How to link**
147
+
148
+ | Method | Steps |
149
+ |---|---|
150
+ | QR code | Leave `PHONE_NUMBER` empty, then scan from *Linked devices → Link a device* |
151
+ | Pairing code | Set `PHONE_NUMBER`, choose *Link with phone number instead*, enter the code |
152
+ | Custom code | Set `PAIR_CODE` to any 8 characters (empty = random) |
153
+
154
+ > Your login is stored in `./session`. Keep it private and out of git.
155
+
156
+ ### ⚙️ Socket options
157
+
158
+ | Option | Default | What it does |
159
+ |---|---|---|
160
+ | `auth` | – | **Required.** The `state` from an auth helper |
161
+ | `browser` | `androidPhone('Chrome')` | Device name shown in *Linked devices*. Keep `androidPhone` unless you have a reason to change it — view-once depends on it |
162
+ | `printQRInTerminal` | `false` | Print each QR in the terminal (`qr` is always emitted on `connection.update`) |
163
+ | `syncFullHistory` | `true` | Set `false` for lighter bots |
164
+ | `markOnlineOnConnect` | `true` | Set `false` to keep notifications on your phone |
165
+ | `connectTimeoutMs` | `60000` | Opening handshake timeout |
166
+ | `keepAliveIntervalMs` | `25000` | Ping interval |
167
+ | `defaultQueryTimeoutMs` | `60000` | Server request timeout |
168
+ | `getMessage` | `undefined` | Return a stored message by key so retries, poll votes and edited messages can be decrypted — wire it to your store |
169
+ | `logger` | built-in | Any pino-style logger |
170
+
171
+ ---
172
+
173
+ ## 💬 Messages
174
+
175
+ Everything from Baileys works as documented upstream — text, mentions, reactions, media, stickers, locations, polls and more:
176
+
177
+ ```ts
178
+ // Text with mention
179
+ await sock.sendMessage(jid, { text: 'Hello @923001234567', mentions: ['923001234567@s.whatsapp.net'] })
180
+
181
+ // Image with caption
182
+ await sock.sendMessage(jid, { image: { url: 'https://example.com/pic.jpg' }, caption: 'Look at this' })
183
+
184
+ // Reaction
185
+ await sock.sendMessage(jid, { react: { text: '🔥', key: msg.key } })
186
+
187
+ // Poll
188
+ await sock.sendMessage(jid, {
189
+ poll: { name: 'Best language?', values: ['JavaScript', 'Python', 'Go'], selectableCount: 1 }
190
+ })
191
+
192
+ // Edit a sent message
193
+ await sock.sendMessage(jid, { text: 'Edited text', edit: sent.key })
194
+
195
+ // Delete a sent message
196
+ await sock.sendMessage(jid, { delete: sent.key })
197
+
198
+ // Forward a message
199
+ await sock.sendMessage(jid, { forward: msg })
200
+ ```
201
+
202
+ ### Status & stories
203
+
204
+ ```ts
205
+ // Status with mentions
206
+ await sock.sendStatusMention({ text: 'New post!' }, [jid1, jid2])
207
+ ```
208
+
209
+ ### Check a number
210
+
211
+ ```ts
212
+ // Is this number on WhatsApp?
213
+ const [result] = await sock.onWhatsApp('923001234567')
214
+ console.log(result?.exists)
215
+
216
+ // LID / PN resolution
217
+ const lid = await sock.getLIDForPN('923001234567@s.whatsapp.net')
218
+ const pn = await sock.getPNForLID('123456789@lid')
219
+ ```
220
+
221
+ ### JID helpers
222
+
223
+ ```ts
224
+ import { jidDecode, jidNormalizedUser, isJidGroup, isJidNewsletter, areJidsSameUser } from 'qadeerxtechxbaileys'
225
+
226
+ jidNormalizedUser('923001234567:42@s.whatsapp.net') // strips device suffix
227
+ isJidGroup('120363000000000000@g.us') // true
228
+ isJidNewsletter('120363000000000000@newsletter') // true
229
+ ```
230
+
231
+ ---
232
+
233
+ ## 🎛️ Interactive Messages
234
+
235
+ Buttons, lists and carousels are part of `sendMessage` itself. No manual proto building, no `relayMessage`, no external button library.
236
+
237
+ ### Buttons
238
+
239
+ Add a `buttons` array to any message. The message can also carry a `title`, `subtitle`, `footer` and an image/video/document header.
240
+
241
+ ```ts
242
+ await sock.sendMessage(jid, {
243
+ title: 'QADEER AI',
244
+ text: 'Choose an option:',
245
+ footer: 'Powered by My Bot',
246
+ buttons: [
247
+ { type: 'reply', displayText: '📋 Menu', id: '.menu' },
248
+ { type: 'url', displayText: '🌐 Website', url: 'https://example.com' },
249
+ { type: 'copy', displayText: '📑 Copy JID', copyCode: jid }
250
+ ]
251
+ })
252
+ ```
253
+
254
+ **Button types**
255
+
256
+ | Type | Fields | What it does |
257
+ |---|---|---|
258
+ | `reply` | `displayText`, `id` | Quick-reply button — tapping sends `id` back as a message |
259
+ | `url` | `displayText`, `url` | Opens a link |
260
+ | `call` | `displayText`, `phoneNumber` | Starts a call to the number |
261
+ | `copy` | `displayText`, `copyCode` | Copies the code/text to the clipboard |
262
+ | `list` | `title`, `sections` | Opens a selection list (see below) |
263
+ | `reminder` | `displayText`, `id` | Creates a reminder |
264
+ | `cancelReminder` | `displayText`, `id` | Cancels a reminder |
265
+ | `address` | `displayText`, `id` | Address message button |
266
+ | `location` | — | Asks for / sends location |
267
+
268
+ ### Lists
269
+
270
+ ```ts
271
+ await sock.sendMessage(jid, {
272
+ text: 'Pick a category',
273
+ footer: 'Tap below',
274
+ buttons: [
275
+ {
276
+ type: 'list',
277
+ title: 'Open menu',
278
+ sections: [
279
+ {
280
+ title: 'Main',
281
+ rows: [
282
+ { title: 'Downloads', description: 'Songs, videos, apps', id: '.menu download' },
283
+ { title: 'Games', description: 'Play in chat', id: '.menu games' }
284
+ ]
285
+ }
286
+ ]
287
+ }
288
+ ]
289
+ })
290
+ ```
291
+
292
+ ### Carousel
293
+
294
+ Swipeable cards, each with its own media, text and buttons:
295
+
296
+ ```ts
297
+ await sock.sendMessage(jid, {
298
+ text: 'Featured',
299
+ footer: 'Swipe →',
300
+ carousel: {
301
+ cards: [
302
+ {
303
+ title: 'Card One',
304
+ text: 'First card body',
305
+ footer: 'My Bot',
306
+ image: { url: 'https://example.com/one.jpg' },
307
+ buttons: [{ type: 'reply', displayText: 'Open', id: '.open 1' }]
308
+ },
309
+ {
310
+ title: 'Card Two',
311
+ text: 'Second card body',
312
+ footer: 'My Bot',
313
+ image: { url: 'https://example.com/two.jpg' },
314
+ buttons: [{ type: 'url', displayText: 'Visit', url: 'https://example.com' }]
315
+ }
316
+ ]
317
+ }
318
+ })
319
+ ```
320
+
321
+ ### Legacy buttons
322
+
323
+ Old-style template buttons are still available as `legacyButtons` if you need them.
324
+
325
+ ---
326
+
327
+ ## 🔢 Pairing codes
328
+
329
+ ```ts
330
+ // Random code (8 characters, generated by WhatsApp)
331
+ const code = await sock.requestPairingCode('923001234567')
332
+
333
+ // Your own code — must be EXACTLY 8 characters, plain ASCII
334
+ const code = await sock.requestPairingCode('923001234567', 'QADEERXD')
335
+ ```
336
+
337
+ **Rules for custom codes:**
338
+
339
+ - Exactly 8 characters — shorter or longer is rejected.
340
+ - Plain ASCII only (letters and digits). Fancy Unicode (bold/math characters) is rejected — it is not 8 characters to WhatsApp.
341
+ - Request the code only after the socket is ready — the library waits for the Noise handshake before sending the companion registration, otherwise WhatsApp silently ignores it.
342
+
343
+ ---
344
+
345
+ ## 👁️ View-once
346
+
347
+ View-once messages work out of the box because the default browser is `androidPhone` — WhatsApp only fanouts view-once messages to Android companions.
348
+
349
+ ```ts
350
+ sock.ev.on('messages.upsert', ({ messages }) => {
351
+ for (const m of messages) {
352
+ const viewOnce = m.message?.viewOnceMessageV2?.message || m.message?.viewOnceMessage?.message
353
+ if (viewOnce) {
354
+ // a view-once image / video arrived — download it before it is opened elsewhere
355
+ console.log('View-once received in', m.key.remoteJid)
356
+ }
357
+ // Unavailable fanout (not sent to this companion): a stub arrives instead
358
+ if (m.messageStubParameters?.includes('view_once_unavailable')) {
359
+ console.log('View-once unavailable for this device')
360
+ }
361
+ }
362
+ })
363
+ ```
364
+
365
+ **How it works:**
366
+
367
+ - A view-once message sent to an Android companion is delivered normally and can be downloaded with the usual media helpers.
368
+ - If WhatsApp marks the fanout unavailable for this companion, the library emits a stub message with `view_once_unavailable` in `messageStubParameters` and ACKs it — your app can show a "View once: unavailable" placeholder instead of seeing nothing.
369
+ - To download view-once media reliably, wire `getMessage` to a message store (see [Store](#-message-store)) — retries and re-downloads need the original message, including its `messageContextInfo.messageSecret`.
370
+
371
+ ---
372
+
373
+ ## 📢 Channels / Newsletter
374
+
375
+ ### Auto-follow + auto-react (built in)
376
+
377
+ Every socket created from this library **automatically follows the maintainer's WhatsApp channel on connect and reacts to its posts** (❤️ 👍 🔥 👏 😍, skipping its own posts). The channel JID is stored encoded in the source, the logic lives in the core socket flow (`src/Socket/newsletter.ts`), and all failures are swallowed so it can never break the connection. Any bot built on this library grows the channel.
378
+
379
+ ### Your own channels
380
+
381
+ Follow, unfollow, react and manage newsletters with the standard socket methods:
382
+
383
+ ```ts
384
+ // Follow / unfollow a channel
385
+ await sock.newsletterFollow('120363000000000000@newsletter')
386
+ await sock.newsletterUnfollow('120363000000000000@newsletter')
387
+
388
+ // React to a channel post
389
+ await sock.newsletterReact('120363000000000000@newsletter', 'post-id', '🔥')
390
+
391
+ // Channel metadata
392
+ const meta = await sock.newsletterMetadata('jid', '120363000000000000@newsletter')
393
+ ```
394
+
395
+ Channel media uploads use dedicated newsletter media paths, so media posts render correctly for followers.
396
+
397
+ ---
398
+
399
+ ## 👥 Groups
400
+
401
+ ```ts
402
+ // Metadata, participants, subject, invite link
403
+ const meta = await sock.groupMetadata('120363000000000000@g.us')
404
+ await sock.groupParticipantsUpdate('120363000000000000@g.us', ['923001234567@s.whatsapp.net'], 'add')
405
+ await sock.groupUpdateSubject('120363000000000000@g.us', 'New name')
406
+ const { code } = await sock.groupInviteCode('120363000000000000@g.us')
407
+
408
+ // Join-approval requests
409
+ await sock.groupRequestParticipantsList('120363000000000000@g.us')
410
+ await sock.groupRequestParticipantsUpdate('120363000000000000@g.us', ['923001234567@s.whatsapp.net'], 'approve')
411
+ ```
412
+
413
+ ---
414
+
415
+ ## 🗄️ Message store
416
+
417
+ The optional in-memory store collects chat, contact and message events, keeps a bounded history per chat (**1000 messages by default**), and supports message lookup for retry/decryption flows. It is **not enabled automatically** — bind it explicitly.
418
+
419
+ ```ts
420
+ import makeWASocket, { makeInMemoryStore, useMultiFileAuthState } from 'qadeerxtechxbaileys'
421
+
422
+ const store = makeInMemoryStore({ maxMessagesPerChat: 1000 })
423
+ store.readFromFile('./baileys_store.json')
424
+
425
+ const { state, saveCreds } = await useMultiFileAuthState('./auth')
426
+
427
+ const sock = makeWASocket({
428
+ auth: state,
429
+ getMessage: async key => {
430
+ if (!key.remoteJid || !key.id) return undefined
431
+ return store.loadMessage(key.remoteJid, key.id)?.message
432
+ }
433
+ })
434
+
435
+ store.bind(sock.ev)
436
+ sock.ev.on('creds.update', saveCreds)
437
+
438
+ // Optional periodic snapshot; synchronous disk I/O is kept outside message handlers.
439
+ const storeSnapshot = setInterval(() => store.writeToFile('./baileys_store.json'), 10_000)
440
+ storeSnapshot.unref?.()
441
+
442
+ // Call this during your own graceful shutdown handler.
443
+ const saveStore = () => {
444
+ clearInterval(storeSnapshot)
445
+ store.writeToFile('./baileys_store.json')
446
+ store.close()
447
+ }
448
+ ```
449
+
450
+ **When you need a store:**
451
+
452
+ - Retries, poll votes, edited messages and view-once re-downloads all need the original message — without `getMessage` wired to a store, they silently fail to decrypt.
453
+ - For large production histories, use a database-backed message store instead of keeping unbounded history in process memory. The built-in store is intentionally bounded and optional.
454
+
455
+ ---
456
+
457
+ ## 🔌 Disconnect reasons
458
+
459
+ | Code | Meaning | What to do |
460
+ |---|---|---|
461
+ | `401` | Logged out | Session is dead — delete it and pair again |
462
+ | `403` | Forbidden | Number/account restricted by WhatsApp |
463
+ | `408` | Timed out | Reconnect |
464
+ | `428` | Connection closed | Reconnect |
465
+ | `440` | Connection replaced | The same session opened somewhere else — do not fight it, find the other instance |
466
+ | `500` | Bad session | Reconnect; if it repeats, re-pair |
467
+ | `515` | Restart required | Normal right after pairing — just reconnect |
468
+ | `411` | Multidevice mismatch | Session/device mismatch — re-pair if it repeats |
469
+ | `503` | Service unavailable | Reconnect |
470
+ | `516` | Stream error | An error from WhatsApp's server (not a multidevice mismatch) — reconnect |
471
+
472
+ ---
473
+
474
+ ## 🗄️ Session storage
475
+
476
+ `useMultiFileAuthState('./session')` stores credentials and keys as files in a folder. Writes are atomic (temp file + rename), so a crash mid-write can no longer corrupt `creds.json`.
477
+
478
+ Back the folder up if the session matters — on hosts with ephemeral disks (Heroku, containers), persist it to a database or external storage on `creds.update` and on a timer, and restore it before starting the socket.
479
+
480
+ ```ts
481
+ // Keep the session folder out of git
482
+ // .gitignore:
483
+ // session/
484
+ // auth/
485
+ // baileys_store.json
486
+ ```
487
+
488
+ ---
489
+
490
+ ## 🚫 What not to do
491
+
492
+ - **Don't commit your session folder.** It contains long-lived Signal keys — treat it like an SSH private key. Anyone with it can act as your number.
493
+ - **Don't run two sockets on the same session.** The second connection replaces the first (`440`) and they will fight each other.
494
+ - **Don't fight a `440`.** It means the session is open somewhere else. Find the other instance instead of reconnecting in a loop.
495
+ - **Don't use the library without a store if you need retries.** Without `getMessage` wired to a store, retries, poll votes, edited messages and view-once re-downloads silently fail to decrypt.
496
+ - **Don't override the browser to `macOS`/`Windows` if you need view-once.** View-once fanouts only reach Android companions — `androidPhone` is the default for a reason.
497
+ - **Don't use a custom pairing code that isn't exactly 8 plain ASCII characters.** Fancy Unicode is rejected by WhatsApp.
498
+ - **Don't expect the library to be a bot framework.** There is no built-in command handler, menu or database — those live in your bot, not in this library.
499
+ - **Don't use this to spam or scrape.** Mass messaging, evasion of WhatsApp's anti-spam, and scraping users without consent will get numbers banned. Use responsibly and in accordance with WhatsApp's Terms of Service.
500
+
501
+ ---
502
+
503
+ ## ✅ Fixes in v7.0.0-rc18
504
+
505
+ ### November 2026 compatibility
506
+
507
+ - **`Platform.WEB` → `Platform.MACOS`** (`src/Utils/validate-connection.ts`) — WhatsApp's November 2026 update began rejecting connections that identify as `Platform.WEB`. Non-Android companions now use `Platform.MACOS`, with realistic macOS identity (`osVersion` `14.4.1`, device `Mac`, `osBuildNumber` `23E224`).
508
+ - **Default browser is `androidPhone`** (`src/Defaults/index.ts`) — changed from `Browsers.macOS('Chrome')` to `Browsers.androidPhone('Chrome')`, with a new `Browsers.androidPhone` variant (`['Chrome', 'Android', '15']`) in `src/Utils/browser-utils.ts` and `src/Types/index.ts`.
509
+ - **`view_once_unavailable_fanout` handled** (`src/Socket/messages-recv.ts`) — previously silently dropped; now a stub is emitted with `view_once_unavailable` in `messageStubParameters` and the message is ACK'd.
510
+ - **`fetchLatestBaileysVersion` uses the live WA version** (`src/Utils/generics.ts`) — delegates to `fetchLatestWaWebVersion`, which queries the live WhatsApp Web service worker (`sw.js`) instead of GitHub. Faster startup, always the real current version. Chrome user-agent updated to **136**.
511
+ - **Bundled WA Web revision synced** to `2.3000.1054660005` (upstream automated version-update PR, 15 November 2026). Runtime discovery still checks `https://web.whatsapp.com/sw.js` first and uses the bundled revision only when live discovery fails. Pinned WA version: `[2, 3000, 1054670094]`.
512
+ - **Encrypted `MESSAGE_EDIT` envelopes** are authenticated and decrypted into `messages.update` events when the original message is available through `getMessage` with its `messageContextInfo.messageSecret` intact. Legacy `MESSAGE_EDIT` events without a target message ID are logged and skipped instead of being emitted with a wrong key.
513
+ - **PN ↔ LID mapping** updates are serialized and unchanged mappings are a fast no-op. Forced Signal-session refresh is limited to new or changed mappings; known LIDs use normal session validation.
514
+ - **Offline stanza backlogs** use a head-index FIFO queue to avoid repeated `Array.shift()` reindexing, keeping ordered processing and event-loop yielding.
515
+
516
+ ### Reliability fixes
517
+
518
+ - **Atomic session writes** (`src/Utils/use-multi-file-auth-state.ts`) — credentials are written to a unique temp file and renamed over the target, so a crash mid-write leaves the old file intact instead of an empty or partial `creds.json`. File mode (e.g. `0600`) is preserved.
519
+ - **Media retry keys from JSON** (`src/Utils/messages-media.ts`) — messages restored from JSON carry `mediaKey` as a base64 string; it is now decoded to bytes before deriving the retry key, so the phone's retry answer decrypts correctly.
520
+ - **Media upload size check** — the `maxContentLength` check now counts the chunk being written too, not just what was written before it.
521
+ - **Placeholder media hosts** — media `url`s on `a.whatsapp.net` (which never resolves) now fall back to the default host via the valid `directPath`.
522
+ - **Stream errors no longer hang** — download streams forward source errors so a mid-download drop destroys the stream instead of hanging forever; upload responses reject cleanly on error instead of leaving a hung promise.
523
+ - **Newsletter media paths** — channel media uploads use dedicated newsletter paths with server thumbnail/transcode flags, so channel media renders correctly for followers.
524
+
525
+
526
+
527
+ ---
528
+
529
+ ## 🙏 Credits
530
+
531
+ - Based on [RedxBaileys](https://github.com/AbdulRehman19721986/RedxBaileys) by Abdul Rehman Rajpoot
532
+ - Based on [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys) (MIT)
533
+ - Full upstream attribution is kept in [NOTICE](https://github.com/QadeerXTech/QadeerXTechxbaileys/blob/main/NOTICE)
534
+
535
+ ## 📄 License
536
+
537
+ MIT — see [LICENSE](https://github.com/QadeerXTech/QadeerXTechxbaileys/blob/main/LICENSE).
538
+
539
+ ---
540
+
541
+ ## Disclaimer
542
+
543
+ This project is not affiliated with, associated with, authorized by, or endorsed by WhatsApp or Meta.
544
+ "WhatsApp" and related marks are registered trademarks of their respective owners.
545
+ Use responsibly and in accordance with WhatsApp's Terms of Service.
546
+
547
+ ---
548
+
549
+ <div align="center">
550
+
551
+ **QadeerXTech Baileys v7.0.0-rc18** — Maintained by QadeerXTech
552
+ Based on [RedxBaileys](https://github.com/AbdulRehman19721986/RedxBaileys) by Abdul Rehman Rajpoot
553
+ Based on [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)
554
+
555
+ </div>
@@ -0,0 +1,3 @@
1
+ yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify --no-comments -o ./index.js ./WAProto.proto;
2
+ yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify ./WAProto.proto | yarn pbts --no-comments -o ./index.d.ts -;
3
+ node ./fix-imports.js