@ruthless-imperium/baileys 0.0.0-stage → 1.0.0

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 (98) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +97 -2
  3. package/WAProto/index.js +115856 -0
  4. package/engine-requirements.js +10 -0
  5. package/lib/Defaults/index.js +120 -0
  6. package/lib/Defaults/noxleyss-version.json +3 -0
  7. package/lib/Signal/Group/ciphertext-message.js +15 -0
  8. package/lib/Signal/Group/group-session-builder.js +64 -0
  9. package/lib/Signal/Group/group_cipher.js +96 -0
  10. package/lib/Signal/Group/index.js +57 -0
  11. package/lib/Signal/Group/keyhelper.js +55 -0
  12. package/lib/Signal/Group/queue-job.js +57 -0
  13. package/lib/Signal/Group/sender-chain-key.js +34 -0
  14. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  15. package/lib/Signal/Group/sender-key-message.js +69 -0
  16. package/lib/Signal/Group/sender-key-name.js +51 -0
  17. package/lib/Signal/Group/sender-key-record.js +53 -0
  18. package/lib/Signal/Group/sender-key-state.js +99 -0
  19. package/lib/Signal/Group/sender-message-key.js +29 -0
  20. package/lib/Signal/libsignal.js +184 -0
  21. package/lib/Socket/Client/index.js +18 -0
  22. package/lib/Socket/Client/types.js +13 -0
  23. package/lib/Socket/Client/websocket.js +72 -0
  24. package/lib/Socket/business.js +260 -0
  25. package/lib/Socket/chats.js +997 -0
  26. package/lib/Socket/groups.js +332 -0
  27. package/lib/Socket/index.js +10 -0
  28. package/lib/Socket/messages-recv.js +1106 -0
  29. package/lib/Socket/messages-send.js +944 -0
  30. package/lib/Socket/newsletter.js +251 -0
  31. package/lib/Socket/socket.js +646 -0
  32. package/lib/Socket/usync.js +70 -0
  33. package/lib/Store/index.js +8 -0
  34. package/lib/Store/make-in-memory-store.js +439 -0
  35. package/lib/Store/make-ordered-dictionary.js +81 -0
  36. package/lib/Store/object-repository.js +27 -0
  37. package/lib/Types/Auth.js +2 -0
  38. package/lib/Types/Call.js +2 -0
  39. package/lib/Types/Chat.js +4 -0
  40. package/lib/Types/Contact.js +2 -0
  41. package/lib/Types/Events.js +2 -0
  42. package/lib/Types/GroupMetadata.js +2 -0
  43. package/lib/Types/Label.js +27 -0
  44. package/lib/Types/LabelAssociation.js +9 -0
  45. package/lib/Types/Message.js +7 -0
  46. package/lib/Types/Newsletter.js +18 -0
  47. package/lib/Types/Product.js +2 -0
  48. package/lib/Types/Signal.js +2 -0
  49. package/lib/Types/Socket.js +2 -0
  50. package/lib/Types/State.js +2 -0
  51. package/lib/Types/USync.js +2 -0
  52. package/lib/Types/index.js +42 -0
  53. package/lib/Utils/auth-utils.js +199 -0
  54. package/lib/Utils/browser-utils.js +35 -0
  55. package/lib/Utils/business.js +234 -0
  56. package/lib/Utils/chat-utils.js +730 -0
  57. package/lib/Utils/crypto.js +193 -0
  58. package/lib/Utils/decode-wa-message.js +217 -0
  59. package/lib/Utils/event-buffer.js +518 -0
  60. package/lib/Utils/generics.js +467 -0
  61. package/lib/Utils/history.js +94 -0
  62. package/lib/Utils/index.js +35 -0
  63. package/lib/Utils/link-preview.js +126 -0
  64. package/lib/Utils/logger.js +7 -0
  65. package/lib/Utils/lt-hash.js +51 -0
  66. package/lib/Utils/make-mutex.js +43 -0
  67. package/lib/Utils/message-retry-manager.js +185 -0
  68. package/lib/Utils/messages-media.js +879 -0
  69. package/lib/Utils/messages.js +1944 -0
  70. package/lib/Utils/noise-handler.js +150 -0
  71. package/lib/Utils/noxleyss-event-stream.js +63 -0
  72. package/lib/Utils/process-message.js +404 -0
  73. package/lib/Utils/signal.js +153 -0
  74. package/lib/Utils/use-multi-file-auth-state.js +124 -0
  75. package/lib/Utils/validate-connection.js +229 -0
  76. package/lib/WABinary/constants.js +1303 -0
  77. package/lib/WABinary/decode.js +265 -0
  78. package/lib/WABinary/encode.js +250 -0
  79. package/lib/WABinary/generic-utils.js +110 -0
  80. package/lib/WABinary/index.js +21 -0
  81. package/lib/WABinary/jid-utils.js +85 -0
  82. package/lib/WABinary/types.js +2 -0
  83. package/lib/WAM/BinaryInfo.js +13 -0
  84. package/lib/WAM/constants.js +15350 -0
  85. package/lib/WAM/encode.js +155 -0
  86. package/lib/WAM/index.js +19 -0
  87. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  88. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  89. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  90. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  91. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
  92. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
  93. package/lib/WAUSync/Protocols/index.js +20 -0
  94. package/lib/WAUSync/USyncQuery.js +89 -0
  95. package/lib/WAUSync/USyncUser.js +26 -0
  96. package/lib/WAUSync/index.js +19 -0
  97. package/lib/index.js +297 -0
  98. package/package.json +119 -3
package/lib/index.js ADDED
@@ -0,0 +1,297 @@
1
+ "use strict";
2
+
3
+ // ==================================================
4
+ // @ruthless-imperium/baileys
5
+ // BAILEYS - CORP
6
+ // ==================================================
7
+
8
+ const { spawn } = require("child_process");
9
+
10
+ const gradients = [
11
+ { c1: [140, 90, 255], c2: [90, 200, 255] },
12
+ { c1: [255, 80, 160], c2: [140, 90, 255] },
13
+ { c1: [0, 200, 255], c2: [120, 255, 220] },
14
+ { c1: [170, 80, 255], c2: [255, 120, 200] }
15
+ ];
16
+
17
+ const RESET = "\x1b[0m";
18
+ const WHITE = "\x1b[38;2;235;235;240m";
19
+ const GRAY = "\x1b[38;2;145;145;155m";
20
+ const GREEN = "\x1b[38;2;80;255;150m";
21
+
22
+ function gradient(text) {
23
+ const { c1, c2 } =
24
+ gradients[Math.floor(Math.random() * gradients.length)];
25
+
26
+ return [...text].map((char, i) => {
27
+ const t = text.length <= 1
28
+ ? 0
29
+ : i / (text.length - 1);
30
+
31
+ const r = Math.round(c1[0] + (c2[0] - c1[0]) * t);
32
+ const g = Math.round(c1[1] + (c2[1] - c1[1]) * t);
33
+ const b = Math.round(c1[2] + (c2[2] - c1[2]) * t);
34
+
35
+ return `\x1b[38;2;${r};${g};${b}m${char}`;
36
+ }).join("") + RESET;
37
+ }
38
+
39
+ function center(text) {
40
+ const width = process.stdout.columns || 80;
41
+
42
+ const clean = text.replace(
43
+ /\x1b\[[0-9;]*m/g,
44
+ ""
45
+ );
46
+
47
+ const padding = Math.max(
48
+ 0,
49
+ Math.floor((width - clean.length) / 2)
50
+ );
51
+
52
+ return " ".repeat(padding) + text;
53
+ }
54
+
55
+ const line = "────────────────────────────────────";
56
+
57
+
58
+ // ==================================================
59
+ // @ruthless-imperium/baileys STARTUP
60
+ // ==================================================
61
+
62
+ console.clear();
63
+
64
+ process.stdout.write("\n");
65
+
66
+ process.stdout.write(
67
+ `${gradient(center("@ruthless-imperium/baileys"))}\n`
68
+ );
69
+
70
+ process.stdout.write(
71
+ `${gradient(center("BAILEYS - CORP"))}\n`
72
+ );
73
+
74
+ process.stdout.write("\n");
75
+
76
+ process.stdout.write(
77
+ `${gradient(center(line))}\n`
78
+ );
79
+
80
+ process.stdout.write("\n");
81
+
82
+
83
+ // ==================================================
84
+ // INITIALIZING
85
+ // ==================================================
86
+
87
+ process.stdout.write(
88
+ ` ◐ ${WHITE}Initializing Calver...${RESET}\n`
89
+ );
90
+
91
+ process.stdout.write("\n");
92
+
93
+ process.stdout.write(
94
+ ` ${GRAY}Creator :${RESET} ${WHITE}Calver${RESET}\n`
95
+ );
96
+
97
+ process.stdout.write(
98
+ ` ${GRAY}Version :${RESET} ${WHITE}1.11.1${RESET}\n`
99
+ );
100
+
101
+ process.stdout.write("\n");
102
+
103
+
104
+ // ==================================================
105
+ // SPINNER PROCESS
106
+ // ==================================================
107
+
108
+ const spinnerCode = `
109
+ const frames = ["◐", "◓", "◑", "◒"];
110
+ let index = 0;
111
+
112
+ process.stdout.write(
113
+ "\\r\\x1b[2K " +
114
+ frames[index] +
115
+ " \\x1b[38;2;235;235;240mInitializing Calver...\\x1b[0m"
116
+ );
117
+
118
+ setInterval(() => {
119
+ index = (index + 1) % frames.length;
120
+
121
+ process.stdout.write(
122
+ "\\r\\x1b[2K " +
123
+ frames[index] +
124
+ " \\x1b[38;2;235;235;240mInitializing Calver...\\x1b[0m"
125
+ );
126
+ }, 120);
127
+ `;
128
+
129
+ const spinner = spawn(
130
+ process.execPath,
131
+ ["-e", spinnerCode],
132
+ {
133
+ stdio: ["ignore", "inherit", "inherit"]
134
+ }
135
+ );
136
+
137
+
138
+ // ==================================================
139
+ // BAILEYS INTERNAL
140
+ // ==================================================
141
+
142
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
143
+ if (k2 === undefined) k2 = k;
144
+
145
+ var desc = Object.getOwnPropertyDescriptor(m, k);
146
+
147
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
148
+ desc = {
149
+ enumerable: true,
150
+ get: function() {
151
+ return m[k];
152
+ }
153
+ };
154
+ }
155
+
156
+ Object.defineProperty(o, k2, desc);
157
+
158
+ }) : (function(o, m, k, k2) {
159
+ if (k2 === undefined) k2 = k;
160
+
161
+ o[k2] = m[k];
162
+ }));
163
+
164
+
165
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
166
+
167
+ for (var p in m)
168
+
169
+ if (
170
+ p !== "default" &&
171
+ !Object.prototype.hasOwnProperty.call(exports, p)
172
+ ) {
173
+ __createBinding(exports, m, p);
174
+ }
175
+ };
176
+
177
+
178
+ var __importDefault = (this && this.__importDefault) || function(mod) {
179
+
180
+ return (mod && mod.__esModule)
181
+ ? mod
182
+ : { "default": mod };
183
+
184
+ };
185
+
186
+
187
+ Object.defineProperty(exports, "__esModule", {
188
+ value: true
189
+ });
190
+
191
+ exports.proto = exports.makeWASocket = void 0;
192
+
193
+
194
+ const WAProto_1 = require("../WAProto");
195
+
196
+
197
+ Object.defineProperty(exports, "proto", {
198
+ enumerable: true,
199
+
200
+ get: function() {
201
+ return WAProto_1.proto;
202
+ }
203
+ });
204
+
205
+
206
+ const Socket_1 = __importDefault(
207
+ require("./Socket")
208
+ );
209
+
210
+ exports.makeWASocket = Socket_1.default;
211
+
212
+
213
+ __exportStar(
214
+ require("../WAProto"),
215
+ exports
216
+ );
217
+
218
+ __exportStar(
219
+ require("./Utils"),
220
+ exports
221
+ );
222
+
223
+ __exportStar(
224
+ require("./Types"),
225
+ exports
226
+ );
227
+
228
+ __exportStar(
229
+ require("./Store"),
230
+ exports
231
+ );
232
+
233
+ __exportStar(
234
+ require("./Defaults"),
235
+ exports
236
+ );
237
+
238
+ __exportStar(
239
+ require("./WABinary"),
240
+ exports
241
+ );
242
+
243
+ __exportStar(
244
+ require("./WAM"),
245
+ exports
246
+ );
247
+
248
+ __exportStar(
249
+ require("./WAUSync"),
250
+ exports
251
+ );
252
+
253
+
254
+ // ==================================================
255
+ // BAILEYS LOADED
256
+ // ==================================================
257
+
258
+ if (spinner && !spinner.killed) {
259
+ spinner.kill();
260
+ }
261
+
262
+ process.stdout.write(
263
+ "\r\x1b[2K"
264
+ );
265
+
266
+ process.stdout.write(
267
+ ` ${GREEN}✓${RESET} ${WHITE}Baileys Ready${RESET}\n`
268
+ );
269
+
270
+ process.stdout.write(
271
+ ` ${GRAY}›${RESET} ${WHITE}Ready to process messages.${RESET}\n`
272
+ );
273
+
274
+ process.stdout.write("\n");
275
+
276
+ process.stdout.write(
277
+ `${gradient(center(line))}\n`
278
+ );
279
+
280
+ process.stdout.write("\n");
281
+
282
+ process.stdout.write(
283
+ `${GRAY}${center("© 2026 Calver")}${RESET}\n`
284
+ );
285
+
286
+ process.stdout.write(
287
+ `${gradient(center(line))}\n`
288
+ );
289
+
290
+ process.stdout.write("\n");
291
+
292
+
293
+ // ==================================================
294
+ // FINAL EXPORT
295
+ // ==================================================
296
+
297
+ exports.default = Socket_1.default;
package/package.json CHANGED
@@ -1,6 +1,122 @@
1
1
  {
2
2
  "name": "@ruthless-imperium/baileys",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "WhatsApp Web API Library",
5
+ "keywords": [
6
+ "imperium",
7
+ "ruthless",
8
+ "latest",
9
+ "last",
10
+ "baileys",
11
+ "whatsapp",
12
+ "whatsapp-api",
13
+ "whatsapp-web",
14
+ "whatsapp-bot",
15
+ "automation",
16
+ "multi-device"
17
+ ],
18
+ "homepage": "https://github.com/FallEzz",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/FallEzz"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/FallEzz"
25
+ },
26
+ "license": "MIT",
27
+ "author": "alberthost",
28
+ "main": "lib/index.js",
29
+ "types": "lib/index.d.ts",
30
+ "files": [
31
+ "lib/",
32
+ "WAProto/",
33
+ "engine-requirements.js"
34
+ ],
35
+ "scripts": {
36
+ "build:all": "tsc && typedoc",
37
+ "build:docs": "typedoc",
38
+ "build:tsc": "tsc",
39
+ "changelog:last": "conventional-changelog -p angular -r 2",
40
+ "changelog:preview": "conventional-changelog -p angular -u",
41
+ "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
42
+ "example": "node --inspect -r ts-node/register Example/example.ts",
43
+ "gen:protobuf": "sh WAProto/GenerateStatics.sh",
44
+ "lint": "node -e \"const { execSync } = require('child_process'); execSync('find lib/ -name \\\"*.js\\\" | xargs -I{} node --check {}'); console.log('LINT_OK');\"",
45
+ "lint:fix": "eslint lib --fix --ext .js",
46
+ "prepack": "echo 'noxleyss WhatsApp Library'",
47
+ "prepare": "echo 'noxleyss WhatsApp Library'",
48
+ "preinstall": "node ./engine-requirements.js",
49
+ "release": "release-it",
50
+ "test": "jest"
51
+ },
52
+ "dependencies": {
53
+ "@adiwajshing/keyed-db": "^0.2.4",
54
+ "@cacheable/node-cache": "^1.4.0",
55
+ "@hapi/boom": "^9.1.3",
56
+ "async-mutex": "^0.5.0",
57
+ "axios": "^1.6.0",
58
+ "cache-manager": "^5.7.6",
59
+ "chalk": "^4.1.2",
60
+ "cheerio": "^1.0.0-rc.10",
61
+ "gradient-string": "^2.0.2",
62
+ "libphonenumber-js": "^1.10.20",
63
+ "libsignal": "npm:@noxzaid/libsignal-node",
64
+ "lodash": "^4.17.21",
65
+ "lru-cache": "^11.1.0",
66
+ "music-metadata": "^7.12.3",
67
+ "p-queue": "^9.0.0",
68
+ "pino": "^9.6",
69
+ "protobufjs": "^6.11.3",
70
+ "uuid": "^10.0.0",
71
+ "ws": "^8.13.0"
72
+ },
73
+ "devDependencies": {
74
+ "@adiwajshing/eslint-config": "npm:@noxzaid/eslint-config",
75
+ "@types/got": "^9.6.11",
76
+ "@types/jest": "^27.5.1",
77
+ "@types/node": "^16.18.126",
78
+ "@types/sharp": "^0.29.4",
79
+ "@types/ws": "^8.0.0",
80
+ "conventional-changelog-cli": "^2.2.2",
81
+ "eslint": "^8.0.0",
82
+ "jest": "^27.0.6",
83
+ "jimp": "^0.22.12",
84
+ "json": "^11.0.0",
85
+ "link-preview-js": "^3.0.0",
86
+ "open": "^8.4.2",
87
+ "qrcode-terminal": "^0.12.0",
88
+ "release-it": "^15.10.3",
89
+ "sharp": "^0.34.1",
90
+ "ts-jest": "^27.0.3",
91
+ "ts-node": "^10.8.1",
92
+ "typedoc": "^0.27.9",
93
+ "typescript": "^5.8.2"
94
+ },
95
+ "peerDependencies": {
96
+ "audio-decode": "^2.1.3",
97
+ "jimp": "^0.22.12",
98
+ "link-preview-js": "^3.0.0",
99
+ "qrcode-terminal": "^0.12.0",
100
+ "sharp": "^0.34.1"
101
+ },
102
+ "peerDependenciesMeta": {
103
+ "audio-decode": {
104
+ "optional": true
105
+ },
106
+ "jimp": {
107
+ "optional": true
108
+ },
109
+ "link-preview-js": {
110
+ "optional": true
111
+ },
112
+ "qrcode-terminal": {
113
+ "optional": true
114
+ },
115
+ "sharp": {
116
+ "optional": true
117
+ }
118
+ },
119
+ "engines": {
120
+ "node": ">=20.0.0"
121
+ }
6
122
  }