@aseppxyzz12/baileys 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +2579 -0
  3. package/WAProto/AICommon/AICommon.js +19396 -0
  4. package/WAProto/AICommon/AICommon.proto +820 -0
  5. package/WAProto/Adv/Adv.js +1137 -0
  6. package/WAProto/Adv/Adv.proto +42 -0
  7. package/WAProto/BotMetadata/BotMetadata.js +8975 -0
  8. package/WAProto/BotMetadata/BotMetadata.proto +484 -0
  9. package/WAProto/Cert/Cert.js +893 -0
  10. package/WAProto/Cert/Cert.proto +30 -0
  11. package/WAProto/ChatLockSettings/ChatLockSettings.js +673 -0
  12. package/WAProto/ChatLockSettings/ChatLockSettings.proto +9 -0
  13. package/WAProto/CompanionReg/CompanionReg.js +2457 -0
  14. package/WAProto/CompanionReg/CompanionReg.proto +103 -0
  15. package/WAProto/DeviceCapabilities/DeviceCapabilities.js +846 -0
  16. package/WAProto/DeviceCapabilities/DeviceCapabilities.proto +38 -0
  17. package/WAProto/E2E/E2E.js +78728 -0
  18. package/WAProto/E2E/E2E.proto +1970 -0
  19. package/WAProto/Ephemeral/Ephemeral.js +143 -0
  20. package/WAProto/Ephemeral/Ephemeral.proto +7 -0
  21. package/WAProto/HistorySync/HistorySync.js +95931 -0
  22. package/WAProto/HistorySync/HistorySync.proto +229 -0
  23. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.js +414 -0
  24. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.proto +13 -0
  25. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.js +980 -0
  26. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.proto +38 -0
  27. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +81185 -0
  28. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.proto +88 -0
  29. package/WAProto/MmsRetry/MmsRetry.js +310 -0
  30. package/WAProto/MmsRetry/MmsRetry.proto +19 -0
  31. package/WAProto/Protocol/Protocol.js +399 -0
  32. package/WAProto/Protocol/Protocol.proto +22 -0
  33. package/WAProto/Reporting/Reporting.js +535 -0
  34. package/WAProto/Reporting/Reporting.proto +22 -0
  35. package/WAProto/ServerSync/ServerSync.js +1830 -0
  36. package/WAProto/ServerSync/ServerSync.proto +70 -0
  37. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.js +3267 -0
  38. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.proto +95 -0
  39. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.js +1140 -0
  40. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.proto +44 -0
  41. package/WAProto/StatusAttributions/StatusAttributions.js +1604 -0
  42. package/WAProto/StatusAttributions/StatusAttributions.proto +89 -0
  43. package/WAProto/SyncAction/SyncAction.js +17424 -0
  44. package/WAProto/SyncAction/SyncAction.proto +663 -0
  45. package/WAProto/UserPassword/UserPassword.js +544 -0
  46. package/WAProto/UserPassword/UserPassword.proto +28 -0
  47. package/WAProto/VnameCert/VnameCert.js +1466 -0
  48. package/WAProto/VnameCert/VnameCert.proto +65 -0
  49. package/WAProto/Wa6/Wa6.js +4601 -0
  50. package/WAProto/Wa6/Wa6.proto +241 -0
  51. package/WAProto/Web/Web.js +90819 -0
  52. package/WAProto/Web/Web.proto +605 -0
  53. package/WAProto/index.js +30 -0
  54. package/engine-requirements.js +9 -0
  55. package/lib/Defaults/baileys-version.json +3 -0
  56. package/lib/Defaults/connection.js +39 -0
  57. package/lib/Defaults/constants.js +50 -0
  58. package/lib/Defaults/history.js +13 -0
  59. package/lib/Defaults/index.js +36 -0
  60. package/lib/Defaults/media.js +43 -0
  61. package/lib/Defaults/phonenumber-mcc.json +223 -0
  62. package/lib/Defaults/prefix.js +12 -0
  63. package/lib/Function/Download/tiktok.js +19 -0
  64. package/lib/Function/Tools/bypass.js +19 -0
  65. package/lib/Function/index.js +13 -0
  66. package/lib/Signal/Group/ciphertext-message.js +14 -0
  67. package/lib/Signal/Group/group-session-builder.js +46 -0
  68. package/lib/Signal/Group/group_cipher.js +104 -0
  69. package/lib/Signal/Group/index.js +42 -0
  70. package/lib/Signal/Group/keyhelper.js +21 -0
  71. package/lib/Signal/Group/queue-job.js +57 -0
  72. package/lib/Signal/Group/sender-chain-key.js +34 -0
  73. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  74. package/lib/Signal/Group/sender-key-message.js +78 -0
  75. package/lib/Signal/Group/sender-key-name.js +49 -0
  76. package/lib/Signal/Group/sender-key-record.js +45 -0
  77. package/lib/Signal/Group/sender-key-state.js +100 -0
  78. package/lib/Signal/Group/sender-message-key.js +28 -0
  79. package/lib/Signal/libsignal.js +364 -0
  80. package/lib/Signal/lid-mapping.js +164 -0
  81. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  82. package/lib/Socket/Client/index.js +31 -0
  83. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  84. package/lib/Socket/Client/types.js +12 -0
  85. package/lib/Socket/Client/web-socket-client.js +62 -0
  86. package/lib/Socket/Client/websocket.js +67 -0
  87. package/lib/Socket/business.js +291 -0
  88. package/lib/Socket/chats.js +874 -0
  89. package/lib/Socket/community.js +454 -0
  90. package/lib/Socket/dugong.js +658 -0
  91. package/lib/Socket/groups.js +357 -0
  92. package/lib/Socket/index.js +13 -0
  93. package/lib/Socket/messages-recv.js +1509 -0
  94. package/lib/Socket/messages-send.js +1505 -0
  95. package/lib/Socket/mex.js +54 -0
  96. package/lib/Socket/newsletter.js +171 -0
  97. package/lib/Socket/registration.js +167 -0
  98. package/lib/Socket/rich-content.js +279 -0
  99. package/lib/Socket/socket.js +905 -0
  100. package/lib/Socket/username.js +157 -0
  101. package/lib/Socket/usync.js +70 -0
  102. package/lib/Store/index.js +37 -0
  103. package/lib/Store/keyed-db.js +114 -0
  104. package/lib/Store/make-cache-manager-store.js +77 -0
  105. package/lib/Store/make-in-memory-store.js +423 -0
  106. package/lib/Store/make-ordered-dictionary.js +78 -0
  107. package/lib/Store/object-repository.js +26 -0
  108. package/lib/Types/Auth.js +2 -0
  109. package/lib/Types/Bussines.js +2 -0
  110. package/lib/Types/Call.js +2 -0
  111. package/lib/Types/Chat.js +10 -0
  112. package/lib/Types/Contact.js +2 -0
  113. package/lib/Types/Events.js +2 -0
  114. package/lib/Types/GroupMetadata.js +2 -0
  115. package/lib/Types/Label.js +25 -0
  116. package/lib/Types/LabelAssociation.js +4 -0
  117. package/lib/Types/Message.js +11 -0
  118. package/lib/Types/Mex.js +40 -0
  119. package/lib/Types/MexUpdates.js +15 -0
  120. package/lib/Types/Newsletter.js +32 -0
  121. package/lib/Types/Product.js +2 -0
  122. package/lib/Types/Signal.js +2 -0
  123. package/lib/Types/Socket.js +2 -0
  124. package/lib/Types/State.js +9 -0
  125. package/lib/Types/USync.js +2 -0
  126. package/lib/Types/index.js +60 -0
  127. package/lib/Utils/auth-utils.js +256 -0
  128. package/lib/Utils/baileys-event-stream.js +63 -0
  129. package/lib/Utils/bot-toolkit.js +455 -0
  130. package/lib/Utils/browser-utils.js +29 -0
  131. package/lib/Utils/business.js +233 -0
  132. package/lib/Utils/chat-utils.js +904 -0
  133. package/lib/Utils/companion-reg-client-utils.js +41 -0
  134. package/lib/Utils/crypto.js +144 -0
  135. package/lib/Utils/decode-wa-message.js +305 -0
  136. package/lib/Utils/event-buffer.js +555 -0
  137. package/lib/Utils/generics.js +411 -0
  138. package/lib/Utils/history.js +100 -0
  139. package/lib/Utils/identity-change-handler.js +53 -0
  140. package/lib/Utils/index.js +57 -0
  141. package/lib/Utils/link-preview.js +76 -0
  142. package/lib/Utils/logger.js +4 -0
  143. package/lib/Utils/lt-hash.js +45 -0
  144. package/lib/Utils/make-mutex.js +33 -0
  145. package/lib/Utils/message-composer.js +289 -0
  146. package/lib/Utils/message-retry-manager.js +134 -0
  147. package/lib/Utils/messages-media.js +806 -0
  148. package/lib/Utils/messages.js +1908 -0
  149. package/lib/Utils/noise-handler.js +157 -0
  150. package/lib/Utils/offline-node-processor.js +42 -0
  151. package/lib/Utils/pre-key-manager.js +86 -0
  152. package/lib/Utils/process-message.js +814 -0
  153. package/lib/Utils/reporting-utils.js +264 -0
  154. package/lib/Utils/signal.js +183 -0
  155. package/lib/Utils/stanza-ack.js +36 -0
  156. package/lib/Utils/sync-action-utils.js +52 -0
  157. package/lib/Utils/tc-token-utils.js +167 -0
  158. package/lib/Utils/use-multi-file-auth-state.js +104 -0
  159. package/lib/Utils/validate-connection.js +229 -0
  160. package/lib/Utils/vialeys-event-stream.js +41 -0
  161. package/lib/WABinary/constants.js +1308 -0
  162. package/lib/WABinary/decode.js +233 -0
  163. package/lib/WABinary/encode.js +212 -0
  164. package/lib/WABinary/generic-utils.js +124 -0
  165. package/lib/WABinary/index.js +36 -0
  166. package/lib/WABinary/jid-utils.js +101 -0
  167. package/lib/WABinary/types.js +2 -0
  168. package/lib/WAM/BinaryInfo.js +12 -0
  169. package/lib/WAM/constants.js +20491 -0
  170. package/lib/WAM/encode.js +148 -0
  171. package/lib/WAM/index.js +34 -0
  172. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +62 -0
  173. package/lib/WAUSync/Protocols/USyncContactProtocol.js +38 -0
  174. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +50 -0
  175. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +25 -0
  176. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +24 -0
  177. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +32 -0
  178. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
  179. package/lib/WAUSync/Protocols/index.js +38 -0
  180. package/lib/WAUSync/USyncQuery.js +97 -0
  181. package/lib/WAUSync/USyncUser.js +33 -0
  182. package/lib/WAUSync/index.js +34 -0
  183. package/lib/index.js +113 -0
  184. package/lib/messages-send.js +1496 -0
  185. package/package.json +100 -0
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const UNAUTHORIZED_CODES = [401, 403, 419];
4
+ const PHONENUMBER_MCC = require("./phonenumber-mcc.json");
5
+ const DEFAULT_ORIGIN = "https://web.whatsapp.com";
6
+ const PHONE_CONNECTION_CB = "CB:Pong";
7
+ const WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0]);
8
+ const WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1]);
9
+ const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5]);
10
+ const WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6]);
11
+ const WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
12
+ const NOISE_MODE = "Noise_XX_25519_AESGCM_SHA256\0\0\0\0";
13
+ const DICT_VERSION = 3;
14
+ const KEY_BUNDLE_TYPE = Buffer.from([5]);
15
+ const NOISE_WA_HEADER = Buffer.from([87, 65, 6, DICT_VERSION]);
16
+ const URL_REGEX =
17
+ /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
18
+ const MIN_PREKEY_COUNT = 5;
19
+ const INITIAL_PREKEY_COUNT = 812;
20
+ const UPLOAD_TIMEOUT = 3e4;
21
+ const MIN_UPLOAD_INTERVAL = 5e3;
22
+ const WA_CERT_DETAILS = { SERIAL: 0 };
23
+ const DEFAULT_CACHE_TTLS = {
24
+ SIGNAL_STORE: 5 * 60,
25
+ MSG_RETRY: 60 * 60,
26
+ CALL_OFFER: 5 * 60,
27
+ USER_DEVICES: 5 * 60,
28
+ };
29
+ module.exports = {
30
+ UNAUTHORIZED_CODES: UNAUTHORIZED_CODES,
31
+ PHONENUMBER_MCC: PHONENUMBER_MCC,
32
+ DEFAULT_ORIGIN: DEFAULT_ORIGIN,
33
+ PHONE_CONNECTION_CB: PHONE_CONNECTION_CB,
34
+ WA_ADV_ACCOUNT_SIG_PREFIX: WA_ADV_ACCOUNT_SIG_PREFIX,
35
+ WA_ADV_DEVICE_SIG_PREFIX: WA_ADV_DEVICE_SIG_PREFIX,
36
+ WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX: WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX,
37
+ WA_ADV_HOSTED_DEVICE_SIG_PREFIX: WA_ADV_HOSTED_DEVICE_SIG_PREFIX,
38
+ WA_DEFAULT_EPHEMERAL: WA_DEFAULT_EPHEMERAL,
39
+ NOISE_MODE: NOISE_MODE,
40
+ DICT_VERSION: DICT_VERSION,
41
+ KEY_BUNDLE_TYPE: KEY_BUNDLE_TYPE,
42
+ NOISE_WA_HEADER: NOISE_WA_HEADER,
43
+ URL_REGEX: URL_REGEX,
44
+ MIN_PREKEY_COUNT: MIN_PREKEY_COUNT,
45
+ MIN_UPLOAD_INTERVAL: MIN_UPLOAD_INTERVAL,
46
+ INITIAL_PREKEY_COUNT: INITIAL_PREKEY_COUNT,
47
+ UPLOAD_TIMEOUT: UPLOAD_TIMEOUT,
48
+ WA_CERT_DETAILS: WA_CERT_DETAILS,
49
+ DEFAULT_CACHE_TTLS: DEFAULT_CACHE_TTLS,
50
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { proto: proto } = require("../../WAProto");
4
+ const PROCESSABLE_HISTORY_TYPES = [
5
+ proto.Message.HistorySyncType.INITIAL_BOOTSTRAP,
6
+ proto.Message.HistorySyncType.PUSH_NAME,
7
+ proto.Message.HistorySyncType.RECENT,
8
+ proto.Message.HistorySyncType.FULL,
9
+ proto.Message.HistorySyncType.ON_DEMAND,
10
+ proto.HistorySync.HistorySyncType.NON_BLOCKING_DATA,
11
+ proto.HistorySync.HistorySyncType.INITIAL_STATUS_V3,
12
+ ];
13
+ module.exports = { PROCESSABLE_HISTORY_TYPES: PROCESSABLE_HISTORY_TYPES };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ const __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ let desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ });
22
+ const __exportStar =
23
+ (this && this.__exportStar) ||
24
+ function (m, exports) {
25
+ for (var p in m) {
26
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) {
27
+ __createBinding(exports, m, p);
28
+ }
29
+ }
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ __exportStar(require("./connection"), exports);
33
+ __exportStar(require("./constants"), exports);
34
+ __exportStar(require("./history"), exports);
35
+ __exportStar(require("./media"), exports);
36
+ __exportStar(require("./prefix"), exports);
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const MEDIA_PATH_MAP = {
4
+ image: "/mms/image",
5
+ video: "/mms/video",
6
+ document: "/mms/document",
7
+ audio: "/mms/audio",
8
+ sticker: "/mms/image",
9
+ "sticker-pack": "/mms/sticker",
10
+ "thumbnail-link": "/mms/image",
11
+ "product-catalog-image": "/product/image",
12
+ "md-app-state": "",
13
+ "md-msg-hist": "/mms/md-app-state",
14
+ "biz-cover-photo": "/pps/biz-cover-photo",
15
+ };
16
+ const MEDIA_HKDF_KEY_MAPPING = {
17
+ audio: "Audio",
18
+ document: "Document",
19
+ gif: "Video",
20
+ image: "Image",
21
+ ppic: "",
22
+ product: "Image",
23
+ ptt: "Audio",
24
+ video: "Video",
25
+ sticker: "Image",
26
+ "sticker-pack": "Sticker Pack",
27
+ "thumbnail-document": "Document Thumbnail",
28
+ "thumbnail-image": "Image Thumbnail",
29
+ "thumbnail-video": "Video Thumbnail",
30
+ "thumbnail-link": "Link Thumbnail",
31
+ "md-msg-hist": "History",
32
+ "md-app-state": "App State",
33
+ "product-catalog-image": "",
34
+ "payment-bg-image": "Payment Background",
35
+ ptv: "Video",
36
+ "biz-cover-photo": "Image",
37
+ };
38
+ const MEDIA_KEYS = Object.keys(MEDIA_PATH_MAP);
39
+ module.exports = {
40
+ MEDIA_KEYS: MEDIA_KEYS,
41
+ MEDIA_PATH_MAP: MEDIA_PATH_MAP,
42
+ MEDIA_HKDF_KEY_MAPPING: MEDIA_HKDF_KEY_MAPPING,
43
+ };
@@ -0,0 +1,223 @@
1
+ {
2
+ "93": 412,
3
+ "355": 276,
4
+ "213": 603,
5
+ "1-684": 544,
6
+ "376": 213,
7
+ "244": 631,
8
+ "1-264": 365,
9
+ "1-268": 344,
10
+ "54": 722,
11
+ "374": 283,
12
+ "297": 363,
13
+ "61": 505,
14
+ "43": 232,
15
+ "994": 400,
16
+ "1-242": 364,
17
+ "973": 426,
18
+ "880": 470,
19
+ "1-246": 342,
20
+ "375": 257,
21
+ "32": 206,
22
+ "501": 702,
23
+ "229": 616,
24
+ "1-441": 350,
25
+ "975": 402,
26
+ "591": 736,
27
+ "387": 218,
28
+ "267": 652,
29
+ "55": 724,
30
+ "1-284": 348,
31
+ "673": 528,
32
+ "359": 284,
33
+ "226": 613,
34
+ "257": 642,
35
+ "855": 456,
36
+ "237": 624,
37
+ "238": 625,
38
+ "1-345": 346,
39
+ "236": 623,
40
+ "235": 622,
41
+ "56": 730,
42
+ "86": 454,
43
+ "57": 732,
44
+ "269": 654,
45
+ "682": 548,
46
+ "506": 712,
47
+ "385": 219,
48
+ "53": 368,
49
+ "357": 280,
50
+ "420": 230,
51
+ "243": 630,
52
+ "45": 238,
53
+ "253": 638,
54
+ "1-767": 366,
55
+ "1-809": 370,
56
+ "1-849": 370,
57
+ "1-829": 370,
58
+ "593": 740,
59
+ "20": 602,
60
+ "503": 706,
61
+ "240": 627,
62
+ "291": 657,
63
+ "372": 248,
64
+ "251": 636,
65
+ "500": 750,
66
+ "298": 288,
67
+ "679": 542,
68
+ "358": 244,
69
+ "33": 208,
70
+ "689": 547,
71
+ "241": 628,
72
+ "220": 607,
73
+ "995": 282,
74
+ "49": 262,
75
+ "233": 620,
76
+ "350": 266,
77
+ "30": 202,
78
+ "299": 290,
79
+ "1-473": 352,
80
+ "1-671": 535,
81
+ "502": 704,
82
+ "224": 537,
83
+ "592": 738,
84
+ "509": 372,
85
+ "504": 708,
86
+ "852": 454,
87
+ "36": 216,
88
+ "354": 274,
89
+ "91": 404,
90
+ "62": 510,
91
+ "98": 432,
92
+ "964": 418,
93
+ "353": 234,
94
+ "972": 425,
95
+ "39": 222,
96
+ "225": 612,
97
+ "1-876": 338,
98
+ "81": 440,
99
+ "962": 416,
100
+ "254": 639,
101
+ "686": 545,
102
+ "383": 221,
103
+ "965": 419,
104
+ "371": 247,
105
+ "961": 415,
106
+ "266": 651,
107
+ "231": 618,
108
+ "218": 606,
109
+ "423": 295,
110
+ "370": 246,
111
+ "352": 270,
112
+ "389": 294,
113
+ "261": 646,
114
+ "265": 650,
115
+ "60": 502,
116
+ "960": 472,
117
+ "223": 610,
118
+ "356": 278,
119
+ "692": 551,
120
+ "222": 609,
121
+ "230": 617,
122
+ "52": 334,
123
+ "691": 550,
124
+ "373": 259,
125
+ "377": 212,
126
+ "976": 428,
127
+ "382": 297,
128
+ "1-664": 354,
129
+ "212": 604,
130
+ "258": 643,
131
+ "95": 414,
132
+ "264": 649,
133
+ "674": 536,
134
+ "977": 429,
135
+ "31": 204,
136
+ "687": 546,
137
+ "64": 530,
138
+ "505": 710,
139
+ "227": 614,
140
+ "234": 621,
141
+ "683": 555,
142
+ "1-670": 534,
143
+ "47": 242,
144
+ "968": 226,
145
+ "92": 410,
146
+ "680": 552,
147
+ "970": 423,
148
+ "507": 714,
149
+ "675": 537,
150
+ "595": 744,
151
+ "51": 716,
152
+ "63": 515,
153
+ "48": 260,
154
+ "351": 268,
155
+ "1-787, 1-939": 330,
156
+ "974": 427,
157
+ "242": 630,
158
+ "40": 226,
159
+ "7": 250,
160
+ "250": 635,
161
+ "290": 658,
162
+ "1-869": 356,
163
+ "1-758": 358,
164
+ "508": 308,
165
+ "1-784": 360,
166
+ "685": 544,
167
+ "378": 292,
168
+ "239": 626,
169
+ "966": 420,
170
+ "221": 608,
171
+ "381": 220,
172
+ "248": 633,
173
+ "232": 619,
174
+ "65": 525,
175
+ "386": 293,
176
+ "677": 540,
177
+ "27": 655,
178
+ "211": 659,
179
+ "34": 214,
180
+ "94": 413,
181
+ "249": 634,
182
+ "597": 746,
183
+ "268": 653,
184
+ "46": 240,
185
+ "41": 228,
186
+ "963": 417,
187
+ "886": 466,
188
+ "992": 436,
189
+ "255": 640,
190
+ "66": 520,
191
+ "228": 615,
192
+ "690": 554,
193
+ "676": 539,
194
+ "1-868": 374,
195
+ "216": 605,
196
+ "90": 286,
197
+ "993": 438,
198
+ "1-649": 376,
199
+ "688": 553,
200
+ "1-340": 332,
201
+ "256": 641,
202
+ "380": 255,
203
+ "971": 424,
204
+ "44": 234,
205
+ "1": 310,
206
+ "598": 748,
207
+ "998": 434,
208
+ "678": 541,
209
+ "379": 225,
210
+ "58": 734,
211
+ "681": 543,
212
+ "967": 421,
213
+ "260": 645,
214
+ "263": 648,
215
+ "670": 514,
216
+ "245": 632,
217
+ "856": 457,
218
+ "599": 362,
219
+ "850": 467,
220
+ "262": 647,
221
+ "82": 450,
222
+ "84": 452
223
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const DEF_TAG_PREFIX = "TAG:";
4
+ const DEF_CALLBACK_PREFIX = "CB:";
5
+ const CALL_VIDEO_PREFIX = "https://call.whatsapp.com/video/";
6
+ const CALL_AUDIO_PREFIX = "https://call.whatsapp.com/voice/";
7
+ module.exports = {
8
+ DEF_TAG_PREFIX: DEF_TAG_PREFIX,
9
+ DEF_CALLBACK_PREFIX: DEF_CALLBACK_PREFIX,
10
+ CALL_VIDEO_PREFIX: CALL_VIDEO_PREFIX,
11
+ CALL_AUDIO_PREFIX: CALL_AUDIO_PREFIX,
12
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+
6
+ const fetch = require("node-fetch");
7
+ const pkg = require("../../../package.json");
8
+
9
+ async function TikTok(url) {
10
+ const base = pkg.profile.baseurl;
11
+
12
+ const res = await fetch(
13
+ `${base}/download/tiktok?url=${encodeURIComponent(url)}`
14
+ );
15
+
16
+ return await res.json();
17
+ }
18
+
19
+ exports.TikTok = TikTok;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+
6
+ const fetch = require("node-fetch");
7
+ const pkg = require("../../../package.json");
8
+
9
+ async function BypassTurnstileMin(url, siteKey) {
10
+ const base = pkg.profile.baseurl;
11
+
12
+ const res = await fetch(
13
+ `${base}/tools/turnstile-min?url=${encodeURIComponent(url)}&siteKey=${encodeURIComponent(siteKey)}`
14
+ );
15
+
16
+ return await res.json();
17
+ }
18
+
19
+ exports.BypassTurnstileMin = BypassTurnstileMin;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+
6
+ // tools
7
+ const { BypassTurnstileMin } = require("./Tools/bypass");
8
+
9
+ // downloader
10
+ const { TikTok } = require("./Download/tiktok");
11
+
12
+ exports.TikTok = TikTok
13
+ exports.BypassTurnstileMin = BypassTurnstileMin;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class CiphertextMessage {
4
+ constructor() {
5
+ this.UNSUPPORTED_VERSION = 1;
6
+ this.CURRENT_VERSION = 3;
7
+ this.WHISPER_TYPE = 2;
8
+ this.PREKEY_TYPE = 3;
9
+ this.SENDERKEY_TYPE = 4;
10
+ this.SENDERKEY_DISTRIBUTION_TYPE = 5;
11
+ this.ENCRYPTED_MESSAGE_OVERHEAD = 53;
12
+ }
13
+ }
14
+ module.exports = { CiphertextMessage: CiphertextMessage };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const {
4
+ generateSenderKey: generateSenderKey,
5
+ generateSenderKeyId: generateSenderKeyId,
6
+ generateSenderSigningKey: generateSenderSigningKey,
7
+ } = require("./keyhelper");
8
+ const {
9
+ SenderKeyDistributionMessage: SenderKeyDistributionMessage,
10
+ } = require("./sender-key-distribution-message");
11
+ class GroupSessionBuilder {
12
+ constructor(senderKeyStore) {
13
+ this.senderKeyStore = senderKeyStore;
14
+ }
15
+ async process(senderKeyName, senderKeyDistributionMessage) {
16
+ const senderKeyRecord = await this.senderKeyStore.loadSenderKey(senderKeyName);
17
+ senderKeyRecord.addSenderKeyState(
18
+ senderKeyDistributionMessage.getId(),
19
+ senderKeyDistributionMessage.getIteration(),
20
+ senderKeyDistributionMessage.getChainKey(),
21
+ senderKeyDistributionMessage.getSignatureKey()
22
+ );
23
+ await this.senderKeyStore.storeSenderKey(senderKeyName, senderKeyRecord);
24
+ }
25
+ async create(senderKeyName) {
26
+ const senderKeyRecord = await this.senderKeyStore.loadSenderKey(senderKeyName);
27
+ if (senderKeyRecord.isEmpty()) {
28
+ const keyId = generateSenderKeyId();
29
+ const senderKey = generateSenderKey();
30
+ const signingKey = generateSenderSigningKey();
31
+ senderKeyRecord.setSenderKeyState(keyId, 0, senderKey, signingKey);
32
+ await this.senderKeyStore.storeSenderKey(senderKeyName, senderKeyRecord);
33
+ }
34
+ const state = senderKeyRecord.getSenderKeyState();
35
+ if (!state) {
36
+ throw new Error("No session state available");
37
+ }
38
+ return new SenderKeyDistributionMessage(
39
+ state.getKeyId(),
40
+ state.getSenderChainKey().getIteration(),
41
+ state.getSenderChainKey().getSeed(),
42
+ state.getSigningKeyPublic()
43
+ );
44
+ }
45
+ }
46
+ module.exports = { GroupSessionBuilder: GroupSessionBuilder };
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { decrypt: decrypt, encrypt: encrypt } = require("libsignal/src/crypto");
4
+ const { SenderKeyMessage: SenderKeyMessage } = require("./sender-key-message");
5
+ class GroupCipher {
6
+ constructor(senderKeyStore, senderKeyName) {
7
+ this.senderKeyStore = senderKeyStore;
8
+ this.senderKeyName = senderKeyName;
9
+ }
10
+ async encrypt(paddedPlaintext) {
11
+ const record = await this.senderKeyStore.loadSenderKey(this.senderKeyName);
12
+ if (!record) {
13
+ throw new Error("No SenderKeyRecord found for encryption");
14
+ }
15
+ const senderKeyState = record.getSenderKeyState();
16
+ if (!senderKeyState) {
17
+ throw new Error("No session to encrypt message");
18
+ }
19
+ const iteration = senderKeyState.getSenderChainKey().getIteration();
20
+ const senderKey = this.getSenderKey(senderKeyState, iteration === 0 ? 0 : iteration + 1);
21
+ const ciphertext = await this.getCipherText(
22
+ senderKey.getIv(),
23
+ senderKey.getCipherKey(),
24
+ paddedPlaintext
25
+ );
26
+ const senderKeyMessage = new SenderKeyMessage(
27
+ senderKeyState.getKeyId(),
28
+ senderKey.getIteration(),
29
+ ciphertext,
30
+ senderKeyState.getSigningKeyPrivate()
31
+ );
32
+ await this.senderKeyStore.storeSenderKey(this.senderKeyName, record);
33
+ return senderKeyMessage.serialize();
34
+ }
35
+ async decrypt(senderKeyMessageBytes) {
36
+ const record = await this.senderKeyStore.loadSenderKey(this.senderKeyName);
37
+ if (!record) {
38
+ throw new Error("No SenderKeyRecord found for decryption");
39
+ }
40
+ const senderKeyMessage = new SenderKeyMessage(
41
+ null,
42
+ null,
43
+ null,
44
+ null,
45
+ senderKeyMessageBytes
46
+ );
47
+ const senderKeyState = record.getSenderKeyState(senderKeyMessage.getKeyId());
48
+ if (!senderKeyState) {
49
+ throw new Error("No session found to decrypt message");
50
+ }
51
+ senderKeyMessage.verifySignature(senderKeyState.getSigningKeyPublic());
52
+ const senderKey = this.getSenderKey(senderKeyState, senderKeyMessage.getIteration());
53
+ const plaintext = await this.getPlainText(
54
+ senderKey.getIv(),
55
+ senderKey.getCipherKey(),
56
+ senderKeyMessage.getCipherText()
57
+ );
58
+ await this.senderKeyStore.storeSenderKey(this.senderKeyName, record);
59
+ return plaintext;
60
+ }
61
+ getSenderKey(senderKeyState, iteration) {
62
+ let senderChainKey = senderKeyState.getSenderChainKey();
63
+ if (senderChainKey.getIteration() > iteration) {
64
+ if (senderKeyState.hasSenderMessageKey(iteration)) {
65
+ const messageKey = senderKeyState.removeSenderMessageKey(iteration);
66
+ if (!messageKey) {
67
+ throw new Error("No sender message key found for iteration");
68
+ }
69
+ return messageKey;
70
+ }
71
+ throw new Error(
72
+ `Received message with old counter: ${senderChainKey.getIteration()}, ${iteration}`
73
+ );
74
+ }
75
+ if (iteration - senderChainKey.getIteration() > 2e3) {
76
+ throw new Error("Over 2000 messages into the future!");
77
+ }
78
+ while (senderChainKey.getIteration() < iteration) {
79
+ senderKeyState.addSenderMessageKey(senderChainKey.getSenderMessageKey());
80
+ senderChainKey = senderChainKey.getNext();
81
+ }
82
+ senderKeyState.setSenderChainKey(senderChainKey.getNext());
83
+ return senderChainKey.getSenderMessageKey();
84
+ }
85
+ async getPlainText(iv, key, ciphertext) {
86
+ try {
87
+ return decrypt(key, ciphertext, iv);
88
+ } catch (e) {
89
+ throw new Error("InvalidMessageException");
90
+ }
91
+ }
92
+ async getCipherText(iv, key, plaintext) {
93
+ try {
94
+ const ivBuffer = typeof iv === "string" ? Buffer.from(iv, "base64") : iv;
95
+ const keyBuffer = typeof key === "string" ? Buffer.from(key, "base64") : key;
96
+ const plaintextBuffer =
97
+ typeof plaintext === "string" ? Buffer.from(plaintext) : plaintext;
98
+ return encrypt(keyBuffer, plaintextBuffer, ivBuffer);
99
+ } catch (e) {
100
+ throw new Error("InvalidMessageException");
101
+ }
102
+ }
103
+ }
104
+ module.exports = { GroupCipher: GroupCipher };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ const __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ let desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ });
22
+ const __exportStar =
23
+ (this && this.__exportStar) ||
24
+ function (m, exports) {
25
+ for (var p in m) {
26
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) {
27
+ __createBinding(exports, m, p);
28
+ }
29
+ }
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ __exportStar(require("./ciphertext-message"), exports);
33
+ __exportStar(require("./group-session-builder"), exports);
34
+ __exportStar(require("./group_cipher"), exports);
35
+ __exportStar(require("./keyhelper"), exports);
36
+ __exportStar(require("./sender-chain-key"), exports);
37
+ __exportStar(require("./sender-key-distribution-message"), exports);
38
+ __exportStar(require("./sender-key-message"), exports);
39
+ __exportStar(require("./sender-key-name"), exports);
40
+ __exportStar(require("./sender-key-record"), exports);
41
+ __exportStar(require("./sender-key-state"), exports);
42
+ __exportStar(require("./sender-message-key"), exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { randomInt: randomInt, randomBytes: randomBytes } = require("crypto");
4
+ const { generateKeyPair: generateKeyPair } = require("libsignal/src/curve");
5
+ function generateSenderKey() {
6
+ return randomBytes(32);
7
+ }
8
+ function generateSenderKeyId() {
9
+ return randomInt(2147483647);
10
+ }
11
+ function generateSenderSigningKey(key) {
12
+ if (!key) {
13
+ key = generateKeyPair();
14
+ }
15
+ return { public: Buffer.from(key.pubKey), private: Buffer.from(key.privKey) };
16
+ }
17
+ module.exports = {
18
+ generateSenderKey: generateSenderKey,
19
+ generateSenderKeyId: generateSenderKeyId,
20
+ generateSenderSigningKey: generateSenderSigningKey,
21
+ };