casper-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 +193 -0
- package/WAProto/GenerateStatics.sh +2 -0
- package/WAProto/WAProto.proto +4633 -0
- package/WAProto/index.js +165059 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.js +105 -0
- package/lib/Signal/Group/ciphertext-message.js +15 -0
- package/lib/Signal/Group/group-session-builder.js +64 -0
- package/lib/Signal/Group/group_cipher.js +96 -0
- package/lib/Signal/Group/index.js +57 -0
- package/lib/Signal/Group/keyhelper.js +55 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.js +34 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.js +69 -0
- package/lib/Signal/Group/sender-key-name.js +51 -0
- package/lib/Signal/Group/sender-key-record.js +53 -0
- package/lib/Signal/Group/sender-key-state.js +99 -0
- package/lib/Signal/Group/sender-message-key.js +29 -0
- package/lib/Signal/libsignal/WhisperTextProtocol.js +933 -0
- package/lib/Signal/libsignal/base_key_type.js +7 -0
- package/lib/Signal/libsignal/chain_type.js +6 -0
- package/lib/Signal/libsignal/crypto.js +98 -0
- package/lib/Signal/libsignal/curve.js +142 -0
- package/lib/Signal/libsignal/errors.js +33 -0
- package/lib/Signal/libsignal/index.js +9 -0
- package/lib/Signal/libsignal/keyhelper.js +45 -0
- package/lib/Signal/libsignal/numeric_fingerprint.js +72 -0
- package/lib/Signal/libsignal/protobufs.js +10 -0
- package/lib/Signal/libsignal/protocol_address.js +40 -0
- package/lib/Signal/libsignal/queue_job.js +69 -0
- package/lib/Signal/libsignal/session_builder.js +160 -0
- package/lib/Signal/libsignal/session_cipher.js +320 -0
- package/lib/Signal/libsignal/session_record.js +302 -0
- package/lib/Signal/libsignal.js +174 -0
- package/lib/Socket/Client/index.js +18 -0
- package/lib/Socket/Client/types.js +13 -0
- package/lib/Socket/Client/websocket.js +62 -0
- package/lib/Socket/business.js +260 -0
- package/lib/Socket/chats.js +880 -0
- package/lib/Socket/gcstatus.js +237 -0
- package/lib/Socket/groups.js +340 -0
- package/lib/Socket/index.js +10 -0
- package/lib/Socket/messages-recv.js +1079 -0
- package/lib/Socket/messages-send.js +1083 -0
- package/lib/Socket/mex.js +46 -0
- package/lib/Socket/newsletter.js +233 -0
- package/lib/Socket/socket.js +617 -0
- package/lib/Socket/usync.js +65 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.js +10 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.js +27 -0
- package/lib/Types/LabelAssociation.js +9 -0
- package/lib/Types/Message.js +7 -0
- package/lib/Types/Newsletter.js +33 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.js +2 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.js +42 -0
- package/lib/Utils/auth-utils.js +199 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/business.js +240 -0
- package/lib/Utils/chat-utils.js +741 -0
- package/lib/Utils/crypto.js +187 -0
- package/lib/Utils/decode-wa-message.js +284 -0
- package/lib/Utils/event-buffer.js +516 -0
- package/lib/Utils/generics.js +400 -0
- package/lib/Utils/history.js +100 -0
- package/lib/Utils/index.js +34 -0
- package/lib/Utils/lid-mapping.js +88 -0
- package/lib/Utils/link-preview.js +122 -0
- package/lib/Utils/logger.js +7 -0
- package/lib/Utils/lt-hash.js +51 -0
- package/lib/Utils/make-mutex.js +44 -0
- package/lib/Utils/messages-media.js +706 -0
- package/lib/Utils/messages.js +872 -0
- package/lib/Utils/noise-handler.js +150 -0
- package/lib/Utils/process-message.js +381 -0
- package/lib/Utils/signal.js +155 -0
- package/lib/Utils/use-multi-file-auth-state.js +124 -0
- package/lib/Utils/validate-connection.js +170 -0
- package/lib/WABinary/constants.js +1303 -0
- package/lib/WABinary/decode.js +266 -0
- package/lib/WABinary/encode.js +252 -0
- package/lib/WABinary/generic-utils.js +110 -0
- package/lib/WABinary/index.js +21 -0
- package/lib/WABinary/jid-utils.js +66 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.js +13 -0
- package/lib/WAM/constants.js +15243 -0
- package/lib/WAM/encode.js +153 -0
- package/lib/WAM/index.js +19 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.js +93 -0
- package/lib/WAUSync/USyncUser.js +26 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/index.js +30 -0
- package/package.json +39 -0
- package/test.js +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Gifted Tech
|
|
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,193 @@
|
|
|
1
|
+
# Casper Baileys
|
|
2
|
+
|
|
3
|
+
A stable, enhanced WhatsApp Web API library forked from Baileys with built-in button support, patched libsignal, and interactive message capabilities.
|
|
4
|
+
|
|
5
|
+
**By Casper Tech Kenya**
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Built-in Button Support** - Send interactive buttons (quick_reply, cta_url, cta_copy, cta_call, single_select) without extra packages
|
|
10
|
+
- **Carousel Cards** - Send carousel messages with multiple cards and buttons
|
|
11
|
+
- **Binary Node Injection** - Automatic `biz`, `interactive`, and `native_flow` node injection for proper button rendering
|
|
12
|
+
- **Patched libsignal** - Suppressed noisy session error logging (Bad MAC, session entry spam) for clean console output
|
|
13
|
+
- **Bundled libsignal** - No external libsignal dependency - everything is self-contained
|
|
14
|
+
- **Group Status Support** - Send status/stories to groups via GiftedStatus module
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install github:Casper-Tech-ke/casper-baileys
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Basic Setup
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
const { default: makeWASocket, useMultiFileAuthState } = require('@whiskeysockets/baileys');
|
|
28
|
+
|
|
29
|
+
const { state, saveCreds } = await useMultiFileAuthState('./auth');
|
|
30
|
+
const sock = makeWASocket({
|
|
31
|
+
auth: state,
|
|
32
|
+
printQRInTerminal: true,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
sock.ev.on('creds.update', saveCreds);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Sending Interactive Buttons
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
// Quick reply buttons
|
|
42
|
+
await sock.sendMessage(jid, {
|
|
43
|
+
text: 'Hello! Choose an option:',
|
|
44
|
+
footer: 'Powered by Casper Baileys',
|
|
45
|
+
interactiveButtons: [
|
|
46
|
+
{
|
|
47
|
+
name: 'quick_reply',
|
|
48
|
+
buttonParamsJson: JSON.stringify({
|
|
49
|
+
display_text: 'Option 1',
|
|
50
|
+
id: 'opt_1'
|
|
51
|
+
})
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'quick_reply',
|
|
55
|
+
buttonParamsJson: JSON.stringify({
|
|
56
|
+
display_text: 'Option 2',
|
|
57
|
+
id: 'opt_2'
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// URL button
|
|
64
|
+
await sock.sendMessage(jid, {
|
|
65
|
+
text: 'Visit our website!',
|
|
66
|
+
footer: 'Casper Tech',
|
|
67
|
+
interactiveButtons: [
|
|
68
|
+
{
|
|
69
|
+
name: 'cta_url',
|
|
70
|
+
buttonParamsJson: JSON.stringify({
|
|
71
|
+
display_text: 'Visit Website',
|
|
72
|
+
url: 'https://example.com'
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Copy button
|
|
79
|
+
await sock.sendMessage(jid, {
|
|
80
|
+
text: 'Copy this code:',
|
|
81
|
+
interactiveButtons: [
|
|
82
|
+
{
|
|
83
|
+
name: 'cta_copy',
|
|
84
|
+
buttonParamsJson: JSON.stringify({
|
|
85
|
+
display_text: 'Copy Code',
|
|
86
|
+
id: 'ABC123',
|
|
87
|
+
copy_code: 'ABC123'
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Sending Carousel Cards
|
|
95
|
+
|
|
96
|
+
```javascript
|
|
97
|
+
await sock.sendMessage(jid, {
|
|
98
|
+
text: 'Check out our products!',
|
|
99
|
+
footer: 'Casper Tech Store',
|
|
100
|
+
cards: [
|
|
101
|
+
{
|
|
102
|
+
image: { url: 'https://example.com/product1.jpg' },
|
|
103
|
+
title: 'Product 1',
|
|
104
|
+
body: 'Amazing product',
|
|
105
|
+
buttons: [
|
|
106
|
+
{
|
|
107
|
+
name: 'quick_reply',
|
|
108
|
+
buttonParamsJson: JSON.stringify({
|
|
109
|
+
display_text: 'Buy Now',
|
|
110
|
+
id: 'buy_1'
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
image: { url: 'https://example.com/product2.jpg' },
|
|
117
|
+
title: 'Product 2',
|
|
118
|
+
body: 'Great product',
|
|
119
|
+
buttons: [
|
|
120
|
+
{
|
|
121
|
+
name: 'cta_url',
|
|
122
|
+
buttonParamsJson: JSON.stringify({
|
|
123
|
+
display_text: 'View Details',
|
|
124
|
+
url: 'https://example.com/product2'
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### List/Select Menu
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
await sock.sendMessage(jid, {
|
|
137
|
+
text: 'Select from the menu:',
|
|
138
|
+
footer: 'Casper Baileys',
|
|
139
|
+
interactiveButtons: [
|
|
140
|
+
{
|
|
141
|
+
name: 'single_select',
|
|
142
|
+
buttonParamsJson: JSON.stringify({
|
|
143
|
+
title: 'Menu',
|
|
144
|
+
sections: [
|
|
145
|
+
{
|
|
146
|
+
title: 'Options',
|
|
147
|
+
rows: [
|
|
148
|
+
{
|
|
149
|
+
header: 'Option A',
|
|
150
|
+
title: 'First option',
|
|
151
|
+
description: 'Description for A',
|
|
152
|
+
id: 'option_a'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
header: 'Option B',
|
|
156
|
+
title: 'Second option',
|
|
157
|
+
description: 'Description for B',
|
|
158
|
+
id: 'option_b'
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Button Types
|
|
170
|
+
|
|
171
|
+
| Type | Description |
|
|
172
|
+
|------|-------------|
|
|
173
|
+
| `quick_reply` | Simple reply button with text and ID |
|
|
174
|
+
| `cta_url` | Opens a URL when tapped |
|
|
175
|
+
| `cta_copy` | Copies text to clipboard |
|
|
176
|
+
| `cta_call` | Initiates a phone call |
|
|
177
|
+
| `single_select` | Dropdown list/menu selection |
|
|
178
|
+
|
|
179
|
+
## Stability Improvements
|
|
180
|
+
|
|
181
|
+
- **Patched libsignal** - No more "Bad MAC" or "session entry" console spam
|
|
182
|
+
- **Bundled dependencies** - libsignal is included directly, no external GitHub dependency
|
|
183
|
+
- **Clean logging** - Suppressed noisy error messages during session renegotiation
|
|
184
|
+
|
|
185
|
+
## Credits
|
|
186
|
+
|
|
187
|
+
- Original Baileys by [@whiskeysockets](https://github.com/WhiskeySockets/Baileys)
|
|
188
|
+
- Button support inspired by community forks
|
|
189
|
+
- Maintained by **Casper Tech Kenya** / **TRABY CASPER**
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
MIT
|