dibosockets 1.0.2 → 1.0.4

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 (40) hide show
  1. package/WAProto/WAProto.proto +5619 -5619
  2. package/lib/Api/Internet/growagarden.js +28 -28
  3. package/lib/Api/creator.json +13 -13
  4. package/lib/Api/downloader/tiktokdownload.js +132 -132
  5. package/lib/Api/index.js +38 -38
  6. package/lib/Api/nsfw/loli.js +79 -79
  7. package/lib/Api/stalker/githubstalk.js +46 -46
  8. package/lib/Api/stalker/stalkroblox.js +94 -94
  9. package/lib/Api/stalker/tiktokstalk.js +68 -68
  10. package/lib/Api/tools/ssweb.js +38 -38
  11. package/lib/Defaults/baileys-version.json +3 -3
  12. package/lib/Defaults/index.js +122 -122
  13. package/lib/Defaults/phonenumber_mcc.json +223 -223
  14. package/lib/Socket/RHandler.js +448 -448
  15. package/lib/Socket/business.js +266 -266
  16. package/lib/Socket/chats.js +1137 -1137
  17. package/lib/Socket/communities.js +441 -441
  18. package/lib/Socket/index.js +43 -43
  19. package/lib/Socket/messages-recv.js +1065 -1065
  20. package/lib/Socket/messages-send.js +881 -881
  21. package/lib/Socket/newsletter.js +286 -286
  22. package/lib/Socket/socket.js +666 -666
  23. package/lib/Store/make-in-memory-store.js +439 -439
  24. package/lib/Types/Newsletter.js +18 -18
  25. package/lib/Utils/async-iterable.js +41 -41
  26. package/lib/Utils/baileys-event-stream.js +63 -63
  27. package/lib/Utils/browser-utils.js +34 -34
  28. package/lib/Utils/event-buffer.js +518 -518
  29. package/lib/Utils/generics.js +431 -431
  30. package/lib/Utils/index.js +36 -36
  31. package/lib/Utils/message-retry-manager.js +127 -127
  32. package/lib/Utils/messages-media.js +926 -926
  33. package/lib/Utils/messages.js +1105 -1105
  34. package/lib/Utils/process-message.js +404 -404
  35. package/lib/Utils/resolveJid.js +52 -52
  36. package/lib/Utils/use-multi-file-auth-state.js +122 -122
  37. package/lib/Utils/validate-connection.js +228 -228
  38. package/lib/WABinary/jid-utils.js +85 -85
  39. package/lib/index.js +87 -74
  40. package/package.json +2 -2
@@ -1,94 +1,94 @@
1
- const { creator: CREATOR } = require("../creator.json");
2
-
3
- const postJson = async (url, body) => {
4
- try {
5
- const res = await fetch(url, {
6
- method: "POST",
7
- headers: { "Content-Type": "application/json" },
8
- body: JSON.stringify(body)
9
- });
10
- if (!res.ok) return null;
11
- return res.json();
12
- } catch {
13
- return null;
14
- }
15
- };
16
-
17
- const safeFetchJson = async (url) => {
18
- try {
19
- const res = await fetch(url);
20
- if (!res.ok) return null;
21
- return res.json();
22
- } catch {
23
- return null;
24
- }
25
- };
26
-
27
- const stalkroblox = async (username) => {
28
- if (!username) {
29
- return {
30
- error: "Missing parameter ?username=",
31
- creator: CREATOR
32
- };
33
- }
34
-
35
- const searchData = await postJson(
36
- "https://users.roblox.com/v1/usernames/users",
37
- { usernames: [username], excludeBannedUsers: true }
38
- );
39
-
40
- const userData = searchData?.data?.[0];
41
- if (!userData) {
42
- return {
43
- error: `User "${username}" not found`,
44
- creator: CREATOR
45
- };
46
- }
47
-
48
- const userId = userData.id;
49
-
50
- const [
51
- thumbnail,
52
- info,
53
- friends,
54
- followers,
55
- following,
56
- groups,
57
- badges
58
- ] = await Promise.all([
59
- safeFetchJson(`https://thumbnails.roblox.com/v1/users/avatar?userIds=${userId}&size=420x420&format=Png&isCircular=false`),
60
- safeFetchJson(`https://users.roblox.com/v1/users/${userId}`),
61
- safeFetchJson(`https://friends.roblox.com/v1/users/${userId}/friends/count`),
62
- safeFetchJson(`https://friends.roblox.com/v1/users/${userId}/followers/count`),
63
- safeFetchJson(`https://friends.roblox.com/v1/users/${userId}/followings/count`),
64
- safeFetchJson(`https://groups.roblox.com/v1/users/${userId}/groups/roles`),
65
- safeFetchJson(`https://badges.roblox.com/v1/users/${userId}/badges?limit=25&sortOrder=Asc`)
66
- ]);
67
-
68
- const data = {
69
- username: userData.name,
70
- displayName: userData.displayName,
71
- userId,
72
- profilePicUrl: thumbnail?.data?.[0]?.imageUrl || null,
73
- description: info?.description || null,
74
- joinDate: info?.created || null,
75
- friendsCount: friends?.count ?? 0,
76
- followersCount: followers?.count ?? 0,
77
- followingCount: following?.count ?? 0,
78
- groups: Array.isArray(groups?.data)
79
- ? groups.data.map(g => g.group?.name).filter(Boolean)
80
- : [],
81
- badges: Array.isArray(badges?.data)
82
- ? badges.data.map(b => b.name)
83
- : []
84
- };
85
-
86
- return {
87
- success: true,
88
- data,
89
- creator: CREATOR
90
- };
91
- };
92
-
93
- module.exports = stalkroblox;
94
- module.exports.default = stalkroblox;
1
+ const { creator: CREATOR } = require("../creator.json");
2
+
3
+ const postJson = async (url, body) => {
4
+ try {
5
+ const res = await fetch(url, {
6
+ method: "POST",
7
+ headers: { "Content-Type": "application/json" },
8
+ body: JSON.stringify(body)
9
+ });
10
+ if (!res.ok) return null;
11
+ return res.json();
12
+ } catch {
13
+ return null;
14
+ }
15
+ };
16
+
17
+ const safeFetchJson = async (url) => {
18
+ try {
19
+ const res = await fetch(url);
20
+ if (!res.ok) return null;
21
+ return res.json();
22
+ } catch {
23
+ return null;
24
+ }
25
+ };
26
+
27
+ const stalkroblox = async (username) => {
28
+ if (!username) {
29
+ return {
30
+ error: "Missing parameter ?username=",
31
+ creator: CREATOR
32
+ };
33
+ }
34
+
35
+ const searchData = await postJson(
36
+ "https://users.roblox.com/v1/usernames/users",
37
+ { usernames: [username], excludeBannedUsers: true }
38
+ );
39
+
40
+ const userData = searchData?.data?.[0];
41
+ if (!userData) {
42
+ return {
43
+ error: `User "${username}" not found`,
44
+ creator: CREATOR
45
+ };
46
+ }
47
+
48
+ const userId = userData.id;
49
+
50
+ const [
51
+ thumbnail,
52
+ info,
53
+ friends,
54
+ followers,
55
+ following,
56
+ groups,
57
+ badges
58
+ ] = await Promise.all([
59
+ safeFetchJson(`https://thumbnails.roblox.com/v1/users/avatar?userIds=${userId}&size=420x420&format=Png&isCircular=false`),
60
+ safeFetchJson(`https://users.roblox.com/v1/users/${userId}`),
61
+ safeFetchJson(`https://friends.roblox.com/v1/users/${userId}/friends/count`),
62
+ safeFetchJson(`https://friends.roblox.com/v1/users/${userId}/followers/count`),
63
+ safeFetchJson(`https://friends.roblox.com/v1/users/${userId}/followings/count`),
64
+ safeFetchJson(`https://groups.roblox.com/v1/users/${userId}/groups/roles`),
65
+ safeFetchJson(`https://badges.roblox.com/v1/users/${userId}/badges?limit=25&sortOrder=Asc`)
66
+ ]);
67
+
68
+ const data = {
69
+ username: userData.name,
70
+ displayName: userData.displayName,
71
+ userId,
72
+ profilePicUrl: thumbnail?.data?.[0]?.imageUrl || null,
73
+ description: info?.description || null,
74
+ joinDate: info?.created || null,
75
+ friendsCount: friends?.count ?? 0,
76
+ followersCount: followers?.count ?? 0,
77
+ followingCount: following?.count ?? 0,
78
+ groups: Array.isArray(groups?.data)
79
+ ? groups.data.map(g => g.group?.name).filter(Boolean)
80
+ : [],
81
+ badges: Array.isArray(badges?.data)
82
+ ? badges.data.map(b => b.name)
83
+ : []
84
+ };
85
+
86
+ return {
87
+ success: true,
88
+ data,
89
+ creator: CREATOR
90
+ };
91
+ };
92
+
93
+ module.exports = stalkroblox;
94
+ module.exports.default = stalkroblox;
@@ -1,68 +1,68 @@
1
- const { creator: CREATOR } = require("../creator.json");
2
- const cheerio = require("cheerio");
3
-
4
- async function ttstalk(username) {
5
- try {
6
- const url = `https://www.tiktok.com/@${username}?_t=ZS-8tHANz7ieoS&_r=1`;
7
-
8
- const response = await fetch(url, {
9
- headers: {
10
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
11
- }
12
- });
13
-
14
- const html = await response.text();
15
- const $ = cheerio.load(html);
16
-
17
- const scriptData = $('#__UNIVERSAL_DATA_FOR_REHYDRATION__').html();
18
- if (!scriptData) {
19
- return {
20
- status: false,
21
- message: "User tidak ditemukan atau data tidak tersedia."
22
- };
23
- }
24
-
25
- const parsedData = JSON.parse(scriptData);
26
- const userDetail = parsedData.__DEFAULT_SCOPE__?.["webapp.user-detail"];
27
-
28
- if (!userDetail) {
29
- return {
30
- status: false,
31
- message: "User tidak ditemukan atau data tidak tersedia."
32
- };
33
- }
34
-
35
- const userInfo = userDetail.userInfo?.user;
36
- const stats = userDetail.userInfo?.stats;
37
-
38
- const hasil = {
39
- id: userInfo?.id || null,
40
- username: userInfo?.uniqueId || null,
41
- nama: userInfo?.nickname || null,
42
- avatar: userInfo?.avatarLarger || null,
43
- bio: userInfo?.signature || null,
44
- region: userInfo?.region || "Tidak diketahui",
45
- verifikasi: userInfo?.verified || false,
46
- totalfollowers: stats?.followerCount || 0,
47
- totalmengikuti: stats?.followingCount || 0,
48
- totaldisukai: stats?.heart || 0,
49
- totalvideo: stats?.videoCount || 0,
50
- totalteman: stats?.friendCount || 0
51
- };
52
-
53
- return {
54
- status: true,
55
- creator: CREATOR,
56
- results: hasil
57
- };
58
-
59
- } catch (error) {
60
- return {
61
- status: false,
62
- message: error.message || "Terjadi kesalahan saat mengambil data."
63
- };
64
- }
65
- }
66
-
67
- module.exports = ttstalk;
68
- module.exports.default = ttstalk;
1
+ const { creator: CREATOR } = require("../creator.json");
2
+ const cheerio = require("cheerio");
3
+
4
+ async function ttstalk(username) {
5
+ try {
6
+ const url = `https://www.tiktok.com/@${username}?_t=ZS-8tHANz7ieoS&_r=1`;
7
+
8
+ const response = await fetch(url, {
9
+ headers: {
10
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
11
+ }
12
+ });
13
+
14
+ const html = await response.text();
15
+ const $ = cheerio.load(html);
16
+
17
+ const scriptData = $('#__UNIVERSAL_DATA_FOR_REHYDRATION__').html();
18
+ if (!scriptData) {
19
+ return {
20
+ status: false,
21
+ message: "User tidak ditemukan atau data tidak tersedia."
22
+ };
23
+ }
24
+
25
+ const parsedData = JSON.parse(scriptData);
26
+ const userDetail = parsedData.__DEFAULT_SCOPE__?.["webapp.user-detail"];
27
+
28
+ if (!userDetail) {
29
+ return {
30
+ status: false,
31
+ message: "User tidak ditemukan atau data tidak tersedia."
32
+ };
33
+ }
34
+
35
+ const userInfo = userDetail.userInfo?.user;
36
+ const stats = userDetail.userInfo?.stats;
37
+
38
+ const hasil = {
39
+ id: userInfo?.id || null,
40
+ username: userInfo?.uniqueId || null,
41
+ nama: userInfo?.nickname || null,
42
+ avatar: userInfo?.avatarLarger || null,
43
+ bio: userInfo?.signature || null,
44
+ region: userInfo?.region || "Tidak diketahui",
45
+ verifikasi: userInfo?.verified || false,
46
+ totalfollowers: stats?.followerCount || 0,
47
+ totalmengikuti: stats?.followingCount || 0,
48
+ totaldisukai: stats?.heart || 0,
49
+ totalvideo: stats?.videoCount || 0,
50
+ totalteman: stats?.friendCount || 0
51
+ };
52
+
53
+ return {
54
+ status: true,
55
+ creator: CREATOR,
56
+ results: hasil
57
+ };
58
+
59
+ } catch (error) {
60
+ return {
61
+ status: false,
62
+ message: error.message || "Terjadi kesalahan saat mengambil data."
63
+ };
64
+ }
65
+ }
66
+
67
+ module.exports = ttstalk;
68
+ module.exports.default = ttstalk;
@@ -1,38 +1,38 @@
1
- async function ssweb(url = "", full = false, type = "desktop") {
2
- type = type.toLowerCase();
3
- if (!["desktop", "tablet", "phone"].includes(type)) type = "desktop";
4
-
5
- const form = new URLSearchParams();
6
- form.append("url", url);
7
- form.append("device", type);
8
- if (!!full) form.append("full", "on");
9
- form.append("cacheLimit", 0);
10
-
11
- const res = await fetch("https://www.screenshotmachine.com/capture.php", {
12
- method: "POST",
13
- body: form,
14
- headers: {
15
- "Content-Type": "application/x-www-form-urlencoded",
16
- },
17
- });
18
-
19
- const cookies = res.headers.get("set-cookie");
20
- const json = await res.json();
21
-
22
- if (!json.link) {
23
- throw new Error("Gagal mendapatkan link screenshot.");
24
- }
25
-
26
-
27
- const imgRes = await fetch("https://www.screenshotmachine.com/" + json.link, {
28
- headers: {
29
- cookie: cookies || "",
30
- },
31
- });
32
-
33
- const arrayBuf = await imgRes.arrayBuffer();
34
- return Buffer.from(arrayBuf);
35
- }
36
-
37
- module.exports = ssweb;
38
- module.exports.default = ssweb;
1
+ async function ssweb(url = "", full = false, type = "desktop") {
2
+ type = type.toLowerCase();
3
+ if (!["desktop", "tablet", "phone"].includes(type)) type = "desktop";
4
+
5
+ const form = new URLSearchParams();
6
+ form.append("url", url);
7
+ form.append("device", type);
8
+ if (!!full) form.append("full", "on");
9
+ form.append("cacheLimit", 0);
10
+
11
+ const res = await fetch("https://www.screenshotmachine.com/capture.php", {
12
+ method: "POST",
13
+ body: form,
14
+ headers: {
15
+ "Content-Type": "application/x-www-form-urlencoded",
16
+ },
17
+ });
18
+
19
+ const cookies = res.headers.get("set-cookie");
20
+ const json = await res.json();
21
+
22
+ if (!json.link) {
23
+ throw new Error("Gagal mendapatkan link screenshot.");
24
+ }
25
+
26
+
27
+ const imgRes = await fetch("https://www.screenshotmachine.com/" + json.link, {
28
+ headers: {
29
+ cookie: cookies || "",
30
+ },
31
+ });
32
+
33
+ const arrayBuf = await imgRes.arrayBuffer();
34
+ return Buffer.from(arrayBuf);
35
+ }
36
+
37
+ module.exports = ssweb;
38
+ module.exports.default = ssweb;
@@ -1,3 +1,3 @@
1
- {
2
- "version": [2, 3000, 1027934701]
3
- }
1
+ {
2
+ "version": [2, 3000, 1027934701]
3
+ }
@@ -1,122 +1,122 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
-
7
- const PHONENUMBER_MCC = require("./phonenumber_mcc.json");
8
- exports.PHONENUMBER_MCC = PHONENUMBER_MCC;
9
-
10
- exports.DEFAULT_CACHE_TTLS = exports.MIN_UPLOAD_INTERVAL = exports.UPLOAD_TIMEOUT = exports.INITIAL_PREKEY_COUNT = exports.MIN_PREKEY_COUNT = exports.MEDIA_KEYS = exports.MEDIA_HKDF_KEY_MAPPING = exports.MEDIA_PATH_MAP = exports.DEFAULT_CONNECTION_CONFIG = exports.PROCESSABLE_HISTORY_TYPES = exports.WA_CERT_DETAILS = exports.URL_REGEX = exports.NOISE_WA_HEADER = exports.KEY_BUNDLE_TYPE = exports.DICT_VERSION = exports.NOISE_MODE = exports.WA_DEFAULT_EPHEMERAL = exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = exports.WA_ADV_DEVICE_SIG_PREFIX = exports.WA_ADV_ACCOUNT_SIG_PREFIX = exports.UNAUTHORIZED_CODES = exports.version = void 0;
11
- const WAProto_1 = require("../../WAProto");
12
- const libsignal_1 = require("../Signal/libsignal");
13
- const browser_utils_1 = require("../Utils/browser-utils");
14
- const logger_1 = __importDefault(require("../Utils/logger"));
15
- exports.version = [2, 3000, 1027934701];
16
- exports.UNAUTHORIZED_CODES = [401, 403, 419];
17
- exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
18
- exports.CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
19
- exports.CALL_AUDIO_PREFIX = 'https://call.whatsapp.com/voice/';
20
- exports.DEF_CALLBACK_PREFIX = 'CB:';
21
- exports.DEF_TAG_PREFIX = 'TAG:';
22
- exports.PHONE_CONNECTION_CB = 'CB:Pong';
23
- exports.WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0]);
24
- exports.WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1]);
25
- exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5]);
26
- exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6]);
27
- exports.WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
28
- exports.NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0';
29
- exports.DICT_VERSION = 3;
30
- exports.KEY_BUNDLE_TYPE = Buffer.from([5]);
31
- exports.NOISE_WA_HEADER = Buffer.from([87, 65, 6, exports.DICT_VERSION]);
32
- exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
33
- exports.WA_CERT_DETAILS = {
34
- SERIAL: 0
35
- };
36
- exports.PROCESSABLE_HISTORY_TYPES = [
37
- WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP,
38
- WAProto_1.proto.HistorySync.HistorySyncType.PUSH_NAME,
39
- WAProto_1.proto.HistorySync.HistorySyncType.RECENT,
40
- WAProto_1.proto.HistorySync.HistorySyncType.FULL,
41
- WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND,
42
- WAProto_1.proto.HistorySync.HistorySyncType.NON_BLOCKING_DATA,
43
- WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_STATUS_V3,
44
- ];
45
- exports.DEFAULT_CONNECTION_CONFIG = {
46
- version: exports.version,
47
- browser: (0, browser_utils_1.Browsers)('Chrome'),
48
- waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
49
- connectTimeoutMs: 20_000,
50
- keepAliveIntervalMs: 30_000,
51
- logger: logger_1.default.child({ class: 'baileys' }),
52
- emitOwnEvents: true,
53
- defaultQueryTimeoutMs: 60_000,
54
- customUploadHosts: [],
55
- retryRequestDelayMs: 250,
56
- maxMsgRetryCount: 5,
57
- fireInitQueries: true,
58
- auth: undefined,
59
- markOnlineOnConnect: true,
60
- syncFullHistory: true,
61
- patchMessageBeforeSending: msg => msg,
62
- shouldSyncHistoryMessage: () => true,
63
- shouldIgnoreJid: () => false,
64
- linkPreviewImageThumbnailWidth: 192,
65
- transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
66
- generateHighQualityLinkPreview: false,
67
- enableAutoSessionRecreation: true,
68
- enableRecentMessageCache: true,
69
- options: {},
70
- appStateMacVerification: {
71
- patch: false,
72
- snapshot: false
73
- },
74
- countryCode: 'US',
75
- getMessage: async () => undefined,
76
- cachedGroupMetadata: async () => undefined,
77
- makeSignalRepository: libsignal_1.makeLibSignalRepository
78
- };
79
- exports.MEDIA_PATH_MAP = {
80
- image: '/mms/image',
81
- video: '/mms/video',
82
- document: '/mms/document',
83
- audio: '/mms/audio',
84
- sticker: '/mms/image',
85
- 'thumbnail-link': '/mms/image',
86
- 'product-catalog-image': '/product/image',
87
- 'md-app-state': '',
88
- 'md-msg-hist': '/mms/md-app-state',
89
- 'biz-cover-photo': '/pps/biz-cover-photo'
90
- };
91
- exports.MEDIA_HKDF_KEY_MAPPING = {
92
- audio: 'Audio',
93
- document: 'Document',
94
- gif: 'Video',
95
- image: 'Image',
96
- ppic: '',
97
- product: 'Image',
98
- ptt: 'Audio',
99
- sticker: 'Image',
100
- video: 'Video',
101
- 'thumbnail-document': 'Document Thumbnail',
102
- 'thumbnail-image': 'Image Thumbnail',
103
- 'thumbnail-video': 'Video Thumbnail',
104
- 'thumbnail-link': 'Link Thumbnail',
105
- 'md-msg-hist': 'History',
106
- 'md-app-state': 'App State',
107
- 'product-catalog-image': '',
108
- 'payment-bg-image': 'Payment Background',
109
- ptv: 'Video',
110
- 'biz-cover-photo': 'Image'
111
- };
112
- exports.MEDIA_KEYS = Object.keys(exports.MEDIA_PATH_MAP);
113
- exports.MIN_PREKEY_COUNT = 5;
114
- exports.INITIAL_PREKEY_COUNT = 812;
115
- exports.UPLOAD_TIMEOUT = 30000;
116
- exports.MIN_UPLOAD_INTERVAL = 5000;
117
- exports.DEFAULT_CACHE_TTLS = {
118
- SIGNAL_STORE: 5 * 60,
119
- MSG_RETRY: 60 * 60,
120
- CALL_OFFER: 5 * 60,
121
- USER_DEVICES: 5 * 60
122
- };
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+
7
+ const PHONENUMBER_MCC = require("./phonenumber_mcc.json");
8
+ exports.PHONENUMBER_MCC = PHONENUMBER_MCC;
9
+
10
+ exports.DEFAULT_CACHE_TTLS = exports.MIN_UPLOAD_INTERVAL = exports.UPLOAD_TIMEOUT = exports.INITIAL_PREKEY_COUNT = exports.MIN_PREKEY_COUNT = exports.MEDIA_KEYS = exports.MEDIA_HKDF_KEY_MAPPING = exports.MEDIA_PATH_MAP = exports.DEFAULT_CONNECTION_CONFIG = exports.PROCESSABLE_HISTORY_TYPES = exports.WA_CERT_DETAILS = exports.URL_REGEX = exports.NOISE_WA_HEADER = exports.KEY_BUNDLE_TYPE = exports.DICT_VERSION = exports.NOISE_MODE = exports.WA_DEFAULT_EPHEMERAL = exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = exports.WA_ADV_DEVICE_SIG_PREFIX = exports.WA_ADV_ACCOUNT_SIG_PREFIX = exports.UNAUTHORIZED_CODES = exports.version = void 0;
11
+ const WAProto_1 = require("../../WAProto");
12
+ const libsignal_1 = require("../Signal/libsignal");
13
+ const browser_utils_1 = require("../Utils/browser-utils");
14
+ const logger_1 = __importDefault(require("../Utils/logger"));
15
+ exports.version = [2, 3000, 1027934701];
16
+ exports.UNAUTHORIZED_CODES = [401, 403, 419];
17
+ exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
18
+ exports.CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
19
+ exports.CALL_AUDIO_PREFIX = 'https://call.whatsapp.com/voice/';
20
+ exports.DEF_CALLBACK_PREFIX = 'CB:';
21
+ exports.DEF_TAG_PREFIX = 'TAG:';
22
+ exports.PHONE_CONNECTION_CB = 'CB:Pong';
23
+ exports.WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0]);
24
+ exports.WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1]);
25
+ exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5]);
26
+ exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6]);
27
+ exports.WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
28
+ exports.NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0';
29
+ exports.DICT_VERSION = 3;
30
+ exports.KEY_BUNDLE_TYPE = Buffer.from([5]);
31
+ exports.NOISE_WA_HEADER = Buffer.from([87, 65, 6, exports.DICT_VERSION]);
32
+ exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
33
+ exports.WA_CERT_DETAILS = {
34
+ SERIAL: 0
35
+ };
36
+ exports.PROCESSABLE_HISTORY_TYPES = [
37
+ WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP,
38
+ WAProto_1.proto.HistorySync.HistorySyncType.PUSH_NAME,
39
+ WAProto_1.proto.HistorySync.HistorySyncType.RECENT,
40
+ WAProto_1.proto.HistorySync.HistorySyncType.FULL,
41
+ WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND,
42
+ WAProto_1.proto.HistorySync.HistorySyncType.NON_BLOCKING_DATA,
43
+ WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_STATUS_V3,
44
+ ];
45
+ exports.DEFAULT_CONNECTION_CONFIG = {
46
+ version: exports.version,
47
+ browser: (0, browser_utils_1.Browsers)('Chrome'),
48
+ waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
49
+ connectTimeoutMs: 20_000,
50
+ keepAliveIntervalMs: 30_000,
51
+ logger: logger_1.default.child({ class: 'baileys' }),
52
+ emitOwnEvents: true,
53
+ defaultQueryTimeoutMs: 60_000,
54
+ customUploadHosts: [],
55
+ retryRequestDelayMs: 250,
56
+ maxMsgRetryCount: 5,
57
+ fireInitQueries: true,
58
+ auth: undefined,
59
+ markOnlineOnConnect: true,
60
+ syncFullHistory: true,
61
+ patchMessageBeforeSending: msg => msg,
62
+ shouldSyncHistoryMessage: () => true,
63
+ shouldIgnoreJid: () => false,
64
+ linkPreviewImageThumbnailWidth: 192,
65
+ transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
66
+ generateHighQualityLinkPreview: false,
67
+ enableAutoSessionRecreation: true,
68
+ enableRecentMessageCache: true,
69
+ options: {},
70
+ appStateMacVerification: {
71
+ patch: false,
72
+ snapshot: false
73
+ },
74
+ countryCode: 'US',
75
+ getMessage: async () => undefined,
76
+ cachedGroupMetadata: async () => undefined,
77
+ makeSignalRepository: libsignal_1.makeLibSignalRepository
78
+ };
79
+ exports.MEDIA_PATH_MAP = {
80
+ image: '/mms/image',
81
+ video: '/mms/video',
82
+ document: '/mms/document',
83
+ audio: '/mms/audio',
84
+ sticker: '/mms/image',
85
+ 'thumbnail-link': '/mms/image',
86
+ 'product-catalog-image': '/product/image',
87
+ 'md-app-state': '',
88
+ 'md-msg-hist': '/mms/md-app-state',
89
+ 'biz-cover-photo': '/pps/biz-cover-photo'
90
+ };
91
+ exports.MEDIA_HKDF_KEY_MAPPING = {
92
+ audio: 'Audio',
93
+ document: 'Document',
94
+ gif: 'Video',
95
+ image: 'Image',
96
+ ppic: '',
97
+ product: 'Image',
98
+ ptt: 'Audio',
99
+ sticker: 'Image',
100
+ video: 'Video',
101
+ 'thumbnail-document': 'Document Thumbnail',
102
+ 'thumbnail-image': 'Image Thumbnail',
103
+ 'thumbnail-video': 'Video Thumbnail',
104
+ 'thumbnail-link': 'Link Thumbnail',
105
+ 'md-msg-hist': 'History',
106
+ 'md-app-state': 'App State',
107
+ 'product-catalog-image': '',
108
+ 'payment-bg-image': 'Payment Background',
109
+ ptv: 'Video',
110
+ 'biz-cover-photo': 'Image'
111
+ };
112
+ exports.MEDIA_KEYS = Object.keys(exports.MEDIA_PATH_MAP);
113
+ exports.MIN_PREKEY_COUNT = 5;
114
+ exports.INITIAL_PREKEY_COUNT = 812;
115
+ exports.UPLOAD_TIMEOUT = 30000;
116
+ exports.MIN_UPLOAD_INTERVAL = 5000;
117
+ exports.DEFAULT_CACHE_TTLS = {
118
+ SIGNAL_STORE: 5 * 60,
119
+ MSG_RETRY: 60 * 60,
120
+ CALL_OFFER: 5 * 60,
121
+ USER_DEVICES: 5 * 60
122
+ };