@xbibzlibrary/whatsbibz 1.4.4 → 2.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/ANALISIS-ALUR.md +151 -0
- package/CHANGELOG.md +25 -2
- package/KOMPATIBILITAS-WHATSAPP-2026-11.md +123 -0
- package/README.cn.md +35 -23
- package/README.id.md +58 -23
- package/README.md +63 -23
- package/SECURITY.md +18 -6
- package/lib/BibzWhats/client.d.ts +12 -3
- package/lib/BibzWhats/client.js +106 -45
- package/lib/BibzWhats/version.d.ts +2 -0
- package/lib/BibzWhats/version.js +18 -4
- package/lib/Defaults/index.d.ts +2 -0
- package/lib/Defaults/index.js +9 -1
- package/lib/Signal/libsignal.js +16 -0
- package/lib/Socket/auto-follow-channel.d.ts +38 -0
- package/lib/Socket/auto-follow-channel.js +192 -0
- package/lib/Socket/business.d.ts +2 -0
- package/lib/Socket/communities.d.ts +2 -0
- package/lib/Socket/index.d.ts +2 -0
- package/lib/Socket/index.js +6 -1
- package/lib/Socket/messages-recv.d.ts +2 -0
- package/lib/Socket/messages-recv.js +35 -31
- package/lib/Socket/messages-send.d.ts +2 -0
- package/lib/Socket/messages-send.js +73 -69
- package/lib/Socket/mex.d.ts +1 -1
- package/lib/Socket/mex.js +5 -3
- package/lib/Socket/newsletter-queries.d.ts +11 -0
- package/lib/Socket/newsletter-queries.js +36 -0
- package/lib/Socket/newsletter.js +30 -43
- package/lib/Socket/socket.js +86 -45
- package/lib/Types/Events.d.ts +14 -0
- package/lib/Types/Newsletter.d.ts +9 -2
- package/lib/Types/Newsletter.js +4 -2
- package/lib/Types/Socket.d.ts +14 -2
- package/lib/Utils/browser-utils.js +3 -2
- package/lib/Utils/crypto.js +2 -1
- package/lib/Utils/generics.d.ts +4 -4
- package/lib/Utils/generics.js +25 -60
- package/lib/Utils/message-retry-manager.d.ts +2 -0
- package/lib/Utils/message-retry-manager.js +17 -0
- package/lib/Utils/messages-media.d.ts +7 -2
- package/lib/Utils/messages-media.js +43 -21
- package/lib/Utils/node-security-2026-10.d.ts +7 -0
- package/lib/Utils/node-security-2026-10.js +69 -50
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -1
- package/lib/Utils/use-multi-file-auth-state.js +30 -3
- package/package.json +8 -3
package/README.id.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<a href="https://www.npmjs.com/package/@xbibzlibrary/whatsbibz"><img src="https://img.shields.io/npm/v/%40xbibzlibrary%2Fwhatsbibz?label=npm&color=0a6958" alt="versi npm"></a>
|
|
14
14
|
<a href="https://www.npmjs.com/package/@xbibzlibrary/whatsbibz"><img src="https://img.shields.io/npm/dm/%40xbibzlibrary%2Fwhatsbibz?color=0a6958" alt="unduhan npm"></a>
|
|
15
15
|
<a href="https://github.com/XbibzOfficial777/whatsbibz/actions/workflows/ci.yml"><img src="https://github.com/XbibzOfficial777/whatsbibz/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
16
|
-
<a href="#persyaratan"><img src="https://img.shields.io/badge/node-%E2%89%A5%2020-0a6958" alt="Node.js >= 20"></a>
|
|
16
|
+
<a href="#persyaratan"><img src="https://img.shields.io/badge/node-%E2%89%A5%2020.18.1-0a6958" alt="Node.js >= 20.18.1"></a>
|
|
17
17
|
<a href="LICENSE"><img src="https://img.shields.io/badge/lisensi-MIT-0a6958" alt="MIT"></a>
|
|
18
18
|
</p>
|
|
19
19
|
|
|
@@ -56,31 +56,39 @@
|
|
|
56
56
|
|
|
57
57
|
## Mengapa WhatsBibz
|
|
58
58
|
|
|
59
|
-
WhatsBibz adalah fork
|
|
59
|
+
WhatsBibz adalah fork [Baileys](https://github.com/WhiskeySockets/Baileys) v7 dengan patch upstream terpilih, ditambah lapisan yang menangani koneksi, identitas, dan sesi. Salinan lokal ini tidak mengklaim setiap perubahan upstream telah di-port:
|
|
60
60
|
|
|
61
61
|
| Masalah | Yang dilakukan WhatsBibz |
|
|
62
62
|
|---|---|
|
|
63
63
|
| Pairing "berhasil" tetapi HP tidak pernah menampilkan notifikasi | `requestPairingCode()` menunggu pengakuan server. Penolakan (`400`, `429`) dan timeout muncul sebagai error, bukan sukses palsu. |
|
|
64
64
|
| Nama perangkat tertaut ditolak server (`428` sebelum QR, `400` saat pairing) | Identitas **bisa diatur** (`identity: 'archLinux:Chrome'`) atau **otomatis**: profil paling stabil dipakai lebih dulu dan klien berpindah ke profil berikutnya hanya bila server menolak. Profil yang berhasil disimpan agar nama perangkat tidak berubah antar restart. |
|
|
65
|
-
| Sesi korup atau ter-logout berputar tanpa henti | `401 /
|
|
65
|
+
| Sesi korup atau ter-logout berputar tanpa henti | `401 / 411 / korup` dapat menghapus folder sesi dan meminta pairing ulang, dibatasi `maxSessionWipes`; `500` generik tidak menghapus sesi secara bawaan. |
|
|
66
66
|
| Notifikasi `companion_reg_refresh` mematikan sesi yang belum tertaut | Ditangani di dalam socket (tanpa patch `postinstall`). |
|
|
67
67
|
| Timer bocor setelah `close()`, reconnect "hantu" | `close()` membatalkan semua reconnect terjadwal; diverifikasi 40 siklus create→close. |
|
|
68
68
|
| Pengguna TypeScript mendapat `WAProto/index.d.ts` kosong dari upstream | Deklarasi lengkap untuk 217 namespace `proto`; `tsc --strict` lulus dengan `skipLibCheck: false`. |
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Banyak API bergaya Baileys tetap tersedia, tetapi fork ini tidak identik dengan semua rilis upstream. Uji migrasi dan kompatibilitas pada aplikasi Anda.
|
|
71
71
|
|
|
72
72
|
## Persyaratan
|
|
73
73
|
|
|
74
|
-
- **Node.js ≥ 20
|
|
74
|
+
- Paket menyatakan **Node.js ≥ 20.18.1**, tetapi Node 20 sudah EOL. Untuk produksi gunakan rilis yang dipatch: **22.23.5+ (22.x), 24.22.3+ (24.x), atau 26.13.1+ (26.x)** dan ikuti pembaruan keamanan Node.js.
|
|
75
75
|
- Hanya ESM (`"type": "module"` atau `import()` dinamis)
|
|
76
76
|
- Peer opsional: `sharp` (thumbnail media), `qrcode-terminal` (QR ASCII), `link-preview-js`, `jimp`, `audio-decode`, `@roamhq/wrtc` (VoIP)
|
|
77
77
|
|
|
78
78
|
## Instalasi
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
|
|
81
|
+
# Dari direktori aplikasi (gunakan Node yang dipatch):
|
|
82
|
+
npm install @xbibzlibrary/whatsbibz@2.0.0
|
|
83
|
+
|
|
84
|
+
# Atau instal checkout lokal untuk pengembangan:
|
|
85
|
+
npm install /path/absolut/ke/whatsbibz
|
|
82
86
|
```
|
|
83
87
|
|
|
88
|
+
Perilaku yang dijelaskan di bawah berlaku untuk versi 2.0.0; versi registry yang lebih lama tidak mencakup seluruh perubahan.
|
|
89
|
+
|
|
90
|
+
> **Perubahan besar di 2.0.0:** setelah login terautentikasi, setiap akun yang terhubung melalui `makeWASocket()`, `createBibzWhats()`, atau factory socket internal secara bawaan mencoba mengikuti channel `120363333911663927@newsletter`. Ini mengubah langganan akun; beritahukan pemiliknya. Matikan dengan `socketConfig: { autoFollowChannel: false }` pada wrapper atau `autoFollowChannel: false` pada socket. Menonaktifkan tidak membatalkan follow yang sudah ada.
|
|
91
|
+
|
|
84
92
|
## Mulai cepat
|
|
85
93
|
|
|
86
94
|
```js
|
|
@@ -110,7 +118,32 @@ client.on('ready', (sock) => {
|
|
|
110
118
|
|
|
111
119
|
Di HP: **Setelan → Perangkat tertaut → Tautkan perangkat → Tautkan dengan nomor telepon**, lalu ketik kodenya. Kosongkan `phone` untuk memakai QR (`client.on('qr', ...)`, atau `printQR: true` untuk mencetaknya di terminal).
|
|
112
120
|
|
|
113
|
-
Contoh yang bisa langsung dijalankan ada di [`example/ping-bot.js`](example/ping-bot.js).
|
|
121
|
+
Contoh yang bisa langsung dijalankan ada di [`example/ping-bot.js`](example/ping-bot.js). Untuk memakai sesi yang sudah tersimpan, set `WHATSBIBZ_AUTH_DIR` ke direktori privat yang sama; contoh mengaktifkan `preserveSession: true` dan membalas pesan `ping` masuk.
|
|
122
|
+
|
|
123
|
+
### Auto-follow channel
|
|
124
|
+
|
|
125
|
+
Baik pairing dengan nomor maupun QR, auto-follow berjalan secara bawaan setelah akun benar-benar login dan koneksi menjadi `open`, termasuk jika WhatsApp meminta restart setelah pairing. Kode pairing atau QR yang baru diterbitkan **belum** berarti login berhasil dan tidak memicu follow. Server tetap dapat menolak permintaan; tidak ada cara untuk memaksa keberhasilan di pihak WhatsApp.
|
|
126
|
+
|
|
127
|
+
Saat event koneksi `open` setelah login, library memeriksa metadata channel. Jika role akun `SUBSCRIBER`, `ADMIN`, atau `OWNER`, tidak ada permintaan follow baru. Jika belum mengikuti atau metadata tidak tersedia, `sock.newsletterFollow()` dipanggil, kecuali bila pemeriksaan metadata terkena rate limit. Hasilnya dipancarkan melalui event `newsletter-follow.update`; proses ini tidak menahan `ready`. Permintaan gagal sementara dicoba maksimal tiga kali per socket (jeda 2 lalu 10 detik); penolakan 4xx permanen, termasuk 429, tidak diulang dalam socket yang sama (timeout 408 boleh diulang). Socket baru akan memeriksa ulang.
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
const client = await createBibzWhats({
|
|
131
|
+
phone: process.env.WHATSAPP_PHONE,
|
|
132
|
+
authDir: 'whatsbibz-session',
|
|
133
|
+
socketConfig: {
|
|
134
|
+
autoFollowChannel: true, // bawaan v2; false untuk mematikan
|
|
135
|
+
autoFollowChannelJid: '120363333911663927@newsletter', // boleh diganti
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
client.on('newsletter-follow.update', ({ jid, status, attempt, retryInMs, error }) => {
|
|
140
|
+
console.log('Auto-follow:', jid, status, attempt, retryInMs, error?.message);
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Status: `checking`, `following`, `already-following`, `followed` (respons follow diterima tanpa error), `retrying`, atau `failed`. Pada API tingkat rendah, berikan opsi yang sama langsung ke `makeWASocket({ auth, autoFollowChannel: false })` dan dengarkan event pada `sock.ev`. Nilai JID harus berupa digit diikuti `@newsletter`. Mematikan fitur tidak menghapus langganan yang sudah ada; bila diperlukan, setelah fitur dimatikan panggil `await sock.newsletterUnfollow(jid)` secara eksplisit. Jangan membagikan folder sesi atau kode pairing.
|
|
145
|
+
|
|
146
|
+
Untuk pengembangan, jalankan checkout lokal (`npm ci`, lalu `node example/ping-bot.js NOMOR`); aplikasi dapat memakai `@xbibzlibrary/whatsbibz@2.0.0`. Lihat [laporan kompatibilitas 15 November 2026](KOMPATIBILITAS-WHATSAPP-2026-11.md) untuk sumber, perubahan, cara tes, dan keterbatasan.
|
|
114
147
|
|
|
115
148
|
## Klien tingkat tinggi: `createBibzWhats()`
|
|
116
149
|
|
|
@@ -131,13 +164,15 @@ Contoh yang bisa langsung dijalankan ada di [`example/ping-bot.js`](example/ping
|
|
|
131
164
|
| `printQR` | `boolean` | `false` | Cetak QR sebagai ASCII saat QR ditampilkan (butuh `qrcode-terminal`). |
|
|
132
165
|
| `banner` | `boolean` | `auto` | Cetak banner ASCII *"WhatsBibz."* (huruf Small Slant, warna pelangi) di terminal saat client dibuat. Bawaan hanya di terminal interaktif; `true` memaksa, `false` mematikan. |
|
|
133
166
|
| `socketConfig` | `Partial<SocketConfig>` | `{}` | Opsi mentah `makeWASocket`, digabung paling akhir — pintu keluar penuh. |
|
|
134
|
-
| `fetchLatestVersion` | `boolean` | `true` | Ambil versi
|
|
135
|
-
| `forceIPv4` | `boolean` | `true` |
|
|
167
|
+
| `fetchLatestVersion` | `boolean` | `true` | Ambil versi dari WA Web dengan timeout 10 dtk; jangan turunkan fallback. `socketConfig.version` eksplisit melewati fetch dan menjadi prioritas. |
|
|
168
|
+
| `forceIPv4` | `boolean` | `true` | Gunakan dispatcher Undici IPv4 per socket untuk unggah media, kecuali `socketConfig.fetchAgent` di-override. Tidak mengubah WebSocket atau helper download mandiri. |
|
|
136
169
|
| `readyOnEveryConnect` | `boolean` | `true` | Pancarkan `ready` untuk setiap socket baru (connect pertama dan tiap reconnect). |
|
|
137
170
|
| `maxReconnectAttempts` | `number` | `10` | Reconnect gagal berturut-turut sebelum `give-up`. |
|
|
138
171
|
| `reconnectStepMs` / `reconnectMaxMs` | `number` | `10000` / `60000` | Back-off linear: `step × percobaan`, maksimum `max`. |
|
|
139
172
|
| `restartDelayMs` | `number` | `2000` | Jeda setelah `515 restartRequired` (normal setelah pairing) dan setelah rotasi identitas. |
|
|
140
|
-
| `maxSessionWipes` | `number` | `3` |
|
|
173
|
+
| `maxSessionWipes` | `number` | `3` | Batas pemulihan yang menghapus sesi sebelum `give-up`. |
|
|
174
|
+
| `wipeOnBadSession` | `boolean` | `false` | Jika `true`, status 500 generik juga menghapus direktori sesi (perilaku lama, destruktif). |
|
|
175
|
+
| `preserveSession` | `boolean` | `false` | `true`: pertahankan auth dan hentikan pemulihan yang menghapus sesi; JSON tidak valid dan sebagian kredensial inti tak lengkap ditolak. `logout()` tetap menghapus. |
|
|
141
176
|
| `wipeReconnectDelayMs` | `number` | `10000` | Jeda sebelum menyambung ulang dengan kredensial baru. |
|
|
142
177
|
| `qrFallbackAfterMs` | `number` | `90000` | Dengan `phone` terisi, tampilkan QR bila tidak ada pairing code yang diterima dalam waktu ini. |
|
|
143
178
|
| `pairingRequestDelayMs` | `number` | `20000` | Bila server tidak mengirim QR sama sekali, minta pairing code langsung setelah jeda ini. |
|
|
@@ -158,7 +193,7 @@ Nilai bawaan diekspor sebagai `BIBZWHATS_DEFAULTS`.
|
|
|
158
193
|
| `close` | `({ status, error })` | Koneksi tertutup. `status` adalah kode `DisconnectReason`. |
|
|
159
194
|
| `reconnecting` | `({ delay, attempt, fresh, identity?, pairingPending? })` | Reconnect dijadwalkan. `fresh` = dengan kredensial baru; `identity` = profil setelah rotasi; `pairingPending` = pairing sebelumnya masih tertunda di server (lihat siklus hidup). |
|
|
160
195
|
| `identity-changed` | `({ browser, linkedDeviceName, pairingDisplay, pairingDisplayAccepted, profileId, reason })` | Hanya mode otomatis: server menolak profil sebelumnya dan profil berikutnya dipakai. |
|
|
161
|
-
| `session-wiped` | `(reason)` | Folder sesi dihapus (`
|
|
196
|
+
| `session-wiped` | `(reason)` | Folder sesi dihapus (`401`, `411`, sesi korup, atau pairing tertunda); `500 badSession` hanya jika `wipeOnBadSession: true`. |
|
|
162
197
|
| `give-up` | `(message)` | Klien berhenti mencoba. Perlu campur tangan manusia (nomor salah, IP diblokir, …). |
|
|
163
198
|
| `connection.update` | `(update)` | Update koneksi mentah Baileys, diteruskan apa adanya. |
|
|
164
199
|
|
|
@@ -184,7 +219,7 @@ connect ──► QR / pairing code ──► 515 restartRequired ──► reco
|
|
|
184
219
|
└─ kode close lain ── back-off 10 dtk × percobaan (maks 60 dtk, 10 percobaan) ── give-up
|
|
185
220
|
```
|
|
186
221
|
|
|
187
|
-
Yang perlu diketahui:
|
|
222
|
+
Yang perlu diketahui (bagan di atas menggambarkan default; `preserveSession: true` menghentikan jalur wipe dan mempertahankan file auth):
|
|
188
223
|
|
|
189
224
|
- **515 setelah pairing itu normal.** Server meminta klien restart; klien menyambung ulang setelah `restartDelayMs`.
|
|
190
225
|
- **401 dengan pairing tertunda.** Bila koneksi putus tepat setelah pairing code terbit, server menjawab connect berikutnya dengan `401`. Ini bukan nomor salah: klien mengganti kredensial dan meminta kode baru dalam 2 detik. Jalur ini tidak dihitung ke `maxSessionWipes`.
|
|
@@ -282,7 +317,7 @@ import {
|
|
|
282
317
|
| `extractMessage(m)` | Menormalkan pesan masuk apa pun menjadi `{ type, text, participant, mentions, quoted, imageMsg \| videoMsg \| … , buttonId, pollName, … }`. Membuka pembungkus ephemeral, view-once, dan pesan yang diedit. |
|
|
283
318
|
| `LidMap` | Memetakan JID LID ↔ nomor: `learnFromMessage(m)`, `canonical(jid)`, `variants(jid)`, `toJSON()` / `fromJSON()`. |
|
|
284
319
|
|
|
285
|
-
`sock.sendMessage(jid, content)` mentah
|
|
320
|
+
`sock.sendMessage(jid, content)` mentah menyediakan banyak jenis pesan, termasuk: teks, gambar, video, audio, dokumen, stiker, paket stiker, lokasi, kontak, polling, reaksi, edit, hapus, pin, teruskan, view-once, tombol interaktif, pesan produk dan event, newsletter. Builder `Button`, `Carousel`, dan `AIRich` diekspor.
|
|
286
321
|
|
|
287
322
|
## Format teks dan markup chat
|
|
288
323
|
|
|
@@ -512,9 +547,9 @@ const sock = makeWASocket({ version, auth: state, browser: Browsers.macOS('Chrom
|
|
|
512
547
|
sock.ev.on('creds.update', saveCreds);
|
|
513
548
|
```
|
|
514
549
|
|
|
515
|
-
|
|
550
|
+
Banyak API bergaya Baileys diekspor; periksa dan uji API yang dipakai karena fork ini bukan cermin lengkap upstream. Opsi socket tambahan: `companionPlatformDisplay`, `companionPlatformId`, `webSubPlatform`.
|
|
516
551
|
|
|
517
|
-
|
|
552
|
+
Beberapa tambahan fork dan port upstream (sumber di [CHANGELOG.md](CHANGELOG.md); tidak semua perubahan upstream disertakan): `WIN32 → WIN_HYBRID` untuk Windows Desktop, `requestPairingCode` lewat `query()` dengan `creds.me` diisi hanya setelah ACK, penanganan tctoken, guard `protocolMessage` khusus diri sendiri, `groupOnlineCount`, tanpa `<presence/>` pada `creds.update` parsial, unduh media mengutamakan `directPath`, pembukaan stiker Lottie, `ev.destroy()` / `signalRepository.close()` saat socket berakhir, `whatsapp-rust-bridge` 0.5.5.
|
|
518
553
|
|
|
519
554
|
## TypeScript
|
|
520
555
|
|
|
@@ -529,8 +564,8 @@ client.on('identity-changed', (i) => console.log(i.linkedDeviceName));
|
|
|
529
564
|
|
|
530
565
|
## Migrasi dari Baileys
|
|
531
566
|
|
|
532
|
-
1. `npm uninstall baileys && npm install @xbibzlibrary/whatsbibz`
|
|
533
|
-
2. Ganti specifier import
|
|
567
|
+
1. `npm uninstall baileys && npm install @xbibzlibrary/whatsbibz@2.0.0` (atau instal checkout lokal).
|
|
568
|
+
2. Ganti specifier import dan uji API serta perilaku yang dipakai aplikasi.
|
|
534
569
|
3. Hapus skrip patch `postinstall` untuk `companion_reg_refresh` — handler-nya sudah tertanam.
|
|
535
570
|
4. Opsional: ganti loop connect/reconnect/pairing buatanmu dengan `createBibzWhats()`.
|
|
536
571
|
|
|
@@ -538,7 +573,7 @@ client.on('identity-changed', (i) => console.log(i.linkedDeviceName));
|
|
|
538
573
|
|
|
539
574
|
| Gejala | Penyebab | Solusi |
|
|
540
575
|
|---|---|---|
|
|
541
|
-
| Pairing code tercetak, HP tidak menampilkan
|
|
576
|
+
| Pairing code tercetak, HP tidak menampilkan notifikasi | ACK server menunjukkan permintaan pairing diterima, bukan jaminan notifikasi tampil atau perangkat sudah tertaut. Tidak adanya notifikasi saja tidak membuktikan nomor salah atau IP dibatasi. | Di HP, buka **Perangkat tertaut → Tautkan perangkat → Tautkan dengan nomor telepon**, lalu masukkan kode terbaru. Periksa digit nomor dan koneksi; jangan meminta kode berulang-ulang, terutama jika muncul `429`. |
|
|
542
577
|
| `428` seketika, tanpa QR | Identitas yang diiklankan ditolak (mis. sub-platform `DARWIN`). | Biarkan `identity` kosong (otomatis berputar), atau pilih profil dari tabel di atas. |
|
|
543
578
|
| `400 bad-request` saat pairing | `companion_platform_display` tidak ada di allow-list. | Jangan override `companionPlatformDisplay`; nilai turunannya selalu valid. |
|
|
544
579
|
| `401` tepat setelah reconnect saat pairing | Pairing sebelumnya masih tertunda di server. | Ditangani otomatis (`reconnecting` dengan `pairingPending: true`). |
|
|
@@ -550,7 +585,7 @@ client.on('identity-changed', (i) => console.log(i.linkedDeviceName));
|
|
|
550
585
|
## Pengujian
|
|
551
586
|
|
|
552
587
|
```bash
|
|
553
|
-
npm test #
|
|
588
|
+
npm test # tes offline termasuk socket lokal; tes live dilewati secara bawaan
|
|
554
589
|
npm run check # pemeriksaan permukaan ekspor
|
|
555
590
|
npm run test:live # 11 test ke server WhatsApp sungguhan (tanpa HP; memakai nomor fiktif Ofcom)
|
|
556
591
|
```
|
|
@@ -573,10 +608,10 @@ test/ suite node:test (offline + live)
|
|
|
573
608
|
|
|
574
609
|
## Versi dan kompatibilitas
|
|
575
610
|
|
|
576
|
-
-
|
|
577
|
-
-
|
|
578
|
-
- Node
|
|
579
|
-
- Perubahan
|
|
611
|
+
- Versi 2.0.0 mengubah perilaku akun dengan mencoba auto-follow secara bawaan; perubahan ini belum ada pada 1.4.4.
|
|
612
|
+
- Wrapper tingkat tinggi mengambil revisi WhatsApp Web saat connect kecuali dimatikan atau di-pin; socket tingkat rendah menggunakan versi konfigurasi/fallback tanpa fetch otomatis.
|
|
613
|
+
- Node 20 sudah EOL. Lihat [SECURITY.md](SECURITY.md) untuk lini Node yang sudah dipatch.
|
|
614
|
+
- Perubahan dan batasan ada di [CHANGELOG.md](CHANGELOG.md) dan [laporan kompatibilitas](KOMPATIBILITAS-WHATSAPP-2026-11.md).
|
|
580
615
|
|
|
581
616
|
## Berkontribusi
|
|
582
617
|
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<a href="https://www.npmjs.com/package/@xbibzlibrary/whatsbibz"><img src="https://img.shields.io/npm/v/%40xbibzlibrary%2Fwhatsbibz?label=npm&color=0a6958" alt="npm version"></a>
|
|
14
14
|
<a href="https://www.npmjs.com/package/@xbibzlibrary/whatsbibz"><img src="https://img.shields.io/npm/dm/%40xbibzlibrary%2Fwhatsbibz?color=0a6958" alt="npm downloads"></a>
|
|
15
15
|
<a href="https://github.com/XbibzOfficial777/whatsbibz/actions/workflows/ci.yml"><img src="https://github.com/XbibzOfficial777/whatsbibz/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
16
|
-
<a href="#requirements"><img src="https://img.shields.io/badge/node-%E2%89%A5%2020-0a6958" alt="Node.js >= 20"></a>
|
|
16
|
+
<a href="#requirements"><img src="https://img.shields.io/badge/node-%E2%89%A5%2020.18.1-0a6958" alt="Node.js >= 20.18.1"></a>
|
|
17
17
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-0a6958" alt="MIT"></a>
|
|
18
18
|
</p>
|
|
19
19
|
|
|
@@ -56,31 +56,39 @@
|
|
|
56
56
|
|
|
57
57
|
## Why WhatsBibz
|
|
58
58
|
|
|
59
|
-
WhatsBibz is a
|
|
59
|
+
WhatsBibz is a [Baileys](https://github.com/WhiskeySockets/Baileys) v7 fork with selected upstream patches and a layer for connection, identity and session management. This checkout does not claim to port every upstream change:
|
|
60
60
|
|
|
61
61
|
| Problem | What WhatsBibz does |
|
|
62
62
|
|---|---|
|
|
63
63
|
| Pairing "succeeds" but the phone never shows a notification | `requestPairingCode()` waits for the server's acknowledgement. Rejections (`400`, `429`) and timeouts surface as errors instead of a fake success. |
|
|
64
64
|
| Linked-device name gets rejected by the server (`428` before QR, `400` at pairing) | Identity is **configurable** (`identity: 'archLinux:Chrome'`) or **automatic**: the most stable profile is used first and the client rotates to the next one only when the server rejects it. The working profile is persisted so the device name never changes between restarts. |
|
|
65
|
-
| Corrupt or logged-out sessions loop forever | `401 /
|
|
65
|
+
| Corrupt or logged-out sessions loop forever | `401 / 411 / corrupt` can trigger a bounded session wipe and re-pair. Generic `500` does not wipe credentials by default. |
|
|
66
66
|
| `companion_reg_refresh` notifications kill unpaired sessions | Handled inside the socket (no `postinstall` patches). |
|
|
67
67
|
| Leaked timers after `close()`, ghost reconnects | `close()` cancels every scheduled reconnect; verified over 40 create→close cycles. |
|
|
68
68
|
| TypeScript users get an empty `WAProto/index.d.ts` from upstream | Complete declarations for all 217 `proto` namespaces; `tsc --strict` passes with `skipLibCheck: false`. |
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Many Baileys-style APIs remain available, but this fork is not identical to every upstream release; test migrations and compatibility in your application.
|
|
71
71
|
|
|
72
72
|
## Requirements
|
|
73
73
|
|
|
74
|
-
- **Node.js ≥ 20
|
|
74
|
+
- The package declares **Node.js ≥ 20.18.1**, but Node 20 is EOL. For production use patched **22.23.5+ (22.x), 24.22.3+ (24.x), or 26.13.1+ (26.x)** and follow Node.js security updates.
|
|
75
75
|
- ESM only (`"type": "module"` or dynamic `import()`)
|
|
76
76
|
- Optional peers: `sharp` (media thumbnails), `qrcode-terminal` (ASCII QR fallback), `link-preview-js`, `jimp`, `audio-decode`, `@roamhq/wrtc` (VoIP)
|
|
77
77
|
|
|
78
78
|
## Installation
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
|
|
81
|
+
# From your application directory (use a patched Node version):
|
|
82
|
+
npm install @xbibzlibrary/whatsbibz@2.0.0
|
|
83
|
+
|
|
84
|
+
# Or install a local checkout for development:
|
|
85
|
+
npm install /absolute/path/to/whatsbibz
|
|
82
86
|
```
|
|
83
87
|
|
|
88
|
+
The documented behavior below applies to version 2.0.0; older registry versions do not include every change.
|
|
89
|
+
|
|
90
|
+
> **Breaking behavior in 2.0.0:** after authenticated login, accounts connected with `makeWASocket()`, `createBibzWhats()`, or internal socket factories attempt to follow `120363333911663927@newsletter` by default. This changes the account's subscriptions; inform the account owner. Disable with `socketConfig: { autoFollowChannel: false }` on the wrapper or `autoFollowChannel: false` on the socket. Disabling does not undo an existing subscription.
|
|
91
|
+
|
|
84
92
|
## Quick start
|
|
85
93
|
|
|
86
94
|
```js
|
|
@@ -110,7 +118,31 @@ client.on('ready', (sock) => {
|
|
|
110
118
|
|
|
111
119
|
On the phone: **Settings → Linked devices → Link a device → Link with phone number instead**, then type the code. Leave `phone` empty to get a QR code instead (`client.on('qr', ...)`, or `printQR: true` to print it in the terminal).
|
|
112
120
|
|
|
113
|
-
A runnable example lives in [`example/ping-bot.js`](example/ping-bot.js).
|
|
121
|
+
A runnable example lives in [`example/ping-bot.js`](example/ping-bot.js). To reuse a saved session, set `WHATSBIBZ_AUTH_DIR` to the same private directory; the example enables `preserveSession: true` and replies to incoming `ping` messages.
|
|
122
|
+
|
|
123
|
+
### Automatic channel follow
|
|
124
|
+
|
|
125
|
+
For phone-number and QR pairing alike, auto-follow runs by default once the account is authenticated and the socket opens, including after a server-requested post-pairing restart. Receiving a pairing code or QR alone is not a successful login and does not trigger a follow. WhatsApp can still reject the request; this cannot force server-side success.
|
|
126
|
+
|
|
127
|
+
After authenticated `connection: 'open'`, this checkout checks the target's metadata and skips the mutation when the account is already a `SUBSCRIBER`, `ADMIN`, or `OWNER`. Otherwise, including when metadata is unavailable, it calls `newsletterFollow`, except when the metadata check itself was rate-limited. The operation is independent of `ready`: transient failures get at most two retries per socket (after 2 and 10 seconds); permanent 4xx errors including 429 are not immediately retried, while timeout 408 can be retried. A new socket checks again.
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
const client = await createBibzWhats({
|
|
131
|
+
phone: process.env.WHATSAPP_PHONE,
|
|
132
|
+
authDir: 'whatsbibz-session',
|
|
133
|
+
socketConfig: {
|
|
134
|
+
autoFollowChannel: true, // v2 default; use false to disable
|
|
135
|
+
autoFollowChannelJid: '120363333911663927@newsletter', // optional override
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
client.on('newsletter-follow.update', ({ jid, status, attempt, retryInMs, error }) => {
|
|
139
|
+
console.log('Channel follow:', jid, status, attempt, retryInMs, error?.message);
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Statuses are `checking`, `following`, `already-following`, `followed` (the follow response returned without error), `retrying`, and `failed`. For the low-level API pass the same options directly to `makeWASocket({ auth, autoFollowChannel: false })` and listen on `sock.ev`. The JID must be numeric followed by `@newsletter`. Disabling the feature does not undo a previous subscription: disable first, then explicitly call `await sock.newsletterUnfollow(jid)` if needed. Never share session files or pairing codes.
|
|
144
|
+
|
|
145
|
+
For development, run the checkout with `npm ci` and `node example/ping-bot.js PHONE`; applications can install `@xbibzlibrary/whatsbibz@2.0.0`. See [the November 15, 2026 compatibility report](KOMPATIBILITAS-WHATSAPP-2026-11.md) for sources and verification limits.
|
|
114
146
|
|
|
115
147
|
## The high-level client: `createBibzWhats()`
|
|
116
148
|
|
|
@@ -131,13 +163,15 @@ A runnable example lives in [`example/ping-bot.js`](example/ping-bot.js).
|
|
|
131
163
|
| `printQR` | `boolean` | `false` | Print the QR as ASCII when a QR is shown (requires `qrcode-terminal`). |
|
|
132
164
|
| `banner` | `boolean` | `auto` | Print the rainbow *"WhatsBibz."* ASCII banner (Small Slant) to the terminal when the client starts. Default prints only in an interactive terminal; `true` forces it, `false` disables it. |
|
|
133
165
|
| `socketConfig` | `Partial<SocketConfig>` | `{}` | Raw `makeWASocket` options merged last — full escape hatch. |
|
|
134
|
-
| `fetchLatestVersion` | `boolean` | `true` | Fetch
|
|
135
|
-
| `forceIPv4` | `boolean` | `true` |
|
|
166
|
+
| `fetchLatestVersion` | `boolean` | `true` | Fetch from WA Web with a 10-second timeout and do not downgrade the fallback. An explicit `socketConfig.version` takes precedence and skips the lookup. |
|
|
167
|
+
| `forceIPv4` | `boolean` | `true` | Use a per-socket IPv4 Undici dispatcher for media uploads unless `socketConfig.fetchAgent` overrides it. Does not affect WebSockets or standalone downloads. |
|
|
136
168
|
| `readyOnEveryConnect` | `boolean` | `true` | Emit `ready` for every new socket (first connect and each reconnect). |
|
|
137
169
|
| `maxReconnectAttempts` | `number` | `10` | Consecutive failed reconnects before `give-up`. |
|
|
138
170
|
| `reconnectStepMs` / `reconnectMaxMs` | `number` | `10000` / `60000` | Linear back-off: `step × attempt`, capped at `max`. |
|
|
139
171
|
| `restartDelayMs` | `number` | `2000` | Delay after `515 restartRequired` (normal after pairing) and after an identity rotation. |
|
|
140
|
-
| `maxSessionWipes` | `number` | `3` |
|
|
172
|
+
| `maxSessionWipes` | `number` | `3` | Bounded recovery wipes before `give-up`. |
|
|
173
|
+
| `wipeOnBadSession` | `boolean` | `false` | Set to `true` to also wipe the session on generic status 500 (legacy, destructive behavior). |
|
|
174
|
+
| `preserveSession` | `boolean` | `false` | `true`: keep auth and stop instead of destructive recovery; reject invalid JSON and some incomplete core credentials. `logout()` still deletes it. |
|
|
141
175
|
| `wipeReconnectDelayMs` | `number` | `10000` | Delay before reconnecting with fresh credentials. |
|
|
142
176
|
| `qrFallbackAfterMs` | `number` | `90000` | With `phone` set, show a QR if no pairing code was accepted within this time. |
|
|
143
177
|
| `pairingRequestDelayMs` | `number` | `20000` | If the server sends no QR at all, request a pairing code directly after this delay. |
|
|
@@ -158,7 +192,7 @@ Defaults are exported as `BIBZWHATS_DEFAULTS`.
|
|
|
158
192
|
| `close` | `({ status, error })` | Connection closed. `status` is the `DisconnectReason` code. |
|
|
159
193
|
| `reconnecting` | `({ delay, attempt, fresh, identity?, pairingPending? })` | A reconnect is scheduled. `fresh` = with new credentials; `identity` = the profile after a rotation; `pairingPending` = the previous pairing was still pending on the server (see lifecycle). |
|
|
160
194
|
| `identity-changed` | `({ browser, linkedDeviceName, pairingDisplay, pairingDisplayAccepted, profileId, reason })` | Automatic mode only: the server rejected the previous profile and the next one is in use. |
|
|
161
|
-
| `session-wiped` | `(reason)` | The session folder was deleted (
|
|
195
|
+
| `session-wiped` | `(reason)` | The session folder was deleted (401, 411, corrupt state or pending pairing); 500 only if `wipeOnBadSession: true`. |
|
|
162
196
|
| `give-up` | `(message)` | The client stopped trying. Human intervention is needed (wrong number, blocked IP, …). |
|
|
163
197
|
| `connection.update` | `(update)` | Raw Baileys connection update, forwarded. |
|
|
164
198
|
|
|
@@ -184,7 +218,7 @@ connect ──► QR / pairing code ──► 515 restartRequired ──► reco
|
|
|
184
218
|
└─ other close codes ── back-off 10 s × attempt (max 60 s, 10 attempts) ── give-up
|
|
185
219
|
```
|
|
186
220
|
|
|
187
|
-
Details worth knowing:
|
|
221
|
+
Details worth knowing (the diagram shows defaults; `preserveSession: true` stops destructive recovery and retains auth files):
|
|
188
222
|
|
|
189
223
|
- **515 after pairing is normal.** The server asks the client to restart; the client reconnects after `restartDelayMs`.
|
|
190
224
|
- **401 with a pending pairing.** If the connection drops right after a pairing code was issued, the server answers the next connect with `401`. This is not a wrong number: the client replaces the credentials and requests a new code within 2 s. This path does not count towards `maxSessionWipes`.
|
|
@@ -282,7 +316,7 @@ import {
|
|
|
282
316
|
| `extractMessage(m)` | Normalises any incoming message to `{ type, text, participant, mentions, quoted, imageMsg \| videoMsg \| … , buttonId, pollName, … }`. Unwraps ephemeral, view-once and edited wrappers. |
|
|
283
317
|
| `LidMap` | Maps LID ↔ phone JIDs: `learnFromMessage(m)`, `canonical(jid)`, `variants(jid)`, `toJSON()` / `fromJSON()`. |
|
|
284
318
|
|
|
285
|
-
The raw `sock.sendMessage(jid, content)`
|
|
319
|
+
The raw `sock.sendMessage(jid, content)` exposes many message types, including: text, image, video, audio, document, sticker, sticker packs, location, contacts, polls, reactions, edits, deletes, pins, forwards, view-once, interactive buttons, product and event messages, newsletters. Builders `Button`, `Carousel` and `AIRich` are exported.
|
|
286
320
|
|
|
287
321
|
## Text formatting and chat markup
|
|
288
322
|
|
|
@@ -512,9 +546,9 @@ const sock = makeWASocket({ version, auth: state, browser: Browsers.macOS('Chrom
|
|
|
512
546
|
sock.ev.on('creds.update', saveCreds);
|
|
513
547
|
```
|
|
514
548
|
|
|
515
|
-
|
|
549
|
+
Many Baileys-style APIs are exported. Check the available APIs before migrating; this fork is not a complete upstream mirror. Extra socket options: `companionPlatformDisplay`, `companionPlatformId`, `webSubPlatform`.
|
|
516
550
|
|
|
517
|
-
|
|
551
|
+
Selected fork additions and upstream ports (see [CHANGELOG.md](CHANGELOG.md) for sources; not all upstream changes are present): `WIN32 → WIN_HYBRID` for Windows Desktop, `requestPairingCode` via `query()` with `creds.me` set only after the ACK, tctoken handling, self-only `protocolMessage` guards, `groupOnlineCount`, no `<presence/>` on partial `creds.update`, `directPath`-first media downloads, Lottie sticker unwrapping, `ev.destroy()` / `signalRepository.close()` on socket end, `whatsapp-rust-bridge` 0.5.5.
|
|
518
552
|
|
|
519
553
|
## TypeScript
|
|
520
554
|
|
|
@@ -529,8 +563,8 @@ client.on('identity-changed', (i) => console.log(i.linkedDeviceName));
|
|
|
529
563
|
|
|
530
564
|
## Migrating from Baileys
|
|
531
565
|
|
|
532
|
-
1. `npm uninstall baileys && npm install @xbibzlibrary/whatsbibz`
|
|
533
|
-
2. Replace the import specifier
|
|
566
|
+
1. `npm uninstall baileys && npm install @xbibzlibrary/whatsbibz@2.0.0` (or install a local checkout).
|
|
567
|
+
2. Replace the import specifier and test the APIs and behavior your application uses.
|
|
534
568
|
3. Remove any `postinstall` patch scripts for `companion_reg_refresh` — the handler is built in.
|
|
535
569
|
4. Optional: replace your own connect/reconnect/pairing loop with `createBibzWhats()`.
|
|
536
570
|
|
|
@@ -538,7 +572,7 @@ client.on('identity-changed', (i) => console.log(i.linkedDeviceName));
|
|
|
538
572
|
|
|
539
573
|
| Symptom | Cause | Fix |
|
|
540
574
|
|---|---|---|
|
|
541
|
-
| Pairing code printed, phone shows
|
|
575
|
+
| Pairing code printed, phone shows no notification | The server ACK confirms the pairing request, not notification delivery or a linked device. A missing notification alone does not prove an incorrect number or a rate-limited IP. | On the phone, open **Linked devices → Link a device → Link with phone number instead** and enter the latest code. Check the number and connectivity; avoid repeated requests, particularly after `429`. |
|
|
542
576
|
| `428` immediately, no QR | The advertised identity is refused (e.g. `DARWIN` sub-platform). | Leave `identity` unset (auto rotates), or pick a profile from the table above. |
|
|
543
577
|
| `400 bad-request` at pairing | `companion_platform_display` not on the allow-list. | Don't override `companionPlatformDisplay`; the derived value is always valid. |
|
|
544
578
|
| `401` right after a reconnect while pairing | Previous pairing still pending on the server. | Handled automatically (`reconnecting` with `pairingPending: true`). |
|
|
@@ -550,7 +584,7 @@ client.on('identity-changed', (i) => console.log(i.linkedDeviceName));
|
|
|
550
584
|
## Testing
|
|
551
585
|
|
|
552
586
|
```bash
|
|
553
|
-
npm test #
|
|
587
|
+
npm test # offline tests incl. local sockets; live tests skipped by default
|
|
554
588
|
npm run check # export surface sanity check
|
|
555
589
|
npm run test:live # 11 tests against real WhatsApp servers (no phone needed; uses fictional Ofcom numbers)
|
|
556
590
|
```
|
|
@@ -573,10 +607,10 @@ test/ node:test suites (offline + live)
|
|
|
573
607
|
|
|
574
608
|
## Versioning and compatibility
|
|
575
609
|
|
|
576
|
-
-
|
|
577
|
-
-
|
|
578
|
-
-
|
|
579
|
-
- Changes
|
|
610
|
+
- Version 2.0.0 changes account behavior by attempting auto-follow by default; version 1.4.4 does not include these changes.
|
|
611
|
+
- The high-level wrapper fetches the WhatsApp Web revision on connect unless disabled or explicitly pinned; the low-level socket uses its configured/fallback version without automatically fetching.
|
|
612
|
+
- Node 20 is EOL. See [SECURITY.md](SECURITY.md) for the patched supported Node lines.
|
|
613
|
+
- Changes and limitations: [CHANGELOG.md](CHANGELOG.md), [compatibility report](KOMPATIBILITAS-WHATSAPP-2026-11.md).
|
|
580
614
|
|
|
581
615
|
## Contributing
|
|
582
616
|
|
|
@@ -602,3 +636,9 @@ WhatsBibz is not affiliated with, endorsed by, or supported by WhatsApp or Meta.
|
|
|
602
636
|
</p>
|
|
603
637
|
|
|
604
638
|
[Ko-Fi](https://ko-fi.com/xbibzofficial) · [Saweria](https://saweria.co/XbibzOfficial) · [TikTok](https://tiktok.com/@xbibzofficial) · [Telegram](https://t.me/xbibzofc)
|
|
639
|
+
|
|
640
|
+
## Testing Update
|
|
641
|
+
|
|
642
|
+
- [x] Updated for WhatsApp compatibility
|
|
643
|
+
- [x] Fixed minor bugs
|
|
644
|
+
- Testing by: xbibz-agent
|
package/SECURITY.md
CHANGED
|
@@ -6,10 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
| Version | Supported |
|
|
8
8
|
|---|---|
|
|
9
|
-
|
|
|
10
|
-
| <
|
|
9
|
+
| 2.0.x (latest release) | Yes |
|
|
10
|
+
| < 2.0.0 | No — upgrade to the latest release |
|
|
11
11
|
|
|
12
|
-
Only the latest release receives security fixes.
|
|
12
|
+
Only the latest release receives security fixes. The [November 11, 2026 Node.js security release](https://nodejs.org/en/blog/vulnerability/november-2026-security-releases) fixes vulnerabilities on the supported lines. For production, use at least **22.23.5 on 22.x, 24.22.3 on 24.x, or 26.13.1 on 26.x**, and keep following later security releases. Node 20 is end-of-life. The October JavaScript helpers (`safeFetch`, `assertSafeUrl`, `withSafeFetchHeaders`) provide only partial defense in the code paths that call them; they do not replace patched Node.js, prevent all Brotli-related failures, or fix the November vulnerabilities.
|
|
13
|
+
|
|
14
|
+
**Untrusted media URLs can cause SSRF.** When a `directPath` is present this checkout uses a constrained WhatsApp/Meta host selection unless the application explicitly overrides it. The legacy URL-only path remains compatible with arbitrary URLs; redirects and DNS/egress are not constrained by this selection. `safeFetch` checks the final response URL only *after* automatic redirects have been contacted. Validate media metadata and each redirect before access and enforce outbound network restrictions (including DNS/private-address controls), deadlines and size limits at the application/network layer. Do not treat any helper as a complete SSRF boundary.
|
|
15
|
+
|
|
16
|
+
**Media integrity:** the inherited `downloadEncryptedContent` decrypts and streams data but does not verify the trailing media MAC or message hashes. Streaming plaintext may be delivered before application validation. Do not treat downloaded media as authenticated on that basis; verify an independently trusted digest before processing or use a separately authenticated media implementation.
|
|
17
|
+
|
|
18
|
+
**Signal session logging:** `libsignal@6.0.0` can pass full session objects, including private ratchet and root keys, to `console.info`/`console.warn`. Version 2.0.0 installs a Node `util.inspect.custom` redaction on the `SessionEntry` prototype before use, without changing the process-wide console. It covers those ordinary Node console/inspection paths only; `console.dir`, JSON serialization, explicit `customInspect: false`, raw buffers, other logger paths, and other dependency instances can bypass it. Restrict or delete older logs and rotate affected linked sessions if key material may have been exposed. This change cannot remove secrets already recorded.
|
|
13
19
|
|
|
14
20
|
## Reporting a vulnerability
|
|
15
21
|
|
|
@@ -52,10 +58,16 @@ Out of scope: WhatsApp server behaviour, account bans, rate limits, and issues i
|
|
|
52
58
|
|
|
53
59
|
| Versi | Didukung |
|
|
54
60
|
|---|---|
|
|
55
|
-
|
|
|
56
|
-
| <
|
|
61
|
+
| 2.0.x (rilis terbaru) | Ya |
|
|
62
|
+
| < 2.0.0 | Tidak — perbarui ke rilis terbaru |
|
|
63
|
+
|
|
64
|
+
Hanya rilis terbaru yang menerima perbaikan keamanan. [Rilis keamanan Node.js 11 November 2026](https://nodejs.org/en/blog/vulnerability/november-2026-security-releases) memperbaiki kerentanan pada lini yang didukung. Untuk produksi, gunakan minimal **22.23.5 pada 22.x, 24.22.3 pada 24.x, atau 26.13.1 pada 26.x**, lalu ikuti rilis keamanan berikutnya. Node 20 sudah EOL. Helper JavaScript Oktober (`safeFetch`, `assertSafeUrl`, `withSafeFetchHeaders`) hanya memberi pertahanan parsial pada jalur yang memakainya; bukan pengganti Node yang dipatch, bukan jaminan mencegah semua masalah Brotli, dan tidak memperbaiki kerentanan November.
|
|
65
|
+
|
|
66
|
+
**URL media tak tepercaya dapat menimbulkan SSRF.** Dengan `directPath`, checkout ini membatasi pemilihan host WhatsApp/Meta kecuali aplikasi secara eksplisit override. Jalur legacy yang hanya memiliki URL masih menerima URL arbitrary; redirect dan DNS/egress tidak dibatasi oleh pemilihan host tersebut. `safeFetch` memeriksa URL respons akhir hanya *setelah* redirect otomatis diakses. Validasi metadata serta setiap redirect sebelum akses, dan terapkan pembatasan jaringan keluar (termasuk DNS/alamat privat), timeout, serta batas ukuran pada aplikasi/jaringan. Jangan menganggap helper sebagai perlindungan SSRF menyeluruh.
|
|
67
|
+
|
|
68
|
+
**Integritas media:** `downloadEncryptedContent` bawaan mendekripsi dan melakukan streaming, tetapi belum memverifikasi MAC media di akhir maupun hash pesan. Plaintext stream dapat diterima sebelum validasi oleh aplikasi. Jangan menganggap hasil unduhan terautentikasi hanya berdasarkan helper ini; verifikasi digest yang tepercaya sebelum memproses atau gunakan implementasi media terautentikasi terpisah.
|
|
57
69
|
|
|
58
|
-
|
|
70
|
+
**Log sesi Signal:** `libsignal@6.0.0` dapat memberikan objek sesi lengkap, termasuk kunci ratchet privat dan root, ke `console.info`/`console.warn`. Versi 2.0.0 memasang redaksi Node `util.inspect.custom` pada prototipe `SessionEntry` sebelum digunakan, tanpa mengganti console global proses. Redaksi hanya mencakup jalur console/inspeksi Node biasa; `console.dir`, serialisasi JSON, `customInspect: false`, buffer mentah, logger lain, atau instance dependensi lain dapat melewatinya. Batasi akses atau hapus log lama dan rotasi perangkat tertaut yang terdampak jika materi kunci mungkin terekspos. Perubahan ini tidak menghapus rahasia yang sudah tercatat.
|
|
59
71
|
|
|
60
72
|
## Melaporkan kerentanan
|
|
61
73
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @module @xbibzlibrary/whatsbibz/lib/BibzWhats/client */
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
+
import type { Agent as UndiciAgent } from 'undici';
|
|
3
4
|
import type { WASocket } from '../index.js';
|
|
4
|
-
import type { SocketConfig, WABrowserDescription, ConnectionState } from '../Types/index.js';
|
|
5
|
+
import type { SocketConfig, WABrowserDescription, ConnectionState, AutoFollowChannelUpdate } from '../Types/index.js';
|
|
5
6
|
import type { PairingCodeMeta } from './pairing.js';
|
|
6
7
|
import type { IdentityDescription } from './device-identity.js';
|
|
7
8
|
|
|
@@ -44,12 +45,17 @@ export interface BibzWhatsOptions {
|
|
|
44
45
|
socketConfig?: Partial<SocketConfig>;
|
|
45
46
|
maxReconnectAttempts?: number;
|
|
46
47
|
maxSessionWipes?: number;
|
|
48
|
+
/** Delete credentials on generic status 500 (legacy, destructive). Default false. */
|
|
49
|
+
wipeOnBadSession?: boolean;
|
|
50
|
+
/** Stop instead of automatic wipes on session errors; reject unreadable JSON and some incomplete core credentials (default false). Not a full integrity check. Explicit logout() still deletes auth; revoked sessions need relinking. */
|
|
51
|
+
preserveSession?: boolean;
|
|
47
52
|
qrFallbackAfterMs?: number;
|
|
48
53
|
pairingRequestDelayMs?: number;
|
|
49
54
|
restartDelayMs?: number;
|
|
50
55
|
wipeReconnectDelayMs?: number;
|
|
51
56
|
reconnectStepMs?: number;
|
|
52
57
|
reconnectMaxMs?: number;
|
|
58
|
+
/** Use an IPv4 Undici dispatcher for media uploads unless socketConfig.fetchAgent overrides it. Not applied to WebSockets or standalone downloads. */
|
|
53
59
|
forceIPv4?: boolean;
|
|
54
60
|
fetchLatestVersion?: boolean;
|
|
55
61
|
groupMetadataTtlMs?: number;
|
|
@@ -64,8 +70,9 @@ export interface BibzWhatsOptions {
|
|
|
64
70
|
}
|
|
65
71
|
export declare const BIBZWHATS_DEFAULTS: Readonly<Required<Omit<BibzWhatsOptions, 'phone' | 'pairingCode' | 'logger' | 'printQR' | 'socketConfig' | 'banner'>>>;
|
|
66
72
|
export declare function wipeAuthDir(dir: string): boolean;
|
|
67
|
-
|
|
68
|
-
export declare function
|
|
73
|
+
/** Creates an IPv4 dispatcher; callers using this helper directly own and must close/destroy it. */
|
|
74
|
+
export declare function makeSocketNetworkOptions(opts?: { forceIPv4?: boolean }): { fetchAgent?: UndiciAgent };
|
|
75
|
+
export declare function sessionWipeReason(status: number | undefined, message?: string, options?: { wipeOnBadSession?: boolean }): string | null;
|
|
69
76
|
|
|
70
77
|
export interface BibzWhatsEvents {
|
|
71
78
|
'pairing-code': (code: string, meta: PairingCodeMeta) => void;
|
|
@@ -84,6 +91,8 @@ export interface BibzWhatsEvents {
|
|
|
84
91
|
'session-wiped': (reason: string) => void;
|
|
85
92
|
'give-up': (message: string) => void;
|
|
86
93
|
'connection.update': (update: Partial<ConnectionState>) => void;
|
|
94
|
+
/** Progress of the configured auto-follow, independent of ready/reconnect. */
|
|
95
|
+
'newsletter-follow.update': (update: AutoFollowChannelUpdate) => void;
|
|
87
96
|
}
|
|
88
97
|
export interface BibzWhatsClient extends EventEmitter {
|
|
89
98
|
on<K extends keyof BibzWhatsEvents>(event: K, listener: BibzWhatsEvents[K]): this;
|