@mrlegendbot/baileys 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.
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/fix-imports.js +85 -0
- package/WAProto/index.d.ts +14017 -0
- package/WAProto/index.js +97691 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.d.ts +75 -0
- package/lib/Defaults/index.js +129 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/group-session-builder.d.ts +15 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.js +26 -0
- package/lib/Signal/libsignal.d.ts +5 -0
- package/lib/Signal/libsignal.js +431 -0
- package/lib/Signal/lid-mapping.d.ts +23 -0
- package/lib/Signal/lid-mapping.js +277 -0
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.js +3 -0
- package/lib/Socket/Client/types.d.ts +16 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/websocket.d.ts +13 -0
- package/lib/Socket/Client/websocket.js +54 -0
- package/lib/Socket/business.d.ts +217 -0
- package/lib/Socket/business.js +379 -0
- package/lib/Socket/chats.d.ts +125 -0
- package/lib/Socket/chats.js +1198 -0
- package/lib/Socket/communities.d.ts +273 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/groups.d.ts +161 -0
- package/lib/Socket/groups.js +347 -0
- package/lib/Socket/index.d.ts +260 -0
- package/lib/Socket/index.js +12 -0
- package/lib/Socket/messages-recv.d.ts +203 -0
- package/lib/Socket/messages-recv.js +1772 -0
- package/lib/Socket/messages-send.d.ts +199 -0
- package/lib/Socket/messages-send.js +1145 -0
- package/lib/Socket/mex.d.ts +3 -0
- package/lib/Socket/mex.js +42 -0
- package/lib/Socket/newsletter.d.ts +170 -0
- package/lib/Socket/newsletter.js +337 -0
- package/lib/Socket/newsletter.zip +0 -0
- package/lib/Socket/socket.d.ts +59 -0
- package/lib/Socket/socket.js +970 -0
- package/lib/Types/Auth.d.ts +117 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Call.d.ts +15 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.d.ts +124 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Contact.d.ts +26 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.d.ts +256 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.d.ts +71 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.d.ts +47 -0
- package/lib/Types/Label.js +25 -0
- package/lib/Types/LabelAssociation.d.ts +30 -0
- package/lib/Types/LabelAssociation.js +7 -0
- package/lib/Types/Message.d.ts +320 -0
- package/lib/Types/Message.js +11 -0
- package/lib/Types/Mex.d.ts +141 -0
- package/lib/Types/Mex.js +37 -0
- package/lib/Types/Product.d.ts +79 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.d.ts +87 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.d.ts +136 -0
- package/lib/Types/Socket.js +3 -0
- package/lib/Types/State.d.ts +97 -0
- package/lib/Types/State.js +56 -0
- package/lib/Types/USync.d.ts +26 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +66 -0
- package/lib/Types/index.js +26 -0
- package/lib/Utils/auth-utils.d.ts +24 -0
- package/lib/Utils/auth-utils.js +302 -0
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.js +29 -0
- package/lib/Utils/business.d.ts +23 -0
- package/lib/Utils/business.js +231 -0
- package/lib/Utils/chat-utils.d.ts +100 -0
- package/lib/Utils/chat-utils.js +872 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
- package/lib/Utils/companion-reg-client-utils.js +35 -0
- package/lib/Utils/crypto.d.ts +37 -0
- package/lib/Utils/crypto.js +118 -0
- package/lib/Utils/decode-wa-message.d.ts +66 -0
- package/lib/Utils/decode-wa-message.js +317 -0
- package/lib/Utils/event-buffer.d.ts +36 -0
- package/lib/Utils/event-buffer.js +622 -0
- package/lib/Utils/generics.d.ts +92 -0
- package/lib/Utils/generics.js +393 -0
- package/lib/Utils/history.d.ts +24 -0
- package/lib/Utils/history.js +134 -0
- package/lib/Utils/identity-change-handler.d.ts +44 -0
- package/lib/Utils/identity-change-handler.js +50 -0
- package/lib/Utils/index.d.ts +22 -0
- package/lib/Utils/index.js +22 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.js +85 -0
- package/lib/Utils/logger.d.ts +12 -0
- package/lib/Utils/logger.js +3 -0
- package/lib/Utils/lt-hash.d.ts +8 -0
- package/lib/Utils/lt-hash.js +8 -0
- package/lib/Utils/make-mutex.d.ts +9 -0
- package/lib/Utils/make-mutex.js +33 -0
- package/lib/Utils/message-retry-manager.d.ts +115 -0
- package/lib/Utils/message-retry-manager.js +265 -0
- package/lib/Utils/messages-media.d.ts +133 -0
- package/lib/Utils/messages-media.js +788 -0
- package/lib/Utils/messages.d.ts +91 -0
- package/lib/Utils/messages.js +893 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +201 -0
- package/lib/Utils/offline-node-processor.d.ts +17 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/process-message.d.ts +60 -0
- package/lib/Utils/process-message.js +630 -0
- package/lib/Utils/reporting-utils.d.ts +11 -0
- package/lib/Utils/reporting-utils.js +258 -0
- package/lib/Utils/signal.d.ts +47 -0
- package/lib/Utils/signal.js +201 -0
- package/lib/Utils/stanza-ack.d.ts +11 -0
- package/lib/Utils/stanza-ack.js +38 -0
- package/lib/Utils/sync-action-utils.d.ts +19 -0
- package/lib/Utils/sync-action-utils.js +49 -0
- package/lib/Utils/tc-token-utils.d.ts +37 -0
- package/lib/Utils/tc-token-utils.js +164 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
- package/lib/Utils/use-multi-file-auth-state.js +121 -0
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.js +210 -0
- package/lib/WABinary/constants.d.ts +28 -0
- package/lib/WABinary/constants.js +1301 -0
- package/lib/WABinary/decode.d.ts +7 -0
- package/lib/WABinary/decode.js +262 -0
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.js +220 -0
- package/lib/WABinary/generic-utils.d.ts +15 -0
- package/lib/WABinary/generic-utils.js +113 -0
- package/lib/WABinary/index.d.ts +6 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/jid-utils.d.ts +48 -0
- package/lib/WABinary/jid-utils.js +96 -0
- package/lib/WABinary/types.d.ts +19 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.d.ts +9 -0
- package/lib/WAM/BinaryInfo.js +10 -0
- package/lib/WAM/constants.d.ts +40 -0
- package/lib/WAM/constants.js +22853 -0
- package/lib/WAM/encode.d.ts +3 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/index.d.ts +4 -0
- package/lib/WAM/index.js +4 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/index.d.ts +6 -0
- package/lib/WAUSync/Protocols/index.js +6 -0
- package/lib/WAUSync/USyncQuery.d.ts +30 -0
- package/lib/WAUSync/USyncQuery.js +98 -0
- package/lib/WAUSync/USyncUser.d.ts +17 -0
- package/lib/WAUSync/USyncUser.js +31 -0
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.js +4 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +11 -0
- package/package.json +137 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>MR LEGEND</h1>
|
|
3
|
+
<h1>TRAVA TIGER</h1>
|
|
4
|
+
<h1>ISMAIL MUGHAL</h1>
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
<strong>Join the channels & stay updated</strong><br>
|
|
8
|
+
<br>
|
|
9
|
+
|
|
10
|
+
<a href="https://whatsapp.com/channel/0029VbDL0mxEFeXoKjO1370H" target="_blank">
|
|
11
|
+
<img src="https://img.shields.io/badge/WhatsApp-Channel-25D366?style=for-the-badge&logo=whatsapp&logoColor=white&labelColor=0f3f30" alt="WhatsApp Channel">
|
|
12
|
+
</a>
|
|
13
|
+
|
|
14
|
+
<a href="https://www.youtube.com/@TRAVA-TIGER" target="_blank">
|
|
15
|
+
<img src="https://img.shields.io/badge/YouTube-TRAVA TIGER-FF0000?style=for-the-badge&logo=youtube&logoColor=white&labelColor=330000" alt="YouTube">
|
|
16
|
+
</a>
|
|
17
|
+
</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<br>
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<br>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify --no-comments -o ./index.js ./WAProto.proto;
|
|
2
|
+
yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify ./WAProto.proto | yarn pbts --no-comments -o ./index.d.ts -;
|
|
3
|
+
node ./fix-imports.js
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import { exit } from 'process';
|
|
3
|
+
|
|
4
|
+
const filePath = './index.js'
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
let content = readFileSync(filePath, 'utf8')
|
|
8
|
+
|
|
9
|
+
content = content.replace(/import \* as (\$protobuf) from/g, 'import $1 from')
|
|
10
|
+
content = content.replace(/(['"])protobufjs\/minimal(['"])/g, '$1protobufjs/minimal.js$2')
|
|
11
|
+
|
|
12
|
+
const marker = 'const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});\n\n'
|
|
13
|
+
const longToStringHelper =
|
|
14
|
+
'function longToString(value, unsigned) {\n' +
|
|
15
|
+
'\tif (typeof value === "string") {\n' +
|
|
16
|
+
'\t\treturn value;\n' +
|
|
17
|
+
'\t}\n' +
|
|
18
|
+
'\tif (typeof value === "number") {\n' +
|
|
19
|
+
'\t\treturn String(value);\n' +
|
|
20
|
+
'\t}\n' +
|
|
21
|
+
'\t// Fast path: convert Long {low, high} directly via native BigInt\n' +
|
|
22
|
+
'\t// BigInt.toString() is a native C++ operation, much faster than Long\'s pure JS division loops\n' +
|
|
23
|
+
'\tif (value && typeof value.low === "number" && typeof value.high === "number") {\n' +
|
|
24
|
+
'\t\tconst lo = BigInt(value.low >>> 0);\n' +
|
|
25
|
+
'\t\tconst hi = BigInt(value.high >>> 0);\n' +
|
|
26
|
+
'\t\tconst combined = (hi << 32n) | lo;\n' +
|
|
27
|
+
'\t\tif (!unsigned && value.high < 0) {\n' +
|
|
28
|
+
'\t\t\treturn (combined - (1n << 64n)).toString();\n' +
|
|
29
|
+
'\t\t}\n' +
|
|
30
|
+
'\t\treturn combined.toString();\n' +
|
|
31
|
+
'\t}\n' +
|
|
32
|
+
'\treturn String(value);\n' +
|
|
33
|
+
'}\n\n'
|
|
34
|
+
const longToNumberHelper =
|
|
35
|
+
'function longToNumber(value, unsigned) {\n' +
|
|
36
|
+
'\tif (typeof value === "number") {\n' +
|
|
37
|
+
'\t\treturn value;\n' +
|
|
38
|
+
'\t}\n' +
|
|
39
|
+
'\tif (typeof value === "string") {\n' +
|
|
40
|
+
'\t\treturn Number(value);\n' +
|
|
41
|
+
'\t}\n' +
|
|
42
|
+
'\t// Fast path: convert Long {low, high} directly via native BigInt\n' +
|
|
43
|
+
'\tif (value && typeof value.low === "number" && typeof value.high === "number") {\n' +
|
|
44
|
+
'\t\tconst lo = BigInt(value.low >>> 0);\n' +
|
|
45
|
+
'\t\tconst hi = BigInt(value.high >>> 0);\n' +
|
|
46
|
+
'\t\tconst combined = (hi << 32n) | lo;\n' +
|
|
47
|
+
'\t\tif (!unsigned && value.high < 0) {\n' +
|
|
48
|
+
'\t\t\treturn Number(combined - (1n << 64n));\n' +
|
|
49
|
+
'\t\t}\n' +
|
|
50
|
+
'\t\treturn Number(combined);\n' +
|
|
51
|
+
'\t}\n' +
|
|
52
|
+
'\treturn Number(value);\n' +
|
|
53
|
+
'}\n\n'
|
|
54
|
+
|
|
55
|
+
if (!content.includes('function longToString(')) {
|
|
56
|
+
const markerIndex = content.indexOf(marker)
|
|
57
|
+
if (markerIndex === -1) {
|
|
58
|
+
throw new Error('Unable to inject Long helpers: marker not found in WAProto index output')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
content = content.replace(marker, `${marker}${longToStringHelper}${longToNumberHelper}`)
|
|
62
|
+
} else {
|
|
63
|
+
const longToStringRegex = /function longToString\(value, unsigned\) {\n[\s\S]*?\n}\n\n/
|
|
64
|
+
const longToNumberRegex = /function longToNumber\(value, unsigned\) {\n[\s\S]*?\n}\n\n/
|
|
65
|
+
|
|
66
|
+
if (!longToStringRegex.test(content) || !longToNumberRegex.test(content)) {
|
|
67
|
+
throw new Error('Unable to update Long helpers: existing definitions not found')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
content = content.replace(longToStringRegex, longToStringHelper)
|
|
71
|
+
content = content.replace(longToNumberRegex, longToNumberHelper)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const longPattern = /([ \t]+d\.(\w+) = )o\.longs === String \? \$util\.Long\.prototype\.toString\.call\(m\.\2\) : o\.longs === Number \? new \$util\.LongBits\(m\.\2\.low >>> 0, m\.\2\.high >>> 0\)\.toNumber\((true)?\) : m\.\2;/g
|
|
75
|
+
content = content.replace(longPattern, (_match, prefix, field, unsignedFlag) => {
|
|
76
|
+
const unsignedArg = unsignedFlag ? ', true' : ''
|
|
77
|
+
return `${prefix}o.longs === String ? longToString(m.${field}${unsignedArg}) : o.longs === Number ? longToNumber(m.${field}${unsignedArg}) : m.${field};`
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
writeFileSync(filePath, content, 'utf8')
|
|
81
|
+
console.log(`✅ Fixed imports in ${filePath}`)
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error(`❌ Error fixing imports: ${error.message}`)
|
|
84
|
+
exit(1)
|
|
85
|
+
}
|