gifted-baileys 1.5.4 → 1.5.6

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 (252) hide show
  1. package/LICENSE +1 -1
  2. package/WAProto/WAProto.proto +88 -969
  3. package/WAProto/index.d.ts +1256 -13195
  4. package/WAProto/index.js +74730 -125106
  5. package/package.json +9 -27
  6. package/src/Defaults/baileys-version.json +3 -0
  7. package/{lib → src}/Defaults/index.js +14 -7
  8. package/src/Defaults/index.ts +131 -0
  9. package/src/README.md +1 -0
  10. package/src/Signal/libsignal.js +180 -0
  11. package/src/Signal/libsignal.ts +141 -0
  12. package/src/Socket/Client/abstract-socket-client.ts +19 -0
  13. package/{lib → src}/Socket/Client/index.js +3 -2
  14. package/src/Socket/Client/index.ts +3 -0
  15. package/src/Socket/Client/mobile-socket-client.js +78 -0
  16. package/src/Socket/Client/mobile-socket-client.ts +66 -0
  17. package/src/Socket/Client/web-socket-client.js +75 -0
  18. package/src/Socket/Client/web-socket-client.ts +57 -0
  19. package/{lib → src}/Socket/business.js +33 -28
  20. package/src/Socket/business.ts +281 -0
  21. package/{lib → src}/Socket/chats.js +176 -174
  22. package/src/Socket/chats.ts +1030 -0
  23. package/{lib → src}/Socket/groups.js +68 -80
  24. package/src/Socket/groups.ts +356 -0
  25. package/{lib → src}/Socket/index.js +1 -4
  26. package/src/Socket/index.ts +13 -0
  27. package/{lib → src}/Socket/messages-recv.js +211 -378
  28. package/src/Socket/messages-recv.ts +985 -0
  29. package/{lib → src}/Socket/messages-send.js +177 -452
  30. package/src/Socket/messages-send.ts +871 -0
  31. package/{lib → src}/Socket/newsletter.js +98 -107
  32. package/src/Socket/newsletter.ts +282 -0
  33. package/{lib → src}/Socket/registration.js +48 -56
  34. package/src/Socket/registration.ts +250 -0
  35. package/{lib → src}/Socket/socket.js +77 -77
  36. package/src/Socket/socket.ts +777 -0
  37. package/src/Store/index.ts +3 -0
  38. package/{lib → src}/Store/make-cache-manager-store.js +34 -25
  39. package/src/Store/make-cache-manager-store.ts +100 -0
  40. package/{lib → src}/Store/make-in-memory-store.js +32 -36
  41. package/src/Store/make-in-memory-store.ts +475 -0
  42. package/src/Store/make-ordered-dictionary.ts +86 -0
  43. package/{lib → src}/Store/object-repository.js +1 -1
  44. package/src/Store/object-repository.ts +32 -0
  45. package/src/Tests/test.app-state-sync.js +204 -0
  46. package/src/Tests/test.app-state-sync.ts +207 -0
  47. package/src/Tests/test.event-buffer.js +270 -0
  48. package/src/Tests/test.event-buffer.ts +319 -0
  49. package/src/Tests/test.key-store.js +76 -0
  50. package/src/Tests/test.key-store.ts +92 -0
  51. package/src/Tests/test.libsignal.js +141 -0
  52. package/src/Tests/test.libsignal.ts +186 -0
  53. package/src/Tests/test.media-download.js +93 -0
  54. package/src/Tests/test.media-download.ts +76 -0
  55. package/src/Tests/test.messages.js +33 -0
  56. package/src/Tests/test.messages.ts +37 -0
  57. package/src/Tests/utils.js +34 -0
  58. package/src/Tests/utils.ts +36 -0
  59. package/src/Types/Auth.ts +113 -0
  60. package/src/Types/Call.ts +15 -0
  61. package/src/Types/Chat.ts +106 -0
  62. package/{lib/Types/Contact.d.ts → src/Types/Contact.ts} +9 -8
  63. package/src/Types/Events.ts +93 -0
  64. package/src/Types/GroupMetadata.ts +53 -0
  65. package/src/Types/Label.ts +36 -0
  66. package/{lib/Types/LabelAssociation.d.ts → src/Types/LabelAssociation.ts} +22 -16
  67. package/src/Types/Message.ts +288 -0
  68. package/src/Types/Newsletter.ts +98 -0
  69. package/src/Types/Product.ts +85 -0
  70. package/src/Types/Signal.ts +68 -0
  71. package/{lib/Types/Socket.d.ts → src/Types/Socket.ts} +68 -61
  72. package/src/Types/State.ts +29 -0
  73. package/src/Types/index.ts +59 -0
  74. package/{lib → src}/Utils/auth-utils.js +90 -73
  75. package/src/Utils/auth-utils.ts +222 -0
  76. package/src/Utils/baileys-event-stream.js +92 -0
  77. package/src/Utils/baileys-event-stream.ts +66 -0
  78. package/{lib → src}/Utils/business.js +43 -15
  79. package/src/Utils/business.ts +275 -0
  80. package/{lib → src}/Utils/chat-utils.js +94 -87
  81. package/src/Utils/chat-utils.ts +860 -0
  82. package/{lib → src}/Utils/crypto.js +2 -4
  83. package/src/Utils/crypto.ts +131 -0
  84. package/src/Utils/decode-wa-message.js +211 -0
  85. package/src/Utils/decode-wa-message.ts +228 -0
  86. package/{lib → src}/Utils/event-buffer.js +13 -4
  87. package/src/Utils/event-buffer.ts +613 -0
  88. package/{lib → src}/Utils/generics.js +86 -67
  89. package/src/Utils/generics.ts +434 -0
  90. package/{lib → src}/Utils/history.js +39 -13
  91. package/src/Utils/history.ts +112 -0
  92. package/src/Utils/index.ts +17 -0
  93. package/{lib → src}/Utils/link-preview.js +54 -17
  94. package/src/Utils/link-preview.ts +122 -0
  95. package/src/Utils/logger.ts +3 -0
  96. package/src/Utils/lt-hash.ts +61 -0
  97. package/{lib → src}/Utils/make-mutex.js +13 -4
  98. package/src/Utils/make-mutex.ts +44 -0
  99. package/{lib → src}/Utils/messages-media.js +255 -193
  100. package/src/Utils/messages-media.ts +847 -0
  101. package/{lib → src}/Utils/messages.js +118 -588
  102. package/src/Utils/messages.ts +956 -0
  103. package/src/Utils/noise-handler.ts +197 -0
  104. package/{lib → src}/Utils/process-message.js +30 -27
  105. package/src/Utils/process-message.ts +414 -0
  106. package/{lib → src}/Utils/signal.js +42 -25
  107. package/src/Utils/signal.ts +177 -0
  108. package/{lib → src}/Utils/use-multi-file-auth-state.js +28 -27
  109. package/src/Utils/use-multi-file-auth-state.ts +90 -0
  110. package/{lib → src}/Utils/validate-connection.js +9 -40
  111. package/src/Utils/validate-connection.ts +238 -0
  112. package/src/WABinary/constants.ts +42 -0
  113. package/src/WABinary/decode.ts +265 -0
  114. package/{lib → src}/WABinary/encode.js +10 -16
  115. package/src/WABinary/encode.ts +236 -0
  116. package/src/WABinary/generic-utils.ts +121 -0
  117. package/src/WABinary/index.ts +5 -0
  118. package/src/WABinary/jid-utils.ts +68 -0
  119. package/src/WABinary/types.ts +17 -0
  120. package/src/WAM/BinaryInfo.ts +12 -0
  121. package/src/WAM/constants.ts +15382 -0
  122. package/src/WAM/encode.ts +174 -0
  123. package/src/WAM/index.ts +3 -0
  124. package/{lib → src}/index.js +0 -1
  125. package/src/index.ts +13 -0
  126. package/README.md +0 -1645
  127. package/lib/Defaults/baileys-version.json +0 -3
  128. package/lib/Defaults/index.d.ts +0 -284
  129. package/lib/Signal/libsignal.d.ts +0 -3
  130. package/lib/Signal/libsignal.js +0 -161
  131. package/lib/Socket/Client/abstract-socket-client.d.ts +0 -15
  132. package/lib/Socket/Client/index.d.ts +0 -2
  133. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -12
  134. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  135. package/lib/Socket/Client/types.d.ts +0 -17
  136. package/lib/Socket/Client/types.js +0 -13
  137. package/lib/Socket/Client/websocket.d.ts +0 -12
  138. package/lib/Socket/Client/websocket.js +0 -62
  139. package/lib/Socket/business.d.ts +0 -170
  140. package/lib/Socket/chats.d.ts +0 -81
  141. package/lib/Socket/groups.d.ts +0 -115
  142. package/lib/Socket/index.d.ts +0 -172
  143. package/lib/Socket/messages-recv.d.ts +0 -158
  144. package/lib/Socket/messages-send.d.ts +0 -155
  145. package/lib/Socket/newsletter.d.ts +0 -132
  146. package/lib/Socket/registration.d.ts +0 -264
  147. package/lib/Socket/socket.d.ts +0 -44
  148. package/lib/Socket/usync.d.ts +0 -37
  149. package/lib/Socket/usync.js +0 -70
  150. package/lib/Store/index.d.ts +0 -3
  151. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  152. package/lib/Store/make-in-memory-store.d.ts +0 -118
  153. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  154. package/lib/Store/object-repository.d.ts +0 -10
  155. package/lib/Types/Auth.d.ts +0 -109
  156. package/lib/Types/Call.d.ts +0 -13
  157. package/lib/Types/Chat.d.ts +0 -107
  158. package/lib/Types/Events.d.ts +0 -172
  159. package/lib/Types/GroupMetadata.d.ts +0 -56
  160. package/lib/Types/Label.d.ts +0 -46
  161. package/lib/Types/Message.d.ts +0 -433
  162. package/lib/Types/Newsletter.d.ts +0 -92
  163. package/lib/Types/Product.d.ts +0 -78
  164. package/lib/Types/Signal.d.ts +0 -57
  165. package/lib/Types/State.d.ts +0 -27
  166. package/lib/Types/USync.d.ts +0 -25
  167. package/lib/Types/USync.js +0 -2
  168. package/lib/Types/index.d.ts +0 -66
  169. package/lib/Utils/auth-utils.d.ts +0 -18
  170. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  171. package/lib/Utils/baileys-event-stream.js +0 -63
  172. package/lib/Utils/business.d.ts +0 -22
  173. package/lib/Utils/chat-utils.d.ts +0 -70
  174. package/lib/Utils/crypto.d.ts +0 -40
  175. package/lib/Utils/decode-wa-message.d.ts +0 -36
  176. package/lib/Utils/decode-wa-message.js +0 -226
  177. package/lib/Utils/event-buffer.d.ts +0 -35
  178. package/lib/Utils/generics.d.ts +0 -88
  179. package/lib/Utils/history.d.ts +0 -19
  180. package/lib/Utils/index.d.ts +0 -17
  181. package/lib/Utils/link-preview.d.ts +0 -21
  182. package/lib/Utils/logger.d.ts +0 -2
  183. package/lib/Utils/lt-hash.d.ts +0 -12
  184. package/lib/Utils/make-mutex.d.ts +0 -7
  185. package/lib/Utils/messages-media.d.ts +0 -113
  186. package/lib/Utils/messages.d.ts +0 -77
  187. package/lib/Utils/noise-handler.d.ts +0 -20
  188. package/lib/Utils/process-message.d.ts +0 -41
  189. package/lib/Utils/signal.d.ts +0 -33
  190. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -12
  191. package/lib/Utils/validate-connection.d.ts +0 -11
  192. package/lib/WABinary/constants.d.ts +0 -27
  193. package/lib/WABinary/decode.d.ts +0 -6
  194. package/lib/WABinary/encode.d.ts +0 -2
  195. package/lib/WABinary/generic-utils.d.ts +0 -14
  196. package/lib/WABinary/index.d.ts +0 -5
  197. package/lib/WABinary/jid-utils.d.ts +0 -31
  198. package/lib/WABinary/types.d.ts +0 -18
  199. package/lib/WAM/BinaryInfo.d.ts +0 -8
  200. package/lib/WAM/constants.d.ts +0 -38
  201. package/lib/WAM/encode.d.ts +0 -2
  202. package/lib/WAM/index.d.ts +0 -3
  203. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  204. package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -32
  205. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  206. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -57
  207. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  208. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -30
  209. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  210. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -42
  211. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  212. package/lib/WAUSync/Protocols/index.js +0 -20
  213. package/lib/WAUSync/USyncQuery.d.ts +0 -26
  214. package/lib/WAUSync/USyncQuery.js +0 -79
  215. package/lib/WAUSync/USyncUser.d.ts +0 -10
  216. package/lib/WAUSync/USyncUser.js +0 -22
  217. package/lib/WAUSync/index.d.ts +0 -3
  218. package/lib/WAUSync/index.js +0 -19
  219. /package/{lib → src}/Defaults/phonenumber-mcc.json +0 -0
  220. /package/{lib → src}/Socket/Client/abstract-socket-client.js +0 -0
  221. /package/{lib → src}/Store/index.js +0 -0
  222. /package/{lib → src}/Store/make-ordered-dictionary.js +0 -0
  223. /package/{lib → src}/Types/Auth.js +0 -0
  224. /package/{lib → src}/Types/Call.js +0 -0
  225. /package/{lib → src}/Types/Chat.js +0 -0
  226. /package/{lib → src}/Types/Contact.js +0 -0
  227. /package/{lib → src}/Types/Events.js +0 -0
  228. /package/{lib → src}/Types/GroupMetadata.js +0 -0
  229. /package/{lib → src}/Types/Label.js +0 -0
  230. /package/{lib → src}/Types/LabelAssociation.js +0 -0
  231. /package/{lib → src}/Types/Message.js +0 -0
  232. /package/{lib → src}/Types/Newsletter.js +0 -0
  233. /package/{lib → src}/Types/Product.js +0 -0
  234. /package/{lib → src}/Types/Signal.js +0 -0
  235. /package/{lib → src}/Types/Socket.js +0 -0
  236. /package/{lib → src}/Types/State.js +0 -0
  237. /package/{lib → src}/Types/index.js +0 -0
  238. /package/{lib → src}/Utils/index.js +0 -0
  239. /package/{lib → src}/Utils/logger.js +0 -0
  240. /package/{lib → src}/Utils/lt-hash.js +0 -0
  241. /package/{lib → src}/Utils/noise-handler.js +0 -0
  242. /package/{lib → src}/WABinary/constants.js +0 -0
  243. /package/{lib → src}/WABinary/decode.js +0 -0
  244. /package/{lib → src}/WABinary/generic-utils.js +0 -0
  245. /package/{lib → src}/WABinary/index.js +0 -0
  246. /package/{lib → src}/WABinary/jid-utils.js +0 -0
  247. /package/{lib → src}/WABinary/types.js +0 -0
  248. /package/{lib → src}/WAM/BinaryInfo.js +0 -0
  249. /package/{lib → src}/WAM/constants.js +0 -0
  250. /package/{lib → src}/WAM/encode.js +0 -0
  251. /package/{lib → src}/WAM/index.js +0 -0
  252. /package/{lib → src}/gifted +0 -0
@@ -1,264 +0,0 @@
1
- import axios, { AxiosRequestConfig } from 'axios';
2
- import { KeyPair, SignedKeyPair, SocketConfig } from '../Types';
3
- export declare const makeRegistrationSocket: (config: SocketConfig) => {
4
- register: (code: string) => Promise<ExistsResponse>;
5
- requestRegistrationCode: (registrationOptions?: RegistrationOptions) => Promise<ExistsResponse>;
6
- logger: Logger;
7
- getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
8
- getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
9
- products: import("../Types").Product[];
10
- nextPageCursor: any;
11
- }>;
12
- getCollections: (jid?: string, limit?: number) => Promise<{
13
- collections: import("../Types").CatalogCollection[];
14
- }>;
15
- productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
16
- productDelete: (productIds: string[]) => Promise<{
17
- deleted: number;
18
- }>;
19
- productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
20
- sendMessageAck: ({ tag, attrs, content }: import("../WABinary").BinaryNode, errorCode?: number) => Promise<void>;
21
- sendRetryRequest: (node: import("../WABinary").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
22
- offerCall: (toJid: string, isVideo?: boolean) => Promise<{
23
- id: any;
24
- to: string;
25
- }>;
26
- rejectCall: (callId: string, callFrom: string) => Promise<void>;
27
- fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
28
- requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
29
- getPrivacyTokens: (jids: string[]) => Promise<import("../WABinary").BinaryNode>;
30
- assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
31
- relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
32
- sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
33
- sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
34
- getButtonArgs: (message: import("../Types").WAProto.IMessage) => import("../WABinary").BinaryNode["attrs"];
35
- readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
36
- refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
37
- getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
38
- sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
39
- createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("../WABinary").BinaryNode["attrs"]) => Promise<{
40
- nodes: import("../WABinary").BinaryNode[];
41
- shouldIncludeDeviceIdentity: boolean;
42
- }>;
43
- waUploadToServer: import("../Types").WAMediaUploadFunction;
44
- fetchPrivacySettings: (force?: boolean) => Promise<{
45
- [_: string]: string;
46
- }>;
47
- updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
48
- sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<import("../Types").WAProto.WebMessageInfo>;
49
- sendAlbumMessage: (jid: string, medias: import("../Types").Media[], options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
50
- sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
51
- subscribeNewsletterUpdates: (jid: string) => Promise<{
52
- duration: string;
53
- }>;
54
- newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
55
- newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
56
- newsletterUpdateName: (jid: string, name: string) => Promise<void>;
57
- newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
58
- newsletterRemovePicture: (jid: string) => Promise<void>;
59
- newsletterUnfollow: (jid: string) => Promise<void>;
60
- newsletterFollow: (jid: string) => Promise<void>;
61
- newsletterUnmute: (jid: string) => Promise<void>;
62
- newsletterMute: (jid: string) => Promise<void>;
63
- newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
64
- newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
65
- newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
66
- newsletterAdminCount: (jid: string) => Promise<number>;
67
- newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
68
- newsletterDemote: (jid: string, user: string) => Promise<void>;
69
- newsletterDelete: (jid: string) => Promise<void>;
70
- newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
71
- newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
72
- newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
73
- groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
74
- groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
75
- groupLeave: (id: string) => Promise<void>;
76
- groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
77
- groupRequestParticipantsList: (jid: string) => Promise<{
78
- [key: string]: string;
79
- }[]>;
80
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
81
- status: string;
82
- jid: string;
83
- }[]>;
84
- groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
85
- status: string;
86
- jid: string;
87
- content: import("../WABinary").BinaryNode;
88
- }[]>;
89
- groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
90
- groupInviteCode: (jid: string) => Promise<string | undefined>;
91
- groupRevokeInvite: (jid: string) => Promise<string | undefined>;
92
- groupAcceptInvite: (code: string) => Promise<string | undefined>;
93
- groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
94
- groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
95
- groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
96
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
97
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
98
- groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
99
- groupFetchAllParticipating: () => Promise<{
100
- [_: string]: import("../Types").GroupMetadata;
101
- }>;
102
- processingMutex: {
103
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
104
- };
105
- upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
106
- appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
107
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
108
- presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
109
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
110
- onWhatsApp: (...jids: string[]) => Promise<{
111
- exists: boolean;
112
- jid: string;
113
- }[]>;
114
- fetchBlocklist: () => Promise<string[]>;
115
- fetchStatus: (jid: string) => Promise<{
116
- status: string | undefined;
117
- setAt: Date;
118
- } | undefined>;
119
- updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
120
- removeProfilePicture: (jid: string) => Promise<void>;
121
- updateProfileStatus: (status: string) => Promise<void>;
122
- updateProfileName: (name: string) => Promise<void>;
123
- updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
124
- updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
125
- updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
126
- updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
127
- updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
128
- updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
129
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
130
- updateDefaultDisappearingMode: (duration: number) => Promise<void>;
131
- getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
132
- resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
133
- chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
134
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
135
- addChatLabel: (jid: string, labelId: string) => Promise<void>;
136
- removeChatLabel: (jid: string, labelId: string) => Promise<void>;
137
- addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
138
- removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
139
- star: (jid: string, messages: {
140
- id: string;
141
- fromMe?: boolean;
142
- }[], star: boolean) => Promise<void>;
143
- type: "md";
144
- ws: any;
145
- ev: import("../Types").BaileysEventEmitter & {
146
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
147
- buffer(): void;
148
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
149
- flush(force?: boolean): boolean;
150
- isBuffering(): boolean;
151
- };
152
- authState: {
153
- creds: import("../Types").AuthenticationCreds;
154
- keys: import("../Types").SignalKeyStoreWithTransaction;
155
- };
156
- signalRepository: import("../Types").SignalRepository;
157
- user: import("../Types").Contact | undefined;
158
- generateMessageTag: () => string;
159
- query: (node: import("../WABinary").BinaryNode, timeoutMs?: number) => Promise<import("../WABinary").BinaryNode>;
160
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
161
- waitForSocketOpen: () => Promise<void>;
162
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
163
- sendNode: (frame: import("../WABinary").BinaryNode) => Promise<void>;
164
- logout: (msg?: string) => Promise<void>;
165
- end: (error: Error | undefined) => void;
166
- onUnexpectedError: (err: Error | axios, msg: string) => void;
167
- uploadPreKeys: (count?: number) => Promise<void>;
168
- uploadPreKeysToServerIfRequired: () => Promise<void>;
169
- requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
170
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
171
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../WABinary").BinaryNode>;
172
- };
173
- export interface RegistrationData {
174
- registrationId: number;
175
- signedPreKey: SignedKeyPair;
176
- noiseKey: KeyPair;
177
- signedIdentityKey: KeyPair;
178
- identityId: Buffer;
179
- phoneId: string;
180
- deviceId: string;
181
- backupToken: Buffer;
182
- }
183
- export interface RegistrationOptions {
184
- /** your phone number */
185
- phoneNumber?: string;
186
- /** the country code of your phone number */
187
- phoneNumberCountryCode: string;
188
- /** your phone number without country code */
189
- phoneNumberNationalNumber: string;
190
- /** the country code of your mobile network
191
- * @see {@link https://de.wikipedia.org/wiki/Mobile_Country_Code}
192
- */
193
- phoneNumberMobileCountryCode: string;
194
- /** the network code of your mobile network
195
- * @see {@link https://de.wikipedia.org/wiki/Mobile_Network_Code}
196
- */
197
- phoneNumberMobileNetworkCode: string;
198
- /**
199
- * How to send the one time code
200
- */
201
- method?: 'sms' | 'voice' | 'captcha';
202
- /**
203
- * The captcha code if it was requested
204
- */
205
- captcha?: string;
206
- }
207
- export type RegistrationParams = RegistrationData & RegistrationOptions;
208
- export declare function registrationParams(params: RegistrationParams): {
209
- cc: string;
210
- in: string;
211
- Rc: string;
212
- lg: string;
213
- lc: string;
214
- mistyped: string;
215
- authkey: any;
216
- e_regid: any;
217
- e_keytype: string;
218
- e_ident: any;
219
- e_skey_id: string;
220
- e_skey_val: any;
221
- e_skey_sig: any;
222
- fdid: string;
223
- network_ratio_type: string;
224
- expid: string;
225
- simnum: string;
226
- hasinrc: string;
227
- pid: string;
228
- id: string;
229
- backup_token: string;
230
- token: any;
231
- fraud_checkpoint_code: string | undefined;
232
- };
233
- /**
234
- * Requests a registration code for the given phone number.
235
- */
236
- export declare function mobileRegisterCode(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
237
- export declare function mobileRegisterExists(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
238
- /**
239
- * Registers the phone number on whatsapp with the received OTP code.
240
- */
241
- export declare function mobileRegister(params: RegistrationParams & {
242
- code: string;
243
- }, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
244
- /**
245
- * Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
246
- */
247
- export declare function mobileRegisterEncrypt(data: string): any;
248
- export declare function mobileRegisterFetch(path: string, opts?: AxiosRequestConfig): Promise<ExistsResponse>;
249
- export interface ExistsResponse {
250
- status: 'fail' | 'sent';
251
- voice_length?: number;
252
- voice_wait?: number;
253
- sms_length?: number;
254
- sms_wait?: number;
255
- reason?: 'incorrect' | 'missing_param' | 'code_checkpoint';
256
- login?: string;
257
- flash_type?: number;
258
- ab_hash?: string;
259
- ab_key?: string;
260
- exp_cfg?: string;
261
- lid?: string;
262
- image_blob?: string;
263
- audio_blob?: string;
264
- }
@@ -1,44 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Boom } from '@hapi/boom';
4
- import { SocketConfig } from '../Types';
5
- import { BinaryNode } from '../WABinary';
6
- /**
7
- * Connects to WA servers and performs:
8
- * - simple queries (no retry mechanism, wait for connection establishment)
9
- * - listen to messages and emit events
10
- * - query phone connection
11
- */
12
- export declare const makeSocket: (config: SocketConfig) => {
13
- type: "md";
14
- ws: any;
15
- ev: import("../Types").BaileysEventEmitter & {
16
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
17
- buffer(): void;
18
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
19
- flush(force?: boolean | undefined): boolean;
20
- isBuffering(): boolean;
21
- };
22
- authState: {
23
- creds: import("../Types").AuthenticationCreds;
24
- keys: import("../Types").SignalKeyStoreWithTransaction;
25
- };
26
- signalRepository: import("../Types").SignalRepository;
27
- readonly user: import("../Types").Contact | undefined;
28
- generateMessageTag: () => string;
29
- query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
30
- waitForMessage: <T_1>(msgId: string, timeoutMs?: number | undefined) => Promise<T_1>;
31
- waitForSocketOpen: () => Promise<void>;
32
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
33
- sendNode: (frame: BinaryNode) => Promise<void>;
34
- logout: (msg?: string) => Promise<void>;
35
- end: (error: Error | undefined) => void;
36
- onUnexpectedError: (err: Error | Boom, msg: string) => void;
37
- uploadPreKeys: (count?: number) => Promise<void>;
38
- uploadPreKeysToServerIfRequired: () => Promise<void>;
39
- requestPairingCode: (phoneNumber: string) => Promise<string>;
40
- /** Waits for the connection to WA to reach a state */
41
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
42
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
43
- };
44
- export type Socket = ReturnType<typeof makeSocket>;
@@ -1,37 +0,0 @@
1
- /// <reference types="node" />
2
- import { Boom } from '@hapi/boom';
3
- import { SocketConfig } from '../Types';
4
- import { BinaryNode } from '../WABinary';
5
- import { USyncQuery } from '../WAUSync';
6
- export declare const makeUSyncSocket: (config: SocketConfig) => {
7
- executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
8
- type: "md";
9
- ws: any;
10
- ev: import("../Types").BaileysEventEmitter & {
11
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
12
- buffer(): void;
13
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
14
- flush(force?: boolean | undefined): boolean;
15
- isBuffering(): boolean;
16
- };
17
- authState: {
18
- creds: import("../Types").AuthenticationCreds;
19
- keys: import("../Types").SignalKeyStoreWithTransaction;
20
- };
21
- signalRepository: import("../Types").SignalRepository;
22
- user: import("../Types").Contact | undefined;
23
- generateMessageTag: () => string;
24
- query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
25
- waitForMessage: <T_1>(msgId: string, timeoutMs?: number | undefined) => Promise<T_1>;
26
- waitForSocketOpen: () => Promise<void>;
27
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
28
- sendNode: (frame: BinaryNode) => Promise<void>;
29
- logout: (msg?: string | undefined) => Promise<void>;
30
- end: (error: Error | undefined) => void;
31
- onUnexpectedError: (err: Error | Boom<any>, msg: string) => void;
32
- uploadPreKeys: (count?: number) => Promise<void>;
33
- uploadPreKeysToServerIfRequired: () => Promise<void>;
34
- requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
35
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
36
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
37
- };
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeUSyncSocket = void 0;
4
- const boom_1 = require("@hapi/boom");
5
- const WABinary_1 = require("../WABinary");
6
- const socket_1 = require("./socket");
7
- const makeUSyncSocket = (config) => {
8
- const sock = (0, socket_1.makeSocket)(config);
9
- const { generateMessageTag, query, } = sock;
10
- const executeUSyncQuery = async (usyncQuery) => {
11
- if (usyncQuery.protocols.length === 0) {
12
- throw new boom_1.Boom('USyncQuery must have at least one protocol');
13
- }
14
- // todo: validate users, throw WARNING on no valid users
15
- // variable below has only validated users
16
- const validUsers = usyncQuery.users;
17
- const userNodes = validUsers.map((user) => {
18
- return {
19
- tag: 'user',
20
- attrs: {
21
- jid: !user.phone ? user.id : undefined,
22
- },
23
- content: usyncQuery.protocols
24
- .map((a) => a.getUserElement(user))
25
- .filter(a => a !== null)
26
- };
27
- });
28
- const listNode = {
29
- tag: 'list',
30
- attrs: {},
31
- content: userNodes
32
- };
33
- const queryNode = {
34
- tag: 'query',
35
- attrs: {},
36
- content: usyncQuery.protocols.map((a) => a.getQueryElement())
37
- };
38
- const iq = {
39
- tag: 'iq',
40
- attrs: {
41
- to: WABinary_1.S_WHATSAPP_NET,
42
- type: 'get',
43
- xmlns: 'usync',
44
- },
45
- content: [
46
- {
47
- tag: 'usync',
48
- attrs: {
49
- context: usyncQuery.context,
50
- mode: usyncQuery.mode,
51
- sid: generateMessageTag(),
52
- last: 'true',
53
- index: '0',
54
- },
55
- content: [
56
- queryNode,
57
- listNode
58
- ]
59
- }
60
- ],
61
- };
62
- const result = await query(iq);
63
- return usyncQuery.parseUSyncQueryResult(result);
64
- };
65
- return {
66
- ...sock,
67
- executeUSyncQuery,
68
- };
69
- };
70
- exports.makeUSyncSocket = makeUSyncSocket;
@@ -1,3 +0,0 @@
1
- import makeCacheManagerAuthState from './make-cache-manager-store';
2
- import makeInMemoryStore from './make-in-memory-store';
3
- export { makeInMemoryStore, makeCacheManagerAuthState };
@@ -1,14 +0,0 @@
1
- import { Storage } from 'cache-manager';
2
- import { AuthenticationCreds } from '../Types';
3
- declare const makeCacheManagerAuthState: (store: Storage, sessionKey: string) => Promise<{
4
- clearState: () => Promise<void>;
5
- saveCreds: () => Promise<void>;
6
- state: {
7
- creds: AuthenticationCreds;
8
- keys: {
9
- get: (type: string, ids: string[]) => Promise<{}>;
10
- set: (data: any) => Promise<void>;
11
- };
12
- };
13
- }>;
14
- export default makeCacheManagerAuthState;
@@ -1,118 +0,0 @@
1
- import type KeyedDB from '@adiwajshing/keyed-db';
2
- import type { Comparable } from '@adiwajshing/keyed-db/lib/Types';
3
- import type { Logger } from 'pino';
4
- import { proto } from '../../WAProto';
5
- import type makeMDSocket from '../Socket';
6
- import type { BaileysEventEmitter, Chat, ConnectionState, Contact, GroupMetadata, PresenceData, WAMessage, WAMessageCursor, WAMessageKey } from '../Types';
7
- import { Label } from '../Types/Label';
8
- import { LabelAssociation } from '../Types/LabelAssociation';
9
- import { ObjectRepository } from './object-repository';
10
- type WASocket = ReturnType<typeof makeMDSocket>;
11
- export declare const waChatKey: (pin: boolean) => {
12
- key: (c: Chat) => string;
13
- compare: (k1: string, k2: string) => number;
14
- };
15
- export declare const waMessageID: (m: WAMessage) => string;
16
- export declare const waLabelAssociationKey: Comparable<LabelAssociation, string>;
17
- export type BaileysInMemoryStoreConfig = {
18
- chatKey?: Comparable<Chat, string>;
19
- labelAssociationKey?: Comparable<LabelAssociation, string>;
20
- logger?: Logger;
21
- socket?: WASocket;
22
- };
23
- declare const _default: (config: BaileysInMemoryStoreConfig) => {
24
- chats: KeyedDB<Chat, string>;
25
- contacts: {
26
- [_: string]: Contact;
27
- };
28
- messages: {
29
- [_: string]: {
30
- array: proto.IWebMessageInfo[];
31
- get: (id: string) => proto.IWebMessageInfo | undefined;
32
- upsert: (item: proto.IWebMessageInfo, mode: "append" | "prepend") => void;
33
- update: (item: proto.IWebMessageInfo) => boolean;
34
- remove: (item: proto.IWebMessageInfo) => boolean;
35
- updateAssign: (id: string, update: Partial<proto.IWebMessageInfo>) => boolean;
36
- clear: () => void;
37
- filter: (contain: (item: proto.IWebMessageInfo) => boolean) => void;
38
- toJSON: () => proto.IWebMessageInfo[];
39
- fromJSON: (newItems: proto.IWebMessageInfo[]) => void;
40
- };
41
- };
42
- groupMetadata: {
43
- [_: string]: GroupMetadata;
44
- };
45
- state: ConnectionState;
46
- presences: {
47
- [id: string]: {
48
- [participant: string]: PresenceData;
49
- };
50
- };
51
- labels: ObjectRepository<Label>;
52
- labelAssociations: KeyedDB<LabelAssociation, string>;
53
- bind: (ev: BaileysEventEmitter) => void;
54
- /** loads messages from the store, if not found -- uses the legacy connection */
55
- loadMessages: (jid: string, count: number, cursor: WAMessageCursor) => Promise<proto.IWebMessageInfo[]>;
56
- /**
57
- * Get all available labels for profile
58
- *
59
- * Keep in mind that the list is formed from predefined tags and tags
60
- * that were "caught" during their editing.
61
- */
62
- getLabels: () => ObjectRepository<Label>;
63
- /**
64
- * Get labels for chat
65
- *
66
- * @returns Label IDs
67
- **/
68
- getChatLabels: (chatId: string) => LabelAssociation[];
69
- /**
70
- * Get labels for message
71
- *
72
- * @returns Label IDs
73
- **/
74
- getMessageLabels: (messageId: string) => string[];
75
- loadMessage: (jid: string, id: string) => Promise<proto.IWebMessageInfo | undefined>;
76
- mostRecentMessage: (jid: string) => Promise<proto.IWebMessageInfo>;
77
- fetchImageUrl: (jid: string, sock: WASocket | undefined) => Promise<string | null | undefined>;
78
- fetchGroupMetadata: (jid: string, sock: WASocket | undefined) => Promise<GroupMetadata>;
79
- fetchMessageReceipts: ({ remoteJid, id }: WAMessageKey) => Promise<proto.IUserReceipt[] | null | undefined>;
80
- toJSON: () => {
81
- chats: KeyedDB<Chat, string>;
82
- contacts: {
83
- [_: string]: Contact;
84
- };
85
- messages: {
86
- [_: string]: {
87
- array: proto.IWebMessageInfo[];
88
- get: (id: string) => proto.IWebMessageInfo | undefined;
89
- upsert: (item: proto.IWebMessageInfo, mode: "append" | "prepend") => void;
90
- update: (item: proto.IWebMessageInfo) => boolean;
91
- remove: (item: proto.IWebMessageInfo) => boolean;
92
- updateAssign: (id: string, update: Partial<proto.IWebMessageInfo>) => boolean;
93
- clear: () => void;
94
- filter: (contain: (item: proto.IWebMessageInfo) => boolean) => void;
95
- toJSON: () => proto.IWebMessageInfo[];
96
- fromJSON: (newItems: proto.IWebMessageInfo[]) => void;
97
- };
98
- };
99
- labels: ObjectRepository<Label>;
100
- labelAssociations: KeyedDB<LabelAssociation, string>;
101
- };
102
- fromJSON: (json: {
103
- chats: Chat[];
104
- contacts: {
105
- [id: string]: Contact;
106
- };
107
- messages: {
108
- [id: string]: proto.IWebMessageInfo[];
109
- };
110
- labels: {
111
- [labelId: string]: Label;
112
- };
113
- labelAssociations: LabelAssociation[];
114
- }) => void;
115
- writeToFile: (path: string) => void;
116
- readFromFile: (path: string) => void;
117
- };
118
- export default _default;
@@ -1,13 +0,0 @@
1
- declare function makeOrderedDictionary<T>(idGetter: (item: T) => string): {
2
- array: T[];
3
- get: (id: string) => T | undefined;
4
- upsert: (item: T, mode: "append" | "prepend") => void;
5
- update: (item: T) => boolean;
6
- remove: (item: T) => boolean;
7
- updateAssign: (id: string, update: Partial<T>) => boolean;
8
- clear: () => void;
9
- filter: (contain: (item: T) => boolean) => void;
10
- toJSON: () => T[];
11
- fromJSON: (newItems: T[]) => void;
12
- };
13
- export default makeOrderedDictionary;
@@ -1,10 +0,0 @@
1
- export declare class ObjectRepository<T extends object> {
2
- readonly entityMap: Map<string, T>;
3
- constructor(entities?: Record<string, T>);
4
- findById(id: string): T | undefined;
5
- findAll(): T[];
6
- upsertById(id: string, entity: T): Map<string, T>;
7
- deleteById(id: string): boolean;
8
- count(): number;
9
- toJSON(): T[];
10
- }