nrx-bails 0.0.1

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 (199) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1541 -0
  3. package/WAProto/GenerateStatics.sh +4 -0
  4. package/WAProto/WAProto.proto +4775 -0
  5. package/WAProto/index.d.ts +2 -0
  6. package/WAProto/index.js +169661 -0
  7. package/lib/Defaults/index.d.ts +113 -0
  8. package/lib/Defaults/index.js +156 -0
  9. package/lib/Defaults/phonenumber-mcc.json +223 -0
  10. package/lib/Defaults/ye-bail-version.json +3 -0
  11. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  12. package/lib/Signal/Group/ciphertext-message.js +41 -0
  13. package/lib/Signal/Group/group-session-builder.d.ts +8 -0
  14. package/lib/Signal/Group/group-session-builder.js +90 -0
  15. package/lib/Signal/Group/group_cipher.d.ts +12 -0
  16. package/lib/Signal/Group/group_cipher.js +122 -0
  17. package/lib/Signal/Group/index.d.ts +22 -0
  18. package/lib/Signal/Group/index.js +83 -0
  19. package/lib/Signal/Group/keyhelper.d.ts +7 -0
  20. package/lib/Signal/Group/keyhelper.js +81 -0
  21. package/lib/Signal/Group/queue-job.d.ts +3 -0
  22. package/lib/Signal/Group/queue-job.js +83 -0
  23. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  24. package/lib/Signal/Group/sender-chain-key.js +60 -0
  25. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  26. package/lib/Signal/Group/sender-key-distribution-message.js +92 -0
  27. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  28. package/lib/Signal/Group/sender-key-message.js +95 -0
  29. package/lib/Signal/Group/sender-key-name.d.ts +12 -0
  30. package/lib/Signal/Group/sender-key-name.js +77 -0
  31. package/lib/Signal/Group/sender-key-record.d.ts +13 -0
  32. package/lib/Signal/Group/sender-key-record.js +79 -0
  33. package/lib/Signal/Group/sender-key-state.d.ts +17 -0
  34. package/lib/Signal/Group/sender-key-state.js +125 -0
  35. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  36. package/lib/Signal/Group/sender-message-key.js +55 -0
  37. package/lib/Signal/libsignal.d.ts +37 -0
  38. package/lib/Signal/libsignal.js +200 -0
  39. package/lib/Socket/Client/index.d.ts +1 -0
  40. package/lib/Socket/Client/index.js +44 -0
  41. package/lib/Socket/Client/types.d.ts +7 -0
  42. package/lib/Socket/Client/types.js +39 -0
  43. package/lib/Socket/Client/websocket.d.ts +19 -0
  44. package/lib/Socket/Client/websocket.js +137 -0
  45. package/lib/Socket/business.d.ts +329 -0
  46. package/lib/Socket/business.js +286 -0
  47. package/lib/Socket/chats.d.ts +84 -0
  48. package/lib/Socket/chats.js +1022 -0
  49. package/lib/Socket/groups.d.ts +216 -0
  50. package/lib/Socket/groups.js +358 -0
  51. package/lib/Socket/index.d.ts +330 -0
  52. package/lib/Socket/index.js +36 -0
  53. package/lib/Socket/messages-recv.d.ts +271 -0
  54. package/lib/Socket/messages-recv.js +1079 -0
  55. package/lib/Socket/messages-send.d.ts +258 -0
  56. package/lib/Socket/messages-send.js +1190 -0
  57. package/lib/Socket/newsletter.d.ts +253 -0
  58. package/lib/Socket/newsletter.js +362 -0
  59. package/lib/Socket/registration.d.ts +361 -0
  60. package/lib/Socket/registration.js +179 -0
  61. package/lib/Socket/socket.d.ts +33 -0
  62. package/lib/Socket/socket.js +699 -0
  63. package/lib/Socket/usync.d.ts +27 -0
  64. package/lib/Socket/usync.js +96 -0
  65. package/lib/Store/index.d.ts +3 -0
  66. package/lib/Store/index.js +36 -0
  67. package/lib/Store/make-cache-manager-auth-state.d.ts +16 -0
  68. package/lib/Store/make-cache-manager-auth-state.js +118 -0
  69. package/lib/Store/make-in-memory-store.d.ts +64 -0
  70. package/lib/Store/make-in-memory-store.js +465 -0
  71. package/lib/Store/make-ordered-dictionary.d.ts +14 -0
  72. package/lib/Store/make-ordered-dictionary.js +107 -0
  73. package/lib/Store/object-repository.d.ts +11 -0
  74. package/lib/Store/object-repository.js +53 -0
  75. package/lib/Types/Auth.d.ts +1 -0
  76. package/lib/Types/Auth.js +28 -0
  77. package/lib/Types/Call.d.ts +1 -0
  78. package/lib/Types/Call.js +28 -0
  79. package/lib/Types/Chat.d.ts +2 -0
  80. package/lib/Types/Chat.js +30 -0
  81. package/lib/Types/Contact.d.ts +1 -0
  82. package/lib/Types/Contact.js +28 -0
  83. package/lib/Types/Events.d.ts +1 -0
  84. package/lib/Types/Events.js +28 -0
  85. package/lib/Types/GroupMetadata.d.ts +1 -0
  86. package/lib/Types/GroupMetadata.js +28 -0
  87. package/lib/Types/Label.d.ts +2 -0
  88. package/lib/Types/Label.js +53 -0
  89. package/lib/Types/LabelAssociation.d.ts +2 -0
  90. package/lib/Types/LabelAssociation.js +35 -0
  91. package/lib/Types/Message.d.ts +2 -0
  92. package/lib/Types/Message.js +33 -0
  93. package/lib/Types/Newsletter.d.ts +4 -0
  94. package/lib/Types/Newsletter.js +62 -0
  95. package/lib/Types/Product.d.ts +1 -0
  96. package/lib/Types/Product.js +28 -0
  97. package/lib/Types/Signal.d.ts +1 -0
  98. package/lib/Types/Signal.js +28 -0
  99. package/lib/Types/Socket.d.ts +1 -0
  100. package/lib/Types/Socket.js +28 -0
  101. package/lib/Types/State.d.ts +1 -0
  102. package/lib/Types/State.js +28 -0
  103. package/lib/Types/USync.d.ts +1 -0
  104. package/lib/Types/USync.js +28 -0
  105. package/lib/Types/index.d.ts +2 -0
  106. package/lib/Types/index.js +68 -0
  107. package/lib/Utils/auth-utils.d.ts +63 -0
  108. package/lib/Utils/auth-utils.js +248 -0
  109. package/lib/Utils/browser-utils.d.ts +3 -0
  110. package/lib/Utils/browser-utils.js +61 -0
  111. package/lib/Utils/business.d.ts +53 -0
  112. package/lib/Utils/business.js +260 -0
  113. package/lib/Utils/chat-utils.d.ts +253 -0
  114. package/lib/Utils/chat-utils.js +756 -0
  115. package/lib/Utils/crypto.d.ts +43 -0
  116. package/lib/Utils/crypto.js +219 -0
  117. package/lib/Utils/decode-wa-message.d.ts +61 -0
  118. package/lib/Utils/decode-wa-message.js +233 -0
  119. package/lib/Utils/event-buffer.d.ts +17 -0
  120. package/lib/Utils/event-buffer.js +544 -0
  121. package/lib/Utils/generics.d.ts +89 -0
  122. package/lib/Utils/generics.js +471 -0
  123. package/lib/Utils/history.d.ts +59 -0
  124. package/lib/Utils/history.js +120 -0
  125. package/lib/Utils/index.d.ts +1 -0
  126. package/lib/Utils/index.js +61 -0
  127. package/lib/Utils/link-preview.d.ts +19 -0
  128. package/lib/Utils/link-preview.js +152 -0
  129. package/lib/Utils/logger.d.ts +3 -0
  130. package/lib/Utils/logger.js +33 -0
  131. package/lib/Utils/lt-hash.d.ts +13 -0
  132. package/lib/Utils/lt-hash.js +77 -0
  133. package/lib/Utils/make-mutex.d.ts +7 -0
  134. package/lib/Utils/make-mutex.js +69 -0
  135. package/lib/Utils/message-retry-manager.d.ts +34 -0
  136. package/lib/Utils/message-retry-manager.js +154 -0
  137. package/lib/Utils/messages-media.d.ts +137 -0
  138. package/lib/Utils/messages-media.js +1024 -0
  139. package/lib/Utils/messages.d.ts +66 -0
  140. package/lib/Utils/messages.js +1407 -0
  141. package/lib/Utils/noise-handler.d.ts +21 -0
  142. package/lib/Utils/noise-handler.js +176 -0
  143. package/lib/Utils/pre-key-manager.d.ts +13 -0
  144. package/lib/Utils/pre-key-manager.js +93 -0
  145. package/lib/Utils/process-message.d.ts +40 -0
  146. package/lib/Utils/process-message.js +430 -0
  147. package/lib/Utils/signal.d.ts +72 -0
  148. package/lib/Utils/signal.js +179 -0
  149. package/lib/Utils/use-multi-file-auth-state.d.ts +18 -0
  150. package/lib/Utils/use-multi-file-auth-state.js +151 -0
  151. package/lib/Utils/validate-connection.d.ts +43 -0
  152. package/lib/Utils/validate-connection.js +255 -0
  153. package/lib/Utils/ye-bail-event-stream.d.ts +16 -0
  154. package/lib/Utils/ye-bail-event-stream.js +89 -0
  155. package/lib/WABinary/constants.d.ts +23 -0
  156. package/lib/WABinary/constants.js +1328 -0
  157. package/lib/WABinary/decode.d.ts +10 -0
  158. package/lib/WABinary/decode.js +291 -0
  159. package/lib/WABinary/encode.d.ts +2 -0
  160. package/lib/WABinary/encode.js +276 -0
  161. package/lib/WABinary/generic-utils.d.ts +16 -0
  162. package/lib/WABinary/generic-utils.js +155 -0
  163. package/lib/WABinary/index.d.ts +1 -0
  164. package/lib/WABinary/index.js +47 -0
  165. package/lib/WABinary/jid-utils.d.ts +34 -0
  166. package/lib/WABinary/jid-utils.js +111 -0
  167. package/lib/WABinary/types.d.ts +1 -0
  168. package/lib/WABinary/types.js +28 -0
  169. package/lib/WAM/BinaryInfo.d.ts +8 -0
  170. package/lib/WAM/BinaryInfo.js +39 -0
  171. package/lib/WAM/constants.d.ts +35374 -0
  172. package/lib/WAM/constants.js +15376 -0
  173. package/lib/WAM/encode.d.ts +2 -0
  174. package/lib/WAM/encode.js +181 -0
  175. package/lib/WAM/index.d.ts +1 -0
  176. package/lib/WAM/index.js +45 -0
  177. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +14 -0
  178. package/lib/WAUSync/Protocols/USyncContactProtocol.js +58 -0
  179. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  180. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +83 -0
  181. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  182. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +56 -0
  183. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  184. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +68 -0
  185. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
  186. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +79 -0
  187. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  188. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +50 -0
  189. package/lib/WAUSync/Protocols/index.d.ts +1 -0
  190. package/lib/WAUSync/Protocols/index.js +46 -0
  191. package/lib/WAUSync/USyncQuery.d.ts +20 -0
  192. package/lib/WAUSync/USyncQuery.js +115 -0
  193. package/lib/WAUSync/USyncUser.d.ts +13 -0
  194. package/lib/WAUSync/USyncUser.js +52 -0
  195. package/lib/WAUSync/index.d.ts +1 -0
  196. package/lib/WAUSync/index.js +45 -0
  197. package/lib/index.js +81 -0
  198. package/package.json +113 -0
  199. package/requirements.js +32 -0
@@ -0,0 +1,113 @@
1
+ export const __esModule: boolean;
2
+ export const version: number[];
3
+ export const UNAUTHORIZED_CODES: number[];
4
+ export const DEFAULT_ORIGIN: "https://web.whatsapp.com";
5
+ export const CALL_VIDEO_PREFIX: "https://call.whatsapp.com/video/";
6
+ export const CALL_AUDIO_PREFIX: "https://call.whatsapp.com/voice/";
7
+ export const DEF_CALLBACK_PREFIX: "CB:";
8
+ export const DEF_TAG_PREFIX: "TAG:";
9
+ export const PHONE_CONNECTION_CB: "CB:Pong";
10
+ export const WA_ADV_ACCOUNT_SIG_PREFIX: Buffer<ArrayBuffer>;
11
+ export const WA_ADV_DEVICE_SIG_PREFIX: Buffer<ArrayBuffer>;
12
+ export const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX: Buffer<ArrayBuffer>;
13
+ export const WA_ADV_HOSTED_DEVICE_SIG_PREFIX: Buffer<ArrayBuffer>;
14
+ export const WA_DEFAULT_EPHEMERAL: number;
15
+ export const MOBILE_TOKEN: Buffer<ArrayBuffer>;
16
+ export const MOBILE_REGISTRATION_ENDPOINT: "https://v.whatsapp.net/v2";
17
+ export const MOBILE_USERAGENT: "WhatsApp/2.25.23.24 iOS/17.5.1 Device/Apple-iPhone_13";
18
+ export const REGISTRATION_PUBLIC_KEY: Buffer<ArrayBuffer>;
19
+ export const NOISE_MODE: "Noise_XX_25519_AESGCM_SHA256\0\0\0\0";
20
+ export const DICT_VERSION: 3;
21
+ export const KEY_BUNDLE_TYPE: Buffer<ArrayBuffer>;
22
+ export const NOISE_WA_HEADER: Buffer<ArrayBuffer>;
23
+ export const URL_REGEX: RegExp;
24
+ export namespace WA_CERT_DETAILS {
25
+ let SERIAL: number;
26
+ }
27
+ export const PROCESSABLE_HISTORY_TYPES: any[];
28
+ export namespace DEFAULT_CONNECTION_CONFIG {
29
+ import version = version;
30
+ export { version };
31
+ export let browser: any[];
32
+ export let waWebSocketUrl: string;
33
+ export let connectTimeoutMs: number;
34
+ export let keepAliveIntervalMs: number;
35
+ export let logger: any;
36
+ export let emitOwnEvents: boolean;
37
+ export let defaultQueryTimeoutMs: number;
38
+ export let customUploadHosts: any[];
39
+ export let retryRequestDelayMs: number;
40
+ export let maxMsgRetryCount: number;
41
+ export let fireInitQueries: boolean;
42
+ export let auth: any;
43
+ export let markOnlineOnConnect: boolean;
44
+ export let syncFullHistory: boolean;
45
+ export function patchMessageBeforeSending(msg: any): any;
46
+ export function shouldSyncHistoryMessage(): boolean;
47
+ export function shouldIgnoreJid(): boolean;
48
+ export let linkPreviewImageThumbnailWidth: number;
49
+ export namespace transactionOpts {
50
+ let maxCommitRetries: number;
51
+ let delayBetweenTriesMs: number;
52
+ }
53
+ export let generateHighQualityLinkPreview: boolean;
54
+ export let enableAutoSessionRecreation: boolean;
55
+ export let enableRecentMessageCache: boolean;
56
+ export let options: {};
57
+ export namespace appStateMacVerification {
58
+ let patch: boolean;
59
+ let snapshot: boolean;
60
+ }
61
+ export let countryCode: string;
62
+ export function getMessage(): Promise<any>;
63
+ export function cachedGroupMetadata(): Promise<any>;
64
+ export let makeSignalRepository: typeof libsignal_1.makeLibSignalRepository;
65
+ }
66
+ export const MEDIA_PATH_MAP: {
67
+ image: string;
68
+ video: string;
69
+ document: string;
70
+ audio: string;
71
+ sticker: string;
72
+ 'thumbnail-link': string;
73
+ 'product-catalog-image': string;
74
+ 'md-app-state': string;
75
+ 'md-msg-hist': string;
76
+ 'biz-cover-photo': string;
77
+ };
78
+ export const MEDIA_HKDF_KEY_MAPPING: {
79
+ audio: string;
80
+ document: string;
81
+ gif: string;
82
+ image: string;
83
+ ppic: string;
84
+ product: string;
85
+ ptt: string;
86
+ sticker: string;
87
+ video: string;
88
+ 'thumbnail-document': string;
89
+ 'thumbnail-image': string;
90
+ 'thumbnail-video': string;
91
+ 'thumbnail-link': string;
92
+ 'md-msg-hist': string;
93
+ 'md-app-state': string;
94
+ 'product-catalog-image': string;
95
+ 'payment-bg-image': string;
96
+ ptv: string;
97
+ 'biz-cover-photo': string;
98
+ };
99
+ export const MEDIA_KEYS: string[];
100
+ export const MIN_PREKEY_COUNT: 5;
101
+ export const INITIAL_PREKEY_COUNT: 812;
102
+ export const UPLOAD_TIMEOUT: 30000;
103
+ export const MIN_UPLOAD_INTERVAL: 5000;
104
+ export namespace DEFAULT_CACHE_TTLS {
105
+ let SIGNAL_STORE: number;
106
+ let MSG_RETRY: number;
107
+ let CALL_OFFER: number;
108
+ let USER_DEVICES: number;
109
+ }
110
+ export const PHONENUMBER_MCC: Record<string, number>;
111
+ declare namespace ___home_roy_ye_bail_lib_Defaults_index_ { }
112
+ import libsignal_1 = require("../Signal/libsignal");
113
+ export {};
@@ -0,0 +1,156 @@
1
+ /**
2
+ * ╔═══════════════════════════════════════════════════════════╗
3
+ * ║ NEROX - WhatsApp API Library ║
4
+ * ║ Premium Edition ║
5
+ * ╚═══════════════════════════════════════════════════════════╝
6
+ *
7
+ * @package nerox-bails
8
+ * @version 0.1.0
9
+ * @author NEROX Development Team
10
+ * @copyright Copyright (c) 2025 NEROX. All rights reserved.
11
+ * @license MIT License
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining
14
+ * a copy of this software and associated documentation files (the "Software"),
15
+ * to deal in the Software without restriction, including without limitation
16
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17
+ * and/or sell copies of the Software, and to permit persons to whom the
18
+ * Software is furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included
21
+ * in all copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26
+ */
27
+ "use strict";
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.PHONENUMBER_MCC = 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;
33
+ const WAProto_1 = require("../../WAProto");
34
+ const libsignal_1 = require("../Signal/libsignal");
35
+ const browser_utils_1 = require("../Utils/browser-utils");
36
+ const logger_1 = __importDefault(require("../Utils/logger"));
37
+ const phonenumber_mcc_1 = __importDefault(require("./phonenumber-mcc.json"));
38
+ exports.version = [2, 3000, 1027934701];
39
+ exports.UNAUTHORIZED_CODES = [401, 403, 419];
40
+ exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
41
+ exports.CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
42
+ exports.CALL_AUDIO_PREFIX = 'https://call.whatsapp.com/voice/';
43
+ exports.DEF_CALLBACK_PREFIX = 'CB:';
44
+ exports.DEF_TAG_PREFIX = 'TAG:';
45
+ exports.PHONE_CONNECTION_CB = 'CB:Pong';
46
+ exports.WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0]);
47
+ exports.WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1]);
48
+ exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5]);
49
+ exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6]);
50
+ exports.WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
51
+ const WA_VERSION = '2.25.23.24';
52
+ const crypto_2 = require("crypto");
53
+ const WA_VERSION_HASH = (0, crypto_2.createHash)('md5').update(WA_VERSION).digest('hex');
54
+ exports.MOBILE_TOKEN = Buffer.from('0a1mLfGUIBVrMKF1RdvLI5lkRBvof6vn0fD2QRSM' + WA_VERSION_HASH);
55
+ exports.MOBILE_REGISTRATION_ENDPOINT = 'https://v.whatsapp.net/v2';
56
+ exports.MOBILE_USERAGENT = `WhatsApp/${WA_VERSION} iOS/17.5.1 Device/Apple-iPhone_13`;
57
+ exports.REGISTRATION_PUBLIC_KEY = Buffer.from([
58
+ 5, 142, 140, 15, 116, 195, 235, 197, 215, 166, 134, 92, 108, 60, 132, 56, 86, 176, 97, 33, 204, 232, 234, 119, 77,
59
+ 34, 251, 111, 18, 37, 18, 48, 45,
60
+ ]);
61
+ exports.NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0';
62
+ exports.DICT_VERSION = 3;
63
+ exports.KEY_BUNDLE_TYPE = Buffer.from([5]);
64
+ exports.NOISE_WA_HEADER = Buffer.from([87, 65, 6, exports.DICT_VERSION]);
65
+ exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
66
+ exports.WA_CERT_DETAILS = {
67
+ SERIAL: 0
68
+ };
69
+ exports.PROCESSABLE_HISTORY_TYPES = [
70
+ WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP,
71
+ WAProto_1.proto.HistorySync.HistorySyncType.PUSH_NAME,
72
+ WAProto_1.proto.HistorySync.HistorySyncType.RECENT,
73
+ WAProto_1.proto.HistorySync.HistorySyncType.FULL,
74
+ WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND,
75
+ WAProto_1.proto.HistorySync.HistorySyncType.NON_BLOCKING_DATA,
76
+ WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_STATUS_V3,
77
+ ];
78
+ exports.DEFAULT_CONNECTION_CONFIG = {
79
+ version: exports.version,
80
+ browser: (0, browser_utils_1.Browsers)('Chrome'),
81
+ waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
82
+ connectTimeoutMs: 20_000,
83
+ keepAliveIntervalMs: 30_000,
84
+ logger: logger_1.default.child({ class: 'ye-bail' }),
85
+ emitOwnEvents: true,
86
+ defaultQueryTimeoutMs: 60_000,
87
+ customUploadHosts: [],
88
+ retryRequestDelayMs: 250,
89
+ maxMsgRetryCount: 5,
90
+ fireInitQueries: true,
91
+ auth: undefined,
92
+ markOnlineOnConnect: true,
93
+ syncFullHistory: true,
94
+ patchMessageBeforeSending: msg => msg,
95
+ shouldSyncHistoryMessage: () => true,
96
+ shouldIgnoreJid: () => false,
97
+ linkPreviewImageThumbnailWidth: 192,
98
+ transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
99
+ generateHighQualityLinkPreview: false,
100
+ enableAutoSessionRecreation: true,
101
+ enableRecentMessageCache: true,
102
+ options: {},
103
+ appStateMacVerification: {
104
+ patch: false,
105
+ snapshot: false
106
+ },
107
+ countryCode: 'US',
108
+ getMessage: async () => undefined,
109
+ cachedGroupMetadata: async () => undefined,
110
+ makeSignalRepository: libsignal_1.makeLibSignalRepository
111
+ };
112
+ exports.MEDIA_PATH_MAP = {
113
+ image: '/mms/image',
114
+ video: '/mms/video',
115
+ document: '/mms/document',
116
+ audio: '/mms/audio',
117
+ sticker: '/mms/image',
118
+ 'thumbnail-link': '/mms/image',
119
+ 'product-catalog-image': '/product/image',
120
+ 'md-app-state': '',
121
+ 'md-msg-hist': '/mms/md-app-state',
122
+ 'biz-cover-photo': '/pps/biz-cover-photo'
123
+ };
124
+ exports.MEDIA_HKDF_KEY_MAPPING = {
125
+ audio: 'Audio',
126
+ document: 'Document',
127
+ gif: 'Video',
128
+ image: 'Image',
129
+ ppic: '',
130
+ product: 'Image',
131
+ ptt: 'Audio',
132
+ sticker: 'Image',
133
+ video: 'Video',
134
+ 'thumbnail-document': 'Document Thumbnail',
135
+ 'thumbnail-image': 'Image Thumbnail',
136
+ 'thumbnail-video': 'Video Thumbnail',
137
+ 'thumbnail-link': 'Link Thumbnail',
138
+ 'md-msg-hist': 'History',
139
+ 'md-app-state': 'App State',
140
+ 'product-catalog-image': '',
141
+ 'payment-bg-image': 'Payment Background',
142
+ ptv: 'Video',
143
+ 'biz-cover-photo': 'Image'
144
+ };
145
+ exports.MEDIA_KEYS = Object.keys(exports.MEDIA_PATH_MAP);
146
+ exports.MIN_PREKEY_COUNT = 5;
147
+ exports.INITIAL_PREKEY_COUNT = 812;
148
+ exports.UPLOAD_TIMEOUT = 30000;
149
+ exports.MIN_UPLOAD_INTERVAL = 5000;
150
+ exports.DEFAULT_CACHE_TTLS = {
151
+ SIGNAL_STORE: 5 * 60,
152
+ MSG_RETRY: 60 * 60,
153
+ CALL_OFFER: 5 * 60,
154
+ USER_DEVICES: 5 * 60
155
+ };
156
+ exports.PHONENUMBER_MCC = phonenumber_mcc_1.default;
@@ -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,3 @@
1
+ {
2
+ "version": [2, 3000, 1027934701]
3
+ }
@@ -0,0 +1,10 @@
1
+ export const __esModule: boolean;
2
+ export class CiphertextMessage {
3
+ UNSUPPORTED_VERSION: number;
4
+ CURRENT_VERSION: number;
5
+ WHISPER_TYPE: number;
6
+ PREKEY_TYPE: number;
7
+ SENDERKEY_TYPE: number;
8
+ SENDERKEY_DISTRIBUTION_TYPE: number;
9
+ ENCRYPTED_MESSAGE_OVERHEAD: number;
10
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * ╔═══════════════════════════════════════════════════════════╗
3
+ * ║ NEROX - WhatsApp API Library ║
4
+ * ║ Premium Edition ║
5
+ * ╚═══════════════════════════════════════════════════════════╝
6
+ *
7
+ * @package nerox-bails
8
+ * @version 0.1.0
9
+ * @author NEROX Development Team
10
+ * @copyright Copyright (c) 2025 NEROX. All rights reserved.
11
+ * @license MIT License
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining
14
+ * a copy of this software and associated documentation files (the "Software"),
15
+ * to deal in the Software without restriction, including without limitation
16
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17
+ * and/or sell copies of the Software, and to permit persons to whom the
18
+ * Software is furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included
21
+ * in all copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26
+ */
27
+ "use strict";
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.CiphertextMessage = void 0;
30
+ class CiphertextMessage {
31
+ constructor() {
32
+ this.UNSUPPORTED_VERSION = 1;
33
+ this.CURRENT_VERSION = 3;
34
+ this.WHISPER_TYPE = 2;
35
+ this.PREKEY_TYPE = 3;
36
+ this.SENDERKEY_TYPE = 4;
37
+ this.SENDERKEY_DISTRIBUTION_TYPE = 5;
38
+ this.ENCRYPTED_MESSAGE_OVERHEAD = 53;
39
+ }
40
+ }
41
+ exports.CiphertextMessage = CiphertextMessage;
@@ -0,0 +1,8 @@
1
+ export const __esModule: boolean;
2
+ export class GroupSessionBuilder {
3
+ constructor(senderKeyStore: any);
4
+ senderKeyStore: any;
5
+ process(senderKeyName: any, senderKeyDistributionMessage: any): Promise<void>;
6
+ create(senderKeyName: any): Promise<sender_key_distribution_message_1.SenderKeyDistributionMessage>;
7
+ }
8
+ import sender_key_distribution_message_1 = require("./sender-key-distribution-message");
@@ -0,0 +1,90 @@
1
+ /**
2
+ * ╔═══════════════════════════════════════════════════════════╗
3
+ * ║ NEROX - WhatsApp API Library ║
4
+ * ║ Premium Edition ║
5
+ * ╚═══════════════════════════════════════════════════════════╝
6
+ *
7
+ * @package nerox-bails
8
+ * @version 0.1.0
9
+ * @author NEROX Development Team
10
+ * @copyright Copyright (c) 2025 NEROX. All rights reserved.
11
+ * @license MIT License
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining
14
+ * a copy of this software and associated documentation files (the "Software"),
15
+ * to deal in the Software without restriction, including without limitation
16
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17
+ * and/or sell copies of the Software, and to permit persons to whom the
18
+ * Software is furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included
21
+ * in all copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26
+ */
27
+ "use strict";
28
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ var desc = Object.getOwnPropertyDescriptor(m, k);
31
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
32
+ desc = { enumerable: true, get: function() { return m[k]; } };
33
+ }
34
+ Object.defineProperty(o, k2, desc);
35
+ }) : (function(o, m, k, k2) {
36
+ if (k2 === undefined) k2 = k;
37
+ o[k2] = m[k];
38
+ }));
39
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
40
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
41
+ }) : function(o, v) {
42
+ o["default"] = v;
43
+ });
44
+ var __importStar = (this && this.__importStar) || (function () {
45
+ var ownKeys = function(o) {
46
+ ownKeys = Object.getOwnPropertyNames || function (o) {
47
+ var ar = [];
48
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
49
+ return ar;
50
+ };
51
+ return ownKeys(o);
52
+ };
53
+ return function (mod) {
54
+ if (mod && mod.__esModule) return mod;
55
+ var result = {};
56
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
57
+ __setModuleDefault(result, mod);
58
+ return result;
59
+ };
60
+ })();
61
+ Object.defineProperty(exports, "__esModule", { value: true });
62
+ exports.GroupSessionBuilder = void 0;
63
+ const keyhelper = __importStar(require("./keyhelper"));
64
+ const sender_key_distribution_message_1 = require("./sender-key-distribution-message");
65
+ class GroupSessionBuilder {
66
+ constructor(senderKeyStore) {
67
+ this.senderKeyStore = senderKeyStore;
68
+ }
69
+ async process(senderKeyName, senderKeyDistributionMessage) {
70
+ const senderKeyRecord = await this.senderKeyStore.loadSenderKey(senderKeyName);
71
+ senderKeyRecord.addSenderKeyState(senderKeyDistributionMessage.getId(), senderKeyDistributionMessage.getIteration(), senderKeyDistributionMessage.getChainKey(), senderKeyDistributionMessage.getSignatureKey());
72
+ await this.senderKeyStore.storeSenderKey(senderKeyName, senderKeyRecord);
73
+ }
74
+ async create(senderKeyName) {
75
+ const senderKeyRecord = await this.senderKeyStore.loadSenderKey(senderKeyName);
76
+ if (senderKeyRecord.isEmpty()) {
77
+ const keyId = keyhelper.generateSenderKeyId();
78
+ const senderKey = keyhelper.generateSenderKey();
79
+ const signingKey = keyhelper.generateSenderSigningKey();
80
+ senderKeyRecord.setSenderKeyState(keyId, 0, senderKey, signingKey);
81
+ await this.senderKeyStore.storeSenderKey(senderKeyName, senderKeyRecord);
82
+ }
83
+ const state = senderKeyRecord.getSenderKeyState();
84
+ if (!state) {
85
+ throw new Error('No session state available');
86
+ }
87
+ return new sender_key_distribution_message_1.SenderKeyDistributionMessage(state.getKeyId(), state.getSenderChainKey().getIteration(), state.getSenderChainKey().getSeed(), state.getSigningKeyPublic());
88
+ }
89
+ }
90
+ exports.GroupSessionBuilder = GroupSessionBuilder;
@@ -0,0 +1,12 @@
1
+ export const __esModule: boolean;
2
+ export class GroupCipher {
3
+ constructor(senderKeyStore: any, senderKeyName: any);
4
+ senderKeyStore: any;
5
+ senderKeyName: any;
6
+ queueJob(awaitable: any): any;
7
+ encrypt(paddedPlaintext: any): Promise<any>;
8
+ decrypt(senderKeyMessageBytes: any): Promise<any>;
9
+ getSenderKey(senderKeyState: any, iteration: any): any;
10
+ getPlainText(iv: any, key: any, ciphertext: any): Promise<Uint8Array<ArrayBufferLike>>;
11
+ getCipherText(iv: any, key: any, plaintext: any): Promise<Buffer<ArrayBufferLike>>;
12
+ }